From 4a77eb16cecc7e3a076e046c6e890bee590a5c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Tue, 10 Oct 2017 11:59:14 +0000 Subject: [PATCH] Replace all instances of ssize_t with gssize ssize_t is supported widely, but not universally, so use gssize instead. Currently only one piece of code actually *needs* this change to be compilable with MSVC, the rest are mostly in *nix parts of the code, but these are changed too, for symmetry. https://bugzilla.gnome.org/show_bug.cgi?id=788180 --- gio/glocalfile.c | 2 +- gio/glocalfileinfo.c | 14 +++++++------- gio/tests/dbus-launch.c | 2 +- glib/gfileutils.c | 2 +- glib/tests/unix.c | 2 +- tests/timeloop-basic.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gio/glocalfile.c b/gio/glocalfile.c index d417c4991..1f78818dc 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -1577,7 +1577,7 @@ expand_symlink (const char *link) char symlink_value[4096]; #ifdef G_OS_WIN32 #else - ssize_t res; + gssize res; #endif #ifdef G_OS_WIN32 diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index a46a842f0..35853cc2d 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -236,7 +236,7 @@ get_selinux_context (const char *path, #define g_setxattr(path,name,value,size) setxattr(path,name,value,size,0) #endif -static ssize_t +static gssize g_getxattr (const char *path, const char *name, void *value, size_t size, gboolean follow_symlinks) { @@ -250,7 +250,7 @@ g_getxattr (const char *path, const char *name, void *value, size_t size, #endif } -static ssize_t +static gssize g_listxattr(const char *path, char *namebuf, size_t size, gboolean follow_symlinks) { @@ -400,7 +400,7 @@ get_one_xattr (const char *path, { char value[64]; char *value_p; - ssize_t len; + gssize len; int errsv; len = g_getxattr (path, xattr, value, sizeof (value)-1, follow_symlinks); @@ -450,7 +450,7 @@ get_xattrs (const char *path, #ifdef HAVE_XATTR gboolean all; gsize list_size; - ssize_t list_res_size; + gssize list_res_size; size_t len; char *list; const char *attr, *attr2; @@ -562,7 +562,7 @@ get_one_xattr_from_fd (int fd, { char value[64]; char *value_p; - ssize_t len; + gssize len; int errsv; len = g_fgetxattr (fd, xattr, value, sizeof (value) - 1); @@ -610,7 +610,7 @@ get_xattrs_from_fd (int fd, #ifdef HAVE_XATTR gboolean all; gsize list_size; - ssize_t list_res_size; + gssize list_res_size; size_t len; char *list; const char *attr, *attr2; @@ -1289,7 +1289,7 @@ get_content_type (const char *basename, if (fd != -1) { - ssize_t res; + gssize res; res = read (fd, sniff_buffer, sniff_length); (void) g_close (fd, NULL); diff --git a/gio/tests/dbus-launch.c b/gio/tests/dbus-launch.c index 5eeb1c0c0..90d8d069e 100644 --- a/gio/tests/dbus-launch.c +++ b/gio/tests/dbus-launch.c @@ -38,7 +38,7 @@ write_all (const void *ptr, while (len > 0) { - ssize_t done = write (STDOUT_FILENO, p, len); + gssize done = write (STDOUT_FILENO, p, len); int errsv = errno; if (done == 0) diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 265952230..ddafa6dd3 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -2055,7 +2055,7 @@ g_file_read_link (const gchar *filename, #ifdef HAVE_READLINK gchar *buffer; size_t size; - ssize_t read_size; + gssize read_size; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); diff --git a/glib/tests/unix.c b/glib/tests/unix.c index 3543458dc..9d55a6c58 100644 --- a/glib/tests/unix.c +++ b/glib/tests/unix.c @@ -32,7 +32,7 @@ test_pipe (void) GError *error = NULL; int pipefd[2]; char buf[1024]; - ssize_t bytes_read; + gssize bytes_read; gboolean res; res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error); diff --git a/tests/timeloop-basic.c b/tests/timeloop-basic.c index 7f952263a..d2bc41eec 100644 --- a/tests/timeloop-basic.c +++ b/tests/timeloop-basic.c @@ -35,7 +35,7 @@ int read_all (int fd, char *buf, int len) { size_t bytes_read = 0; - ssize_t count; + gssize count; while (bytes_read < len) { @@ -58,7 +58,7 @@ int write_all (int fd, char *buf, int len) { size_t bytes_written = 0; - ssize_t count; + gssize count; while (bytes_written < len) {