mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-22 14:44:09 +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");
|
VARFMT(VT_BSTR,V_BSTR,bstrin,"<&>&",S_OK,"testing");
|
||||||
SysFreeString(bstrin);
|
SysFreeString(bstrin);
|
||||||
bstrin = SysAllocString(L"39697.11");
|
bstrin = SysAllocString(L"39697.11");
|
||||||
todo_wine VARFMT(VT_BSTR,V_BSTR,bstrin,"hh:mm",S_OK,"02:38");
|
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,"mm-dd-yy",S_OK,"09-06-08");
|
||||||
SysFreeString(bstrin);
|
SysFreeString(bstrin);
|
||||||
/* Numeric values are converted to strings then output */
|
/* Numeric values are converted to strings then output */
|
||||||
VARFMT(VT_I1,V_I1,1,"<&>&",S_OK,"1");
|
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;
|
USHORT usFlags = dwFlags & VARIANT_CALENDAR_HIJRI ? VAR_CALENDAR_HIJRI : 0;
|
||||||
|
|
||||||
hRes = VariantChangeTypeEx(&vDate, pVarIn, lcid, usFlags, VT_DATE);
|
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))
|
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));
|
dateHeader = (FMT_DATE_HEADER*)(rgbTok + FmtGetPositive(header));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue