Commit 2a1114f8 authored by Alexandre Julliard's avatar Alexandre Julliard

oleaut32: Avoid floating point for some VarCy conversions.

parent 4c184a8b
...@@ -3420,7 +3420,8 @@ static const int CY_Divisors[5] = { CY_MULTIPLIER/10000, CY_MULTIPLIER/1000, ...@@ -3420,7 +3420,8 @@ static const int CY_Divisors[5] = { CY_MULTIPLIER/10000, CY_MULTIPLIER/1000,
*/ */
HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pCyOut) HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pCyOut)
{ {
return VarCyFromR8(bIn, pCyOut); pCyOut->int64 = (ULONG64)bIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3440,7 +3441,8 @@ HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pCyOut) ...@@ -3440,7 +3441,8 @@ HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromI2(SHORT sIn, CY* pCyOut) HRESULT WINAPI VarCyFromI2(SHORT sIn, CY* pCyOut)
{ {
return VarCyFromR8(sIn, pCyOut); pCyOut->int64 = (LONG64)sIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3460,7 +3462,8 @@ HRESULT WINAPI VarCyFromI2(SHORT sIn, CY* pCyOut) ...@@ -3460,7 +3462,8 @@ HRESULT WINAPI VarCyFromI2(SHORT sIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pCyOut) HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pCyOut)
{ {
return VarCyFromR8(lIn, pCyOut); pCyOut->int64 = (LONG64)lIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3617,7 +3620,8 @@ HRESULT WINAPI VarCyFromDisp(IDispatch* pdispIn, LCID lcid, CY* pCyOut) ...@@ -3617,7 +3620,8 @@ HRESULT WINAPI VarCyFromDisp(IDispatch* pdispIn, LCID lcid, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pCyOut) HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pCyOut)
{ {
return VarCyFromR8(boolIn, pCyOut); pCyOut->int64 = (LONG64)boolIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3637,7 +3641,8 @@ HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pCyOut) ...@@ -3637,7 +3641,8 @@ HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromI1(signed char cIn, CY* pCyOut) HRESULT WINAPI VarCyFromI1(signed char cIn, CY* pCyOut)
{ {
return VarCyFromR8(cIn, pCyOut); pCyOut->int64 = (LONG64)cIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3657,7 +3662,8 @@ HRESULT WINAPI VarCyFromI1(signed char cIn, CY* pCyOut) ...@@ -3657,7 +3662,8 @@ HRESULT WINAPI VarCyFromI1(signed char cIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pCyOut) HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pCyOut)
{ {
return VarCyFromR8(usIn, pCyOut); pCyOut->int64 = (ULONG64)usIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3677,7 +3683,8 @@ HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pCyOut) ...@@ -3677,7 +3683,8 @@ HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pCyOut) HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pCyOut)
{ {
return VarCyFromR8(ulIn, pCyOut); pCyOut->int64 = (ULONG64)ulIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
...@@ -3757,7 +3764,9 @@ HRESULT WINAPI VarCyFromI8(LONG64 llIn, CY* pCyOut) ...@@ -3757,7 +3764,9 @@ HRESULT WINAPI VarCyFromI8(LONG64 llIn, CY* pCyOut)
*/ */
HRESULT WINAPI VarCyFromUI8(ULONG64 ullIn, CY* pCyOut) HRESULT WINAPI VarCyFromUI8(ULONG64 ullIn, CY* pCyOut)
{ {
return VarCyFromR8(ullIn, pCyOut); if (ullIn >= (I8_MAX/CY_MULTIPLIER)) return DISP_E_OVERFLOW;
pCyOut->int64 = ullIn * CY_MULTIPLIER;
return S_OK;
} }
/************************************************************************ /************************************************************************
......
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