diff options
author | Philip Withnall <withnall@endlessm.com> | 2020-05-27 12:14:31 +0100 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2020-07-26 21:37:46 +0100 |
commit | 387c1598626b4d2a0a1c77d965d4e07398b020ec (patch) | |
tree | a71a8fb0234a120718fe2cb21a9689f34a59e1bb /glib/gfileutils.c | |
parent | e4e618c604645d0331d3b86557f7bc561c2f37c6 (diff) | |
download | glib-387c1598626b4d2a0a1c77d965d4e07398b020ec.tar.gz |
gfileutils: Tidy up types of length arguments in helper functions
We can guarantee that they’re non-negative.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #1302
Diffstat (limited to 'glib/gfileutils.c')
-rw-r--r-- | glib/gfileutils.c | 10 |
1 files changed, 5 insertions, 5 deletions
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) { |