From 387c1598626b4d2a0a1c77d965d4e07398b020ec Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 27 May 2020 12:14:31 +0100 Subject: gfileutils: Tidy up types of length arguments in helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can guarantee that they’re non-negative. Signed-off-by: Philip Withnall Helps: #1302 --- glib/gfileutils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'glib/gfileutils.c') diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 94901cdc4..03b0462a9 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -1088,7 +1088,7 @@ fd_should_be_fsynced (int fd, /* closes @fd once it’s finished (on success or error) */ static gboolean write_to_file (const gchar *contents, - gssize length, + gsize length, int fd, const gchar *dest_file, gboolean do_fsync, @@ -1161,7 +1161,7 @@ steal_fd (int *fd_ptr) static gchar * write_to_temp_file (const gchar *contents, - gssize length, + gsize length, const gchar *dest_file, GError **err) { @@ -1288,11 +1288,11 @@ g_file_set_contents_full (const gchar *filename, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (contents != NULL || length == 0, FALSE); g_return_val_if_fail (length >= -1, FALSE); - - if (length == -1) + + if (length < 0) length = strlen (contents); - tmp_filename = write_to_temp_file (contents, length, filename, error); + tmp_filename = write_to_temp_file (contents, (gsize) length, filename, error); if (!tmp_filename) { -- cgit v1.2.1