[PATCH 1/2] oledb32: Convert to a BSTR to work out it size

Huw Davies huw at codeweavers.com
Tue Dec 22 02:52:13 CST 2015


On Tue, Dec 22, 2015 at 06:32:03PM +1100, Alistair Leslie-Hughes wrote:
> 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>
> ---
>  dlls/oledb32/convert.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c
> index 72714d3..a87cf18 100644
> --- a/dlls/oledb32/convert.c
> +++ b/dlls/oledb32/convert.c
> @@ -1372,10 +1372,22 @@ 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);
> +        {
> +            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);
> +            }
>              else
> +            {
>                  WARN("DBTYPE_VARIANT(%d)->DBTYPE_WSTR unimplemented\n", V_VT((VARIANT*)src));

This WARN should go away, then it will actually be consistent with the
DBTYPE_STR case.

Huw.



More information about the wine-devel mailing list