[2/4] oledb32: Check for DBSTATUS_S_ISNULL first (try 2)

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sat May 25 18:19:18 CDT 2013


Hi,


Changelog:
         oledb32: Check for DBSTATUS_S_ISNULL first


Best Regards
      Alistair Leslie-Hughes




-------------- next part --------------
>From f2eecc39a7ce2750a1aff91d337573d75046d8f8 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri, 24 May 2013 15:35:30 +1000
Subject: [PATCH] Check for DBSTATUS_S_ISNULL first
To: wine-patches <wine-patches at winehq.org>

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

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 94ba4ce..4829ae8 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -179,11 +179,6 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
 
     *dst_status = DBSTATUS_E_BADACCESSOR;
 
-    if(IDataConvert_CanConvert(iface, src_type, dst_type) != S_OK)
-    {
-        return DB_E_UNSUPPORTEDCONVERSION;
-    }
-
     if(src_status == DBSTATUS_S_ISNULL)
     {
         *dst_status = DBSTATUS_S_ISNULL;
@@ -191,6 +186,11 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
         return S_OK;
     }
 
+    if(IDataConvert_CanConvert(iface, src_type, dst_type) != S_OK)
+    {
+        return DB_E_UNSUPPORTEDCONVERSION;
+    }
+
     if(dst == NULL && get_length(dst_type) != 0)
     {
         *dst_len = get_length(src_type);
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 88dc1d3..089b28c 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2714,6 +2714,21 @@ static void test_converttotimestamp(void)
     SysFreeString(bstr);
 }
 
+static void test_converttoiunknown(void)
+{
+    HRESULT hr;
+    DBSTATUS dst_status;
+    DBLENGTH dst_len;
+    IUnknown *dst = NULL;
+    static WCHAR strW[] = {'t','e','s','t',0};
+
+    dst_len = 0x1234;
+    hr = IDataConvert_DataConvert(convert, DBTYPE_WSTR, DBTYPE_IUNKNOWN, sizeof(strW), &dst_len, strW, dst, sizeof(dst), DBSTATUS_S_ISNULL, &dst_status, 0, 0, 0);
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(dst_status == DBSTATUS_S_ISNULL, "got %08x\n", dst_status);
+    ok(dst_len == 0, "got %ld\n", dst_len);
+}
+
 START_TEST(convert)
 {
     HRESULT hr;
@@ -2751,6 +2766,7 @@ START_TEST(convert)
     test_converttodbdate();
     test_getconversionsize();
     test_converttotimestamp();
+    test_converttoiunknown();
 
     IDataConvert_Release(convert);
 
-- 
1.8.1.2







More information about the wine-patches mailing list