aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/gme_decoder_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-02-11 16:59:24 +0100
committerMax Kellermann <max@duempel.org>2012-02-11 16:59:24 +0100
commitb7356bc526dbbd6fa00d40caff2addec10ae7c7e (patch)
tree186e5cc761780f779a5a2ead9d8a9241e9aeb325 /src/decoder/gme_decoder_plugin.c
parent8ec8282f38876b5b266e387cb9157ccd229d0afa (diff)
downloadmpd-b7356bc526dbbd6fa00d40caff2addec10ae7c7e.tar.gz
mpd-b7356bc526dbbd6fa00d40caff2addec10ae7c7e.tar.xz
mpd-b7356bc526dbbd6fa00d40caff2addec10ae7c7e.zip
decoder/gme: convert runtime check to assertion
When gme_track_info() returns with success, then the gme_info_t pointer must be set.
Diffstat (limited to 'src/decoder/gme_decoder_plugin.c')
-rw-r--r--src/decoder/gme_decoder_plugin.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/decoder/gme_decoder_plugin.c b/src/decoder/gme_decoder_plugin.c
index e14a52d32..8fdc39fd1 100644
--- a/src/decoder/gme_decoder_plugin.c
+++ b/src/decoder/gme_decoder_plugin.c
@@ -202,29 +202,30 @@ gme_tag_dup(const char *path_fs)
return NULL;
}
+ assert(ti != NULL);
+
struct tag *tag = tag_new();
- if(ti != NULL){
- if(ti->length > 0)
- tag->time = ti->length / 1000;
- if(ti->song != NULL){
- if(gme_track_count(emu) > 1){
- /* start numbering subtunes from 1 */
- char *tag_title=g_strdup_printf("%s (%d/%d)",
- ti->song, song_num+1, gme_track_count(emu));
- tag_add_item(tag, TAG_TITLE, tag_title);
- g_free(tag_title);
- }else
- tag_add_item(tag, TAG_TITLE, ti->song);
- }
- if(ti->author != NULL)
- tag_add_item(tag, TAG_ARTIST, ti->author);
- if(ti->game != NULL)
- tag_add_item(tag, TAG_ALBUM, ti->game);
- if(ti->comment != NULL)
- tag_add_item(tag, TAG_COMMENT, ti->comment);
- if(ti->copyright != NULL)
- tag_add_item(tag, TAG_DATE, ti->copyright);
+
+ if(ti->length > 0)
+ tag->time = ti->length / 1000;
+ if(ti->song != NULL){
+ if(gme_track_count(emu) > 1){
+ /* start numbering subtunes from 1 */
+ char *tag_title=g_strdup_printf("%s (%d/%d)",
+ ti->song, song_num+1, gme_track_count(emu));
+ tag_add_item(tag, TAG_TITLE, tag_title);
+ g_free(tag_title);
+ }else
+ tag_add_item(tag, TAG_TITLE, ti->song);
}
+ if(ti->author != NULL)
+ tag_add_item(tag, TAG_ARTIST, ti->author);
+ if(ti->game != NULL)
+ tag_add_item(tag, TAG_ALBUM, ti->game);
+ if(ti->comment != NULL)
+ tag_add_item(tag, TAG_COMMENT, ti->comment);
+ if(ti->copyright != NULL)
+ tag_add_item(tag, TAG_DATE, ti->copyright);
gme_free_info(ti);
gme_delete(emu);