oleaut32: Fix checks for digit characters.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4873dd49aa
commit
db77f53507
|
@ -1312,6 +1312,7 @@ static void test_VarParseNumFromStr(void)
|
|||
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
|
||||
NUMPARSE np;
|
||||
BYTE rgb[128];
|
||||
WCHAR str[128];
|
||||
|
||||
/** No flags **/
|
||||
|
||||
|
@ -1734,6 +1735,11 @@ static void test_VarParseNumFromStr(void)
|
|||
CONVERT("0.10", NUMPRS_STD);
|
||||
EXPECT(1,NUMPRS_STD,NUMPRS_DECIMAL,4,0,-1);
|
||||
EXPECT2(1,0);
|
||||
|
||||
str[0] = 0x0660;
|
||||
str[1] = 0;
|
||||
hres = pVarParseNumFromStr(str, lcid, LOCALE_NOUSEROVERRIDE, &np, rgb);
|
||||
ok(hres == DISP_E_TYPEMISMATCH, "VarParseNumFromStr returned %08x\n", hres);
|
||||
}
|
||||
|
||||
static HRESULT (WINAPI *pVarNumFromParseNum)(NUMPARSE*,BYTE*,ULONG,VARIANT*);
|
||||
|
|
|
@ -1571,6 +1571,11 @@ static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID
|
|||
#define B_PROCESSING_HEX 0x20
|
||||
#define B_PROCESSING_OCT 0x40
|
||||
|
||||
static inline BOOL is_digit(WCHAR c)
|
||||
{
|
||||
return '0' <= c && c <= '9';
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* VarParseNumFromStr [OLEAUT32.46]
|
||||
*
|
||||
|
@ -1714,14 +1719,14 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
|
|||
|
||||
while (*lpszStr)
|
||||
{
|
||||
if (iswdigit(*lpszStr))
|
||||
if (is_digit(*lpszStr))
|
||||
{
|
||||
if (dwState & B_PROCESSING_EXPONENT)
|
||||
{
|
||||
int exponentSize = 0;
|
||||
if (dwState & B_EXPONENT_START)
|
||||
{
|
||||
if (!iswdigit(*lpszStr))
|
||||
if (!is_digit(*lpszStr))
|
||||
break; /* No exponent digits - invalid */
|
||||
while (*lpszStr == '0')
|
||||
{
|
||||
|
@ -1731,7 +1736,7 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
|
|||
}
|
||||
}
|
||||
|
||||
while (iswdigit(*lpszStr))
|
||||
while (is_digit(*lpszStr))
|
||||
{
|
||||
exponentSize *= 10;
|
||||
exponentSize += *lpszStr - '0';
|
||||
|
|
|
@ -7657,7 +7657,7 @@ HRESULT WINAPI VarDateFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, DATE* pd
|
|||
/* Parse the string into our structure */
|
||||
while (*strIn)
|
||||
{
|
||||
if (iswdigit(*strIn))
|
||||
if ('0' <= *strIn && *strIn <= '9')
|
||||
{
|
||||
if (dp.dwCount >= 6)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue