pidgin: 148e99c7: Make untarring work for non-ASCII destin...
datallah at pidgin.im
datallah at pidgin.im
Mon Nov 8 17:55:48 EST 2010
----------------------------------------------------------------------
Revision: 148e99c7c4a60cc18826232bd8b3270cbdddc7b5
Parent: 3f45fb467a368f69da5333f03c401698d89d14bc
Author: datallah at pidgin.im
Date: 11/04/10 15:20:38
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/148e99c7c4a60cc18826232bd8b3270cbdddc7b5
Changelog:
Make untarring work for non-ASCII destination dirs on Windows.
Changes against parent 3f45fb467a368f69da5333f03c401698d89d14bc
patched pidgin/win32/untar.c
-------------- next part --------------
============================================================
--- pidgin/win32/untar.c eada085c61b9f12463d22561dc3e7f5b4be1c6fb
+++ pidgin/win32/untar.c bca7360dd645d50dc42fef7937471cb72eefa65b
@@ -578,7 +578,8 @@ int untar(const char *filename, const ch
*/
int untar(const char *filename, const char* destdir, untar_opt options) {
int ret=1;
- char curdir[_MAX_PATH];
+ wchar_t curdir[_MAX_PATH];
+ wchar_t *w_destdir;
untarops = options;
/* open the archive */
inname = filename;
@@ -589,13 +590,15 @@ int untar(const char *filename, const ch
return 0;
}
+ w_destdir = g_utf8_to_utf16(destdir, -1, NULL, NULL, NULL);
+
/* Set current directory */
- if(!GetCurrentDirectory(_MAX_PATH, curdir)) {
+ if(!GetCurrentDirectoryW(_MAX_PATH, curdir)) {
untar_error("Could not get current directory (error %lu).\n", GetLastError());
fclose(infp);
return 0;
}
- if(!SetCurrentDirectory(destdir)) {
+ if(!SetCurrentDirectoryW(w_destdir)) {
untar_error("Could not set current directory to (error %lu): %s\n", GetLastError(), destdir);
fclose(infp);
return 0;
@@ -614,12 +617,14 @@ int untar(const char *filename, const ch
fclose(outfp);
outfp = NULL;
}
- if(!SetCurrentDirectory(curdir)) {
+ if(!SetCurrentDirectoryW(curdir)) {
untar_error("Could not set current dir back to original (error %lu).\n", GetLastError());
ret=0;
}
}
+ g_free(w_destdir);
+
/* close the archive file. */
fclose(infp);
More information about the Commits
mailing list