wcecompat
wcecompat copied to clipboard
fix for Windows CE 6.0 compatibility
Windows CE 6 implements _isctype and _strdup in corelibc, so those functions should be #ifdef'd out.
++ b/src/wce211_string.c
@@ -64,6 +64,8 @@ _CRTIMP char* __cdecl strrchr(const char* s, int c)
return NULL;
}
// corelibc implements this function in Win CE 6.0 and later
#if (_WIN32_WCE < 600)
_CRTIMP char* __cdecl _strdup(const char* s)
{
char* new_s = (char*)malloc(strlen(s)+1);
@@ -72,3 +74,4 @@ _CRTIMP char* __cdecl _strdup(const char* s)
strcpy(new_s, s);
return new_s;
}
#endif
++ b/src/wce211_ctype.c
@@ -88,11 +88,13 @@ _CRTIMP const unsigned short _ctype[] =
_CRTIMP const unsigned short *_pctype = &_ctype[1];
_CRTIMP const wctype_t *_pwctype = &_ctype[1];
// corelibc implements this function in Win CE 6.0 and later
#if (_WIN32_WCE < 600)
_CRTIMP int __cdecl _isctype(int c, int mask)
{
return (int)(_pctype[c] & mask);
}
#endif
#ifdef _WIN32_WCE_EMULATION
_CRTIMP int __cdecl iswctype(wint_t c, wctype_t mask)