summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9e4282)
raw | patch | inline | side by side (parent: b9e4282)
author | Max Kellermann <max@duempel.org> | |
Fri, 5 Dec 2008 08:33:54 +0000 (09:33 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Fri, 5 Dec 2008 08:33:54 +0000 (09:33 +0100) |
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.
the type of the third parameter (n) differs. This patch adds a
wrapper function with the correct type.
src/screen_play.c | patch | blob | history |
diff --git a/src/screen_play.c b/src/screen_play.c
index 7b94b80bafdfa9a632ab6bc94c71abfe2b43c4ca..feff1f7ae08f5b60c1ea381f4e257447d9b89564 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
}
#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)
{
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;
/* 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;