oleaut32: Fix parsing of hex numbers with 'e' in the string by moving
the exponent parsing to after the hex digit parsing.
This commit is contained in:
parent
19d4378a54
commit
123592f0c3
|
@ -957,13 +957,15 @@ static void test_VarParseNumFromStr(void)
|
|||
EXPECTRGB(4,FAILDIG);
|
||||
|
||||
/* VB hex lower case and leading zero */
|
||||
CONVERT("&h0abcd", NUMPRS_HEX_OCT);
|
||||
EXPECT(4,NUMPRS_HEX_OCT,0x40,7,4,0);
|
||||
CONVERT("&h0abcdef", NUMPRS_HEX_OCT);
|
||||
EXPECT(6,NUMPRS_HEX_OCT,0x40,9,4,0);
|
||||
EXPECTRGB(0,10);
|
||||
EXPECTRGB(1,11);
|
||||
EXPECTRGB(2,12);
|
||||
EXPECTRGB(3,13);
|
||||
EXPECTRGB(4,FAILDIG);
|
||||
EXPECTRGB(4,14);
|
||||
EXPECTRGB(5,15);
|
||||
EXPECTRGB(6,FAILDIG);
|
||||
|
||||
/* VB oct */
|
||||
CONVERT("&O300", NUMPRS_HEX_OCT);
|
||||
|
|
|
@ -1732,23 +1732,6 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ((*lpszStr == 'e' || *lpszStr == 'E') &&
|
||||
pNumprs->dwInFlags & NUMPRS_EXPONENT &&
|
||||
!(pNumprs->dwOutFlags & NUMPRS_EXPONENT))
|
||||
{
|
||||
dwState |= B_PROCESSING_EXPONENT;
|
||||
pNumprs->dwOutFlags |= NUMPRS_EXPONENT;
|
||||
cchUsed++;
|
||||
}
|
||||
else if (dwState & B_PROCESSING_EXPONENT && *lpszStr == chars.cPositiveSymbol)
|
||||
{
|
||||
cchUsed++; /* Ignore positive exponent */
|
||||
}
|
||||
else if (dwState & B_PROCESSING_EXPONENT && *lpszStr == chars.cNegativeSymbol)
|
||||
{
|
||||
dwState |= B_NEGATIVE_EXPONENT;
|
||||
cchUsed++;
|
||||
}
|
||||
else if (((*lpszStr >= 'a' && *lpszStr <= 'f') ||
|
||||
(*lpszStr >= 'A' && *lpszStr <= 'F')) &&
|
||||
dwState & B_PROCESSING_HEX)
|
||||
|
@ -1767,6 +1750,23 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
|
|||
pNumprs->cDig++;
|
||||
cchUsed++;
|
||||
}
|
||||
else if ((*lpszStr == 'e' || *lpszStr == 'E') &&
|
||||
pNumprs->dwInFlags & NUMPRS_EXPONENT &&
|
||||
!(pNumprs->dwOutFlags & NUMPRS_EXPONENT))
|
||||
{
|
||||
dwState |= B_PROCESSING_EXPONENT;
|
||||
pNumprs->dwOutFlags |= NUMPRS_EXPONENT;
|
||||
cchUsed++;
|
||||
}
|
||||
else if (dwState & B_PROCESSING_EXPONENT && *lpszStr == chars.cPositiveSymbol)
|
||||
{
|
||||
cchUsed++; /* Ignore positive exponent */
|
||||
}
|
||||
else if (dwState & B_PROCESSING_EXPONENT && *lpszStr == chars.cNegativeSymbol)
|
||||
{
|
||||
dwState |= B_NEGATIVE_EXPONENT;
|
||||
cchUsed++;
|
||||
}
|
||||
else
|
||||
break; /* Stop at an unrecognised character */
|
||||
|
||||
|
@ -1783,6 +1783,7 @@ HRESULT WINAPI VarParseNumFromStr(OLECHAR *lpszStr, LCID lcid, ULONG dwFlags,
|
|||
if (pNumprs->dwOutFlags & NUMPRS_EXPONENT && dwState & B_PROCESSING_EXPONENT)
|
||||
{
|
||||
pNumprs->cchUsed = cchUsed;
|
||||
WARN("didn't completely parse exponent\n");
|
||||
return DISP_E_TYPEMISMATCH; /* Failed to completely parse the exponent */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue