STR#2056 Fixed all compilation problems and tested that fluid, utf8 demo works the utf8 code is harmonized with the unix impl. instead of the win32 impl in case Cygwin lib is used.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6376 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
fdeb60898e
commit
355223b558
@ -666,7 +666,6 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
||||
free(b);
|
||||
}
|
||||
#else
|
||||
#warning CHECKME (Cygwin) this should probably be UTF8 aware as well
|
||||
if (!filename[0]) strcpy(filename, "C:\\FLTK");
|
||||
#endif
|
||||
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
|
||||
|
@ -29,7 +29,10 @@
|
||||
// are found on the X server. It tries to place the fonts into families
|
||||
// and to sort them so the first 4 in a family are normal, bold, italic,
|
||||
// and bold italic.
|
||||
#include <Fl/fl_utf8.h>
|
||||
#include <FL/fl_utf8.h>
|
||||
#ifdef __CYGWIN__
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
|
||||
// Bug: older versions calculated the value for *ap as a side effect of
|
||||
// making the name, and then forgot about it. To avoid having to change
|
||||
|
@ -41,14 +41,17 @@
|
||||
#include <FL/filename.H>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# include <ctype.h>
|
||||
# include <io.h>
|
||||
# include <direct.h>
|
||||
# include <windows.h>
|
||||
# include <winbase.h>
|
||||
# include <process.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <wchar.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
extern "C" {
|
||||
int XUtf8Tolower(int ucs);
|
||||
unsigned short XUtf8IsNonSpacing(unsigned int ucs);
|
||||
@ -370,13 +373,16 @@ unsigned int fl_nonspacing(unsigned int ucs)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
static xchar *mbwbuf = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
unsigned int fl_codepage = 0;
|
||||
#endif
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
|
||||
static char *buf = NULL;
|
||||
static int buf_len = 0;
|
||||
static unsigned short *wbufa = NULL;
|
||||
@ -433,7 +439,7 @@ char *fl_locale_to_utf8(const char *s, int len, UINT codepage)
|
||||
char * fl_utf2mbcs(const char *s)
|
||||
{
|
||||
if (!s) return NULL;
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(s);
|
||||
static char *buf = NULL;
|
||||
|
||||
@ -478,7 +484,7 @@ char * fl_mbcs2utf(const char *s)
|
||||
} // fl_mbcs2utf
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
static xchar *wbuf = NULL;
|
||||
static xchar *wbuf1 = NULL;
|
||||
#endif
|
||||
@ -486,7 +492,7 @@ static xchar *wbuf1 = NULL;
|
||||
|
||||
char *fl_getenv(const char* v)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(v);
|
||||
// static xchar* wbuf = NULL;
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
@ -520,7 +526,7 @@ int fl_open(const char* f, int oflags, ...)
|
||||
va_start(ap, oflags);
|
||||
pmode = va_arg (ap, int);
|
||||
va_end(ap);
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -538,7 +544,7 @@ int fl_open(const char* f, int oflags, ...)
|
||||
|
||||
FILE *fl_fopen(const char* f, const char *mode)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -561,7 +567,7 @@ FILE *fl_fopen(const char* f, const char *mode)
|
||||
|
||||
int fl_system(const char* f)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
# ifdef __MINGW32__
|
||||
return system(fl_utf2mbcs(f));
|
||||
# else
|
||||
@ -581,7 +587,7 @@ int fl_system(const char* f)
|
||||
|
||||
int fl_execvp(const char *file, char *const *argv)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#ifdef __MINGW32__
|
||||
return _execvp(fl_utf2mbcs(file), argv);
|
||||
#else
|
||||
@ -629,7 +635,7 @@ int fl_execvp(const char *file, char *const *argv)
|
||||
|
||||
int fl_chmod(const char* f, int mode)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -645,7 +651,7 @@ int fl_chmod(const char* f, int mode)
|
||||
|
||||
int fl_access(const char* f, int mode)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -662,7 +668,7 @@ int fl_access(const char* f, int mode)
|
||||
|
||||
int fl_stat(const char* f, struct stat *b)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -681,7 +687,7 @@ char *fl_getcwd(char* b, int l)
|
||||
if (b == NULL) {
|
||||
b = (char*) malloc(l+1);
|
||||
}
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
static xchar *wbuf = NULL;
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// xchar *ret = _wgetcwd(wbuf, l / 5);
|
||||
@ -704,7 +710,7 @@ char *fl_getcwd(char* b, int l)
|
||||
|
||||
int fl_unlink(const char* f)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -737,7 +743,7 @@ int fl_mkdir(const char* f, int mode)
|
||||
|
||||
int fl_rmdir(const char* f)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
// wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
|
||||
// wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
|
||||
@ -753,7 +759,7 @@ int fl_rmdir(const char* f)
|
||||
|
||||
int fl_rename(const char* f, const char *n)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
int l = strlen(f);
|
||||
unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length
|
||||
wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
|
||||
|
Loading…
Reference in New Issue
Block a user