Mercurial > pidgin.yaz
diff src/win32/untar.c @ 10589:0f7452b1f777
[gaim-migrate @ 11994]
Use GLib 2.6's gstdio functions. This should fix gaim not liking non-ascii filenames in win32.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 11 Feb 2005 05:10:40 +0000 |
parents | 59ffe137176d |
children |
line wrap: on
line diff
--- a/src/win32/untar.c Fri Feb 11 03:51:26 2005 +0000 +++ b/src/win32/untar.c Fri Feb 11 05:10:40 2005 +0000 @@ -78,8 +78,17 @@ #endif #include "debug.h" #include "untar.h" +#include <glib.h> +#if GLIB_CHECK_VERSION(2,6,0) +# include <glib/gstdio.h> +#else #define mkdir(a,b) _mkdir((a)) +#define g_mkdir mkdir +#define g_fopen fopen +#define g_unlink unlink +#endif + #define untar_error( error, args... ) gaim_debug(GAIM_DEBUG_ERROR, "untar", error, ## args ) #define untar_warning( warning, args... ) gaim_debug(GAIM_DEBUG_WARNING, "untar", warning, ## args ) #define untar_verbose( args... ) gaim_debug(GAIM_DEBUG_INFO, "untar", ## args ) @@ -153,7 +162,7 @@ } /* first try creating it the easy way */ - fp = fopen(name, CONVERT ? "w" : "wb"); + fp = g_fopen(name, CONVERT ? "w" : "wb"); if (fp) return fp; @@ -169,11 +178,11 @@ if (name[i] == '/') { name[i] = '\0'; - (void)mkdir(name, 0777); + (void)g_mkdir(name, 0777); name[i] = '/'; } } - fp = fopen(name, CONVERT ? "w" : "wb"); + fp = g_fopen(name, CONVERT ? "w" : "wb"); if (!fp) untar_error("Error opening: %s\n", name); return fp; @@ -192,7 +201,7 @@ int c; /* Open the source file. We do this first to make sure it exists */ - fpsrc = fopen(src, "rb"); + fpsrc = g_fopen(src, "rb"); if (!fpsrc) { untar_error("Error opening: %s\n", src); @@ -211,7 +220,7 @@ # ifndef _WEAK_POSIX /* first try to link it over, instead of copying */ fclose(fpdst); - unlink(dst); + g_unlink(dst); if (sym) { if (symlink(src, dst)) @@ -229,7 +238,7 @@ } /* Dang. Reopen the destination again */ - fpdst = fopen(dst, "wb"); + fpdst = g_fopen(dst, "wb"); /* This *can't* fail */ # endif /* _WEAK_POSIX */ @@ -521,7 +530,7 @@ #ifdef _POSIX_SOURCE else if (mkdir(nbuf, mode) == 0) #else - else if (mkdir(nbuf, 0755) == 0) + else if (g_mkdir(nbuf, 0755) == 0) #endif n2 = " created"; else @@ -578,7 +587,7 @@ untarops = options; /* open the archive */ inname = filename; - infp = fopen(filename, "rb"); + infp = g_fopen(filename, "rb"); if (!infp) { untar_error("Error opening: %s\n", filename);