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>
This commit is contained in:
Ralf Habacker 2015-11-24 00:15:11 +01:00
parent 8d83e4da18
commit e803cf1644
2 changed files with 19 additions and 13 deletions

View file

@ -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)

View file

@ -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;
}