From 01b7f1c07c83f893832eafde1e04335ce5e3741d Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Fri, 12 Dec 2008 10:38:32 +0000 Subject: [PATCH] 2008-12-12 [paul] 3.6.1cvs71 * src/imap.c * src/mh.c * src/partial_download.c * src/textview.c * src/common/claws.c * src/common/prefs.c * src/common/utils.c win32: fix unlinking, renaming and bug with non-ascii username --- ChangeLog | 12 ++++++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/common/claws.c | 2 +- src/common/prefs.c | 4 ++-- src/common/utils.c | 15 ++++++++------- src/imap.c | 2 +- src/mh.c | 2 +- src/partial_download.c | 2 +- src/textview.c | 4 ++-- 10 files changed, 30 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8cedc76f..726b6de6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-12-12 [paul] 3.6.1cvs71 + + * src/imap.c + * src/mh.c + * src/partial_download.c + * src/textview.c + * src/common/claws.c + * src/common/prefs.c + * src/common/utils.c + win32: fix unlinking, renaming and bug with + non-ascii username + 2008-12-11 [colin] 3.6.1cvs70 * po/fr.po diff --git a/PATCHSETS b/PATCHSETS index 1037ac2ba..4c724a9de 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -3652,3 +3652,4 @@ ( cvs diff -u -r 1.1.2.15 -r 1.1.2.16 src/plugins/pgpcore/pgp_viewer.c; ) > 3.6.1cvs68.patchset ( cvs diff -u -r 1.1.2.17 -r 1.1.2.18 manual/faq.xml; ) > 3.6.1cvs69.patchset ( cvs diff -u -r 1.42.2.44 -r 1.42.2.45 po/fr.po; cvs diff -u -r 1.1.2.18 -r 1.1.2.19 manual/fr/advanced.xml; ) > 3.6.1cvs70.patchset +( cvs diff -u -r 1.179.2.237 -r 1.179.2.238 src/imap.c; cvs diff -u -r 1.79.2.66 -r 1.79.2.67 src/mh.c; cvs diff -u -r 1.1.2.22 -r 1.1.2.23 src/partial_download.c; cvs diff -u -r 1.96.2.211 -r 1.96.2.212 src/textview.c; cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/common/claws.c; cvs diff -u -r 1.5.2.12 -r 1.5.2.13 src/common/prefs.c; cvs diff -u -r 1.36.2.155 -r 1.36.2.156 src/common/utils.c; ) > 3.6.1cvs71.patchset diff --git a/configure.ac b/configure.ac index 906c90723..6e7e243de 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=6 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=70 +EXTRA_VERSION=71 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/common/claws.c b/src/common/claws.c index 53037af0a..366fb2668 100644 --- a/src/common/claws.c +++ b/src/common/claws.c @@ -110,7 +110,7 @@ gboolean claws_init(int *argc, char ***argv) /* backup if old rc file exists */ if (is_file_exist(RC_DIR)) { - if (rename(RC_DIR, RC_DIR ".bak") < 0) { + if (g_rename(RC_DIR, RC_DIR ".bak") < 0) { FILE_OP_ERROR(RC_DIR, "rename"); return FALSE; } diff --git a/src/common/prefs.c b/src/common/prefs.c index 6aa24c855..7644b72eb 100644 --- a/src/common/prefs.c +++ b/src/common/prefs.c @@ -175,7 +175,7 @@ gint prefs_file_close(PrefFile *pfile) #ifdef G_OS_WIN32 claws_unlink(bakpath); #endif - if (rename(path, bakpath) < 0) { + if (g_rename(path, bakpath) < 0) { FILE_OP_ERROR(path, "rename"); claws_unlink(tmppath); g_free(path); @@ -188,7 +188,7 @@ gint prefs_file_close(PrefFile *pfile) #ifdef G_OS_WIN32 claws_unlink(path); #endif - if (rename(tmppath, path) < 0) { + if (g_rename(tmppath, path) < 0) { FILE_OP_ERROR(tmppath, "rename"); claws_unlink(tmppath); g_free(path); diff --git a/src/common/utils.c b/src/common/utils.c index 0b187ce6b..2d97ab6b4 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -1732,7 +1732,7 @@ w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e) handle = dlopen (dllnames[i], RTLD_LAZY); if (handle) { - func = dlsym (handle, "SHGetFolderPathA"); + func = dlsym (handle, "SHGetFolderPathW"); if (!func) { dlclose (handle); @@ -1793,15 +1793,16 @@ const gchar *get_locale_dir(void) const gchar *get_home_dir(void) { #ifdef G_OS_WIN32 - static char home_dir[MAX_PATH] = ""; - - if (home_dir[0] == '\0') { + static char home_dir_utf16[MAX_PATH] = ""; + static gchar *home_dir_utf8 = NULL; + if (home_dir_utf16[0] == '\0') { if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, - NULL, 0, home_dir) < 0) - strcpy (home_dir, "C:\\Sylpheed"); + NULL, 0, home_dir_utf16) < 0) + strcpy (home_dir_utf16, "C:\\Sylpheed"); + home_dir_utf8 = g_utf16_to_utf8 ((const gunichar *)home_dir_utf16, -1, NULL, NULL, NULL); } - return home_dir; + return home_dir_utf8; #else static const gchar *homeenv = NULL; diff --git a/src/imap.c b/src/imap.c index c98c5e76d..9f6901e91 100644 --- a/src/imap.c +++ b/src/imap.c @@ -2790,7 +2790,7 @@ static gint imap_rename_folder(Folder *folder, FolderItem *item, if (is_dir_exist(old_cache_dir)) { new_cache_dir = folder_item_get_path(item); - if (rename(old_cache_dir, new_cache_dir) < 0) { + if (g_rename(old_cache_dir, new_cache_dir) < 0) { FILE_OP_ERROR(old_cache_dir, "rename"); } g_free(new_cache_dir); diff --git a/src/mh.c b/src/mh.c index 672cb3497..620e70a55 100644 --- a/src/mh.c +++ b/src/mh.c @@ -826,7 +826,7 @@ static gchar *mh_item_get_path(Folder *folder, FolderItem *item) if (!is_dir_exist(real_path) && is_dir_exist(path)) { /* mmh, older version did put utf8 filenames instead of * the correct encoding */ - rename(path, real_path); + g_rename(path, real_path); folder_item_scan(item); } diff --git a/src/partial_download.c b/src/partial_download.c index b31dce542..4b11c80e9 100644 --- a/src/partial_download.c +++ b/src/partial_download.c @@ -318,7 +318,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download) fclose(fp); claws_unlink(filename); - rename(pathnew, filename); + g_rename(pathnew, filename); g_free(pathnew); msginfo->planned_download = download; msgcache_update_msg(msginfo->folder->cache, msginfo); diff --git a/src/textview.c b/src/textview.c index 645a30898..d367e4b52 100644 --- a/src/textview.c +++ b/src/textview.c @@ -1038,14 +1038,14 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo) if (textview->stop_loading) { fclose(tmpfp); waitpid(pid, pfd, 0); - unlink(fname); + g_unlink(fname); return; } } fclose(tmpfp); waitpid(pid, pfd, 0); - unlink(fname); + g_unlink(fname); #endif } else { textview_default: -- 2.25.1