Move IsCharAlphaA and IsCharAlphaNumericA to user32.
Better implement some of user32 *Char* functions regarding locale. Remove kernel32 dependency on user32.
This commit is contained in:
parent
49dd3fb448
commit
affc9a8817
|
@ -405,7 +405,6 @@ LPWSTR WINAPI CharLowerW(LPWSTR x)
|
|||
|
||||
/***********************************************************************
|
||||
* CharUpperW (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
LPWSTR WINAPI CharUpperW(LPWSTR x)
|
||||
{
|
||||
|
@ -416,14 +415,24 @@ LPWSTR WINAPI CharUpperW(LPWSTR x)
|
|||
|
||||
/***********************************************************************
|
||||
* CharLowerBuffA (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
DWORD WINAPI CharLowerBuffA( LPSTR str, DWORD len )
|
||||
{
|
||||
DWORD ret = len;
|
||||
DWORD lenW;
|
||||
WCHAR *strW;
|
||||
if (!str) return 0; /* YES */
|
||||
for (; len; len--, str++) *str = tolower(*str);
|
||||
return ret;
|
||||
|
||||
lenW = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0);
|
||||
strW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR));
|
||||
if(strW)
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, str, len, strW, lenW);
|
||||
CharLowerBuffW(strW, lenW);
|
||||
len = WideCharToMultiByte(CP_ACP, 0, strW, lenW, str, len, NULL, NULL);
|
||||
HeapFree(GetProcessHeap(), 0, strW);
|
||||
return len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -441,14 +450,24 @@ DWORD WINAPI CharLowerBuffW( LPWSTR str, DWORD len )
|
|||
|
||||
/***********************************************************************
|
||||
* CharUpperBuffA (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
DWORD WINAPI CharUpperBuffA( LPSTR str, DWORD len )
|
||||
{
|
||||
DWORD ret = len;
|
||||
DWORD lenW;
|
||||
WCHAR *strW;
|
||||
if (!str) return 0; /* YES */
|
||||
for (; len; len--, str++) *str = toupper(*str);
|
||||
return ret;
|
||||
|
||||
lenW = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0);
|
||||
strW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR));
|
||||
if(strW)
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, str, len, strW, lenW);
|
||||
CharUpperBuffW(strW, lenW);
|
||||
len = WideCharToMultiByte(CP_ACP, 0, strW, lenW, str, len, NULL, NULL);
|
||||
HeapFree(GetProcessHeap(), 0, strW);
|
||||
return len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -467,11 +486,12 @@ DWORD WINAPI CharUpperBuffW( LPWSTR str, DWORD len )
|
|||
/***********************************************************************
|
||||
* IsCharLowerA (USER.436)
|
||||
* IsCharLowerA (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
BOOL WINAPI IsCharLowerA(CHAR x)
|
||||
{
|
||||
return islower(x);
|
||||
WCHAR wch;
|
||||
MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1);
|
||||
return IsCharLowerW(wch);
|
||||
}
|
||||
|
||||
|
||||
|
@ -480,18 +500,19 @@ BOOL WINAPI IsCharLowerA(CHAR x)
|
|||
*/
|
||||
BOOL WINAPI IsCharLowerW(WCHAR x)
|
||||
{
|
||||
return get_char_typeW(x) & C1_LOWER;
|
||||
return (get_char_typeW(x) & C1_LOWER) != 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* IsCharUpperA (USER.435)
|
||||
* IsCharUpperA (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
BOOL WINAPI IsCharUpperA(CHAR x)
|
||||
{
|
||||
return isupper(x);
|
||||
WCHAR wch;
|
||||
MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1);
|
||||
return IsCharUpperW(wch);
|
||||
}
|
||||
|
||||
|
||||
|
@ -500,7 +521,18 @@ BOOL WINAPI IsCharUpperA(CHAR x)
|
|||
*/
|
||||
BOOL WINAPI IsCharUpperW(WCHAR x)
|
||||
{
|
||||
return get_char_typeW(x) & C1_UPPER;
|
||||
return (get_char_typeW(x) & C1_UPPER) != 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* IsCharAlphaNumericA (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI IsCharAlphaNumericA(CHAR x)
|
||||
{
|
||||
WCHAR wch;
|
||||
MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1);
|
||||
return IsCharAlphaNumericW(wch);
|
||||
}
|
||||
|
||||
|
||||
|
@ -509,7 +541,18 @@ BOOL WINAPI IsCharUpperW(WCHAR x)
|
|||
*/
|
||||
BOOL WINAPI IsCharAlphaNumericW(WCHAR x)
|
||||
{
|
||||
return get_char_typeW(x) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
|
||||
return (get_char_typeW(x) & (C1_ALPHA|C1_DIGIT)) != 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* IsCharAlphaA (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI IsCharAlphaA(CHAR x)
|
||||
{
|
||||
WCHAR wch;
|
||||
MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1);
|
||||
return IsCharAlphaW(wch);
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,7 +561,7 @@ BOOL WINAPI IsCharAlphaNumericW(WCHAR x)
|
|||
*/
|
||||
BOOL WINAPI IsCharAlphaW(WCHAR x)
|
||||
{
|
||||
return get_char_typeW(x) & (C1_ALPHA|C1_LOWER|C1_UPPER);
|
||||
return (get_char_typeW(x) & C1_ALPHA) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ C_SRCS = \
|
|||
cdrom.c \
|
||||
cpu.c \
|
||||
error.c \
|
||||
lstr.c \
|
||||
main.c \
|
||||
options.c \
|
||||
registry.c \
|
||||
|
|
49
misc/lstr.c
49
misc/lstr.c
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* String functions
|
||||
*
|
||||
* Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
|
||||
* Copyright 1996 Marcus Meissner
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/winuser16.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "winnls.h"
|
||||
#include "heap.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(resource);
|
||||
|
||||
extern const WORD OLE2NLS_CT_CType3_LUT[]; /* FIXME: does not belong here */
|
||||
|
||||
/***********************************************************************
|
||||
* IsCharAlphaA (USER.433)
|
||||
* IsCharAlphaA (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
BOOL WINAPI IsCharAlphaA(CHAR x)
|
||||
{
|
||||
return (OLE2NLS_CT_CType3_LUT[(unsigned char)x] & C3_ALPHA);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* IsCharAlphaNumericA (USER.434)
|
||||
* IsCharAlphaNumericA (USER32.@)
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
BOOL WINAPI IsCharAlphaNumericA(CHAR x)
|
||||
{
|
||||
return IsCharAlphaA(x) || isdigit(x) ;
|
||||
}
|
|
@ -1075,7 +1075,7 @@ static const unsigned char CT_CType2_LUT[] = {
|
|||
C2_LEFTTORIGHT /* ÿ - 255 */
|
||||
};
|
||||
|
||||
const WORD OLE2NLS_CT_CType3_LUT[] = {
|
||||
static const WORD OLE2NLS_CT_CType3_LUT[] = {
|
||||
0x0000, /* - 0 */
|
||||
0x0000, /* - 1 */
|
||||
0x0000, /* - 2 */
|
||||
|
@ -1841,13 +1841,14 @@ static int OLE2NLS_isNonSpacing(unsigned char c)
|
|||
|
||||
/******************************************************************************
|
||||
* OLE2NLS_isSymbol [INTERNAL]
|
||||
* FIXME: handle current locale
|
||||
*/
|
||||
static int OLE2NLS_isSymbol(unsigned char c)
|
||||
{
|
||||
/* This function is used by LCMapStringA. Characters
|
||||
for which it returns true are ignored when mapping a
|
||||
string with NORM_IGNORESYMBOLS */
|
||||
return ( (c!=0) && !IsCharAlphaNumericA(c) );
|
||||
return ( (c!=0) && !(isalpha(c) || isdigit(c)) );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
Loading…
Reference in New Issue