From aae48c97fb3d2b0140daa8e49459a7afe3488683 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 11:06:26 +0200 Subject: song: song_file_update() returns boolean Instead of returning 0 or -1, return true on success and false on failure. This seems more natural, and when the C library was designed, there was no "bool" data type. [ew: changing to bool semantics but sticking with integer type since bool is C99 and I don't require a C99 compiler, and I don't feel like writing compatibility wrappers to support it. _Bool is usually (always?) a signed int anyways. ] --- src/song.c | 4 +--- src/update.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/song.c b/src/song.c index f76c1e4d9..09a92223c 100644 --- a/src/song.c +++ b/src/song.c @@ -239,10 +239,8 @@ int song_file_update(struct mpd_song * song) if (old_tag) tag_free(old_tag); } - if (!song->tag || song->tag->time < 0) - return -1; - return 0; + return (song->tag && song->tag->time >= 0); } char *song_get_url(struct mpd_song *song, char *path_max_tmp) diff --git a/src/update.c b/src/update.c index e7a49e56e..594e7f48c 100644 --- a/src/update.c +++ b/src/update.c @@ -226,7 +226,7 @@ updateInDirectory(struct directory *directory, const char *name) return UPDATE_RETURN_UPDATED; } else if (st.st_mtime != song->mtime) { LOG("updating %s\n", name); - if (song_file_update(song) < 0) + if (!song_file_update(song)) delete_song(directory, song); return UPDATE_RETURN_UPDATED; } @@ -405,7 +405,7 @@ static enum update_return updatePath(const char *utf8path) isMusic(song_get_url(song, path_max_tmp), &mtime, 0)) { if (song->mtime == mtime) return UPDATE_RETURN_NOUPDATE; - else if (song_file_update(song) == 0) + else if (song_file_update(song)) return UPDATE_RETURN_UPDATED; else { delete_song(parentDirectory, song); -- cgit v1.2.3