tag: renamed functions, no CamelCase

This commit is contained in:
Max Kellermann 2008-08-29 09:38:21 +02:00
parent d0556dc983
commit 91502cd71e
16 changed files with 110 additions and 111 deletions

View File

@ -245,7 +245,7 @@ static int handleUrlHandlers(int fd, mpd_unused int *permission,
static int handleTagTypes(int fd, mpd_unused int *permission, static int handleTagTypes(int fd, mpd_unused int *permission,
mpd_unused int argc, mpd_unused char *argv[]) mpd_unused int argc, mpd_unused char *argv[])
{ {
printTagTypes(fd); tag_print_types(fd);
return 0; return 0;
} }

View File

@ -125,10 +125,10 @@ static unsigned int commentMatchesAddToTag(const
if ((vlen > 0) && (0 == strncasecmp(str, (char *)entry->entry, slen)) if ((vlen > 0) && (0 == strncasecmp(str, (char *)entry->entry, slen))
&& (*(entry->entry + slen) == '=')) { && (*(entry->entry + slen) == '=')) {
if (!*tag) if (!*tag)
*tag = newMpdTag(); *tag = tag_new();
addItemToMpdTagWithLen(*tag, itemType, tag_add_item_n(*tag, itemType,
(char *)(entry->entry + slen + 1), vlen); (char *)(entry->entry + slen + 1), vlen);
return 1; return 1;
} }

View File

@ -578,8 +578,8 @@ static struct tag *aacTagDup(char *file)
int file_time = getAacTotalTime(file); int file_time = getAacTotalTime(file);
if (file_time >= 0) { if (file_time >= 0) {
if ((ret = id3Dup(file)) == NULL) if ((ret = tag_id3_load(file)) == NULL)
ret = newMpdTag(); ret = tag_new();
ret->time = file_time; ret->time = file_time;
} else { } else {
DEBUG("aacTagDup: Failed to get total song time from: %s\n", DEBUG("aacTagDup: Failed to get total song time from: %s\n",

View File

@ -127,7 +127,7 @@ static struct tag *audiofileTagDup(char *file)
if (total_time >= 0) { if (total_time >= 0) {
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
ret->time = total_time; ret->time = total_time;
} else { } else {
DEBUG DEBUG

View File

@ -336,7 +336,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
*vorbisCommentFound = 1; *vorbisCommentFound = 1;
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
ret->time = ((float)block->data.stream_info. ret->time = ((float)block->data.stream_info.
total_samples) / total_samples) /
block->data.stream_info.sample_rate + 0.5; block->data.stream_info.sample_rate + 0.5;
@ -360,10 +360,10 @@ static struct tag *flacTagDup(char *file)
return NULL; return NULL;
} }
if (!foundVorbisComment) { if (!foundVorbisComment) {
struct tag *temp = id3Dup(file); struct tag *temp = tag_id3_load(file);
if (temp) { if (temp) {
temp->time = ret->time; temp->time = ret->time;
freeMpdTag(ret); tag_free(ret);
ret = temp; ret = temp;
} }
} }
@ -482,7 +482,7 @@ static struct tag *oggflac_tag_dup(char *file)
ret = copyVorbisCommentBlockToMpdTag(block, ret); ret = copyVorbisCommentBlockToMpdTag(block, ret);
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
ret->time = ((float)block->data.stream_info. ret->time = ((float)block->data.stream_info.
total_samples) / total_samples) /
block->data.stream_info.sample_rate + 0.5; block->data.stream_info.sample_rate + 0.5;

View File

@ -232,12 +232,12 @@ static struct tag *modTagDup(char *file)
} }
Player_Free(moduleHandle); Player_Free(moduleHandle);
ret = newMpdTag(); ret = tag_new();
ret->time = 0; ret->time = 0;
title = xstrdup(Player_LoadTitle(file)); title = xstrdup(Player_LoadTitle(file));
if (title) if (title)
addItemToMpdTag(ret, TAG_ITEM_TITLE, title); tag_add_item(ret, TAG_ITEM_TITLE, title);
MikMod_Exit(); MikMod_Exit();

View File

@ -345,10 +345,10 @@ static void mp3_parseId3Tag(mp3DecodeData * data, size_t tagsize,
goto fail; goto fail;
if (mpdTag) { if (mpdTag) {
tmpMpdTag = parseId3Tag(id3Tag); tmpMpdTag = tag_id3_import(id3Tag);
if (tmpMpdTag) { if (tmpMpdTag) {
if (*mpdTag) if (*mpdTag)
freeMpdTag(*mpdTag); tag_free(*mpdTag);
*mpdTag = tmpMpdTag; *mpdTag = tmpMpdTag;
} }
} }
@ -821,7 +821,7 @@ static int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
if (decodeFirstFrame(data, tag, replayGainInfo) < 0) { if (decodeFirstFrame(data, tag, replayGainInfo) < 0) {
mp3DecodeDataFinalize(data); mp3DecodeDataFinalize(data);
if (tag && *tag) if (tag && *tag)
freeMpdTag(*tag); tag_free(*tag);
return -1; return -1;
} }
@ -896,17 +896,16 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
} }
if (data->inStream->metaTitle) { if (data->inStream->metaTitle) {
struct tag *tag = newMpdTag(); struct tag *tag = tag_new();
if (data->inStream->metaName) { if (data->inStream->metaName) {
addItemToMpdTag(tag, tag_add_item(tag, TAG_ITEM_NAME,
TAG_ITEM_NAME, data->inStream->metaName);
data->inStream->metaName);
} }
addItemToMpdTag(tag, TAG_ITEM_TITLE, tag_add_item(tag, TAG_ITEM_TITLE,
data->inStream->metaTitle); data->inStream->metaTitle);
free(data->inStream->metaTitle); free(data->inStream->metaTitle);
data->inStream->metaTitle = NULL; data->inStream->metaTitle = NULL;
freeMpdTag(tag); tag_free(tag);
} }
if (!data->decodedFirstFrame) { if (!data->decodedFirstFrame) {
@ -1050,27 +1049,27 @@ static int mp3_decode(struct decoder * decoder, InputStream * inStream)
if (inStream->metaTitle) { if (inStream->metaTitle) {
if (tag) if (tag)
freeMpdTag(tag); tag_free(tag);
tag = newMpdTag(); tag = tag_new();
addItemToMpdTag(tag, TAG_ITEM_TITLE, inStream->metaTitle); tag_add_item(tag, TAG_ITEM_TITLE, inStream->metaTitle);
free(inStream->metaTitle); free(inStream->metaTitle);
inStream->metaTitle = NULL; inStream->metaTitle = NULL;
if (inStream->metaName) { if (inStream->metaName) {
addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
} }
freeMpdTag(tag); tag_free(tag);
} else if (tag) { } else if (tag) {
if (inStream->metaName) { if (inStream->metaName) {
clearItemsFromMpdTag(tag, TAG_ITEM_NAME); tag_clear_items_by_type(tag, TAG_ITEM_NAME);
addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
} }
freeMpdTag(tag); tag_free(tag);
} else if (inStream->metaName) { } else if (inStream->metaName) {
tag = newMpdTag(); tag = tag_new();
if (inStream->metaName) { if (inStream->metaName) {
addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName); tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
} }
freeMpdTag(tag); tag_free(tag);
} }
decoder_initialized(decoder, &audio_format, data.totalTime); decoder_initialized(decoder, &audio_format, data.totalTime);
@ -1097,13 +1096,13 @@ static struct tag *mp3_tagDup(char *file)
struct tag *ret = NULL; struct tag *ret = NULL;
int total_time; int total_time;
ret = id3Dup(file); ret = tag_id3_load(file);
total_time = getMp3TotalTime(file); total_time = getMp3TotalTime(file);
if (total_time >= 0) { if (total_time >= 0) {
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
ret->time = total_time; ret->time = total_time;
} else { } else {
DEBUG("mp3_tagDup: Failed to get total song time from: %s\n", DEBUG("mp3_tagDup: Failed to get total song time from: %s\n",

View File

@ -334,14 +334,14 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
return NULL; return NULL;
} }
ret = newMpdTag(); ret = tag_new();
file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track); file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track);
scale = mp4ff_time_scale(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track);
if (scale < 0) { if (scale < 0) {
mp4ff_close(mp4fh); mp4ff_close(mp4fh);
closeInputStream(&inStream); closeInputStream(&inStream);
free(callback); free(callback);
freeMpdTag(ret); tag_free(ret);
return NULL; return NULL;
} }
ret->time = ((float)file_time) / scale + 0.5; ret->time = ((float)file_time) / scale + 0.5;
@ -353,25 +353,25 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
mp4ff_meta_get_by_index(mp4fh, i, &item, &value); mp4ff_meta_get_by_index(mp4fh, i, &item, &value);
if (0 == strcasecmp("artist", item)) { if (0 == strcasecmp("artist", item)) {
addItemToMpdTag(ret, TAG_ITEM_ARTIST, value); tag_add_item(ret, TAG_ITEM_ARTIST, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} else if (0 == strcasecmp("title", item)) { } else if (0 == strcasecmp("title", item)) {
addItemToMpdTag(ret, TAG_ITEM_TITLE, value); tag_add_item(ret, TAG_ITEM_TITLE, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} else if (0 == strcasecmp("album", item)) { } else if (0 == strcasecmp("album", item)) {
addItemToMpdTag(ret, TAG_ITEM_ALBUM, value); tag_add_item(ret, TAG_ITEM_ALBUM, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} else if (0 == strcasecmp("track", item)) { } else if (0 == strcasecmp("track", item)) {
addItemToMpdTag(ret, TAG_ITEM_TRACK, value); tag_add_item(ret, TAG_ITEM_TRACK, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} else if (0 == strcasecmp("disc", item)) { /* Is that the correct id? */ } else if (0 == strcasecmp("disc", item)) { /* Is that the correct id? */
addItemToMpdTag(ret, TAG_ITEM_DISC, value); tag_add_item(ret, TAG_ITEM_DISC, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} else if (0 == strcasecmp("genre", item)) { } else if (0 == strcasecmp("genre", item)) {
addItemToMpdTag(ret, TAG_ITEM_GENRE, value); tag_add_item(ret, TAG_ITEM_GENRE, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} else if (0 == strcasecmp("date", item)) { } else if (0 == strcasecmp("date", item)) {
addItemToMpdTag(ret, TAG_ITEM_DATE, value); tag_add_item(ret, TAG_ITEM_DATE, value);
*mp4MetadataFound = 1; *mp4MetadataFound = 1;
} }
@ -394,10 +394,10 @@ static struct tag *mp4TagDup(char *file)
if (!ret) if (!ret)
return NULL; return NULL;
if (!mp4MetadataFound) { if (!mp4MetadataFound) {
struct tag *temp = id3Dup(file); struct tag *temp = tag_id3_load(file);
if (temp) { if (temp) {
temp->time = ret->time; temp->time = ret->time;
freeMpdTag(ret); tag_free(ret);
ret = temp; ret = temp;
} }
} }

View File

@ -290,11 +290,11 @@ static struct tag *mpcTagDup(char *file)
return NULL; return NULL;
} }
ret = apeDup(file); ret = tag_ape_load(file);
if (!ret) if (!ret)
ret = id3Dup(file); ret = tag_id3_load(file);
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
ret->time = total_time; ret->time = total_time;
return ret; return ret;

View File

@ -158,9 +158,9 @@ static unsigned int ogg_parseCommentAddToTag(char *comment,
if (strncasecmp(comment, needle, len) == 0 && *(comment + len) == '=') { if (strncasecmp(comment, needle, len) == 0 && *(comment + len) == '=') {
if (!*tag) if (!*tag)
*tag = newMpdTag(); *tag = tag_new();
addItemToMpdTag(*tag, itemType, comment + len + 1); tag_add_item(*tag, itemType, comment + len + 1);
return 1; return 1;
} }
@ -191,17 +191,17 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
tag = oggCommentsParse(comments); tag = oggCommentsParse(comments);
if (!tag && streamName) { if (!tag && streamName) {
tag = newMpdTag(); tag = tag_new();
} }
if (!tag) if (!tag)
return; return;
if (streamName) { if (streamName) {
clearItemsFromMpdTag(tag, TAG_ITEM_NAME); tag_clear_items_by_type(tag, TAG_ITEM_NAME);
addItemToMpdTag(tag, TAG_ITEM_NAME, streamName); tag_add_item(tag, TAG_ITEM_NAME, streamName);
} }
freeMpdTag(tag); tag_free(tag);
} }
/* public */ /* public */
@ -357,7 +357,7 @@ static struct tag *oggvorbis_TagDup(char *file)
ret = oggCommentsParse(ov_comment(&vf, -1)->user_comments); ret = oggCommentsParse(ov_comment(&vf, -1)->user_comments);
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
ret->time = (int)(ov_time_total(&vf, -1) + 0.5); ret->time = (int)(ov_time_total(&vf, -1) + 0.5);
ov_clear(&vf); ov_clear(&vf);

View File

@ -296,9 +296,9 @@ static struct tag *wavpack_tagdup(char *fname)
return NULL; return NULL;
} }
tag = newMpdTag(); tag = tag_new();
if (tag == NULL) { if (tag == NULL) {
ERROR("failed to newMpdTag()\n"); ERROR("failed to tag_new()\n");
return NULL; return NULL;
} }
@ -325,7 +325,7 @@ static struct tag *wavpack_tagdup(char *fname)
} }
WavpackGetTagItem(wpc, tagtypes[i].name, s, j); WavpackGetTagItem(wpc, tagtypes[i].name, s, j);
addItemToMpdTag(tag, tagtypes[i].type, s); tag_add_item(tag, tagtypes[i].type, s);
} }
} }

View File

@ -397,7 +397,7 @@ int main(int argc, char *argv[])
killFromPidFile(); killFromPidFile();
initStats(); initStats();
initTagConfig(); tag_lib_init();
initLog(options.verbose); initLog(options.verbose);
if (options.createDB <= 0) if (options.createDB <= 0)

View File

@ -917,10 +917,10 @@ static void syncCurrentPlayerDecodeMetadata(void)
if (song->type == SONG_TYPE_URL && if (song->type == SONG_TYPE_URL &&
0 == strcmp(get_song_url(path_max_tmp, song), songPlayer->url) && 0 == strcmp(get_song_url(path_max_tmp, song), songPlayer->url) &&
!mpdTagsAreEqual(song->tag, songPlayer->tag)) { !tag_equal(song->tag, songPlayer->tag)) {
if (song->tag) if (song->tag)
freeMpdTag(song->tag); tag_free(song->tag);
song->tag = mpdTagDup(songPlayer->tag); song->tag = tag_dup(songPlayer->tag);
playlist.songMod[songNum] = playlist.version; playlist.songMod[songNum] = playlist.version;
incrPlaylistVersion(); incrPlaylistVersion();
} }

View File

@ -93,7 +93,7 @@ void freeJustSong(Song * song)
{ {
free(song->url); free(song->url);
if (song->tag) if (song->tag)
freeMpdTag(song->tag); tag_free(song->tag);
free(song); free(song);
} }
@ -148,7 +148,7 @@ int printSongInfo(int fd, Song * song)
printSongUrl(fd, song); printSongUrl(fd, song);
if (song->tag) if (song->tag)
printMpdTag(fd, song->tag); tag_print(fd, song->tag);
return 0; return 0;
} }
@ -201,7 +201,7 @@ static void insertSongIntoList(SongList * list, ListNode ** nextSongNode,
} else if (cmpRet == 0) { } else if (cmpRet == 0) {
Song *tempSong = (Song *) ((*nextSongNode)->data); Song *tempSong = (Song *) ((*nextSongNode)->data);
if (tempSong->mtime != song->mtime) { if (tempSong->mtime != song->mtime) {
freeMpdTag(tempSong->tag); tag_free(tempSong->tag);
tempSong->tag = song->tag; tempSong->tag = song->tag;
tempSong->mtime = song->mtime; tempSong->mtime = song->mtime;
song->tag = NULL; song->tag = NULL;
@ -258,14 +258,14 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir)
*/ */
} else if (matchesAnMpdTagItemKey(buffer, &itemType)) { } else if (matchesAnMpdTagItemKey(buffer, &itemType)) {
if (!song->tag) if (!song->tag)
song->tag = newMpdTag(); song->tag = tag_new();
addItemToMpdTag(song->tag, itemType, tag_add_item(song->tag, itemType,
&(buffer &(buffer
[strlen(mpdTagItemKeys[itemType]) + [strlen(mpdTagItemKeys[itemType]) +
2])); 2]));
} else if (0 == strncmp(SONG_TIME, buffer, strlen(SONG_TIME))) { } else if (0 == strncmp(SONG_TIME, buffer, strlen(SONG_TIME))) {
if (!song->tag) if (!song->tag)
song->tag = newMpdTag(); song->tag = tag_new();
song->tag->time = atoi(&(buffer[strlen(SONG_TIME)])); song->tag->time = atoi(&(buffer[strlen(SONG_TIME)]));
} else if (0 == strncmp(SONG_MTIME, buffer, strlen(SONG_MTIME))) { } else if (0 == strncmp(SONG_MTIME, buffer, strlen(SONG_MTIME))) {
song->mtime = atoi(&(buffer[strlen(SONG_MTIME)])); song->mtime = atoi(&(buffer[strlen(SONG_MTIME)]));
@ -296,7 +296,7 @@ int updateSongInfo(Song * song)
rmp2amp_r(abs_path, abs_path); rmp2amp_r(abs_path, abs_path);
if (song->tag) if (song->tag)
freeMpdTag(song->tag); tag_free(song->tag);
song->tag = NULL; song->tag = NULL;

View File

@ -55,7 +55,7 @@ const char *mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] = {
static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES]; static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES];
void initTagConfig(void) void tag_lib_init(void)
{ {
int quit = 0; int quit = 0;
char *temp; char *temp;
@ -104,7 +104,7 @@ void initTagConfig(void)
free(temp); free(temp);
} }
void printTagTypes(int fd) void tag_print_types(int fd)
{ {
int i; int i;
@ -114,7 +114,7 @@ void printTagTypes(int fd)
} }
} }
void printMpdTag(int fd, struct tag *tag) void tag_print(int fd, struct tag *tag)
{ {
int i; int i;
@ -224,8 +224,8 @@ static struct tag *getID3Info(
continue; continue;
if (mpdTag == NULL) if (mpdTag == NULL)
mpdTag = newMpdTag(); mpdTag = tag_new();
addItemToMpdTag(mpdTag, type, (char *)utf8); tag_add_item(mpdTag, type, (char *)utf8);
free(utf8); free(utf8);
} }
} }
@ -256,8 +256,8 @@ static struct tag *getID3Info(
if(utf8) if(utf8)
{ {
if (mpdTag == NULL) if (mpdTag == NULL)
mpdTag = newMpdTag(); mpdTag = tag_new();
addItemToMpdTag(mpdTag, type, (char *)utf8); tag_add_item(mpdTag, type, (char *)utf8);
free(utf8); free(utf8);
} }
} }
@ -283,7 +283,7 @@ static struct tag *getID3Info(
#endif #endif
#ifdef HAVE_ID3TAG #ifdef HAVE_ID3TAG
struct tag *parseId3Tag(struct id3_tag * tag) struct tag *tag_id3_import(struct id3_tag * tag)
{ {
struct tag *ret = NULL; struct tag *ret = NULL;
@ -425,7 +425,7 @@ static struct id3_tag *findId3TagFromEnd(FILE * stream)
} }
#endif #endif
struct tag *id3Dup(char *file) struct tag *tag_id3_load(char *file)
{ {
struct tag *ret = NULL; struct tag *ret = NULL;
#ifdef HAVE_ID3TAG #ifdef HAVE_ID3TAG
@ -434,7 +434,7 @@ struct tag *id3Dup(char *file)
stream = fopen(file, "r"); stream = fopen(file, "r");
if (!stream) { if (!stream) {
DEBUG("id3Dup: Failed to open file: '%s', %s\n", file, DEBUG("tag_id3_load: Failed to open file: '%s', %s\n", file,
strerror(errno)); strerror(errno));
return NULL; return NULL;
} }
@ -447,13 +447,13 @@ struct tag *id3Dup(char *file)
if (!tag) if (!tag)
return NULL; return NULL;
ret = parseId3Tag(tag); ret = tag_id3_import(tag);
id3_tag_delete(tag); id3_tag_delete(tag);
#endif #endif
return ret; return ret;
} }
struct tag *apeDup(char *file) struct tag *tag_ape_load(char *file)
{ {
struct tag *ret = NULL; struct tag *ret = NULL;
FILE *fp; FILE *fp;
@ -556,9 +556,9 @@ struct tag *apeDup(char *file)
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
if (strcasecmp(key, apeItems[i]) == 0) { if (strcasecmp(key, apeItems[i]) == 0) {
if (!ret) if (!ret)
ret = newMpdTag(); ret = tag_new();
addItemToMpdTagWithLen(ret, tagItems[i], tag_add_item_n(ret, tagItems[i],
p, size); p, size);
} }
} }
} }
@ -574,7 +574,7 @@ fail:
return ret; return ret;
} }
struct tag *newMpdTag(void) struct tag *tag_new(void)
{ {
struct tag *ret = xmalloc(sizeof(*ret)); struct tag *ret = xmalloc(sizeof(*ret));
ret->items = NULL; ret->items = NULL;
@ -605,7 +605,7 @@ static void deleteItem(struct tag *tag, int idx)
} }
} }
void clearItemsFromMpdTag(struct tag *tag, enum tag_type type) void tag_clear_items_by_type(struct tag *tag, enum tag_type type)
{ {
int i; int i;
@ -636,13 +636,13 @@ static void clearMpdTag(struct tag *tag)
tag->time = -1; tag->time = -1;
} }
void freeMpdTag(struct tag *tag) void tag_free(struct tag *tag)
{ {
clearMpdTag(tag); clearMpdTag(tag);
free(tag); free(tag);
} }
struct tag *mpdTagDup(struct tag *tag) struct tag *tag_dup(struct tag *tag)
{ {
struct tag *ret; struct tag *ret;
int i; int i;
@ -650,17 +650,17 @@ struct tag *mpdTagDup(struct tag *tag)
if (!tag) if (!tag)
return NULL; return NULL;
ret = newMpdTag(); ret = tag_new();
ret->time = tag->time; ret->time = tag->time;
for (i = 0; i < tag->numOfItems; i++) { for (i = 0; i < tag->numOfItems; i++) {
addItemToMpdTag(ret, tag->items[i].type, tag->items[i].value); tag_add_item(ret, tag->items[i].type, tag->items[i].value);
} }
return ret; return ret;
} }
int mpdTagsAreEqual(struct tag *tag1, struct tag *tag2) int tag_equal(struct tag *tag1, struct tag *tag2)
{ {
int i; int i;
@ -718,8 +718,8 @@ static void appendToTagItems(struct tag *tag, enum tag_type type,
free(duplicated); free(duplicated);
} }
void addItemToMpdTagWithLen(struct tag *tag, enum tag_type itemType, void tag_add_item_n(struct tag *tag, enum tag_type itemType,
const char *value, size_t len) const char *value, size_t len)
{ {
if (ignoreTagItems[itemType]) if (ignoreTagItems[itemType])
{ {

View File

@ -57,33 +57,33 @@ struct tag {
}; };
#ifdef HAVE_ID3TAG #ifdef HAVE_ID3TAG
struct tag *parseId3Tag(struct id3_tag *); struct tag *tag_id3_import(struct id3_tag *);
#endif #endif
struct tag *apeDup(char *file); struct tag *tag_ape_load(char *file);
struct tag *id3Dup(char *file); struct tag *tag_id3_load(char *file);
struct tag *newMpdTag(void); struct tag *tag_new(void);
void initTagConfig(void); void tag_lib_init(void);
void clearItemsFromMpdTag(struct tag *tag, enum tag_type itemType); void tag_clear_items_by_type(struct tag *tag, enum tag_type itemType);
void freeMpdTag(struct tag *tag); void tag_free(struct tag *tag);
void addItemToMpdTagWithLen(struct tag *tag, enum tag_type itemType, void tag_add_item_n(struct tag *tag, enum tag_type itemType,
const char *value, size_t len); const char *value, size_t len);
#define addItemToMpdTag(tag, itemType, value) \ #define tag_add_item(tag, itemType, value) \
addItemToMpdTagWithLen(tag, itemType, value, strlen(value)) tag_add_item_n(tag, itemType, value, strlen(value))
void printTagTypes(int fd); void tag_print_types(int fd);
void printMpdTag(int fd, struct tag *tag); void tag_print(int fd, struct tag *tag);
struct tag *mpdTagDup(struct tag *tag); struct tag *tag_dup(struct tag *tag);
int mpdTagsAreEqual(struct tag *tag1, struct tag *tag2); int tag_equal(struct tag *tag1, struct tag *tag2);
#endif #endif