From 9c70026092f49872ee3d6f3a71df45f28cf2bed8 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 22 Dec 2015 21:09:45 +1100 Subject: [PATCH] oledb32: Convert to a BSTR to work out it size. This makes code for handling variants with DBTYPE_STR and DBTYPE_WSTR types consistent. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/oledb32/convert.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index 72714d32d7f..891b31c1bd5 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -1372,10 +1372,16 @@ static HRESULT WINAPI convert_GetConversionSize(IDataConvert* iface, switch (src_type) { case DBTYPE_VARIANT: - if(V_VT((VARIANT*)src) == VT_BSTR) - *dst_len = (SysStringLen(V_BSTR((VARIANT*)src))+1) * sizeof(WCHAR); - else - WARN("DBTYPE_VARIANT(%d)->DBTYPE_WSTR unimplemented\n", V_VT((VARIANT*)src)); + { + VARIANT v; + + VariantInit(&v); + if ((hr = VariantChangeType(&v, (VARIANT*)src, 0, VT_BSTR)) == S_OK) + { + *dst_len = (SysStringLen(V_BSTR(&v))+1) * sizeof(WCHAR); + VariantClear(&v); + } + } break; case DBTYPE_STR: if(src_len)