From ab9c9068d4fa9b083daa17582987b846c6c985d4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Jan 2014 08:57:22 +0100 Subject: Queue: rename struct queue to Queue Works around a build failure on Solaris because annoyingly, Solaris reserves the name "queue". This rename was pending anyway. --- src/Playlist.hxx | 2 +- src/PlaylistPrint.cxx | 4 ++-- src/PlaylistSave.cxx | 2 +- src/PlaylistSave.hxx | 4 ++-- src/Queue.cxx | 50 +++++++++++++++++++++++++------------------------- src/Queue.hxx | 10 +++++----- src/QueuePrint.cxx | 12 ++++++------ src/QueuePrint.hxx | 12 ++++++------ src/QueueSave.cxx | 4 ++-- src/QueueSave.hxx | 6 +++--- 10 files changed, 53 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/Playlist.hxx b/src/Playlist.hxx index 5875ff4d8..7d7e9b154 100644 --- a/src/Playlist.hxx +++ b/src/Playlist.hxx @@ -30,7 +30,7 @@ struct playlist { /** * The song queue - it contains the "real" playlist. */ - struct queue queue; + struct Queue queue; /** * This value is true if the player is currently playing (or diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx index 8e3beaa47..e3d500be3 100644 --- a/src/PlaylistPrint.cxx +++ b/src/PlaylistPrint.cxx @@ -40,7 +40,7 @@ void playlist_print_uris(Client &client, const playlist &playlist) { - const queue &queue = playlist.queue; + const Queue &queue = playlist.queue; queue_print_uris(client, queue, 0, queue.GetLength()); } @@ -49,7 +49,7 @@ bool playlist_print_info(Client &client, const playlist &playlist, unsigned start, unsigned end) { - const queue &queue = playlist.queue; + const Queue &queue = playlist.queue; if (end > queue.GetLength()) /* correct the "end" offset */ diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx index 481d9bf75..29bf193fd 100644 --- a/src/PlaylistSave.cxx +++ b/src/PlaylistSave.cxx @@ -65,7 +65,7 @@ playlist_print_uri(FILE *file, const char *uri) } PlaylistResult -spl_save_queue(const char *name_utf8, const queue &queue) +spl_save_queue(const char *name_utf8, const Queue &queue) { if (map_spl_path().IsNull()) return PlaylistResult::DISABLED; diff --git a/src/PlaylistSave.hxx b/src/PlaylistSave.hxx index 70b40f3fa..71e0a8189 100644 --- a/src/PlaylistSave.hxx +++ b/src/PlaylistSave.hxx @@ -25,7 +25,7 @@ #include struct Song; -struct queue; +struct Queue; struct playlist; struct PlayerControl; class Error; @@ -40,7 +40,7 @@ playlist_print_uri(FILE *fp, const char *uri); * Saves a queue object into a stored playlist file. */ PlaylistResult -spl_save_queue(const char *name_utf8, const queue &queue); +spl_save_queue(const char *name_utf8, const Queue &queue); /** * Saves a playlist object into a stored playlist file. diff --git a/src/Queue.cxx b/src/Queue.cxx index 451609438..92beefd0e 100644 --- a/src/Queue.cxx +++ b/src/Queue.cxx @@ -23,7 +23,7 @@ #include -queue::queue(unsigned _max_length) +Queue::Queue(unsigned _max_length) :max_length(_max_length), length(0), version(1), items(new Item[max_length]), @@ -36,7 +36,7 @@ queue::queue(unsigned _max_length) { } -queue::~queue() +Queue::~Queue() { Clear(); @@ -45,7 +45,7 @@ queue::~queue() } int -queue::GetNextOrder(unsigned _order) const +Queue::GetNextOrder(unsigned _order) const { assert(_order < length); @@ -62,7 +62,7 @@ queue::GetNextOrder(unsigned _order) const } void -queue::IncrementVersion() +Queue::IncrementVersion() { static unsigned long max = ((uint32_t) 1 << 31) - 1; @@ -77,7 +77,7 @@ queue::IncrementVersion() } void -queue::ModifyAtOrder(unsigned _order) +Queue::ModifyAtOrder(unsigned _order) { assert(_order < length); @@ -86,7 +86,7 @@ queue::ModifyAtOrder(unsigned _order) } unsigned -queue::Append(Song *song, uint8_t priority) +Queue::Append(Song *song, uint8_t priority) { assert(!IsFull()); @@ -105,7 +105,7 @@ queue::Append(Song *song, uint8_t priority) } void -queue::SwapPositions(unsigned position1, unsigned position2) +Queue::SwapPositions(unsigned position1, unsigned position2) { unsigned id1 = items[position1].id; unsigned id2 = items[position2].id; @@ -120,7 +120,7 @@ queue::SwapPositions(unsigned position1, unsigned position2) } void -queue::MovePostion(unsigned from, unsigned to) +Queue::MovePostion(unsigned from, unsigned to) { const Item tmp = items[from]; @@ -156,7 +156,7 @@ queue::MovePostion(unsigned from, unsigned to) } void -queue::MoveRange(unsigned start, unsigned end, unsigned to) +Queue::MoveRange(unsigned start, unsigned end, unsigned to) { Item tmp[end - start]; // Copy the original block [start,end-1] @@ -198,7 +198,7 @@ queue::MoveRange(unsigned start, unsigned end, unsigned to) } void -queue::MoveOrder(unsigned from_order, unsigned to_order) +Queue::MoveOrder(unsigned from_order, unsigned to_order) { assert(from_order < length); assert(to_order <= length); @@ -217,7 +217,7 @@ queue::MoveOrder(unsigned from_order, unsigned to_order) } void -queue::DeletePosition(unsigned position) +Queue::DeletePosition(unsigned position) { assert(position < length); @@ -254,7 +254,7 @@ queue::DeletePosition(unsigned position) } void -queue::Clear() +Queue::Clear() { for (unsigned i = 0; i < length; i++) { Item *item = &items[i]; @@ -270,7 +270,7 @@ queue::Clear() } static void -queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end) +queue_sort_order_by_priority(Queue *queue, unsigned start, unsigned end) { assert(queue != nullptr); assert(queue->random); @@ -278,8 +278,8 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end) assert(end <= queue->length); auto cmp = [queue](unsigned a_pos, unsigned b_pos){ - const queue::Item &a = queue->items[a_pos]; - const queue::Item &b = queue->items[b_pos]; + const Queue::Item &a = queue->items[a_pos]; + const Queue::Item &b = queue->items[b_pos]; return a.priority > b.priority; }; @@ -288,7 +288,7 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end) } void -queue::ShuffleOrderRange(unsigned start, unsigned end) +Queue::ShuffleOrderRange(unsigned start, unsigned end) { assert(random); assert(start <= end); @@ -303,7 +303,7 @@ queue::ShuffleOrderRange(unsigned start, unsigned end) * priority group. */ void -queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end) +Queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end) { assert(random); assert(start <= end); @@ -337,13 +337,13 @@ queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end) } void -queue::ShuffleOrder() +Queue::ShuffleOrder() { ShuffleOrderRangeWithPriority(0, length); } void -queue::ShuffleOrderFirst(unsigned start, unsigned end) +Queue::ShuffleOrderFirst(unsigned start, unsigned end) { rand.AutoCreate(); @@ -352,7 +352,7 @@ queue::ShuffleOrderFirst(unsigned start, unsigned end) } void -queue::ShuffleOrderLast(unsigned start, unsigned end) +Queue::ShuffleOrderLast(unsigned start, unsigned end) { rand.AutoCreate(); @@ -361,7 +361,7 @@ queue::ShuffleOrderLast(unsigned start, unsigned end) } void -queue::ShuffleRange(unsigned start, unsigned end) +Queue::ShuffleRange(unsigned start, unsigned end) { assert(start <= end); assert(end <= length); @@ -377,7 +377,7 @@ queue::ShuffleRange(unsigned start, unsigned end) } unsigned -queue::FindPriorityOrder(unsigned start_order, uint8_t priority, +Queue::FindPriorityOrder(unsigned start_order, uint8_t priority, unsigned exclude_order) const { assert(random); @@ -394,7 +394,7 @@ queue::FindPriorityOrder(unsigned start_order, uint8_t priority, } unsigned -queue::CountSamePriority(unsigned start_order, uint8_t priority) const +Queue::CountSamePriority(unsigned start_order, uint8_t priority) const { assert(random); assert(start_order <= length); @@ -410,7 +410,7 @@ queue::CountSamePriority(unsigned start_order, uint8_t priority) const } bool -queue::SetPriority(unsigned position, uint8_t priority, int after_order) +Queue::SetPriority(unsigned position, uint8_t priority, int after_order) { assert(position < length); @@ -468,7 +468,7 @@ queue::SetPriority(unsigned position, uint8_t priority, int after_order) } bool -queue::SetPriorityRange(unsigned start_position, unsigned end_position, +Queue::SetPriorityRange(unsigned start_position, unsigned end_position, uint8_t priority, int after_order) { assert(start_position <= end_position); diff --git a/src/Queue.hxx b/src/Queue.hxx index 48ee69cc8..3c6001b4f 100644 --- a/src/Queue.hxx +++ b/src/Queue.hxx @@ -41,7 +41,7 @@ struct Song; * - the unique id (which stays the same, regardless of moves) * - the order number (which only differs from "position" in random mode) */ -struct queue { +struct Queue { /** * reserve max_length * HASH_MULT elements in the id * number space @@ -103,16 +103,16 @@ struct queue { /** random number generator for shuffle and random mode */ LazyRandomEngine rand; - explicit queue(unsigned max_length); + explicit Queue(unsigned max_length); /** * Deinitializes a queue object. It does not free the queue * pointer itself. */ - ~queue(); + ~Queue(); - queue(const queue &other) = delete; - queue &operator=(const queue &other) = delete; + Queue(const Queue &) = delete; + Queue &operator=(const Queue &) = delete; unsigned GetLength() const { assert(length <= max_length); diff --git a/src/QueuePrint.cxx b/src/QueuePrint.cxx index d5651cde0..89f3c0ad3 100644 --- a/src/QueuePrint.cxx +++ b/src/QueuePrint.cxx @@ -38,7 +38,7 @@ extern "C" { * @param end the index of the last song (excluding) */ static void -queue_print_song_info(Client &client, const queue &queue, +queue_print_song_info(Client &client, const Queue &queue, unsigned position) { song_print_info(client, queue.Get(position)); @@ -51,7 +51,7 @@ queue_print_song_info(Client &client, const queue &queue, } void -queue_print_info(Client &client, const queue &queue, +queue_print_info(Client &client, const Queue &queue, unsigned start, unsigned end) { assert(start <= end); @@ -62,7 +62,7 @@ queue_print_info(Client &client, const queue &queue, } void -queue_print_uris(Client &client, const queue &queue, +queue_print_uris(Client &client, const Queue &queue, unsigned start, unsigned end) { assert(start <= end); @@ -75,7 +75,7 @@ queue_print_uris(Client &client, const queue &queue, } void -queue_print_changes_info(Client &client, const queue &queue, +queue_print_changes_info(Client &client, const Queue &queue, uint32_t version) { for (unsigned i = 0; i < queue.GetLength(); i++) { @@ -85,7 +85,7 @@ queue_print_changes_info(Client &client, const queue &queue, } void -queue_print_changes_position(Client &client, const queue &queue, +queue_print_changes_position(Client &client, const Queue &queue, uint32_t version) { for (unsigned i = 0; i < queue.GetLength(); i++) @@ -95,7 +95,7 @@ queue_print_changes_position(Client &client, const queue &queue, } void -queue_find(Client &client, const queue &queue, +queue_find(Client &client, const Queue &queue, const SongFilter &filter) { for (unsigned i = 0; i < queue.GetLength(); i++) { diff --git a/src/QueuePrint.hxx b/src/QueuePrint.hxx index dbcb5ef4a..bc91bb5de 100644 --- a/src/QueuePrint.hxx +++ b/src/QueuePrint.hxx @@ -27,28 +27,28 @@ #include -struct queue; +struct Queue; class SongFilter; class Client; void -queue_print_info(Client &client, const queue &queue, +queue_print_info(Client &client, const Queue &queue, unsigned start, unsigned end); void -queue_print_uris(Client &client, const queue &queue, +queue_print_uris(Client &client, const Queue &queue, unsigned start, unsigned end); void -queue_print_changes_info(Client &client, const queue &queue, +queue_print_changes_info(Client &client, const Queue &queue, uint32_t version); void -queue_print_changes_position(Client &client, const queue &queue, +queue_print_changes_position(Client &client, const Queue &queue, uint32_t version); void -queue_find(Client &client, const queue &queue, +queue_find(Client &client, const Queue &queue, const SongFilter &filter); #endif diff --git a/src/QueueSave.cxx b/src/QueueSave.cxx index 6a1a51992..2ab5f6280 100644 --- a/src/QueueSave.cxx +++ b/src/QueueSave.cxx @@ -60,7 +60,7 @@ queue_save_song(FILE *fp, int idx, const Song &song) } void -queue_save(FILE *fp, const queue &queue) +queue_save(FILE *fp, const Queue &queue) { for (unsigned i = 0; i < queue.GetLength(); i++) { uint8_t prio = queue.GetPriorityAtPosition(i); @@ -72,7 +72,7 @@ queue_save(FILE *fp, const queue &queue) } void -queue_load_song(TextFile &file, const char *line, queue &queue) +queue_load_song(TextFile &file, const char *line, Queue &queue) { if (queue.IsFull()) return; diff --git a/src/QueueSave.hxx b/src/QueueSave.hxx index 13322cc95..6c618c0dc 100644 --- a/src/QueueSave.hxx +++ b/src/QueueSave.hxx @@ -27,16 +27,16 @@ #include -struct queue; +struct Queue; class TextFile; void -queue_save(FILE *fp, const queue &queue); +queue_save(FILE *fp, const Queue &queue); /** * Loads one song from the state file and appends it to the queue. */ void -queue_load_song(TextFile &file, const char *line, queue &queue); +queue_load_song(TextFile &file, const char *line, Queue &queue); #endif -- cgit v1.2.3