Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
471bdafa
Commit
471bdafa
authored
May 24, 2013
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
May 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Implement DataConvert DBTYPE_VARIANT->DBTYPE_BYTES.
parent
40fcf667
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
convert.c
dlls/oledb32/convert.c
+43
-0
convert.c
dlls/oledb32/tests/convert.c
+25
-0
No files found.
dlls/oledb32/convert.c
View file @
471bdafa
...
...
@@ -995,6 +995,49 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
memcpy
(
d
,
src
,
min
(
src_len
,
dst_max_len
));
return
S_OK
;
case
DBTYPE_VARIANT
:
{
if
(
V_VT
((
VARIANT
*
)
src
)
==
VT_NULL
)
{
*
dst_status
=
DBSTATUS_S_ISNULL
;
*
dst_len
=
0
;
return
S_OK
;
}
else
{
switch
(
V_VT
((
VARIANT
*
)
src
))
{
case
VT_UI1
|
VT_ARRAY
:
{
LONG
l
;
BYTE
*
data
=
NULL
;
hr
=
SafeArrayGetUBound
(
V_ARRAY
((
VARIANT
*
)
src
),
1
,
&
l
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
SafeArrayAccessData
(
V_ARRAY
((
VARIANT
*
)
src
),
(
VOID
**
)
&
data
);
if
(
FAILED
(
hr
))
{
ERR
(
"SafeArrayAccessData Failed = 0x%08x
\n
"
,
hr
);
return
hr
;
}
*
dst_len
=
l
+
1
;
*
dst_status
=
DBSTATUS_S_OK
;
memcpy
(
d
,
data
,
*
dst_len
);
SafeArrayUnaccessData
(
V_ARRAY
((
VARIANT
*
)
src
));
return
S_OK
;
}
break
;
default:
FIXME
(
"Unimplemented variant type %d -> BYTES
\n
"
,
V_VT
((
VARIANT
*
)
src
));
return
E_NOTIMPL
;
}
}
}
break
;
default:
FIXME
(
"Unimplemented conversion %04x -> DBTYPE_BYTES
\n
"
,
src_type
);
return
E_NOTIMPL
;
}
break
;
...
...
dlls/oledb32/tests/convert.c
View file @
471bdafa
...
...
@@ -2500,8 +2500,12 @@ static void test_converttobytes(void)
DBLENGTH
dst_len
;
HRESULT
hr
;
BYTE
byte_src
[]
=
{
0
,
1
,
2
,
4
,
5
};
BYTE
byte_dst
[]
=
{
0
,
0
,
0
,
0
,
0
};
BYTE
dst
[
10
]
=
{
0
};
DBSTATUS
dst_status
;
VARIANT
v
;
SAFEARRAY
*
psa
=
NULL
;
SAFEARRAYBOUND
rgsabound
[
1
];
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
);
...
...
@@ -2516,6 +2520,27 @@ static void test_converttobytes(void)
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
"
);
V_VT
(
&
v
)
=
VT_NULL
;
dst_len
=
0
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_BYTES
,
sizeof
(
v
),
&
dst_len
,
&
v
,
&
dst
,
2
,
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_ISNULL
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
0
,
"got %ld
\n
"
,
dst_len
);
dst_len
=
0
;
rgsabound
[
0
].
lLbound
=
0
;
rgsabound
[
0
].
cElements
=
4
;
psa
=
SafeArrayCreate
(
VT_UI1
,
1
,
rgsabound
);
V_VT
(
&
v
)
=
VT_ARRAY
|
VT_UI1
;
V_ARRAY
(
&
v
)
=
psa
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_BYTES
,
sizeof
(
v
),
&
dst_len
,
&
v
,
&
dst
,
10
,
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
dst_len
==
4
,
"%ld
\n
"
,
dst_len
);
ok
(
!
memcmp
(
byte_dst
,
dst
,
dst_len
),
"bytes differ
\n
"
);
VariantClear
(
&
v
);
}
static
void
test_converttobytesbyref
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment