[PATCH] oledb32: Support DBTYPE_I4->DBTYPE_WSTR in GetConversionSize

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Mon Jun 12 23:09:54 CDT 2017


dst_len cannot be set to 110 beacuse we don't have any idea of how this
value is set.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/oledb32/convert.c       |  5 +++++
 dlls/oledb32/tests/convert.c | 12 ++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
index 0d45ef0..bf01101 100644
--- a/dlls/oledb32/convert.c
+++ b/dlls/oledb32/convert.c
@@ -1401,6 +1401,11 @@ static HRESULT WINAPI convert_GetConversionSize(IDataConvert* iface,
     case DBTYPE_WSTR:
         switch (src_type)
         {
+        case DBTYPE_I4:
+        {
+            /* Return S_OK to signal we can convert from this type. On windows, dst_len is set to 110. */
+            break;
+        }
         case DBTYPE_VARIANT:
         {
             VARIANT v;
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
index 116ca16..d07ebf1 100644
--- a/dlls/oledb32/tests/convert.c
+++ b/dlls/oledb32/tests/convert.c
@@ -2715,6 +2715,7 @@ static void test_getconversionsize(void)
     VARIANT var;
     SAFEARRAY *psa = NULL;
     SAFEARRAYBOUND rgsabound[1];
+    int i4;
 
     /* same way as CanConvert fails here */
     dst_len = 0;
@@ -2834,6 +2835,17 @@ static void test_getconversionsize(void)
     ok(dst_len == 1802, "%ld\n", dst_len);
     VariantClear(&var);
 
+    /* A value of 110 is returned in dst_len */
+    dst_len = 0;
+    src_len = sizeof(i4);
+    i4 = 200;
+    hr = IDataConvert_GetConversionSize(convert, DBTYPE_I4, DBTYPE_WSTR, &src_len, &dst_len, &i4);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    dst_len = 0;
+    hr = IDataConvert_GetConversionSize(convert, DBTYPE_I4, DBTYPE_WSTR, NULL, &dst_len, NULL);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
     /* On Windows, NULL variants being convert to a non-fixed sized type will return a dst_len of
      * 110 but we aren't testing for this value.
      */
-- 
1.9.1




More information about the wine-patches mailing list