TagType: rename enum tag_type to TagType
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
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));
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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[];
|
||||
|
Reference in New Issue
Block a user