mirror of
https://github.com/wine-mirror/wine
synced 2024-07-09 04:16:08 +00:00
oleaut32: Handle DATE in string form in VarFormat.
Testing has proven that coercion functions should reject the value which indicates that this is handled as a special case in VarFormat Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=13778 Signed-off-by: David Kahurani <k.kahurani@gmail.com>
This commit is contained in:
parent
97a3802093
commit
9af3a79b96
|
@ -304,8 +304,8 @@ static void test_VarFormat(void)
|
|||
VARFMT(VT_BSTR,V_BSTR,bstrin,"<&>&",S_OK,"testing");
|
||||
SysFreeString(bstrin);
|
||||
bstrin = SysAllocString(L"39697.11");
|
||||
todo_wine VARFMT(VT_BSTR,V_BSTR,bstrin,"hh:mm",S_OK,"02:38");
|
||||
todo_wine VARFMT(VT_BSTR,V_BSTR,bstrin,"mm-dd-yy",S_OK,"09-06-08");
|
||||
VARFMT(VT_BSTR,V_BSTR,bstrin,"hh:mm",S_OK,"02:38");
|
||||
VARFMT(VT_BSTR,V_BSTR,bstrin,"mm-dd-yy",S_OK,"09-06-08");
|
||||
SysFreeString(bstrin);
|
||||
/* Numeric values are converted to strings then output */
|
||||
VARFMT(VT_I1,V_I1,1,"<&>&",S_OK,"1");
|
||||
|
|
|
@ -1585,8 +1585,34 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
|
|||
USHORT usFlags = dwFlags & VARIANT_CALENDAR_HIJRI ? VAR_CALENDAR_HIJRI : 0;
|
||||
|
||||
hRes = VariantChangeTypeEx(&vDate, pVarIn, lcid, usFlags, VT_DATE);
|
||||
/* 31809.40 and similar are treated as invalid by coercion functions but
|
||||
* it simply is a DATE in string form as far as VarFormat is concerned
|
||||
*/
|
||||
if (FAILED(hRes))
|
||||
return hRes;
|
||||
{
|
||||
if (V_TYPE(pVarIn) == VT_BSTR)
|
||||
{
|
||||
DATE out;
|
||||
OLECHAR *endptr = NULL;
|
||||
/* Try consume the string with wcstod */
|
||||
double tmp = wcstod(V_BSTR(pVarIn), &endptr);
|
||||
|
||||
/* Not a double in string form */
|
||||
if (*endptr)
|
||||
return hRes;
|
||||
|
||||
hRes = VarDateFromR8(tmp, &out);
|
||||
|
||||
if (FAILED(hRes))
|
||||
return hRes;
|
||||
|
||||
V_VT(&vDate) = VT_DATE;
|
||||
V_DATE(&vDate) = out;
|
||||
}
|
||||
else
|
||||
return hRes;
|
||||
}
|
||||
|
||||
dateHeader = (FMT_DATE_HEADER*)(rgbTok + FmtGetPositive(header));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user