oledb32: Implement DataConvert DBTYPE_BYTES->DBTYPE_BYTES.

This commit is contained in:
Alistair Leslie-Hughes 2013-04-18 11:22:47 +10:00 committed by Alexandre Julliard
parent 3dea8a69ec
commit c476d1785e
2 changed files with 44 additions and 0 deletions

View File

@ -794,6 +794,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
}
break;
}
case DBTYPE_BYTES:
{
BYTE *d = dst;
switch(src_type)
{
case DBTYPE_BYTES:
if( src_len > dst_max_len)
*dst_status = DBSTATUS_S_TRUNCATED;
else
*dst_status = DBSTATUS_S_OK;
*dst_len = src_len;
memcpy(d, src, min(src_len, dst_max_len));
return S_OK;
default: FIXME("Unimplemented conversion %04x -> DBTYPE_BYTES\n", src_type); return E_NOTIMPL;
}
break;
}
default:
FIXME("Unimplemented conversion %04x -> %04x\n", src_type, dst_type);

View File

@ -2424,6 +2424,29 @@ static void test_getconversionsize(void)
}
static void test_converttobytes(void)
{
DBLENGTH dst_len;
HRESULT hr;
BYTE byte_src[] = {0, 1, 2, 4, 5};
BYTE dst[10] = {0};
DBSTATUS dst_status;
dst_len = 0;
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_BYTES, sizeof(byte_src), &dst_len, byte_src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status);
ok(dst_len == sizeof(byte_src), "got %ld\n", dst_len);
ok(!memcmp(byte_src, dst, dst_len ), "bytes differ\n");
dst_len = 0;
hr = IDataConvert_DataConvert(convert, DBTYPE_BYTES, DBTYPE_BYTES, sizeof(byte_src), &dst_len, byte_src, &dst, 2, 0, &dst_status, 0, 0, 0);
ok(hr == S_OK, "got %08x\n", hr);
ok(dst_status == DBSTATUS_S_TRUNCATED, "got %08x\n", dst_status);
ok(dst_len == sizeof(byte_src), "got %ld\n", dst_len);
ok(!memcmp(byte_src, dst, 2 ), "bytes differ\n");
}
static void test_converttovar(void)
{
static WCHAR strW[] = {'t','e','s','t',0};
@ -2559,6 +2582,7 @@ START_TEST(convert)
test_converttocy();
test_converttoui8();
test_converttovar();
test_converttobytes();
test_getconversionsize();
IDataConvert_Release(convert);