aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/song.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/song.c b/src/song.c
index 5803d4f97..f76c1e4d9 100644
--- a/src/song.c
+++ b/src/song.c
@@ -216,31 +216,31 @@ void readSongInfoIntoList(FILE * fp, struct directory * parent)
int song_file_update(struct mpd_song * song)
{
- if (song_is_file(song)) {
- InputPlugin *plugin;
- unsigned int next = 0;
- char path_max_tmp[MPD_PATH_MAX];
- char abs_path[MPD_PATH_MAX];
- struct mpd_tag *old_tag = song->tag;
- struct mpd_tag *new_tag = NULL;
-
- utf8_to_fs_charset(abs_path, song_get_url(song, path_max_tmp));
- rmp2amp_r(abs_path, abs_path);
-
- while ((plugin = isMusic(abs_path, &song->mtime, next++))) {
- if ((new_tag = plugin->tagDupFunc(abs_path)))
- break;
- }
- if (new_tag && tag_equal(new_tag, old_tag)) {
- tag_free(new_tag);
- } else {
- song->tag = new_tag;
- if (old_tag)
- tag_free(old_tag);
- }
- if (!song->tag || song->tag->time < 0)
- return -1;
+ InputPlugin *plugin;
+ unsigned int next = 0;
+ char path_max_tmp[MPD_PATH_MAX];
+ char abs_path[MPD_PATH_MAX];
+ struct mpd_tag *old_tag = song->tag;
+ struct mpd_tag *new_tag = NULL;
+
+ assert(song_is_file(song));
+
+ utf8_to_fs_charset(abs_path, song_get_url(song, path_max_tmp));
+ rmp2amp_r(abs_path, abs_path);
+
+ while ((plugin = isMusic(abs_path, &song->mtime, next++))) {
+ if ((new_tag = plugin->tagDupFunc(abs_path)))
+ break;
+ }
+ if (new_tag && tag_equal(new_tag, old_tag)) {
+ tag_free(new_tag);
+ } else {
+ song->tag = new_tag;
+ if (old_tag)
+ tag_free(old_tag);
}
+ if (!song->tag || song->tag->time < 0)
+ return -1;
return 0;
}