From: Max Kellermann Date: Tue, 29 Sep 2009 20:33:02 +0000 (+0200) Subject: mpdclient: mpdclient_update() returns bool X-Git-Tag: release-0.16~293 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a0e81557edb29856bb20a64f2116d51ddcd5380c;p=ncmpc.git mpdclient: mpdclient_update() returns bool As a side effect, this patch adds the missing mpdclient_finish_command() call to mpdclient_playlist_update_changes(). --- diff --git a/src/mpdclient.c b/src/mpdclient.c index 179aecc..5e138ed 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -212,15 +212,15 @@ mpdclient_connect(struct mpdclient *c, return true; } -gint +bool mpdclient_update(struct mpdclient *c) { - gint retval = 0; + bool retval; c->volume = MPD_STATUS_NO_VOLUME; if (MPD_ERROR(c)) - return -1; + return false; /* free the old status */ if (c->status) @@ -229,7 +229,7 @@ mpdclient_update(struct mpdclient *c) /* retrieve new status */ c->status = mpd_run_status(c->connection); if (c->status == NULL) - return mpdclient_handle_error(c); + return mpdclient_handle_error(c) == 0; if (c->updatingdb && c->updatingdb != mpd_status_get_update_id(c->status)) @@ -713,13 +713,13 @@ mpdclient_remove_error_callback(struct mpdclient *c, mpdc_error_cb_t cb) /****************************************************************************/ /* update playlist */ -gint +bool mpdclient_playlist_update(struct mpdclient *c) { struct mpd_entity *entity; if (MPD_ERROR(c)) - return -1; + return false; playlist_clear(&c->playlist); @@ -737,18 +737,18 @@ mpdclient_playlist_update(struct mpdclient *c) /* call playlist updated callbacks */ mpdclient_playlist_callback(c, PLAYLIST_EVENT_UPDATED, NULL); - return mpdclient_finish_command(c); + return mpdclient_finish_command(c) == 0; } /* update playlist (plchanges) */ -gint +bool mpdclient_playlist_update_changes(struct mpdclient *c) { struct mpd_song *song; guint length; if (MPD_ERROR(c)) - return -1; + return false; mpd_send_queue_changes_meta(c->connection, c->playlist.id); @@ -781,7 +781,7 @@ mpdclient_playlist_update_changes(struct mpdclient *c) mpdclient_playlist_callback(c, PLAYLIST_EVENT_UPDATED, NULL); - return 0; + return mpdclient_finish_command(c) == 0; } diff --git a/src/mpdclient.h b/src/mpdclient.h index fa2f1b6..e9150ba 100644 --- a/src/mpdclient.h +++ b/src/mpdclient.h @@ -47,7 +47,8 @@ mpdclient_connect(struct mpdclient *c, const gchar *host, gint port, void mpdclient_disconnect(struct mpdclient *c); -gint mpdclient_update(struct mpdclient *c); +bool +mpdclient_update(struct mpdclient *c); /*** MPD Commands **********************************************************/ @@ -98,10 +99,12 @@ void mpdclient_remove_error_callback(struct mpdclient *c, mpdc_error_cb_t cb); /*** playlist functions **************************************************/ /* update the complete playlist */ -gint mpdclient_playlist_update(struct mpdclient *c); +bool +mpdclient_playlist_update(struct mpdclient *c); /* get playlist changes */ -gint mpdclient_playlist_update_changes(struct mpdclient *c); +bool +mpdclient_playlist_update_changes(struct mpdclient *c); /*** mpdclient playlist callbacks *****************************************/