Fixed Fl_Preferences Cygwin wide character bug (STR #2164)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7104 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
0ec12cc9c4
commit
f59cd1f4aa
1
CHANGES
1
CHANGES
@ -1,5 +1,6 @@
|
||||
CHANGES IN FLTK 1.3.0
|
||||
|
||||
- Fixed Fl_Preferences Cygwin wide character bug (STR #2164)
|
||||
- Fixed sorting in Fl_Browser - last item would not
|
||||
be sorted (STR #2300)
|
||||
- Fixed window levels in OS X Cocoa (STR #2316)
|
||||
|
@ -67,6 +67,10 @@ typedef RPC_STATUS (WINAPI* uuid_func)(UUID __RPC_FAR *Uuid);
|
||||
# include <sys/time.h>
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
|
||||
char Fl_Preferences::nameBuffer[128];
|
||||
char Fl_Preferences::uuidBuffer[40];
|
||||
Fl_Preferences *Fl_Preferences::runtimePrefs = 0;
|
||||
@ -1121,19 +1125,23 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
||||
}
|
||||
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
if (!filename[1] && !filename[0]) {
|
||||
if (!filename[1] && !filename[0]) {
|
||||
strcpy(filename, "C:\\FLTK");
|
||||
} else {
|
||||
xchar *b = (xchar*)_wcsdup((xchar*)filename);
|
||||
// filename[fl_unicode2utf(b, wcslen((xchar*)b), filename)] = 0;
|
||||
unsigned len = fl_utf8fromwc(filename, (FL_PATH_MAX-1), b, wcslen((xchar*)b));
|
||||
filename[len] = 0;
|
||||
free(b);
|
||||
}
|
||||
} else {
|
||||
#if 0
|
||||
xchar *b = (xchar*)_wcsdup((xchar *)filename);
|
||||
#else
|
||||
if (!filename[0]) strcpy(filename, "C:\\FLTK");
|
||||
// cygwin does not come with _wcsdup. Use malloc + wcscpy.
|
||||
// For implementation of wcsdup functionality See
|
||||
// - http://linenum.info/p/glibc/2.7/wcsmbs/wcsdup.c
|
||||
xchar *b = (xchar*) malloc((wcslen((xchar *) filename) + 1) * sizeof(xchar));
|
||||
wcscpy(b, (xchar *) filename);
|
||||
#endif
|
||||
// filename[fl_unicode2utf(b, wcslen((xchar*)b), filename)] = 0;
|
||||
unsigned len = fl_utf8fromwc(filename, (FL_PATH_MAX-1), b, wcslen(b));
|
||||
filename[len] = 0;
|
||||
free(b);
|
||||
}
|
||||
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
|
||||
"/%s/%s.prefs", vendor, application);
|
||||
for (char *s = filename; *s; s++) if (*s == '\\') *s = '/';
|
||||
|
Loading…
Reference in New Issue
Block a user