[PATCH 2/2] oledb32: GetConversionSize shouldn't fail for null variants. (try 2)

Huw Davies huw at codeweavers.com
Tue Dec 22 04:24:46 CST 2015


On Tue, Dec 22, 2015 at 09:09:46PM +1100, Alistair Leslie-Hughes wrote:
> diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c
> index a785457..ac2f6be 100644
> --- a/dlls/oledb32/tests/convert.c
> +++ b/dlls/oledb32/tests/convert.c
> @@ -2627,6 +2627,33 @@ static void test_getconversionsize(void)
>      ok(hr == S_OK, "got 0x%08x\n", hr);
>      VariantClear(&var);
>  
> +    dst_len = 78;
> +    V_VT(&var) = VT_NULL;
> +    hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_WSTR, NULL, &dst_len, &var);
> +    ok(hr == S_OK, "got 0x%08x\n", hr);
> +
> +    dst_len = 0;
> +    src_len = 20;
> +    V_VT(&var) = VT_BSTR;
> +    V_BSTR(&var) = SysAllocString(strW);
> +    hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_STR, &src_len, &dst_len, &var);
> +    ok(hr == S_OK, "got 0x%08x\n", hr);
> +    ok(dst_len == 5, "%ld\n", dst_len);
> +    VariantClear(&var);
> +
> +    dst_len = 0;
> +    src_len = 20;
> +    V_VT(&var) = VT_I4;
> +    V_I4(&var) = 4;
> +    hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_STR, &src_len, &dst_len, &var);
> +    ok(hr == S_OK, "got 0x%08x\n", hr);
> +    VariantClear(&var);
> +
> +    /* On Windows dst_len will get a value of 110 but we aren't testing this parameter. */
> +    V_VT(&var) = VT_NULL;
> +    hr = IDataConvert_GetConversionSize(convert, DBTYPE_VARIANT, DBTYPE_STR, NULL, &dst_len, &var);
> +    ok(hr == S_OK, "got 0x%08x\n", hr);
> +

Why did you put the comment on the 2nd VT_NULL conversion rather than the
first?  Same goes for the unneeded dst_len initiailization (which also
applies in the VT_I4 case).

If would probably make more sense to group these three together, i.e. move
the VT_BSTR case to the top, then have the comment, then the three tests
(all of which do not need the dst_len init).

Huw.



More information about the wine-devel mailing list