summaryrefslogtreecommitdiff
path: root/dbus
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2015-11-24 00:15:11 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2015-11-24 12:28:21 +0100
commite803cf16443ea0406969f3074b6fb28de1eaddc1 (patch)
treed338c43f91453e6aeebf5d34a0bdf11b8097f43d /dbus
parent8d83e4da18319c25083e29e4e31ebe990c03dde7 (diff)
Fix warning: "pointer targets in passing argument 1 of '_mbsrchr' differ in signedness [-Wpointer-sign]".
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-string.h5
-rw-r--r--dbus/dbus-sysdeps-win.c27
2 files changed, 19 insertions, 13 deletions
diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h
index 44ce5d27..ae2a2380 100644
--- a/dbus/dbus-string.h
+++ b/dbus/dbus-string.h
@@ -361,6 +361,11 @@ dbus_bool_t _dbus_string_validate_nul (const DBusString *str,
int len);
void _dbus_string_zero (DBusString *str);
+static inline unsigned char *
+_dbus_string_get_udata (DBusString *str)
+{
+ return (unsigned char *) _dbus_string_get_data (str);
+}
static inline unsigned char *
_dbus_string_get_udata_len (DBusString *str, int start, int len)
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index 4ad6ff1d..ea9c43d0 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -2320,7 +2320,8 @@ _dbus_get_tmpdir(void)
if (tmpdir == NULL)
{
- char *last_slash;
+ unsigned char *last_slash;
+ unsigned char *p = (unsigned char *)buf;
if (!GetTempPathA (sizeof (buf), buf))
{
@@ -2329,11 +2330,11 @@ _dbus_get_tmpdir(void)
}
/* Drop terminating backslash or slash */
- last_slash = _mbsrchr (buf, '\\');
- if (last_slash > buf && last_slash[1] == '\0')
+ last_slash = _mbsrchr (p, '\\');
+ if (last_slash > p && last_slash[1] == '\0')
last_slash[0] = '\0';
- last_slash = _mbsrchr (buf, '/');
- if (last_slash > buf && last_slash[1] == '\0')
+ last_slash = _mbsrchr (p, '/');
+ if (last_slash > p && last_slash[1] == '\0')
last_slash[0] = '\0';
tmpdir = buf;
@@ -3308,8 +3309,8 @@ _dbus_get_install_root (DBusString *str)
{
/* this is just an initial guess */
DWORD pathLength = MAX_PATH;
- char *lastSlash;
- char *prefix;
+ unsigned char *lastSlash;
+ unsigned char *prefix;
do
{
@@ -3352,9 +3353,9 @@ _dbus_get_install_root (DBusString *str)
/* the rest of this function works by direct byte manipulation of the
* underlying buffer */
- prefix = _dbus_string_get_data (str);
+ prefix = _dbus_string_get_udata (str);
- lastSlash = _mbsrchr(prefix, '\\');
+ lastSlash = _mbsrchr (prefix, '\\');
if (lastSlash == NULL) {
/* failed, but not OOM */
_dbus_string_set_length (str, 0);
@@ -3368,15 +3369,15 @@ _dbus_get_install_root (DBusString *str)
//folder's name happens to end with the *bytes*
//"\\bin"... (I.e. the second byte of some Han character and then
//the Latin "bin", but that is not likely I think...
- if (lastSlash - prefix >= 4 && strnicmp(lastSlash - 4, "\\bin", 4) == 0)
+ if (lastSlash - prefix >= 4 && _mbsnicmp (lastSlash - 4, (const unsigned char *)"\\bin", 4) == 0)
lastSlash[-3] = 0;
- else if (lastSlash - prefix >= 10 && strnicmp(lastSlash - 10, "\\bin\\debug", 10) == 0)
+ else if (lastSlash - prefix >= 10 && _mbsnicmp (lastSlash - 10, (const unsigned char *)"\\bin\\debug", 10) == 0)
lastSlash[-9] = 0;
- else if (lastSlash - prefix >= 12 && strnicmp(lastSlash - 12, "\\bin\\release", 12) == 0)
+ else if (lastSlash - prefix >= 12 && _mbsnicmp (lastSlash - 12, (const unsigned char *)"\\bin\\release", 12) == 0)
lastSlash[-11] = 0;
/* fix up the length to match the byte-manipulation */
- _dbus_string_set_length (str, strlen (prefix));
+ _dbus_string_set_length (str, strlen ((char *) prefix));
return TRUE;
}