Alistair Leslie-Hughes : oledb32: Convert to a BSTR to work out it size.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 22 14:06:51 CST 2015


Module: wine
Branch: master
Commit: 9c70026092f49872ee3d6f3a71df45f28cf2bed8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9c70026092f49872ee3d6f3a71df45f28cf2bed8

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Dec 22 21:09:45 2015 +1100

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 <leslie_alistair at hotmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 72714d3..891b31c 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)




More information about the wine-cvs mailing list