Make MSVC a bit happy with sources
This commit is contained in:
parent
9d4ae516d5
commit
c283d9e260
@ -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++) {
|
||||
*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);
|
||||
*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))
|
||||
for(i = 32; i < 256; i++) {
|
||||
tu[i] = tl[i] = i;
|
||||
if(tu[tl[i]] != tu[i])
|
||||
tu[i] = i;
|
||||
if(tl[tu[i]] != tl[i])
|
||||
tl[i] = i;
|
||||
*dst = i; dst[1] = 0;
|
||||
OemToChar(dst, src);
|
||||
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);
|
||||
if(LCMapString(LOCALE_SYSTEM_DEFAULT, LCMAP_LOWERCASE, src, 1, dst, 2)) {
|
||||
CharToOem(dst, src);
|
||||
tl[i] = *src;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -55,7 +55,9 @@
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <io.h> header file. */
|
||||
#undef HAVE_IO_H
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define HAVE_IO_H
|
||||
#endif
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
@ -70,7 +72,9 @@
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#ifdef _POSIX_SOURCE
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the <varargs.h> header file. */
|
||||
/* #undef HAVE_VARARGS_H */
|
||||
|
@ -38,6 +38,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
@ -45,6 +45,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
@ -42,6 +42,9 @@
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user