From: <svn...@op...> - 2009-03-30 12:32:20
|
Author: dgollub Date: Mon Mar 30 14:32:13 2009 New Revision: 5461 URL: http://www.opensync.org/changeset/5461 Log: Fix warning about different signess compare in string marshal functions. Spotted by Björn. Modified: trunk/opensync/common/opensync_marshal.c Modified: trunk/opensync/common/opensync_marshal.c ============================================================================== --- trunk/opensync/common/opensync_marshal.c Mon Mar 30 10:29:50 2009 (r5460) +++ trunk/opensync/common/opensync_marshal.c Mon Mar 30 14:32:13 2009 (r5461) @@ -105,14 +105,14 @@ void osync_marshal_write_string(OSyncMarshal *marshal, const char *value) { unsigned int length = 0; - if (value == NULL) { - length = -1; - g_byte_array_append( marshal->buffer, (unsigned char*)&length, sizeof( unsigned int ) ); - } else { - length = strlen( value ) + 1; - g_byte_array_append( marshal->buffer, (unsigned char*)&length, sizeof( unsigned int ) ); + + if (value) + length = strlen(value) + 1; + + g_byte_array_append( marshal->buffer, (unsigned char*)&length, sizeof( unsigned int ) ); + + if (value) g_byte_array_append( marshal->buffer, (unsigned char*)value, length ); - } } void osync_marshal_write_data(OSyncMarshal *marshal, const void *value, unsigned int size) @@ -174,7 +174,7 @@ unsigned int length = 0; osync_marshal_read_uint(marshal, &length); - if (length == -1) { + if (!length) { *value = NULL; return; } |