msado15: Convert to Integer for field index.
Thanks Gabriel Ivăncescu. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0a4a7c4345
commit
f6fc0e2b77
|
@ -740,28 +740,24 @@ static HRESULT map_index( struct fields *fields, VARIANT *index, ULONG *ret )
|
|||
{
|
||||
ULONG i;
|
||||
|
||||
if (V_VT( index ) == VT_I4 || V_VT( index ) == VT_I2)
|
||||
if (V_VT( index ) != VT_BSTR)
|
||||
{
|
||||
if (V_VT( index ) == VT_I4)
|
||||
i = V_I4 ( index );
|
||||
else
|
||||
i = V_I2 ( index );
|
||||
VARIANT idx;
|
||||
|
||||
if (i < fields->count)
|
||||
VariantInit(&idx);
|
||||
if (VariantChangeType(&idx, index, 0, VT_UI4) == S_OK)
|
||||
{
|
||||
*ret = i;
|
||||
return S_OK;
|
||||
i = V_UI4 ( &idx );
|
||||
if (i < fields->count)
|
||||
{
|
||||
*ret = i;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return MAKE_ADO_HRESULT(adErrItemNotFound);
|
||||
}
|
||||
|
||||
if (V_VT( index ) != VT_BSTR)
|
||||
{
|
||||
FIXME( "variant type %u not supported\n", V_VT( index ) );
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
for (i = 0; i < fields->count; i++)
|
||||
{
|
||||
BSTR name;
|
||||
|
|
|
@ -150,6 +150,23 @@ static void test_Recordset(void)
|
|||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
Field_Release(field);
|
||||
|
||||
V_VT( &index ) = VT_I1;
|
||||
V_I1( &index ) = 0;
|
||||
hr = Fields_get_Item( fields, index, &field );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
Field_Release(field);
|
||||
|
||||
V_VT( &index ) = VT_R8;
|
||||
V_R8( &index ) = 0.1;
|
||||
hr = Fields_get_Item( fields, index, &field );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
Field_Release(field);
|
||||
|
||||
V_VT( &index ) = VT_UNKNOWN;
|
||||
V_UNKNOWN( &index ) = NULL;
|
||||
hr = Fields_get_Item( fields, index, &field );
|
||||
ok( hr == MAKE_ADO_HRESULT(adErrItemNotFound), "got %08x\n", hr );
|
||||
|
||||
V_VT( &index ) = VT_BSTR;
|
||||
V_BSTR( &index ) = name;
|
||||
hr = Fields_get_Item( fields, index, &field );
|
||||
|
|
Loading…
Reference in New Issue