pan-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-users] Re: Pan fails to deal with non-Latin usernames (Windows)


From: Роман Донченко
Subject: [Pan-users] Re: Pan fails to deal with non-Latin usernames (Windows)
Date: Sun, 7 Sep 2008 22:57:22 +0400

Oh, I see.  I guess whoever wrote the code decided the glib
wrapper functions weren't working right for MSDOS and wanted
to use fopen without the filename translation that glib does.

Well, he wasn't obligated to use the Glib functions. In fact, none of the g_ functions that are #define'd in file-util.h are used anywhere.
(Besides, I don't think Glib runs on MSDOS, not sure though. 8=])

But isn't that what you say ought to be done?

Nope. I initially suggested converting the filename in the system's "native" encoding before opening it, but now that I see that Glib has the wrapper function to do exactly that, it would be wasteful not to use it (especially since g_fopen uses the Unicode version of fopen where it's available).

 I'm confused.

You're not alone. 8=]
Now that I thought of it, my original advice to change it to be "#define fopen g_fopen" is no good. Since on Unix g_fopen is defined to fopen, that would lead to essentially "#define fopen fopen". Bad.

I suppose the correct solution will involve the following:

a) Change that bit to:

#if !GLIB_CHECK_VERSION(2,6,0) // if Glib is too old to have wrappers, fall back to libc
#define g_freopen freopen
#define g_fopen fopen
#define g_rmdir rmdir
#define g_remove remove
#define g_unlink unlink
#define g_lstat lstat
#define g_stat stat
#define g_rename rename
#define g_open open
#endif

b) Use g_fopen instead of fopen everywhere else.

Roman.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]