oledb32: Implement DataConvert DBTYPE_BOOL->VARIANT (try 2)

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Apr 24 05:38:25 CDT 2013


Hi,
Corrected cast

Changelog:
      oledb32: Implement DataConvert DBTYPE_BOOL->VARIANT


Best Regards
   Alistair Leslie-Hughes

-------------- next part --------------
>From 6d267d11f870d7dff490276f3d9280f1ade66e8d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Thu, 18 Apr 2013 14:36:34 +1000
Subject: [PATCH] Implement DataConvert DBTYPE_BOOL->VARIANT
To: wine-patches <wine-patches at winehq.org>

---
 dlls/oledb32/convert.c       |    5 +++++
 dlls/oledb32/tests/convert.c |   11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 4b2a480..0bcaae9 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -758,6 +758,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
 
         switch(src_type)
         {
+        case DBTYPE_BOOL:
+            V_VT(v) = VT_BOOL;
+            V_BOOL(v) = *(VARIANT_BOOL*)src;
+            hr = S_OK;
+            break;
         case DBTYPE_I4:
             V_VT(v) = VT_I4;
             V_I4(v) = *(signed int*)src;
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 51dc0f6..58b6965 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2564,6 +2564,7 @@ static void test_converttovar(void)
     DATE date;
     INT i4;
     LARGE_INTEGER i8;
+    VARIANT_BOOL boolean = VARIANT_TRUE;
 
     hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert);
     if(FAILED(hr))
@@ -2617,6 +2618,16 @@ static void test_converttovar(void)
     V_VT(&dst) = VT_EMPTY;
     dst_len = 0;
     dst_status = DBSTATUS_S_DEFAULT;
+    hr = IDataConvert_DataConvert(convert, DBTYPE_BOOL, DBTYPE_VARIANT, sizeof(boolean), &dst_len, &boolean, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
+    ok(dst_len == sizeof(dst), "got %ld\n", dst_len);
+    ok(V_VT(&dst) == VT_BOOL, "got %d\n", V_VT(&dst));
+    ok(V_BOOL(&dst) == VARIANT_TRUE, "got %d\n", V_BOOL(&dst));
+
+    V_VT(&dst) = VT_EMPTY;
+    dst_len = 0;
+    dst_status = DBSTATUS_S_DEFAULT;
     i4 = 123;
     hr = IDataConvert_DataConvert(convert, DBTYPE_I4, DBTYPE_VARIANT, sizeof(i4), &dst_len, &i4, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
     ok(hr == S_OK, "got %08x\n", hr);
-- 
1.7.10.4



More information about the wine-patches mailing list