tag: id3v2: Don't output any tag when we encounter a negative track number - the tag type is uint, so...

Original commit message from CVS:
* gst-libs/gst/tag/id3v2frames.c: (id3v2_tag_to_taglist):
Don't output any tag when we encounter a negative track number - the
tag type is uint, so we end up outputting huge positive numbers
instead. (Fixes: #342029)
This commit is contained in:
Jan Schmidt 2006-05-19 14:05:53 +00:00 committed by Tim-Philipp Müller
parent 5b67108b7d
commit 7e7ee7278b

View file

@ -450,41 +450,34 @@ id3v2_tag_to_taglist (ID3TagsWorking * work, const gchar * tag_name,
switch (tag_type) { switch (tag_type) {
case G_TYPE_UINT: case G_TYPE_UINT:
{ {
guint tmp; gint current, total;
gchar *check;
tmp = strtoul ((char *) tag_str, &check, 10);
if (sscanf (tag_str, "%d/%d", &current, &total) == 2) {
if (total < 0) {
GST_WARNING ("Ignoring negative value for total %d in tag %s",
total, tag_name);
} else {
if (strcmp (tag_name, GST_TAG_TRACK_NUMBER) == 0) { if (strcmp (tag_name, GST_TAG_TRACK_NUMBER) == 0) {
if (*check == '/') {
guint total;
check++;
total = strtoul (check, &check, 10);
if (*check != '\0')
break;
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
GST_TAG_TRACK_COUNT, total, NULL); GST_TAG_TRACK_COUNT, total, NULL);
}
} else if (strcmp (tag_name, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) { } else if (strcmp (tag_name, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) {
if (*check == '/') {
guint total;
check++;
total = strtoul (check, &check, 10);
if (*check != '\0')
break;
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
GST_TAG_ALBUM_VOLUME_COUNT, total, NULL); GST_TAG_ALBUM_VOLUME_COUNT, total, NULL);
} }
} }
} else if (sscanf (tag_str, "%d", &current) != 1) {
if (*check != '\0') /* Not an integer in the string */
GST_WARNING ("Tag string for tag %s does not contain an integer - "
"ignoring", tag_name);
break; break;
}
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, tmp, NULL); if (current < 0)
GST_WARNING ("Ignoring negative value %d in tag %s", current, tag_name);
else {
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, current,
NULL);
}
break; break;
} }
case G_TYPE_UINT64: case G_TYPE_UINT64: