mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gio: Fix various implicit conversions from size_t to smaller types
Basically various trivial instances of the following MSVC compiler warning: ``` ../gio/gio-tool-set.c(50): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data ``` Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -472,15 +472,21 @@ g_unix_socket_address_new_with_type (const gchar *path,
|
||||
{
|
||||
GSocketAddress *address;
|
||||
GByteArray *array;
|
||||
size_t path_len_unsigned;
|
||||
|
||||
if (type == G_UNIX_SOCKET_ADDRESS_ANONYMOUS)
|
||||
path_len = 0;
|
||||
else if (path_len == -1)
|
||||
path_len = strlen (path);
|
||||
path_len_unsigned = 0;
|
||||
else if (path_len < 0)
|
||||
path_len_unsigned = strlen (path);
|
||||
else
|
||||
path_len_unsigned = (size_t) path_len;
|
||||
|
||||
array = g_byte_array_sized_new (path_len);
|
||||
/* The code below can’t handle anything longer. */
|
||||
g_return_val_if_fail (path_len_unsigned <= G_MAXUINT, NULL);
|
||||
|
||||
g_byte_array_append (array, (guint8 *)path, path_len);
|
||||
array = g_byte_array_sized_new (path_len_unsigned);
|
||||
|
||||
g_byte_array_append (array, (guint8 *)path, path_len_unsigned);
|
||||
|
||||
address = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
|
||||
"path-as-array", array,
|
||||
|
Reference in New Issue
Block a user