Mercurial > pidgin.yaz
changeset 20917:aa420b502a6b
nosnilmot points out that this is a better way to ensure the size is valid.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sat, 13 Oct 2007 17:23:40 +0000 |
parents | e1f1f3c1c19c |
children | 8fa6ff212db7 |
files | libpurple/util.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/util.c Sat Oct 13 17:20:19 2007 +0000 +++ b/libpurple/util.c Sat Oct 13 17:23:40 2007 +0000 @@ -2565,6 +2565,8 @@ purple_debug_info("util", "Writing file %s\n", filename_full); + g_return_val_if_fail((size >= -1), FALSE); + filename_temp = g_strdup_printf("%s.save", filename_full); /* Remove an old temporary file, if one exists */ @@ -2590,7 +2592,7 @@ } /* Write to file */ - real_size = (size == -1) ? strlen(data) : size; + real_size = (size == -1) ? strlen(data) : (size_t) size; byteswritten = fwrite(data, 1, real_size, file); /* Close file */