dbus/dbus dbus-string.c,1.67,1.68
Havoc Pennington
hp at freedesktop.org
Sun Apr 10 13:36:48 EST 2005
Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv18243/dbus
Modified Files:
dbus-string.c
Log Message:
2005-04-09 Havoc Pennington <hp at redhat.com>
* dbus/dbus-string.c (copy): change a memcpy to memmove due to
possible overlap, fix from Daniel Reed
(fixup_alignment): fix signedness warnings
(_dbus_string_append_unichar): ditto
Index: dbus-string.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-string.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- dbus-string.c 25 Feb 2005 22:03:30 -0000 1.67
+++ dbus-string.c 10 Apr 2005 03:36:46 -0000 1.68
@@ -76,8 +76,8 @@
static void
fixup_alignment (DBusRealString *real)
{
- char *aligned;
- char *real_block;
+ unsigned char *aligned;
+ unsigned char *real_block;
unsigned int old_align_offset;
/* we have to have extra space in real->allocated for the align offset and nul byte */
@@ -238,7 +238,7 @@
real = (DBusRealString*) str;
- real->str = (char*) value;
+ real->str = (unsigned char*) value;
real->len = len;
real->allocated = real->len + _DBUS_STRING_ALLOCATION_PADDING; /* a lie, just to avoid special-case assertions... */
real->max_length = real->len + 1;
@@ -296,7 +296,7 @@
#define MAX_WASTE 48
if (real->allocated - MAX_WASTE > real->len)
{
- char *new_str;
+ unsigned char *new_str;
int new_allocated;
new_allocated = real->len + _DBUS_STRING_ALLOCATION_PADDING;
@@ -318,7 +318,7 @@
int new_length)
{
int new_allocated;
- char *new_str;
+ unsigned char *new_str;
/* at least double our old allocation to avoid O(n), avoiding
* overflow
@@ -418,7 +418,7 @@
{
DBUS_STRING_PREAMBLE (str);
- return real->str;
+ return (char*) real->str;
}
#endif /* _dbus_string_get_data */
@@ -435,7 +435,7 @@
{
DBUS_CONST_STRING_PREAMBLE (str);
- return real->str;
+ return (const char*) real->str;
}
#endif /* _dbus_string_get_const_data */
@@ -463,7 +463,7 @@
_dbus_assert (start <= real->len);
_dbus_assert (len <= real->len - start);
- return real->str + start;
+ return (char*) real->str + start;
}
/* only do the function if we don't have the macro */
@@ -487,7 +487,7 @@
_dbus_assert (start <= real->len);
_dbus_assert (len <= real->len - start);
- return real->str + start;
+ return (const char*) real->str + start;
}
#endif /* _dbus_string_get_const_data_len */
@@ -613,7 +613,7 @@
undo_alignment (real);
- *data_return = real->str;
+ *data_return = (char*) real->str;
old_max_length = real->max_length;
@@ -621,7 +621,7 @@
if (!_dbus_string_init (str))
{
/* hrm, put it back then */
- real->str = *data_return;
+ real->str = (unsigned char*) *data_return;
*data_return = NULL;
fixup_alignment (real);
return FALSE;
@@ -1210,7 +1210,7 @@
return FALSE;
}
- vsprintf (real->str + (real->len - len),
+ vsprintf ((char*) (real->str + (real->len - len)),
format, args_copy);
va_end (args_copy);
@@ -1298,7 +1298,7 @@
int len;
int first;
int i;
- char *out;
+ unsigned char *out;
DBUS_STRING_PREAMBLE (str);
@@ -1405,9 +1405,9 @@
if (!open_gap (len, dest, insert_at))
return FALSE;
- memcpy (dest->str + insert_at,
- source->str + start,
- len);
+ memmove (dest->str + insert_at,
+ source->str + start,
+ len);
return TRUE;
}
More information about the dbus-commit
mailing list