Commit 22c2ac72 authored by Alexandre Julliard's avatar Alexandre Julliard

Implemented inline version of the iswxxx functions.

parent e2c477b2
...@@ -268,7 +268,7 @@ INT MSVCRT_wctomb( char *dst, WCHAR ch ) ...@@ -268,7 +268,7 @@ INT MSVCRT_wctomb( char *dst, WCHAR ch )
*/ */
INT MSVCRT_iswalnum( WCHAR wc ) INT MSVCRT_iswalnum( WCHAR wc )
{ {
return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER); return isalnumW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -276,7 +276,7 @@ INT MSVCRT_iswalnum( WCHAR wc ) ...@@ -276,7 +276,7 @@ INT MSVCRT_iswalnum( WCHAR wc )
*/ */
INT MSVCRT_iswalpha( WCHAR wc ) INT MSVCRT_iswalpha( WCHAR wc )
{ {
return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER); return isalphaW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -284,7 +284,7 @@ INT MSVCRT_iswalpha( WCHAR wc ) ...@@ -284,7 +284,7 @@ INT MSVCRT_iswalpha( WCHAR wc )
*/ */
INT MSVCRT_iswcntrl( WCHAR wc ) INT MSVCRT_iswcntrl( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_CNTRL; return iscntrlW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -292,7 +292,7 @@ INT MSVCRT_iswcntrl( WCHAR wc ) ...@@ -292,7 +292,7 @@ INT MSVCRT_iswcntrl( WCHAR wc )
*/ */
INT MSVCRT_iswdigit( WCHAR wc ) INT MSVCRT_iswdigit( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_DIGIT; return isdigitW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -300,7 +300,7 @@ INT MSVCRT_iswdigit( WCHAR wc ) ...@@ -300,7 +300,7 @@ INT MSVCRT_iswdigit( WCHAR wc )
*/ */
INT MSVCRT_iswgraph( WCHAR wc ) INT MSVCRT_iswgraph( WCHAR wc )
{ {
return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER); return isgraphW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -308,7 +308,7 @@ INT MSVCRT_iswgraph( WCHAR wc ) ...@@ -308,7 +308,7 @@ INT MSVCRT_iswgraph( WCHAR wc )
*/ */
INT MSVCRT_iswlower( WCHAR wc ) INT MSVCRT_iswlower( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_LOWER; return islowerW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -316,7 +316,7 @@ INT MSVCRT_iswlower( WCHAR wc ) ...@@ -316,7 +316,7 @@ INT MSVCRT_iswlower( WCHAR wc )
*/ */
INT MSVCRT_iswprint( WCHAR wc ) INT MSVCRT_iswprint( WCHAR wc )
{ {
return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER); return isprintW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -324,7 +324,7 @@ INT MSVCRT_iswprint( WCHAR wc ) ...@@ -324,7 +324,7 @@ INT MSVCRT_iswprint( WCHAR wc )
*/ */
INT MSVCRT_iswpunct( WCHAR wc ) INT MSVCRT_iswpunct( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_PUNCT; return ispunctW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -332,7 +332,7 @@ INT MSVCRT_iswpunct( WCHAR wc ) ...@@ -332,7 +332,7 @@ INT MSVCRT_iswpunct( WCHAR wc )
*/ */
INT MSVCRT_iswspace( WCHAR wc ) INT MSVCRT_iswspace( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_SPACE; return isspaceW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -340,7 +340,7 @@ INT MSVCRT_iswspace( WCHAR wc ) ...@@ -340,7 +340,7 @@ INT MSVCRT_iswspace( WCHAR wc )
*/ */
INT MSVCRT_iswupper( WCHAR wc ) INT MSVCRT_iswupper( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_UPPER; return isupperW( wc );
} }
/********************************************************************* /*********************************************************************
...@@ -348,7 +348,7 @@ INT MSVCRT_iswupper( WCHAR wc ) ...@@ -348,7 +348,7 @@ INT MSVCRT_iswupper( WCHAR wc )
*/ */
INT MSVCRT_iswxdigit( WCHAR wc ) INT MSVCRT_iswxdigit( WCHAR wc )
{ {
return get_char_typeW(wc) & C1_XDIGIT; return isxdigitW( wc );
} }
/********************************************************************* /*********************************************************************
......
...@@ -88,7 +88,7 @@ static BOOL URL_NeedEscapeA(CHAR ch, DWORD dwFlags) ...@@ -88,7 +88,7 @@ static BOOL URL_NeedEscapeA(CHAR ch, DWORD dwFlags)
static BOOL URL_NeedEscapeW(WCHAR ch, DWORD dwFlags) static BOOL URL_NeedEscapeW(WCHAR ch, DWORD dwFlags)
{ {
if (iswalnum(ch)) if (isalnumW(ch))
return FALSE; return FALSE;
if(dwFlags & URL_ESCAPE_SPACES_ONLY) { if(dwFlags & URL_ESCAPE_SPACES_ONLY) {
...@@ -136,7 +136,7 @@ static BOOL URL_JustLocation(LPCWSTR str) ...@@ -136,7 +136,7 @@ static BOOL URL_JustLocation(LPCWSTR str)
if (*str) { if (*str) {
while (*str && ((*str == L'-') || while (*str && ((*str == L'-') ||
(*str == L'.') || (*str == L'.') ||
iswalnum(*str))) str++; isalnumW(*str))) str++;
if (*str == L'/') return FALSE; if (*str == L'/') return FALSE;
} }
return TRUE; return TRUE;
...@@ -233,9 +233,9 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, ...@@ -233,9 +233,9 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
while (*wk1) { while (*wk1) {
switch (state) { switch (state) {
case 0: case 0:
if (!iswalnum(*wk1)) {state = 3; break;} if (!isalnumW(*wk1)) {state = 3; break;}
*wk2++ = *wk1++; *wk2++ = *wk1++;
if (!iswalnum(*wk1)) {state = 3; break;} if (!isalnumW(*wk1)) {state = 3; break;}
*wk2++ = *wk1++; *wk2++ = *wk1++;
state = 1; state = 1;
break; break;
...@@ -256,8 +256,8 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, ...@@ -256,8 +256,8 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
wk2 += strlenW(wk2); wk2 += strlenW(wk2);
break; break;
case 4: case 4:
if (!iswalnum(*wk1) && (*wk1 != L'-')) {state = 3; break;} if (!isalnumW(*wk1) && (*wk1 != L'-')) {state = 3; break;}
while(iswalnum(*wk1) || (*wk1 == L'-')) *wk2++ = *wk1++; while(isalnumW(*wk1) || (*wk1 == L'-')) *wk2++ = *wk1++;
state = 5; state = 5;
break; break;
case 5: case 5:
...@@ -946,7 +946,7 @@ HRESULT WINAPI UrlUnescapeW( ...@@ -946,7 +946,7 @@ HRESULT WINAPI UrlUnescapeW(
(*src == L'#' || *src == L'?')) { (*src == L'#' || *src == L'?')) {
stop_unescapping = TRUE; stop_unescapping = TRUE;
next = *src; next = *src;
} else if(*src == L'%' && iswxdigit(*(src + 1)) && iswxdigit(*(src + 2)) } else if(*src == L'%' && isxdigitW(*(src + 1)) && isxdigitW(*(src + 2))
&& stop_unescapping == FALSE) { && stop_unescapping == FALSE) {
INT ih; INT ih;
WCHAR buf[3]; WCHAR buf[3];
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define __WINE_UNICODE_H #define __WINE_UNICODE_H
#include "windef.h" #include "windef.h"
#include "winnls.h"
/* code page info common to SBCS and DBCS */ /* code page info common to SBCS and DBCS */
struct cp_info struct cp_info
...@@ -81,6 +82,61 @@ static inline unsigned short get_char_typeW( WCHAR ch ) ...@@ -81,6 +82,61 @@ static inline unsigned short get_char_typeW( WCHAR ch )
return wctype_table[wctype_table[ch >> 8] + (ch & 0xff)]; return wctype_table[wctype_table[ch >> 8] + (ch & 0xff)];
} }
inline static int iscntrlW( WCHAR wc )
{
return get_char_typeW(wc) & C1_CNTRL;
}
inline static int ispunctW( WCHAR wc )
{
return get_char_typeW(wc) & C1_PUNCT;
}
inline static int isspaceW( WCHAR wc )
{
return get_char_typeW(wc) & C1_SPACE;
}
inline static int isdigitW( WCHAR wc )
{
return get_char_typeW(wc) & C1_DIGIT;
}
inline static int isxdigitW( WCHAR wc )
{
return get_char_typeW(wc) & C1_XDIGIT;
}
inline static int islowerW( WCHAR wc )
{
return get_char_typeW(wc) & C1_LOWER;
}
inline static int isupperW( WCHAR wc )
{
return get_char_typeW(wc) & C1_UPPER;
}
inline static int isalnumW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
}
inline static int isalphaW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
}
inline static int isgraphW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
}
inline static int isprintW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
}
/* some useful string manipulation routines */ /* some useful string manipulation routines */
static inline unsigned int strlenW( const WCHAR *str ) static inline unsigned int strlenW( const WCHAR *str )
......
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