*/
#define MAX_ELEM_LEN 64 /* Max length of country/language/CP string */
-unsigned char MSVCRT_mbctype[257] = { 0 };
-static int g_mbcp_is_multibyte = 0;
+unsigned char _mbctype[257] = { 0 };
+int g_mbcp_is_multibyte = 0;
/* It seems that the data about valid trail bytes is not available from kernel32
* so we have to store is here. The format is the same as for lead bytes in CPINFO */
{936, {0x40, 0xfe, 0, 0}},
{949, {0x41, 0xfe, 0, 0}},
{950, {0x40, 0x7e, 0xa1, 0xfe, 0, 0}},
+ {1361, {0x31, 0x7e, 0x81, 0xfe, 0, 0}},
{20932, {1, 255, 0, 0}}, /* seems to give different results on different systems */
{0, {1, 255, 0, 0}} /* match all with FIXME */
};
size_t i;
for (i = 0; i < sizeof(_country_synonyms)/sizeof(char*); i += 2 )
{
- if (!strcasecmp(_country_synonyms[i],name))
+ if (!_stricmp(_country_synonyms[i],name))
{
TRACE(":Mapping synonym %s to %s\n",name,_country_synonyms[i+1]);
name[0] = _country_synonyms[i+1][0];
if (!buff[0] || !cmp[0])
return 0;
/* Partial matches are allowed, e.g. "Germ" matches "Germany" */
- return !strncasecmp(cmp, buff, strlen(cmp));
+ return !_strnicmp(cmp, buff, strlen(cmp));
}
res->match_flags = flags;
res->found_lang_id = LangID;
}
- if (flags & (FOUND_LANGUAGE & FOUND_COUNTRY & FOUND_CODEPAGE))
+ if ((flags & (FOUND_LANGUAGE | FOUND_COUNTRY | FOUND_CODEPAGE)) ==
+ (FOUND_LANGUAGE | FOUND_COUNTRY | FOUND_CODEPAGE))
{
TRACE(":found exact locale match\n");
return STOP_LOOKING;
else
{
/* Special codepage values: OEM & ANSI */
- if (strcasecmp(locale->search_codepage,"OCP"))
+ if (_stricmp(locale->search_codepage,"OCP"))
{
GetLocaleInfoA(lcid, LOCALE_IDEFAULTCODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
}
- if (strcasecmp(locale->search_codepage,"ACP"))
+ if (_stricmp(locale->search_codepage,"ACP"))
{
GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
{
int i;
char str[3];
- unsigned char *traverse = (unsigned char *)cp.LeadByte;
+ unsigned char *traverse = cp.LeadByte;
memset(MSVCRT_current_ctype, 0, sizeof(MSVCRT__ctype));
MSVCRT___lc_codepage = codepage;
{
MSVCRT_current_lc_all[0] = 'C';
MSVCRT_current_lc_all[1] = '\0';
- MSVCRT___lc_codepage = 1252;
- MSVCRT___lc_collate_cp = 1252;
+ MSVCRT___lc_codepage = GetACP();
+ MSVCRT___lc_collate_cp = GetACP();
switch (category) {
case MSVCRT_LC_ALL:
}
/* setup the _mbctype */
- memset(MSVCRT_mbctype, 0, sizeof(MSVCRT_mbctype));
+ memset(_mbctype, 0, sizeof(_mbctype));
bytes = cpi.LeadByte;
while (bytes[0] || bytes[1])
{
for (i = bytes[0]; i <= bytes[1]; i++)
- MSVCRT_mbctype[i + 1] |= _M1;
+ _mbctype[i + 1] |= _M1;
bytes += 2;
}
while (bytes[0] || bytes[1])
{
for (i = bytes[0]; i <= bytes[1]; i++)
- MSVCRT_mbctype[i + 1] |= _M2;
+ _mbctype[i + 1] |= _M2;
bytes += 2;
}
break;
*/
charcount = 0;
for (i = 0; i < 256; i++)
- if (!(MSVCRT_mbctype[i + 1] & _M1))
+ if (!(_mbctype[i + 1] & _M1))
bufA[charcount++] = i;
ret = MultiByteToWideChar(newcp, 0, bufA, charcount, bufW, charcount);
curr_type = chartypes;
for (i = 0; i < 256; i++)
- if (!(MSVCRT_mbctype[i + 1] & _M1))
+ if (!(_mbctype[i + 1] & _M1))
{
if ((*curr_type) & C1_UPPER)
- MSVCRT_mbctype[i + 1] |= _SBUP;
+ _mbctype[i + 1] |= _SBUP;
if ((*curr_type) & C1_LOWER)
- MSVCRT_mbctype[i + 1] |= _SBLOW;
+ _mbctype[i + 1] |= _SBLOW;
curr_type++;
}
* also faster execution.
*/
for (i = 161; i <= 165; i++)
- MSVCRT_mbctype[i + 1] |= _MP;
+ _mbctype[i + 1] |= _MP;
for (i = 166; i <= 223; i++)
- MSVCRT_mbctype[i + 1] |= _MS;
+ _mbctype[i + 1] |= _MS;
}
MSVCRT___lc_collate_cp = MSVCRT___lc_codepage = newcp;
{
return __setlc_active;
}
+
+/*********************************************************************
+ * __crtGetStringTypeW(MSVCRT.@)
+ *
+ * This function was accepting different number of arguments in older
+ * versions of msvcrt.
+ */
+BOOL CDECL __crtGetStringTypeW(DWORD unk, DWORD type,
+ wchar_t *buffer, int len, WORD *out)
+{
+ FIXME("(unk %x, type %x, wstr %p(%d), %p) partial stub\n",
+ unk, type, buffer, len, out);
+
+ return GetStringTypeW(type, buffer, len, out);
+}