v2: Correct Parameters passed to VariantChangeType.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/oledb32/convert.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index 267de1b..22609ae 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -475,10 +475,13 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, } break; case DBTYPE_VARIANT: - if( V_VT((VARIANT*)src) == VT_DATE) + { + VariantInit(&tmp); + + if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_DATE)) == S_OK) { SYSTEMTIME st; - hr = (VariantTimeToSystemTime( V_DATE((VARIANT*)src), &st) ? S_OK : E_FAIL); + hr = (VariantTimeToSystemTime( V_DATE(&tmp), &st) ? S_OK : E_FAIL); d->year = st.wYear; d->month = st.wMonth; d->day = st.wDay; @@ -489,6 +492,7 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, return E_NOTIMPL; } break; + } default: FIXME("Unimplemented conversion %04x -> DBDATE\n", src_type); return E_NOTIMPL; } break;
On Tue, Jan 02, 2018 at 12:21:03AM +0000, Alistair Leslie-Hughes wrote:
v2: Correct Parameters passed to VariantChangeType.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/oledb32/convert.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index 267de1b..22609ae 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -475,10 +475,13 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, } break; case DBTYPE_VARIANT:
if( V_VT((VARIANT*)src) == VT_DATE)
{
VariantInit(&tmp);
if ((hr = VariantChangeType(&tmp, (VARIANT*)src, 0, VT_DATE)) == S_OK) { SYSTEMTIME st;
hr = (VariantTimeToSystemTime( V_DATE((VARIANT*)src), &st) ? S_OK : E_FAIL);
hr = (VariantTimeToSystemTime( V_DATE(&tmp), &st) ? S_OK : E_FAIL); d->year = st.wYear; d->month = st.wMonth; d->day = st.wDay;
@@ -489,6 +492,7 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, return E_NOTIMPL; } break;
} default: FIXME("Unimplemented conversion %04x -> DBDATE\n", src_type); return E_NOTIMPL; } break;
Adding a test of say a VT_R8 variant -> DBDATE would be nice.
Huw.