Mercurial > pidgin
diff libpurple/util.c @ 21121:35b4f1dc4c8d
replace most calls to strerror with calls to g_strerror. strerror will return
a locale-specific string in the locale-specific encoding, which isn't
guaranteed to be UTF-8. g_strerror will always return a UTF-8 string.
I left gg and zephyr untouched, since gg doesn't include glib headers yet,
and zephyr does something weird with a #define for strerror. Someone more
familliar with those should take a look.
And the win32 guys should check and see if I screwed something up, since
they had strerror #defined to something else.
This should fix #2247 (and maybe some mystery crashes)
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 03 Nov 2007 17:52:28 +0000 |
parents | e4cf0506be74 |
children | 33da7f2a30e4 |
line wrap: on
line diff
--- a/libpurple/util.c Sat Nov 03 17:04:25 2007 +0000 +++ b/libpurple/util.c Sat Nov 03 17:52:28 2007 +0000 @@ -2505,7 +2505,7 @@ } if (g_mkdir(dir, mode) < 0) { - purple_debug_warning("build_dir", "mkdir: %s\n", strerror(errno)); + purple_debug_warning("build_dir", "mkdir: %s\n", g_strerror(errno)); g_strfreev(components); g_free(dir); return -1; @@ -2541,7 +2541,7 @@ if (g_mkdir(user_dir, S_IRUSR | S_IWUSR | S_IXUSR) == -1) { purple_debug_error("util", "Error creating directory %s: %s\n", - user_dir, strerror(errno)); + user_dir, g_strerror(errno)); return FALSE; } } @@ -2576,7 +2576,7 @@ { purple_debug_error("util", "Error removing old file " "%s: %s\n", - filename_temp, strerror(errno)); + filename_temp, g_strerror(errno)); } } @@ -2586,7 +2586,7 @@ { purple_debug_error("util", "Error opening file %s for " "writing: %s\n", - filename_temp, strerror(errno)); + filename_temp, g_strerror(errno)); g_free(filename_temp); return FALSE; } @@ -2599,7 +2599,7 @@ if (fclose(file) != 0) { purple_debug_error("util", "Error closing file %s: %s\n", - filename_temp, strerror(errno)); + filename_temp, g_strerror(errno)); g_free(filename_temp); return FALSE; } @@ -2631,7 +2631,7 @@ if (chmod(filename_temp, S_IRUSR | S_IWUSR) == -1) { purple_debug_error("util", "Error setting permissions of file %s: %s\n", - filename_temp, strerror(errno)); + filename_temp, g_strerror(errno)); } #endif @@ -2640,7 +2640,7 @@ { purple_debug_error("util", "Error renaming %s to %s: %s\n", filename_temp, filename_full, - strerror(errno)); + g_strerror(errno)); } g_free(filename_temp); @@ -3688,7 +3688,7 @@ if(new_data == NULL) { purple_debug_error("util", "Failed to allocate %u bytes: %s\n", - content_len, strerror(errno)); + content_len, g_strerror(errno)); purple_util_fetch_url_error(gfud, _("Unable to allocate enough memory to hold " "the contents from %s. The web server may " @@ -3726,7 +3726,7 @@ return; } else { purple_util_fetch_url_error(gfud, _("Error reading from %s: %s"), - gfud->website.address, strerror(errno)); + gfud->website.address, g_strerror(errno)); return; } } @@ -3757,7 +3757,7 @@ return; else if (len < 0) { purple_util_fetch_url_error(gfud, _("Error writing to %s: %s"), - gfud->website.address, strerror(errno)); + gfud->website.address, g_strerror(errno)); return; } gfud->request_written += len;