Fixed locale on MSVCRT compilation, e-mail fixes.
This commit is contained in:
@@ -49,16 +49,10 @@ extern "C" {
|
||||
extern char tl[256], tu[256];
|
||||
inline int _nls_tolower(int c) { return tl[c]; }
|
||||
inline int _nls_toupper(int c) { return tu[c]; }
|
||||
#ifdef __MSVCRT__
|
||||
inline int _nls_isspace(int c) { return (iscntrl(c) or (c == ' ')); }
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#define tolower(a) _nls_tolower((unsigned char)(a))
|
||||
#define toupper(a) _nls_toupper((unsigned char)(a))
|
||||
#ifdef __MSVCRT__
|
||||
#define isspace(a) _nls_isspace((unsigned char)(a))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -26,6 +26,8 @@
|
||||
// Clipboard handling donated by Eugene Roshal
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
#include <clocale>
|
||||
#include <cstdio>
|
||||
#include <gstrall.h>
|
||||
#include <gmemdbg.h>
|
||||
#include <gutlos.h>
|
||||
@@ -133,20 +135,32 @@ int g_init_os(int flags) {
|
||||
SetFileApisToOEM();
|
||||
GetConsoleTitle(ge_win_coldtitle, sizeof(ge_win_coldtitle));
|
||||
if(WinVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
||||
#ifdef __MSVCRT__
|
||||
char locale[256] = "";
|
||||
char *lc = setlocale(LC_CTYPE, "");
|
||||
if(lc) {
|
||||
strxcpy(locale, lc, 256);
|
||||
lc = strchr(locale, '.');
|
||||
if(lc) {
|
||||
sprintf(lc+1, "%u", GetOEMCP());
|
||||
}
|
||||
}
|
||||
setlocale(LC_CTYPE, locale);
|
||||
#endif
|
||||
for(i = 0; i < 256; i++) {
|
||||
#ifndef __MSVCRT__
|
||||
tu[i] = (toupper)(i);
|
||||
tl[i] = (tolower)(i);
|
||||
#endif
|
||||
if(i >= ' ') {
|
||||
CHAR chr = (CHAR)i;
|
||||
MultiByteToWideChar(CP_OEMCP, 0, &chr, 1, oem2unicode+i, 1);
|
||||
}
|
||||
}
|
||||
#ifndef __MSVCRT__
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#ifdef __MSVCRT__
|
||||
else
|
||||
setlocale(LC_CTYPE, "C");
|
||||
#endif
|
||||
// Due to Win9x doesn't have proper locale support we should rebuild
|
||||
// tolower/toupper tables
|
||||
char src[2], dst[2];
|
||||
|
Reference in New Issue
Block a user