From a78b2d84ed7c2a82c69c56125036e70b009a87b0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 20 Oct 2013 13:32:59 +0200 Subject: TagType: rename enum tag_type to TagType --- src/DatabaseHelpers.cxx | 4 ++-- src/DatabaseHelpers.hxx | 2 +- src/DatabasePlugin.hxx | 2 +- src/DatabasePrint.cxx | 6 +++--- src/DatabaseSave.cxx | 2 +- src/IcyMetaDataParser.cxx | 2 +- src/IcyMetaDataServer.cxx | 2 +- src/IcyMetaDataServer.hxx | 2 +- src/SongSave.cxx | 2 +- src/SongSort.cxx | 6 +++--- src/cue/CueParser.cxx | 6 +++--- src/db/ProxyDatabasePlugin.cxx | 10 +++++----- src/db/SimpleDatabasePlugin.cxx | 2 +- src/db/SimpleDatabasePlugin.hxx | 2 +- src/decoder/AdPlugDecoderPlugin.cxx | 2 +- src/decoder/DsdiffDecoderPlugin.cxx | 2 +- src/decoder/FfmpegMetaData.cxx | 4 ++-- src/decoder/FlacMetadata.cxx | 4 ++-- src/decoder/OpusTags.cxx | 2 +- src/decoder/VorbisComments.cxx | 4 ++-- src/decoder/WavpackDecoderPlugin.cxx | 4 ++-- src/output/HttpdOutputPlugin.cxx | 2 +- src/output/RoarOutputPlugin.cxx | 2 +- src/playlist/AsxPlaylistPlugin.cxx | 2 +- src/playlist/RssPlaylistPlugin.cxx | 2 +- src/playlist/XspfPlaylistPlugin.cxx | 2 +- src/tag/ApeTag.cxx | 6 +++--- src/tag/Tag.cxx | 18 +++++++++--------- src/tag/Tag.hxx | 20 ++++++++++---------- src/tag/TagBuilder.cxx | 6 +++--- src/tag/TagBuilder.hxx | 6 +++--- src/tag/TagHandler.cxx | 2 +- src/tag/TagHandler.hxx | 4 ++-- src/tag/TagId3.cxx | 14 +++++++------- src/tag/TagItem.hxx | 4 ++-- src/tag/TagPool.cxx | 8 ++++---- src/tag/TagPool.hxx | 2 +- src/tag/TagTable.cxx | 4 ++-- src/tag/TagTable.hxx | 6 +++--- src/tag/TagType.h | 4 ++-- test/read_tags.cxx | 2 +- 41 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/DatabaseHelpers.cxx b/src/DatabaseHelpers.cxx index f250e447a..a8a5bb98f 100644 --- a/src/DatabaseHelpers.cxx +++ b/src/DatabaseHelpers.cxx @@ -37,7 +37,7 @@ struct StringLess { typedef std::set StringSet; static bool -CollectTags(StringSet &set, enum tag_type tag_type, Song &song) +CollectTags(StringSet &set, TagType tag_type, Song &song) { Tag *tag = song.tag; if (tag == nullptr) @@ -59,7 +59,7 @@ CollectTags(StringSet &set, enum tag_type tag_type, Song &song) bool VisitUniqueTags(const Database &db, const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error) { diff --git a/src/DatabaseHelpers.hxx b/src/DatabaseHelpers.hxx index 70e3e54fb..d8806bc69 100644 --- a/src/DatabaseHelpers.hxx +++ b/src/DatabaseHelpers.hxx @@ -31,7 +31,7 @@ struct DatabaseStats; bool VisitUniqueTags(const Database &db, const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error); diff --git a/src/DatabasePlugin.hxx b/src/DatabasePlugin.hxx index 0477d5d88..a0dd3ddfe 100644 --- a/src/DatabasePlugin.hxx +++ b/src/DatabasePlugin.hxx @@ -125,7 +125,7 @@ public: * Visit all unique tag values. */ virtual bool VisitUniqueTags(const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error) const = 0; diff --git a/src/DatabasePrint.cxx b/src/DatabasePrint.cxx index 101383488..3732e98f3 100644 --- a/src/DatabasePrint.cxx +++ b/src/DatabasePrint.cxx @@ -208,7 +208,7 @@ PrintSongURIVisitor(Client &client, Song &song) } static bool -PrintUniqueTag(Client &client, enum tag_type tag_type, +PrintUniqueTag(Client &client, TagType tag_type, const char *value) { client_printf(client, "%s: %s\n", tag_item_names[tag_type], value); @@ -234,8 +234,8 @@ listAllUniqueTags(Client &client, int type, } else { using namespace std::placeholders; const auto f = std::bind(PrintUniqueTag, std::ref(client), - (enum tag_type)type, _1); - return db->VisitUniqueTags(selection, (enum tag_type)type, + (TagType)type, _1); + return db->VisitUniqueTags(selection, (TagType)type, f, error); } } diff --git a/src/DatabaseSave.cxx b/src/DatabaseSave.cxx index 0fb00c8c0..0b6338013 100644 --- a/src/DatabaseSave.cxx +++ b/src/DatabaseSave.cxx @@ -117,7 +117,7 @@ db_load_internal(TextFile &file, Directory &music_root, Error &error) } } else if (g_str_has_prefix(line, DB_TAG_PREFIX)) { const char *name = line + sizeof(DB_TAG_PREFIX) - 1; - enum tag_type tag = tag_name_parse(name); + TagType tag = tag_name_parse(name); if (tag == TAG_NUM_OF_ITEM_TYPES) { error.Format(db_domain, "Unrecognized tag '%s', " diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx index e4251d526..8861efb2e 100644 --- a/src/IcyMetaDataParser.cxx +++ b/src/IcyMetaDataParser.cxx @@ -66,7 +66,7 @@ IcyMetaDataParser::Data(size_t length) } static void -icy_add_item(Tag &tag, enum tag_type type, const char *value) +icy_add_item(Tag &tag, TagType type, const char *value) { size_t length = strlen(value); diff --git a/src/IcyMetaDataServer.cxx b/src/IcyMetaDataServer.cxx index 67b20852c..f5e981c2f 100644 --- a/src/IcyMetaDataServer.cxx +++ b/src/IcyMetaDataServer.cxx @@ -84,7 +84,7 @@ icy_server_metadata_string(const char *stream_title, const char* stream_url) } Page * -icy_server_metadata_page(const Tag &tag, const enum tag_type *types) +icy_server_metadata_page(const Tag &tag, const TagType *types) { const gchar *tag_items[TAG_NUM_OF_ITEM_TYPES]; gint last_item, item; diff --git a/src/IcyMetaDataServer.hxx b/src/IcyMetaDataServer.hxx index 941d8ba4a..20964ce74 100644 --- a/src/IcyMetaDataServer.hxx +++ b/src/IcyMetaDataServer.hxx @@ -34,6 +34,6 @@ icy_server_metadata_header(const char *name, const char *content_type, int metaint); Page * -icy_server_metadata_page(const Tag &tag, const enum tag_type *types); +icy_server_metadata_page(const Tag &tag, const TagType *types); #endif diff --git a/src/SongSave.cxx b/src/SongSave.cxx index d5b00e270..ae055729d 100644 --- a/src/SongSave.cxx +++ b/src/SongSave.cxx @@ -61,7 +61,7 @@ song_load(TextFile &file, Directory *parent, const char *uri, ? Song::NewFile(uri, parent) : Song::NewRemote(uri); char *line, *colon; - enum tag_type type; + TagType type; const char *value; TagBuilder tag; diff --git a/src/SongSort.cxx b/src/SongSort.cxx index 431d629b0..4d422657a 100644 --- a/src/SongSort.cxx +++ b/src/SongSort.cxx @@ -33,7 +33,7 @@ extern "C" { #include static const char * -tag_get_value_checked(const Tag *tag, enum tag_type type) +tag_get_value_checked(const Tag *tag, TagType type) { return tag != nullptr ? tag->GetValue(type) @@ -58,7 +58,7 @@ compare_utf8_string(const char *a, const char *b) */ static int compare_string_tag_item(const Tag *a, const Tag *b, - enum tag_type type) + TagType type) { return compare_utf8_string(tag_get_value_checked(a, type), tag_get_value_checked(b, type)); @@ -84,7 +84,7 @@ compare_number_string(const char *a, const char *b) } static int -compare_tag_item(const Tag *a, const Tag *b, enum tag_type type) +compare_tag_item(const Tag *a, const Tag *b, TagType type) { return compare_number_string(tag_get_value_checked(a, type), tag_get_value_checked(b, type)); diff --git a/src/cue/CueParser.cxx b/src/cue/CueParser.cxx index f52f8526f..60b33b6b4 100644 --- a/src/cue/CueParser.cxx +++ b/src/cue/CueParser.cxx @@ -109,7 +109,7 @@ cue_next_value(char **pp) } static void -cue_add_tag(Tag &tag, enum tag_type type, char *p) +cue_add_tag(Tag &tag, TagType type, char *p) { const char *value = cue_next_value(&p); if (value != nullptr) @@ -124,7 +124,7 @@ cue_parse_rem(char *p, Tag &tag) if (type == nullptr) return; - enum tag_type type2 = tag_name_parse_i(type); + TagType type2 = tag_name_parse_i(type); if (type2 != TAG_NUM_OF_ITEM_TYPES) cue_add_tag(tag, type2, p); } @@ -198,7 +198,7 @@ CueParser::Feed2(char *p) CD artist, while at track-level it specifies the track artist." */ - enum tag_type type = state == TRACK + TagType type = state == TRACK ? TAG_ARTIST : TAG_ALBUM_ARTIST; diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx index 0cde8bef9..68d3a1128 100644 --- a/src/db/ProxyDatabasePlugin.cxx +++ b/src/db/ProxyDatabasePlugin.cxx @@ -63,7 +63,7 @@ public: Error &error) const override; virtual bool VisitUniqueTags(const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error) const override; @@ -78,7 +78,7 @@ protected: static constexpr Domain libmpdclient_domain("libmpdclient"); static constexpr struct { - enum tag_type d; + TagType d; enum mpd_tag_type s; } tag_table[] = { { TAG_ARTIST, MPD_TAG_ARTIST }, @@ -103,7 +103,7 @@ static constexpr struct { gcc_const static enum mpd_tag_type -Convert(enum tag_type tag_type) +Convert(TagType tag_type) { for (auto i = &tag_table[0]; i->d != TAG_NUM_OF_ITEM_TYPES; ++i) if (i->d == tag_type) @@ -248,7 +248,7 @@ Visit(struct mpd_connection *connection, } static void -Copy(TagBuilder &tag, enum tag_type d_tag, +Copy(TagBuilder &tag, TagType d_tag, const struct mpd_song *song, enum mpd_tag_type s_tag) { @@ -405,7 +405,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection, bool ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error) const { diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/SimpleDatabasePlugin.cxx index 6f30e4b61..55c9d47a8 100644 --- a/src/db/SimpleDatabasePlugin.cxx +++ b/src/db/SimpleDatabasePlugin.cxx @@ -263,7 +263,7 @@ SimpleDatabase::Visit(const DatabaseSelection &selection, bool SimpleDatabase::VisitUniqueTags(const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error) const { diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx index bd112f8f3..acf1b9426 100644 --- a/src/db/SimpleDatabasePlugin.hxx +++ b/src/db/SimpleDatabasePlugin.hxx @@ -77,7 +77,7 @@ public: Error &error) const override; virtual bool VisitUniqueTags(const DatabaseSelection &selection, - enum tag_type tag_type, + TagType tag_type, VisitString visit_string, Error &error) const override; diff --git a/src/decoder/AdPlugDecoderPlugin.cxx b/src/decoder/AdPlugDecoderPlugin.cxx index daac0a740..39dbf118b 100644 --- a/src/decoder/AdPlugDecoderPlugin.cxx +++ b/src/decoder/AdPlugDecoderPlugin.cxx @@ -81,7 +81,7 @@ adplug_file_decode(struct decoder *decoder, const char *path_fs) } static void -adplug_scan_tag(enum tag_type type, const std::string &value, +adplug_scan_tag(TagType type, const std::string &value, const struct tag_handler *handler, void *handler_ctx) { if (!value.empty()) diff --git a/src/decoder/DsdiffDecoderPlugin.cxx b/src/decoder/DsdiffDecoderPlugin.cxx index 93002509f..95d4c4844 100644 --- a/src/decoder/DsdiffDecoderPlugin.cxx +++ b/src/decoder/DsdiffDecoderPlugin.cxx @@ -202,7 +202,7 @@ static void dsdiff_handle_native_tag(struct input_stream *is, const struct tag_handler *handler, void *handler_ctx, input_stream::offset_type tagoffset, - enum tag_type type) + TagType type) { if (!dsdlib_skip_to(nullptr, is, tagoffset)) return; diff --git a/src/decoder/FfmpegMetaData.cxx b/src/decoder/FfmpegMetaData.cxx index 9965e4d28..17255f0a4 100644 --- a/src/decoder/FfmpegMetaData.cxx +++ b/src/decoder/FfmpegMetaData.cxx @@ -36,7 +36,7 @@ static const struct tag_table ffmpeg_tags[] = { }; static void -ffmpeg_copy_metadata(enum tag_type type, +ffmpeg_copy_metadata(TagType type, AVDictionary *m, const char *name, const struct tag_handler *handler, void *handler_ctx) { @@ -63,7 +63,7 @@ ffmpeg_scan_dictionary(AVDictionary *dict, const struct tag_handler *handler, void *handler_ctx) { for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) - ffmpeg_copy_metadata(tag_type(i), dict, tag_item_names[i], + ffmpeg_copy_metadata(TagType(i), dict, tag_item_names[i], handler, handler_ctx); for (const struct tag_table *i = ffmpeg_tags; diff --git a/src/decoder/FlacMetadata.cxx b/src/decoder/FlacMetadata.cxx index 078d0c081..99659d143 100644 --- a/src/decoder/FlacMetadata.cxx +++ b/src/decoder/FlacMetadata.cxx @@ -152,7 +152,7 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry, */ static bool flac_copy_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry, - const char *name, enum tag_type tag_type, + const char *name, TagType tag_type, const struct tag_handler *handler, void *handler_ctx) { const char *value; @@ -193,7 +193,7 @@ flac_scan_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry, for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) if (flac_copy_comment(entry, - tag_item_names[i], (enum tag_type)i, + tag_item_names[i], (TagType)i, handler, handler_ctx)) return; } diff --git a/src/decoder/OpusTags.cxx b/src/decoder/OpusTags.cxx index f09d79c3b..806ab40bd 100644 --- a/src/decoder/OpusTags.cxx +++ b/src/decoder/OpusTags.cxx @@ -34,7 +34,7 @@ ScanOneOpusTag(const char *name, const char *value, tag_handler_invoke_pair(handler, ctx, name, value); if (handler->tag != nullptr) { - enum tag_type t = tag_table_lookup_i(xiph_tags, name); + TagType t = tag_table_lookup_i(xiph_tags, name); if (t != TAG_NUM_OF_ITEM_TYPES) tag_handler_invoke_tag(handler, ctx, t, value); } diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx index 402ee7c2b..773eca261 100644 --- a/src/decoder/VorbisComments.cxx +++ b/src/decoder/VorbisComments.cxx @@ -84,7 +84,7 @@ vorbis_comments_to_replay_gain(struct replay_gain_info *rgi, char **comments) */ static bool vorbis_copy_comment(const char *comment, - const char *name, enum tag_type tag_type, + const char *name, TagType tag_type, const struct tag_handler *handler, void *handler_ctx) { const char *value; @@ -122,7 +122,7 @@ vorbis_scan_comment(const char *comment, for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) if (vorbis_copy_comment(comment, - tag_item_names[i], tag_type(i), + tag_item_names[i], TagType(i), handler, handler_ctx)) return; } diff --git a/src/decoder/WavpackDecoderPlugin.cxx b/src/decoder/WavpackDecoderPlugin.cxx index 56b6efc51..4bdf2122a 100644 --- a/src/decoder/WavpackDecoderPlugin.cxx +++ b/src/decoder/WavpackDecoderPlugin.cxx @@ -260,7 +260,7 @@ wavpack_replaygain(struct replay_gain_info *replay_gain_info, static void wavpack_scan_tag_item(WavpackContext *wpc, const char *name, - enum tag_type type, + TagType type, const struct tag_handler *handler, void *handler_ctx) { char buffer[1024]; @@ -312,7 +312,7 @@ wavpack_scan_file(const char *fname, for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) { const char *name = tag_item_names[i]; if (name != nullptr) - wavpack_scan_tag_item(wpc, name, (enum tag_type)i, + wavpack_scan_tag_item(wpc, name, (TagType)i, handler, handler_ctx); } diff --git a/src/output/HttpdOutputPlugin.cxx b/src/output/HttpdOutputPlugin.cxx index 09f0f5e6b..a456701b5 100644 --- a/src/output/HttpdOutputPlugin.cxx +++ b/src/output/HttpdOutputPlugin.cxx @@ -514,7 +514,7 @@ HttpdOutput::SendTag(const Tag *tag) if (metadata != NULL) metadata->Unref(); - static constexpr tag_type types[] = { + static constexpr TagType types[] = { TAG_ALBUM, TAG_ARTIST, TAG_TITLE, TAG_NUM_OF_ITEM_TYPES }; diff --git a/src/output/RoarOutputPlugin.cxx b/src/output/RoarOutputPlugin.cxx index 1dcd7442d..895a165d1 100644 --- a/src/output/RoarOutputPlugin.cxx +++ b/src/output/RoarOutputPlugin.cxx @@ -316,7 +316,7 @@ roar_play(struct audio_output *ao, const void *chunk, size_t size, } static const char* -roar_tag_convert(enum tag_type type, bool *is_uuid) +roar_tag_convert(TagType type, bool *is_uuid) { *is_uuid = false; switch (type) diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx index 4dcbf56b9..ab204773f 100644 --- a/src/playlist/AsxPlaylistPlugin.cxx +++ b/src/playlist/AsxPlaylistPlugin.cxx @@ -57,7 +57,7 @@ struct AsxParser { * valid if state==ENTRY. TAG_NUM_OF_ITEM_TYPES means there * is no (known) tag. */ - enum tag_type tag; + TagType tag; /** * The current song. It is allocated after the "location" diff --git a/src/playlist/RssPlaylistPlugin.cxx b/src/playlist/RssPlaylistPlugin.cxx index c2becc15a..7faf6faac 100644 --- a/src/playlist/RssPlaylistPlugin.cxx +++ b/src/playlist/RssPlaylistPlugin.cxx @@ -57,7 +57,7 @@ struct RssParser { * valid if state==ITEM. TAG_NUM_OF_ITEM_TYPES means there * is no (known) tag. */ - enum tag_type tag; + TagType tag; /** * The current song. It is allocated after the "location" diff --git a/src/playlist/XspfPlaylistPlugin.cxx b/src/playlist/XspfPlaylistPlugin.cxx index 9b55f1962..c1ce21e6d 100644 --- a/src/playlist/XspfPlaylistPlugin.cxx +++ b/src/playlist/XspfPlaylistPlugin.cxx @@ -57,7 +57,7 @@ struct XspfParser { * valid if state==TRACK. TAG_NUM_OF_ITEM_TYPES means there * is no (known) tag. */ - enum tag_type tag; + TagType tag; /** * The current song. It is allocated after the "location" diff --git a/src/tag/ApeTag.cxx b/src/tag/ApeTag.cxx index 266d1546f..fa2e744c4 100644 --- a/src/tag/ApeTag.cxx +++ b/src/tag/ApeTag.cxx @@ -34,10 +34,10 @@ const struct tag_table ape_tags[] = { { nullptr, TAG_NUM_OF_ITEM_TYPES } }; -static enum tag_type +static TagType tag_ape_name_parse(const char *name) { - enum tag_type type = tag_table_lookup_i(ape_tags, name); + TagType type = tag_table_lookup_i(ape_tags, name); if (type == TAG_NUM_OF_ITEM_TYPES) type = tag_name_parse_i(name); @@ -58,7 +58,7 @@ tag_ape_import_item(unsigned long flags, tag_handler_invoke_pair(handler, handler_ctx, key, value); - enum tag_type type = tag_ape_name_parse(key); + TagType type = tag_ape_name_parse(key); if (type == TAG_NUM_OF_ITEM_TYPES) return false; diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx index 8e6766f80..6ff8b3dc9 100644 --- a/src/tag/Tag.cxx +++ b/src/tag/Tag.cxx @@ -27,7 +27,7 @@ #include #include -enum tag_type +TagType tag_name_parse(const char *name) { assert(name != nullptr); @@ -36,13 +36,13 @@ tag_name_parse(const char *name) assert(tag_item_names[i] != nullptr); if (strcmp(name, tag_item_names[i]) == 0) - return (enum tag_type)i; + return (TagType)i; } return TAG_NUM_OF_ITEM_TYPES; } -enum tag_type +TagType tag_name_parse_i(const char *name) { assert(name != nullptr); @@ -51,7 +51,7 @@ tag_name_parse_i(const char *name) assert(tag_item_names[i] != nullptr); if (g_ascii_strcasecmp(name, tag_item_names[i]) == 0) - return (enum tag_type)i; + return (TagType)i; } return TAG_NUM_OF_ITEM_TYPES; @@ -166,7 +166,7 @@ Tag::MergeReplace(Tag *base, Tag *add) } const char * -Tag::GetValue(tag_type type) const +Tag::GetValue(TagType type) const { assert(type < TAG_NUM_OF_ITEM_TYPES); @@ -178,13 +178,13 @@ Tag::GetValue(tag_type type) const } bool -Tag::HasType(tag_type type) const +Tag::HasType(TagType type) const { return GetValue(type) != nullptr; } void -Tag::AddItemInternal(tag_type type, const char *value, size_t len) +Tag::AddItemInternal(TagType type, const char *value, size_t len) { unsigned int i = num_items; @@ -206,7 +206,7 @@ Tag::AddItemInternal(tag_type type, const char *value, size_t len) } void -Tag::AddItem(tag_type type, const char *value, size_t len) +Tag::AddItem(TagType type, const char *value, size_t len) { if (ignore_tag_items[type]) return; @@ -218,7 +218,7 @@ Tag::AddItem(tag_type type, const char *value, size_t len) } void -Tag::AddItem(tag_type type, const char *value) +Tag::AddItem(TagType type, const char *value) { AddItem(type, value, strlen(value)); } diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx index 4a1b16b39..4d8f1a4e8 100644 --- a/src/tag/Tag.hxx +++ b/src/tag/Tag.hxx @@ -110,7 +110,7 @@ struct Tag { * @param value the value of the tag item (not null-terminated) * @param len the length of #value */ - void AddItem(tag_type type, const char *value, size_t len); + void AddItem(TagType type, const char *value, size_t len); /** * Appends a new tag item. @@ -119,11 +119,11 @@ struct Tag { * @param type the type of the new tag item * @param value the value of the tag item (null-terminated) */ - void AddItem(tag_type type, const char *value); + void AddItem(TagType type, const char *value); /** * Merges the data from two tags. If both tags share data for the - * same tag_type, only data from "add" is used. + * same TagType, only data from "add" is used. * * @return a newly allocated tag */ @@ -144,35 +144,35 @@ struct Tag { * is present in this tag object. */ gcc_pure - const char *GetValue(tag_type type) const; + const char *GetValue(TagType type) const; /** * Checks whether the tag contains one or more items with * the specified type. */ gcc_pure - bool HasType(tag_type type) const; + bool HasType(TagType type) const; private: - void AddItemInternal(tag_type type, const char *value, size_t len); + void AddItemInternal(TagType type, const char *value, size_t len); }; /** - * Parse the string, and convert it into a #tag_type. Returns + * Parse the string, and convert it into a #TagType. Returns * #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized. */ gcc_pure -enum tag_type +TagType tag_name_parse(const char *name); /** - * Parse the string, and convert it into a #tag_type. Returns + * Parse the string, and convert it into a #TagType. Returns * #TAG_NUM_OF_ITEM_TYPES if the string could not be recognized. * * Case does not matter. */ gcc_pure -enum tag_type +TagType tag_name_parse_i(const char *name); #endif diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 23409fe33..25e5cc24b 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -75,7 +75,7 @@ TagBuilder::Commit() } inline void -TagBuilder::AddItemInternal(tag_type type, const char *value, size_t length) +TagBuilder::AddItemInternal(TagType type, const char *value, size_t length) { assert(value != nullptr); assert(length > 0); @@ -96,7 +96,7 @@ TagBuilder::AddItemInternal(tag_type type, const char *value, size_t length) } void -TagBuilder::AddItem(tag_type type, const char *value, size_t length) +TagBuilder::AddItem(TagType type, const char *value, size_t length) { assert(value != nullptr); @@ -107,7 +107,7 @@ TagBuilder::AddItem(tag_type type, const char *value, size_t length) } void -TagBuilder::AddItem(tag_type type, const char *value) +TagBuilder::AddItem(TagType type, const char *value) { assert(value != nullptr); diff --git a/src/tag/TagBuilder.hxx b/src/tag/TagBuilder.hxx index d737f2b2e..ffc60a1b2 100644 --- a/src/tag/TagBuilder.hxx +++ b/src/tag/TagBuilder.hxx @@ -116,7 +116,7 @@ public: * @param len the length of #value */ gcc_nonnull_all - void AddItem(tag_type type, const char *value, size_t length); + void AddItem(TagType type, const char *value, size_t length); /** * Appends a new tag item. @@ -125,11 +125,11 @@ public: * @param value the value of the tag item (null-terminated) */ gcc_nonnull_all - void AddItem(tag_type type, const char *value); + void AddItem(TagType type, const char *value); private: gcc_nonnull_all - void AddItemInternal(tag_type type, const char *value, size_t length); + void AddItemInternal(TagType type, const char *value, size_t length); }; #endif diff --git a/src/tag/TagHandler.cxx b/src/tag/TagHandler.cxx index 859f92b20..9e31a7d1d 100644 --- a/src/tag/TagHandler.cxx +++ b/src/tag/TagHandler.cxx @@ -32,7 +32,7 @@ add_tag_duration(unsigned seconds, void *ctx) } static void -add_tag_tag(enum tag_type type, const char *value, void *ctx) +add_tag_tag(TagType type, const char *value, void *ctx) { TagBuilder &tag = *(TagBuilder *)ctx; diff --git a/src/tag/TagHandler.hxx b/src/tag/TagHandler.hxx index 36871c962..b8c3c6b79 100644 --- a/src/tag/TagHandler.hxx +++ b/src/tag/TagHandler.hxx @@ -42,7 +42,7 @@ struct tag_handler { * @param the value of the tag; the pointer will become * invalid after returning */ - void (*tag)(enum tag_type type, const char *value, void *ctx); + void (*tag)(TagType type, const char *value, void *ctx); /** * A name-value pair has been read. It is the codec specific @@ -63,7 +63,7 @@ tag_handler_invoke_duration(const struct tag_handler *handler, void *ctx, static inline void tag_handler_invoke_tag(const struct tag_handler *handler, void *ctx, - enum tag_type type, const char *value) + TagType type, const char *value) { assert(handler != nullptr); assert((unsigned)type < TAG_NUM_OF_ITEM_TYPES); diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index 2f32ef6e5..63df529d3 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -134,7 +134,7 @@ import_id3_string(bool is_id3v1, const id3_ucs4_t *ucs4) */ static void tag_id3_import_text_frame(struct id3_tag *tag, const struct id3_frame *frame, - enum tag_type type, + TagType type, const struct tag_handler *handler, void *handler_ctx) { id3_ucs4_t const *ucs4; @@ -182,7 +182,7 @@ tag_id3_import_text_frame(struct id3_tag *tag, const struct id3_frame *frame, * 4.2). This is a wrapper for tag_id3_import_text_frame(). */ static void -tag_id3_import_text(struct id3_tag *tag, const char *id, enum tag_type type, +tag_id3_import_text(struct id3_tag *tag, const char *id, TagType type, const struct tag_handler *handler, void *handler_ctx) { const struct id3_frame *frame; @@ -203,7 +203,7 @@ tag_id3_import_text(struct id3_tag *tag, const char *id, enum tag_type type, */ static void tag_id3_import_comment_frame(struct id3_tag *tag, - const struct id3_frame *frame, enum tag_type type, + const struct id3_frame *frame, TagType type, const struct tag_handler *handler, void *handler_ctx) { @@ -236,7 +236,7 @@ tag_id3_import_comment_frame(struct id3_tag *tag, * wrapper for tag_id3_import_comment_frame(). */ static void -tag_id3_import_comment(struct id3_tag *tag, const char *id, enum tag_type type, +tag_id3_import_comment(struct id3_tag *tag, const char *id, TagType type, const struct tag_handler *handler, void *handler_ctx) { const struct id3_frame *frame; @@ -247,10 +247,10 @@ tag_id3_import_comment(struct id3_tag *tag, const char *id, enum tag_type type, } /** - * Parse a TXXX name, and convert it to a tag_type enum value. + * Parse a TXXX name, and convert it to a TagType enum value. * Returns TAG_NUM_OF_ITEM_TYPES if the TXXX name is not understood. */ -static enum tag_type +static TagType tag_id3_parse_txxx_name(const char *name) { static const struct tag_table txxx_tags[] = { @@ -277,7 +277,7 @@ tag_id3_import_musicbrainz(struct id3_tag *id3_tag, for (unsigned i = 0;; ++i) { const struct id3_frame *frame; id3_utf8_t *name, *value; - enum tag_type type; + TagType type; frame = id3_tag_findframe(id3_tag, "TXXX", i); if (frame == nullptr) diff --git a/src/tag/TagItem.hxx b/src/tag/TagItem.hxx index 5db9a2116..7c3100393 100644 --- a/src/tag/TagItem.hxx +++ b/src/tag/TagItem.hxx @@ -24,13 +24,13 @@ #include "Compiler.h" /** - * One tag value. It is a mapping of #tag_type to am arbitrary string + * One tag value. It is a mapping of #TagType to am arbitrary string * value. Each tag can have multiple items of one tag type (although * few clients support that). */ struct TagItem { /** the type of this item */ - enum tag_type type; + TagType type; /** * the value of this tag; this is a variable length string diff --git a/src/tag/TagPool.cxx b/src/tag/TagPool.cxx index 57a9137a7..cc28ea9a6 100644 --- a/src/tag/TagPool.cxx +++ b/src/tag/TagPool.cxx @@ -39,7 +39,7 @@ struct slot { static struct slot *slots[NUM_SLOTS]; static inline unsigned -calc_hash_n(enum tag_type type, const char *p, size_t length) +calc_hash_n(TagType type, const char *p, size_t length) { unsigned hash = 5381; @@ -52,7 +52,7 @@ calc_hash_n(enum tag_type type, const char *p, size_t length) } static inline unsigned -calc_hash(enum tag_type type, const char *p) +calc_hash(TagType type, const char *p) { unsigned hash = 5381; @@ -71,7 +71,7 @@ tag_item_to_slot(TagItem *item) } static struct slot *slot_alloc(struct slot *next, - enum tag_type type, + TagType type, const char *value, int length) { struct slot *slot; @@ -87,7 +87,7 @@ static struct slot *slot_alloc(struct slot *next, } TagItem * -tag_pool_get_item(enum tag_type type, const char *value, size_t length) +tag_pool_get_item(TagType type, const char *value, size_t length) { struct slot **slot_p, *slot; diff --git a/src/tag/TagPool.hxx b/src/tag/TagPool.hxx index a6b28b355..f41f3a724 100644 --- a/src/tag/TagPool.hxx +++ b/src/tag/TagPool.hxx @@ -28,7 +28,7 @@ extern Mutex tag_pool_lock; struct TagItem; TagItem * -tag_pool_get_item(enum tag_type type, const char *value, size_t length); +tag_pool_get_item(TagType type, const char *value, size_t length); TagItem * tag_pool_dup_item(TagItem *item); diff --git a/src/tag/TagTable.cxx b/src/tag/TagTable.cxx index 9c833d5a2..c7e920f2e 100644 --- a/src/tag/TagTable.cxx +++ b/src/tag/TagTable.cxx @@ -28,7 +28,7 @@ * Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found * in the table. */ -tag_type +TagType tag_table_lookup(const struct tag_table *table, const char *name) { for (; table->name != nullptr; ++table) @@ -43,7 +43,7 @@ tag_table_lookup(const struct tag_table *table, const char *name) * Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found * in the table. */ -tag_type +TagType tag_table_lookup_i(const struct tag_table *table, const char *name) { for (; table->name != nullptr; ++table) diff --git a/src/tag/TagTable.hxx b/src/tag/TagTable.hxx index 553415a86..c050f61ac 100644 --- a/src/tag/TagTable.hxx +++ b/src/tag/TagTable.hxx @@ -26,7 +26,7 @@ struct tag_table { const char *name; - enum tag_type type; + TagType type; }; /** @@ -35,7 +35,7 @@ struct tag_table { * in the table. */ gcc_pure -tag_type +TagType tag_table_lookup(const tag_table *table, const char *name); /** @@ -44,7 +44,7 @@ tag_table_lookup(const tag_table *table, const char *name); * in the table. */ gcc_pure -tag_type +TagType tag_table_lookup_i(const tag_table *table, const char *name); #endif diff --git a/src/tag/TagType.h b/src/tag/TagType.h index 118d66a02..0b8aa55d4 100644 --- a/src/tag/TagType.h +++ b/src/tag/TagType.h @@ -27,7 +27,7 @@ /** * Codes for the type of a tag item. */ -enum tag_type +enum TagType #ifdef __cplusplus /* the size of this enum is 1 byte; this is only relevant for C++ code; the only C sources including this header don't use instances @@ -59,7 +59,7 @@ enum tag_type }; /** - * An array of strings, which map the #tag_type to its machine + * An array of strings, which map the #TagType to its machine * readable name (specific to the MPD protocol). */ extern const char *const tag_item_names[]; diff --git a/test/read_tags.cxx b/test/read_tags.cxx index aae2a2df9..7b631cae5 100644 --- a/test/read_tags.cxx +++ b/test/read_tags.cxx @@ -124,7 +124,7 @@ print_duration(unsigned seconds, gcc_unused void *ctx) } static void -print_tag(enum tag_type type, const char *value, gcc_unused void *ctx) +print_tag(TagType type, const char *value, gcc_unused void *ctx) { g_print("[%s]=%s\n", tag_item_names[type], value); empty = false; -- cgit v1.2.3