Commit c476d178 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

oledb32: Implement DataConvert DBTYPE_BYTES->DBTYPE_BYTES.

parent 3dea8a69
...@@ -794,6 +794,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, ...@@ -794,6 +794,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
} }
break; 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: default:
FIXME("Unimplemented conversion %04x -> %04x\n", src_type, dst_type); FIXME("Unimplemented conversion %04x -> %04x\n", src_type, dst_type);
......
...@@ -2424,6 +2424,29 @@ static void test_getconversionsize(void) ...@@ -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 void test_converttovar(void)
{ {
static WCHAR strW[] = {'t','e','s','t',0}; static WCHAR strW[] = {'t','e','s','t',0};
...@@ -2559,6 +2582,7 @@ START_TEST(convert) ...@@ -2559,6 +2582,7 @@ START_TEST(convert)
test_converttocy(); test_converttocy();
test_converttoui8(); test_converttoui8();
test_converttovar(); test_converttovar();
test_converttobytes();
test_getconversionsize(); test_getconversionsize();
IDataConvert_Release(convert); IDataConvert_Release(convert);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment