aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-08 11:06:26 +0200
committerEric Wong <normalperson@yhbt.net>2008-10-11 19:21:48 -0700
commitaae48c97fb3d2b0140daa8e49459a7afe3488683 (patch)
tree0e250f502f03f005ecb0f5cd7156c6819b5ef486
parente4ca5f5b5c051f98b90070303a83f53b68851034 (diff)
downloadmpd-aae48c97fb3d2b0140daa8e49459a7afe3488683.tar.gz
mpd-aae48c97fb3d2b0140daa8e49459a7afe3488683.tar.xz
mpd-aae48c97fb3d2b0140daa8e49459a7afe3488683.zip
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. ]
-rw-r--r--src/song.c4
-rw-r--r--src/update.c4
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);