diff options
author | Max Kellermann <max@duempel.org> | 2008-12-05 09:33:54 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-05 09:33:54 +0100 |
commit | 9b66deea6385f02628d1a57ae3fef292e8e490dd (patch) | |
tree | ac0b7b933b518e9037d7f9ce9bcc2b3ab0ccb744 | |
parent | b9e428208440e53929b2b6f280b79da393eac0cb (diff) | |
download | mpd-9b66deea6385f02628d1a57ae3fef292e8e490dd.tar.gz mpd-9b66deea6385f02628d1a57ae3fef292e8e490dd.tar.xz mpd-9b66deea6385f02628d1a57ae3fef292e8e490dd.zip |
sreen_play: fixed the g_completion_set_compare() callback type
Passing strncmp to g_completion_set_compare() is incorrect, because
the type of the third parameter (n) differs. This patch adds a
wrapper function with the correct type.
Diffstat (limited to '')
-rw-r--r-- | src/screen_play.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/screen_play.c b/src/screen_play.c index 7b94b80ba..feff1f7ae 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -178,6 +178,19 @@ save_post_completion_cb(G_GNUC_UNUSED GCompletion *gcmp, } #endif +#ifndef NCMPC_MINI +/** + * Wrapper for strncmp(). We are not allowed to pass &strncmp to + * g_completion_set_compare(), because strncmp() takes size_t where + * g_completion_set_compare passes a gsize value. + */ +static gint +completion_strncmp(const gchar *s1, const gchar *s2, gsize n) +{ + return strncmp(s1, s2, n); +} +#endif + int playlist_save(mpdclient_t *c, char *name, char *defaultname) { @@ -197,7 +210,7 @@ playlist_save(mpdclient_t *c, char *name, char *defaultname) if (name == NULL) { /* initialize completion support */ gcmp = g_completion_new(NULL); - g_completion_set_compare(gcmp, strncmp); + g_completion_set_compare(gcmp, completion_strncmp); data.list = &list; data.dir_list = NULL; data.c = c; @@ -335,7 +348,7 @@ handle_add_to_playlist(mpdclient_t *c) /* initialize completion support */ gcmp = g_completion_new(NULL); - g_completion_set_compare(gcmp, strncmp); + g_completion_set_compare(gcmp, completion_strncmp); data.list = &list; data.dir_list = &dir_list; data.c = c; |