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 20:05:46 +0400

So I checked the Pan source, and this is what I found:

1) pan2/pan/data/article-cache.cc, line 232:

~
   fp = fopen (filename, "wb+");
~

The ~filename~ in question is in Glib's "filename encoding", which in Windows in UTF-8. Obviously fopen~ can't cope with that. Fortunately Glib includes the g_fopen() function that does exactlye the same, yet accepts the encoding that ~filename~ is in. And I would suggest switching fopen for g_fopen, if not for artifact 2:

2) pan2/pan/general/file-util.h, line 34:

~
#if GLIB_CHECK_VERSION(2,6,0)
extern "C" {
 #include <glib/gstdio.h>
}
#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
~

This apparently has the intent of replacing the C functions with Glib functions when they are available, except... it's very broken because the #define arguments are in the wrong order. So even if you use Glib functions, the preprocessor will change them to libc ones!

So, the suggestion is to fix the defines, which should fix everything. Of course, this will also *break* everything if a C header is included after file-util.h, but I suppose it is of less concern.

Roman.






reply via email to

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