Commit e9a1ff11 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Use locale category definiotion from public header.

parent 595ee43c
......@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <locale.h>
#include "msvcrt.h"
#include "winnls.h"
......@@ -168,7 +169,7 @@ int CDECL MSVCRT__isctype_l(int c, int type, _locale_t locale)
*pconv++ = c & 0xff;
*pconv = 0;
if (GetStringTypeExA(locinfo->lc_handle[MSVCRT_LC_CTYPE],
if (GetStringTypeExA(locinfo->lc_handle[LC_CTYPE],
CT_CTYPE1, convert, convert[1] ? 2 : 1, &typeInfo))
return typeInfo & type;
}
......@@ -456,7 +457,7 @@ int CDECL MSVCRT__toupper_l(int c, _locale_t locale)
}
*p++ = c & 255;
switch(__crtLCMapStringA(locinfo->lc_handle[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE,
switch(__crtLCMapStringA(locinfo->lc_handle[LC_CTYPE], LCMAP_UPPERCASE,
(char*)str, p-str, (char*)ret, 2, locinfo->lc_codepage, 0))
{
case 0:
......@@ -510,7 +511,7 @@ int CDECL MSVCRT__tolower_l(int c, _locale_t locale)
}
*p++ = c & 255;
switch(__crtLCMapStringA(locinfo->lc_handle[MSVCRT_LC_CTYPE], LCMAP_LOWERCASE,
switch(__crtLCMapStringA(locinfo->lc_handle[LC_CTYPE], LCMAP_LOWERCASE,
(char*)str, p-str, (char*)ret, 2, locinfo->lc_codepage, 0))
{
case 0:
......
......@@ -574,15 +574,6 @@ struct MSVCRT__stat64 {
#define MSVCRT__P_NOWAITO 3
#define MSVCRT__P_DETACH 4
#define MSVCRT_LC_ALL 0
#define MSVCRT_LC_COLLATE 1
#define MSVCRT_LC_CTYPE 2
#define MSVCRT_LC_MONETARY 3
#define MSVCRT_LC_NUMERIC 4
#define MSVCRT_LC_TIME 5
#define MSVCRT_LC_MIN MSVCRT_LC_ALL
#define MSVCRT_LC_MAX MSVCRT_LC_TIME
#define MSVCRT__HEAPEMPTY -1
#define MSVCRT__HEAPOK -2
#define MSVCRT__HEAPBADBEGIN -3
......
......@@ -82,7 +82,7 @@ int CDECL MSVCRT__strlwr_s_l(char *str, size_t len, _locale_t locale)
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE])
if(!locinfo->lc_handle[LC_CTYPE])
{
while (*str)
{
......@@ -161,7 +161,7 @@ int CDECL MSVCRT__strupr_s_l(char *str, size_t len, _locale_t locale)
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE])
if(!locinfo->lc_handle[LC_CTYPE])
{
while (*str)
{
......@@ -1149,9 +1149,9 @@ int CDECL MSVCRT_strcoll_l( const char* str1, const char* str2, _locale_t locale
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
return strcmp(str1, str2);
return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL;
return CompareStringA(locinfo->lc_handle[LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL;
}
/*********************************************************************
......@@ -1174,9 +1174,9 @@ int CDECL MSVCRT__stricoll_l( const char* str1, const char* str2, _locale_t loca
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
return MSVCRT__stricmp(str1, str2);
return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
return CompareStringA(locinfo->lc_handle[LC_COLLATE], NORM_IGNORECASE,
str1, -1, str2, -1)-CSTR_EQUAL;
}
......@@ -1200,9 +1200,9 @@ int CDECL MSVCRT__strncoll_l( const char* str1, const char* str2, size_t count,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
return MSVCRT_strncmp(str1, str2, count);
return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0,
return CompareStringA(locinfo->lc_handle[LC_COLLATE], 0,
str1, MSVCRT_strnlen(str1, count),
str2, MSVCRT_strnlen(str2, count))-CSTR_EQUAL;
}
......@@ -1227,9 +1227,9 @@ int CDECL MSVCRT__strnicoll_l( const char* str1, const char* str2, size_t count,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
return MSVCRT__strnicmp(str1, str2, count);
return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
return CompareStringA(locinfo->lc_handle[LC_COLLATE], NORM_IGNORECASE,
str1, MSVCRT_strnlen(str1, count),
str2, MSVCRT_strnlen(str2, count))-CSTR_EQUAL;
}
......@@ -1402,12 +1402,12 @@ size_t CDECL MSVCRT__strxfrm_l( char *dest, const char *src,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) {
if(!locinfo->lc_handle[LC_COLLATE]) {
MSVCRT_strncpy(dest, src, len);
return strlen(src);
}
ret = LCMapStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE],
ret = LCMapStringA(locinfo->lc_handle[LC_COLLATE],
LCMAP_SORTKEY, src, -1, NULL, 0);
if(!ret) {
if(len) dest[0] = 0;
......@@ -1422,7 +1422,7 @@ size_t CDECL MSVCRT__strxfrm_l( char *dest, const char *src,
return ret-1;
}
return LCMapStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE],
return LCMapStringA(locinfo->lc_handle[LC_COLLATE],
LCMAP_SORTKEY, src, -1, dest, len) - 1;
}
......@@ -2666,7 +2666,7 @@ int __cdecl MSVCRT__strnicmp_l(const char *s1, const char *s2,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE])
if(!locinfo->lc_handle[LC_CTYPE])
{
do {
if ((c1 = *s1++) >= 'A' && c1 <= 'Z')
......
......@@ -98,13 +98,13 @@ int CDECL MSVCRT__towlower_l(wint_t c, _locale_t locale)
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE]) {
if(!locinfo->lc_handle[LC_CTYPE]) {
if(c >= 'A' && c <= 'Z')
return c + 'a' - 'A';
return c;
}
if(!LCMapStringW(locinfo->lc_handle[MSVCRT_LC_CTYPE], LCMAP_LOWERCASE, &c, 1, &ret, 1))
if(!LCMapStringW(locinfo->lc_handle[LC_CTYPE], LCMAP_LOWERCASE, &c, 1, &ret, 1))
return c;
return ret;
}
......@@ -204,7 +204,7 @@ int CDECL MSVCRT__wcsicoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
{
wchar_t c1, c2;
......@@ -221,7 +221,7 @@ int CDECL MSVCRT__wcsicoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t
return c1 - c2;
}
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
return CompareStringW(locinfo->lc_handle[LC_COLLATE], NORM_IGNORECASE,
str1, -1, str2, -1)-CSTR_EQUAL;
}
......@@ -246,7 +246,7 @@ int CDECL MSVCRT__wcsnicoll_l(const wchar_t* str1, const wchar_t* str2,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
{
wchar_t c1, c2;
......@@ -266,7 +266,7 @@ int CDECL MSVCRT__wcsnicoll_l(const wchar_t* str1, const wchar_t* str2,
return c1 - c2;
}
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
return CompareStringW(locinfo->lc_handle[LC_COLLATE], NORM_IGNORECASE,
str1, MSVCRT_wcsnlen(str1, count),
str2, MSVCRT_wcsnlen(str2, count))-CSTR_EQUAL;
}
......@@ -515,9 +515,9 @@ int CDECL MSVCRT__wcsncoll_l(const wchar_t* str1, const wchar_t* str2,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
return MSVCRT_wcsncmp(str1, str2, count);
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0,
return CompareStringW(locinfo->lc_handle[LC_COLLATE], 0,
str1, MSVCRT_wcsnlen(str1, count),
str2, MSVCRT_wcsnlen(str2, count))-CSTR_EQUAL;
}
......@@ -1863,9 +1863,9 @@ int CDECL MSVCRT__wcscoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
if(!locinfo->lc_handle[LC_COLLATE])
return MSVCRT_wcscmp(str1, str2);
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL;
return CompareStringW(locinfo->lc_handle[LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL;
}
/*********************************************************************
......@@ -2793,13 +2793,13 @@ int CDECL MSVCRT__towupper_l(wint_t c, _locale_t locale)
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_CTYPE]) {
if(!locinfo->lc_handle[LC_CTYPE]) {
if(c >= 'a' && c <= 'z')
return c + 'A' - 'a';
return c;
}
if(!LCMapStringW(locinfo->lc_handle[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE, &c, 1, &ret, 1))
if(!LCMapStringW(locinfo->lc_handle[LC_CTYPE], LCMAP_UPPERCASE, &c, 1, &ret, 1))
return c;
return ret;
}
......@@ -2918,12 +2918,12 @@ size_t CDECL MSVCRT__wcsxfrm_l(wchar_t *dest, const wchar_t *src,
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) {
if(!locinfo->lc_handle[LC_COLLATE]) {
MSVCRT_wcsncpy(dest, src, len);
return MSVCRT_wcslen(src);
}
ret = LCMapStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE],
ret = LCMapStringW(locinfo->lc_handle[LC_COLLATE],
LCMAP_SORTKEY, src, -1, NULL, 0);
if(!ret) {
if(len) dest[0] = 0;
......@@ -2938,7 +2938,7 @@ size_t CDECL MSVCRT__wcsxfrm_l(wchar_t *dest, const wchar_t *src,
return ret-1;
}
ret = LCMapStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE],
ret = LCMapStringW(locinfo->lc_handle[LC_COLLATE],
LCMAP_SORTKEY, src, -1, dest, len) - 1;
for(i=ret; i>=0; i--)
dest[i] = ((unsigned char*)dest)[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment