Cleanup mp3_parseId3Tag to only modify the MpdTag if we have something new to replace it with.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4278 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
J. Alexander Treuman 2006-06-21 16:11:07 +00:00
parent bdf4107117
commit c6dbba6c5d

View File

@ -260,8 +260,7 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, MpdTag **
id3_length_t count;
id3_byte_t const *id3_data;
id3_byte_t * allocated = NULL;
if(mpdTag) *mpdTag = NULL;
MpdTag * newMpdTag;
count = data->stream.bufend - data->stream.this_frame;
@ -298,13 +297,18 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, MpdTag **
}
id3Tag = id3_tag_parse(id3_data, tagsize);
if(id3Tag) {
if(mpdTag) *mpdTag = parseId3Tag(id3Tag);
if(replayGainInfo) mp3_getReplayGainInfo(id3Tag, replayGainInfo);
id3_tag_delete(id3Tag);
if(!id3Tag) goto fail;
if(mpdTag) {
newMpdTag = parseId3Tag(id3Tag);
if(newMpdTag) {
if(*mpdTag) freeMpdTag(*mpdTag);
*mpdTag = newMpdTag;
}
}
if(replayGainInfo) mp3_getReplayGainInfo(id3Tag, replayGainInfo);
id3_tag_delete(id3Tag);
fail:
if(allocated) free(allocated);
}