Make MSVC a bit happy with sources
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@@ -34,7 +34,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _POSIX_SOURCE
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user