From 91502cd71ea92716729109677c6d8e57c42e63ae Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Fri, 29 Aug 2008 09:38:21 +0200
Subject: tag: renamed functions, no CamelCase

---
 src/inputPlugins/_flac_common.c     |  6 +++---
 src/inputPlugins/aac_plugin.c       |  4 ++--
 src/inputPlugins/audiofile_plugin.c |  2 +-
 src/inputPlugins/flac_plugin.c      |  8 +++----
 src/inputPlugins/mod_plugin.c       |  4 ++--
 src/inputPlugins/mp3_plugin.c       | 43 ++++++++++++++++++-------------------
 src/inputPlugins/mp4_plugin.c       | 22 +++++++++----------
 src/inputPlugins/mpc_plugin.c       |  6 +++---
 src/inputPlugins/oggvorbis_plugin.c | 14 ++++++------
 src/inputPlugins/wavpack_plugin.c   |  6 +++---
 10 files changed, 57 insertions(+), 58 deletions(-)

(limited to 'src/inputPlugins')

diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c
index 1e400a18f..e0c251489 100644
--- a/src/inputPlugins/_flac_common.c
+++ b/src/inputPlugins/_flac_common.c
@@ -125,10 +125,10 @@ static unsigned int commentMatchesAddToTag(const
 	if ((vlen > 0) && (0 == strncasecmp(str, (char *)entry->entry, slen))
 	    && (*(entry->entry + slen) == '=')) {
 		if (!*tag)
-			*tag = newMpdTag();
+			*tag = tag_new();
 
-		addItemToMpdTagWithLen(*tag, itemType,
-				       (char *)(entry->entry + slen + 1), vlen);
+		tag_add_item_n(*tag, itemType,
+			       (char *)(entry->entry + slen + 1), vlen);
 
 		return 1;
 	}
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index bd5e6a432..789b87b57 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -578,8 +578,8 @@ static struct tag *aacTagDup(char *file)
 	int file_time = getAacTotalTime(file);
 
 	if (file_time >= 0) {
-		if ((ret = id3Dup(file)) == NULL)
-			ret = newMpdTag();
+		if ((ret = tag_id3_load(file)) == NULL)
+			ret = tag_new();
 		ret->time = file_time;
 	} else {
 		DEBUG("aacTagDup: Failed to get total song time from: %s\n",
diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c
index 06c9fff4c..9511c84ed 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -127,7 +127,7 @@ static struct tag *audiofileTagDup(char *file)
 
 	if (total_time >= 0) {
 		if (!ret)
-			ret = newMpdTag();
+			ret = tag_new();
 		ret->time = total_time;
 	} else {
 		DEBUG
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index a8dcc0b41..15d5c6d63 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -336,7 +336,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
 				*vorbisCommentFound = 1;
 		} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
 			if (!ret)
-				ret = newMpdTag();
+				ret = tag_new();
 			ret->time = ((float)block->data.stream_info.
 				     total_samples) /
 			    block->data.stream_info.sample_rate + 0.5;
@@ -360,10 +360,10 @@ static struct tag *flacTagDup(char *file)
 		return NULL;
 	}
 	if (!foundVorbisComment) {
-		struct tag *temp = id3Dup(file);
+		struct tag *temp = tag_id3_load(file);
 		if (temp) {
 			temp->time = ret->time;
-			freeMpdTag(ret);
+			tag_free(ret);
 			ret = temp;
 		}
 	}
@@ -482,7 +482,7 @@ static struct tag *oggflac_tag_dup(char *file)
 			ret = copyVorbisCommentBlockToMpdTag(block, ret);
 		} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
 			if (!ret)
-				ret = newMpdTag();
+				ret = tag_new();
 			ret->time = ((float)block->data.stream_info.
 				     total_samples) /
 			    block->data.stream_info.sample_rate + 0.5;
diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c
index 754dd6746..1d458919c 100644
--- a/src/inputPlugins/mod_plugin.c
+++ b/src/inputPlugins/mod_plugin.c
@@ -232,12 +232,12 @@ static struct tag *modTagDup(char *file)
 	}
 	Player_Free(moduleHandle);
 
-	ret = newMpdTag();
+	ret = tag_new();
 
 	ret->time = 0;
 	title = xstrdup(Player_LoadTitle(file));
 	if (title)
-		addItemToMpdTag(ret, TAG_ITEM_TITLE, title);
+		tag_add_item(ret, TAG_ITEM_TITLE, title);
 
 	MikMod_Exit();
 
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index 0d1c8e99a..11486ce9d 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -345,10 +345,10 @@ static void mp3_parseId3Tag(mp3DecodeData * data, size_t tagsize,
 		goto fail;
 
 	if (mpdTag) {
-		tmpMpdTag = parseId3Tag(id3Tag);
+		tmpMpdTag = tag_id3_import(id3Tag);
 		if (tmpMpdTag) {
 			if (*mpdTag)
-				freeMpdTag(*mpdTag);
+				tag_free(*mpdTag);
 			*mpdTag = tmpMpdTag;
 		}
 	}
@@ -821,7 +821,7 @@ static int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
 	if (decodeFirstFrame(data, tag, replayGainInfo) < 0) {
 		mp3DecodeDataFinalize(data);
 		if (tag && *tag)
-			freeMpdTag(*tag);
+			tag_free(*tag);
 		return -1;
 	}
 
@@ -896,17 +896,16 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
 		}
 
 		if (data->inStream->metaTitle) {
-			struct tag *tag = newMpdTag();
+			struct tag *tag = tag_new();
 			if (data->inStream->metaName) {
-				addItemToMpdTag(tag,
-						TAG_ITEM_NAME,
-						data->inStream->metaName);
+				tag_add_item(tag, TAG_ITEM_NAME,
+					     data->inStream->metaName);
 			}
-			addItemToMpdTag(tag, TAG_ITEM_TITLE,
+			tag_add_item(tag, TAG_ITEM_TITLE,
 					data->inStream->metaTitle);
 			free(data->inStream->metaTitle);
 			data->inStream->metaTitle = NULL;
-			freeMpdTag(tag);
+			tag_free(tag);
 		}
 
 		if (!data->decodedFirstFrame) {
@@ -1050,27 +1049,27 @@ static int mp3_decode(struct decoder * decoder, InputStream * inStream)
 
 	if (inStream->metaTitle) {
 		if (tag)
-			freeMpdTag(tag);
-		tag = newMpdTag();
-		addItemToMpdTag(tag, TAG_ITEM_TITLE, inStream->metaTitle);
+			tag_free(tag);
+		tag = tag_new();
+		tag_add_item(tag, TAG_ITEM_TITLE, inStream->metaTitle);
 		free(inStream->metaTitle);
 		inStream->metaTitle = NULL;
 		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) {
 		if (inStream->metaName) {
-			clearItemsFromMpdTag(tag, TAG_ITEM_NAME);
-			addItemToMpdTag(tag, TAG_ITEM_NAME, inStream->metaName);
+			tag_clear_items_by_type(tag, TAG_ITEM_NAME);
+			tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
 		}
-		freeMpdTag(tag);
+		tag_free(tag);
 	} else if (inStream->metaName) {
-		tag = newMpdTag();
+		tag = tag_new();
 		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);
@@ -1097,13 +1096,13 @@ static struct tag *mp3_tagDup(char *file)
 	struct tag *ret = NULL;
 	int total_time;
 
-	ret = id3Dup(file);
+	ret = tag_id3_load(file);
 
 	total_time = getMp3TotalTime(file);
 
 	if (total_time >= 0) {
 		if (!ret)
-			ret = newMpdTag();
+			ret = tag_new();
 		ret->time = total_time;
 	} else {
 		DEBUG("mp3_tagDup: Failed to get total song time from: %s\n",
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c
index 89519cb0c..ab712ef5f 100644
--- a/src/inputPlugins/mp4_plugin.c
+++ b/src/inputPlugins/mp4_plugin.c
@@ -334,14 +334,14 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
 		return NULL;
 	}
 
-	ret = newMpdTag();
+	ret = tag_new();
 	file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track);
 	scale = mp4ff_time_scale(mp4fh, track);
 	if (scale < 0) {
 		mp4ff_close(mp4fh);
 		closeInputStream(&inStream);
 		free(callback);
-		freeMpdTag(ret);
+		tag_free(ret);
 		return NULL;
 	}
 	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);
 
 		if (0 == strcasecmp("artist", item)) {
-			addItemToMpdTag(ret, TAG_ITEM_ARTIST, value);
+			tag_add_item(ret, TAG_ITEM_ARTIST, value);
 			*mp4MetadataFound = 1;
 		} else if (0 == strcasecmp("title", item)) {
-			addItemToMpdTag(ret, TAG_ITEM_TITLE, value);
+			tag_add_item(ret, TAG_ITEM_TITLE, value);
 			*mp4MetadataFound = 1;
 		} else if (0 == strcasecmp("album", item)) {
-			addItemToMpdTag(ret, TAG_ITEM_ALBUM, value);
+			tag_add_item(ret, TAG_ITEM_ALBUM, value);
 			*mp4MetadataFound = 1;
 		} else if (0 == strcasecmp("track", item)) {
-			addItemToMpdTag(ret, TAG_ITEM_TRACK, value);
+			tag_add_item(ret, TAG_ITEM_TRACK, value);
 			*mp4MetadataFound = 1;
 		} 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;
 		} else if (0 == strcasecmp("genre", item)) {
-			addItemToMpdTag(ret, TAG_ITEM_GENRE, value);
+			tag_add_item(ret, TAG_ITEM_GENRE, value);
 			*mp4MetadataFound = 1;
 		} else if (0 == strcasecmp("date", item)) {
-			addItemToMpdTag(ret, TAG_ITEM_DATE, value);
+			tag_add_item(ret, TAG_ITEM_DATE, value);
 			*mp4MetadataFound = 1;
 		}
 
@@ -394,10 +394,10 @@ static struct tag *mp4TagDup(char *file)
 	if (!ret)
 		return NULL;
 	if (!mp4MetadataFound) {
-		struct tag *temp = id3Dup(file);
+		struct tag *temp = tag_id3_load(file);
 		if (temp) {
 			temp->time = ret->time;
-			freeMpdTag(ret);
+			tag_free(ret);
 			ret = temp;
 		}
 	}
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index 2ae6bf141..54e7e5479 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -290,11 +290,11 @@ static struct tag *mpcTagDup(char *file)
 		return NULL;
 	}
 
-	ret = apeDup(file);
+	ret = tag_ape_load(file);
 	if (!ret)
-		ret = id3Dup(file);
+		ret = tag_id3_load(file);
 	if (!ret)
-		ret = newMpdTag();
+		ret = tag_new();
 	ret->time = total_time;
 
 	return ret;
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index 6d160dcdc..d8ee63bfe 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -158,9 +158,9 @@ static unsigned int ogg_parseCommentAddToTag(char *comment,
 
 	if (strncasecmp(comment, needle, len) == 0 && *(comment + len) == '=') {
 		if (!*tag)
-			*tag = newMpdTag();
+			*tag = tag_new();
 
-		addItemToMpdTag(*tag, itemType, comment + len + 1);
+		tag_add_item(*tag, itemType, comment + len + 1);
 
 		return 1;
 	}
@@ -191,17 +191,17 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
 
 	tag = oggCommentsParse(comments);
 	if (!tag && streamName) {
-		tag = newMpdTag();
+		tag = tag_new();
 	}
 	if (!tag)
 		return;
 
 	if (streamName) {
-		clearItemsFromMpdTag(tag, TAG_ITEM_NAME);
-		addItemToMpdTag(tag, TAG_ITEM_NAME, streamName);
+		tag_clear_items_by_type(tag, TAG_ITEM_NAME);
+		tag_add_item(tag, TAG_ITEM_NAME, streamName);
 	}
 
-	freeMpdTag(tag);
+	tag_free(tag);
 }
 
 /* public */
@@ -357,7 +357,7 @@ static struct tag *oggvorbis_TagDup(char *file)
 	ret = oggCommentsParse(ov_comment(&vf, -1)->user_comments);
 
 	if (!ret)
-		ret = newMpdTag();
+		ret = tag_new();
 	ret->time = (int)(ov_time_total(&vf, -1) + 0.5);
 
 	ov_clear(&vf);
diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c
index 13c8f8769..2bcafbbb9 100644
--- a/src/inputPlugins/wavpack_plugin.c
+++ b/src/inputPlugins/wavpack_plugin.c
@@ -296,9 +296,9 @@ static struct tag *wavpack_tagdup(char *fname)
 		return NULL;
 	}
 
-	tag = newMpdTag();
+	tag = tag_new();
 	if (tag == NULL) {
-		ERROR("failed to newMpdTag()\n");
+		ERROR("failed to tag_new()\n");
 		return NULL;
 	}
 
@@ -325,7 +325,7 @@ static struct tag *wavpack_tagdup(char *fname)
 			}
 
 			WavpackGetTagItem(wpc, tagtypes[i].name, s, j);
-			addItemToMpdTag(tag, tagtypes[i].type, s);
+			tag_add_item(tag, tagtypes[i].type, s);
 		}
 	}
 
-- 
cgit v1.2.3