diff --git a/goldlib/gall/gcmpall.h b/goldlib/gall/gcmpall.h index 6cf8d84..c815adc 100644 --- a/goldlib/gall/gcmpall.h +++ b/goldlib/gall/gcmpall.h @@ -73,9 +73,11 @@ #endif #endif +#ifdef __GNUC__ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) #error You definetly need to upgrade your gcc at least up to 2.8.x #endif +#endif // ------------------------------------------------------------------ diff --git a/goldlib/gall/gfilutil.h b/goldlib/gall/gfilutil.h index 61296e2..c678c52 100644 --- a/goldlib/gall/gfilutil.h +++ b/goldlib/gall/gfilutil.h @@ -34,7 +34,11 @@ #include #include #include +#ifdef _POSIX_SOURCE #include +#else +#include +#endif #include #include #include diff --git a/goldlib/gall/gutlwin.cpp b/goldlib/gall/gutlwin.cpp index da95616..71216d6 100644 --- a/goldlib/gall/gutlwin.cpp +++ b/goldlib/gall/gutlwin.cpp @@ -162,30 +162,28 @@ int g_init_os(int flags) { #endif // Due to Win9x doesn't have proper locale support we should rebuild // tolower/toupper tables - char src[2], dst[2]; - for(i = 0; i < 128; i++) { + char src[2], dst[2], tst[2]; + for(i = 0; i < 32; i++) { tu[i] = (toupper)(i); tl[i] = (tolower)(i); } - for(i = 128; i < 256; i++) { + for(i = 32; i < 256; i++) { + tu[i] = tl[i] = i; *dst = i; dst[1] = 0; OemToChar(dst, src); - LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_UPPERCASE, src, 1, dst, 2); - CharToOem(dst, src); - tu[i] = (*src & 0xff); + CharToOem(src, tst); + if(*dst != *tst) + continue; + if(LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_UPPERCASE, src, 1, dst, 2)) { + CharToOem(dst, src); + tu[i] = *src; + } *dst = i; dst[1] = 0; OemToChar(dst, src); - LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_LOWERCASE, src, 1, dst, 2); - CharToOem(dst, src); - tl[i] = (*src & 0xff); - } - for(i = 128; i < 256; i++) { - if((tu[tl[i]] != i) && (tl[tu[i]] != i)) - tu[i] = tl[i] = i; - if(tu[tl[i]] != tu[i]) - tu[i] = i; - if(tl[tu[i]] != tl[i]) - tl[i] = i; + if(LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_LOWERCASE, src, 1, dst, 2)) { + CharToOem(dst, src); + tl[i] = *src; + } } return 0; } diff --git a/goldlib/glibc/config.h b/goldlib/glibc/config.h index c4e123d..aea3d2c 100644 --- a/goldlib/glibc/config.h +++ b/goldlib/glibc/config.h @@ -6,7 +6,9 @@ #define HAVE_DIRENT_H 1 #define STDC_HEADERS 1 +#ifdef _POSIX_SOURCE #define HAVE_UNISTD_H 1 +#endif #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRCOLL 1 diff --git a/goldlib/uulib/config.h b/goldlib/uulib/config.h index 39192a3..508dd9d 100644 --- a/goldlib/uulib/config.h +++ b/goldlib/uulib/config.h @@ -55,7 +55,9 @@ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ -#undef HAVE_IO_H +#ifndef _POSIX_SOURCE +#define HAVE_IO_H +#endif /* Define if you have the header file. */ #undef HAVE_MALLOC_H @@ -70,7 +72,9 @@ #define HAVE_SYS_TIME_H 1 /* Define if you have the header file. */ +#ifdef _POSIX_SOURCE #define HAVE_UNISTD_H 1 +#endif /* Define if you have the header file. */ /* #undef HAVE_VARARGS_H */ diff --git a/goldlib/uulib/uuencode.c b/goldlib/uulib/uuencode.c index 3b46ec4..93581ff 100644 --- a/goldlib/uulib/uuencode.c +++ b/goldlib/uulib/uuencode.c @@ -38,6 +38,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_ERRNO_H #include #endif diff --git a/goldlib/uulib/uunconc.c b/goldlib/uulib/uunconc.c index a9ec2ea..95f6353 100644 --- a/goldlib/uulib/uunconc.c +++ b/goldlib/uulib/uunconc.c @@ -45,6 +45,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_ERRNO_H #include #endif diff --git a/goldlib/uulib/uuutil.c b/goldlib/uulib/uuutil.c index f1779b2..20f2b52 100644 --- a/goldlib/uulib/uuutil.c +++ b/goldlib/uulib/uuutil.c @@ -42,6 +42,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_MEMORY_H #include #endif