mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
gvariant: Fix -Wsign-compare warnings
Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
91c0c6f95b
commit
17e6a3a2f4
@ -1054,7 +1054,7 @@ g_variant_type_new_tuple_slow (const GVariantType * const *items,
|
|||||||
* happen only in truly insane code, so it can be slow.
|
* happen only in truly insane code, so it can be slow.
|
||||||
*/
|
*/
|
||||||
GString *string;
|
GString *string;
|
||||||
gsize i;
|
gint i;
|
||||||
|
|
||||||
string = g_string_new ("(");
|
string = g_string_new ("(");
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
@ -1080,16 +1080,19 @@ g_variant_type_new_tuple (const GVariantType * const *items,
|
|||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
gsize offset;
|
gsize offset;
|
||||||
gsize i;
|
gsize i;
|
||||||
|
gsize length_unsigned;
|
||||||
|
|
||||||
g_return_val_if_fail (length == 0 || items != NULL, NULL);
|
g_return_val_if_fail (length == 0 || items != NULL, NULL);
|
||||||
|
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
for (length = 0; items[length] != NULL; length++);
|
for (length_unsigned = 0; items[length_unsigned] != NULL; length_unsigned++);
|
||||||
|
else
|
||||||
|
length_unsigned = (gsize) length;
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
buffer[offset++] = '(';
|
buffer[offset++] = '(';
|
||||||
|
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length_unsigned; i++)
|
||||||
{
|
{
|
||||||
const GVariantType *type;
|
const GVariantType *type;
|
||||||
gsize size;
|
gsize size;
|
||||||
@ -1100,7 +1103,7 @@ g_variant_type_new_tuple (const GVariantType * const *items,
|
|||||||
size = g_variant_type_get_string_length (type);
|
size = g_variant_type_get_string_length (type);
|
||||||
|
|
||||||
if (offset + size >= sizeof buffer) /* leave room for ')' */
|
if (offset + size >= sizeof buffer) /* leave room for ')' */
|
||||||
return g_variant_type_new_tuple_slow (items, length);
|
return g_variant_type_new_tuple_slow (items, length_unsigned);
|
||||||
|
|
||||||
memcpy (&buffer[offset], type, size);
|
memcpy (&buffer[offset], type, size);
|
||||||
offset += size;
|
offset += size;
|
||||||
|
Loading…
Reference in New Issue
Block a user