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
This commit is contained in:
Philip Withnall 2020-05-27 12:14:31 +01:00
parent e4e618c604
commit 387c159862

View File

@ -1088,7 +1088,7 @@ fd_should_be_fsynced (int fd,
/* closes @fd once its 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)
{