Commit 4a4effe3 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

oleaut32: VarBstrFromCy - Remove use of sprintfW by converting a CY

into a DECIMAL instead of a double as an intermediate step.
parent ed219354
...@@ -6499,13 +6499,26 @@ HRESULT WINAPI VarBstrFromR8(double dblIn, LCID lcid, ULONG dwFlags, BSTR* pbstr ...@@ -6499,13 +6499,26 @@ HRESULT WINAPI VarBstrFromR8(double dblIn, LCID lcid, ULONG dwFlags, BSTR* pbstr
HRESULT WINAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut) HRESULT WINAPI VarBstrFromCy(CY cyIn, LCID lcid, ULONG dwFlags, BSTR *pbstrOut)
{ {
WCHAR buff[256]; WCHAR buff[256];
double dblVal; VARIANT_DI decVal;
if (!pbstrOut) if (!pbstrOut)
return E_INVALIDARG; return E_INVALIDARG;
VarR8FromCy(cyIn, &dblVal); decVal.scale = 4;
sprintfW(buff, szDoubleFormatW, dblVal); decVal.sign = 0;
decVal.bitsnum[0] = cyIn.s.Lo;
decVal.bitsnum[1] = cyIn.s.Hi;
if (cyIn.s.Hi & 0x80000000UL) {
DWORD one = 1;
/* Negative number! */
decVal.sign = 1;
decVal.bitsnum[0] = ~decVal.bitsnum[0];
decVal.bitsnum[1] = ~decVal.bitsnum[1];
VARIANT_int_add(decVal.bitsnum, 3, &one, 1);
}
decVal.bitsnum[2] = 0;
VARIANT_DI_tostringW(&decVal, buff, sizeof(buff));
if (dwFlags & LOCALE_USE_NLS) if (dwFlags & LOCALE_USE_NLS)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment