Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
714283c9
Commit
714283c9
authored
Apr 05, 2010
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Apr 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Implement conversion from DBTYPE_BYTES to DBTYPE_WSTR/DBTYPE_STR.
parent
ec7e2979
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
30 deletions
+24
-30
convert.c
dlls/oledb32/convert.c
+20
-0
convert.c
dlls/oledb32/tests/convert.c
+4
-30
No files found.
dlls/oledb32/convert.c
View file @
714283c9
...
...
@@ -352,6 +352,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
hr
=
*
d
?
S_OK
:
E_OUTOFMEMORY
;
}
break
;
case
DBTYPE_BYTES
:
{
*
d
=
SysAllocStringLen
(
NULL
,
2
*
src_len
);
if
(
*
d
==
NULL
)
hr
=
E_OUTOFMEMORY
;
else
{
const
char
hexchars
[]
=
"0123456789ABCDEF"
;
WCHAR
*
s
=
*
d
;
unsigned
char
*
p
=
src
;
while
(
src_len
>
0
)
{
*
s
++
=
hexchars
[(
*
p
>>
4
)
&
0x0F
];
*
s
++
=
hexchars
[(
*
p
)
&
0x0F
];
src_len
--
;
p
++
;
}
hr
=
S_OK
;
}
}
break
;
default:
FIXME
(
"Unimplemented conversion %04x -> BSTR
\n
"
,
src_type
);
return
E_NOTIMPL
;
}
break
;
...
...
dlls/oledb32/tests/convert.c
View file @
714283c9
...
...
@@ -1286,82 +1286,68 @@ static void test_converttowstr(void)
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
sizeof
(
hexpacked_w
),
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_w
)
*
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpW
(
hexunpacked_w
,
dst
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
}
ok
(
dst
[
sizeof
(
hexpacked_w
)
/
sizeof
(
WCHAR
)
*
4
+
1
]
==
0xcccc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
}
ok
(
dst_len
==
0
,
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
1
]
==
0xcccc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
4
,
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
2
*
sizeof
(
WCHAR
)
*
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_w
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
ok
(
dst
[
2
*
4
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
+
1
]
==
0xcccc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
sizeof
(
hexpacked_w
),
&
dst_len
,
src
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
+
sizeof
(
WCHAR
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_TRUNCATED
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_w
)
*
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_w
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
ok
(
dst
[
2
*
4
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
+
1
]
==
0xcccc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
sizeof
(
hexpacked_w
),
&
dst_len
,
src
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
+
1
,
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_TRUNCATED
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_w
)
*
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_w
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
-
2
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
ok
(
dst
[
2
*
4
-
1
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
]
==
0xcccc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
sizeof
(
hexpacked_w
),
&
dst_len
,
src
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
,
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_TRUNCATED
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_w
)
*
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_w
,
dst
,
2
*
sizeof
(
WCHAR
)
*
4
-
2
),
"got %s
\n
"
,
wine_dbgstr_w
(
dst
));
ok
(
dst
[
2
*
4
-
1
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
]
==
0xcccc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_w
,
sizeof
(
hexpacked_w
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_WSTR
,
0
,
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
DBDATACONVERT_LENGTHFROMNTS
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
}
ok
(
dst_len
==
0
,
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
1
]
==
0xcccc
,
"clobbered buffer
\n
"
);
...
...
@@ -1768,70 +1754,58 @@ static void test_converttostr(void)
memcpy
(
src
,
hexpacked_a
,
sizeof
(
hexpacked_a
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_STR
,
sizeof
(
hexpacked_a
),
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_a
)
*
2
,
"got %d
\n
"
,
dst_len
);
ok
(
!
lstrcmpA
(
hexunpacked_a
,
dst
),
"got %s
\n
"
,
dst
);
}
ok
(
dst
[
sizeof
(
hexpacked_a
)
/
sizeof
(
char
)
*
4
+
1
]
==
(
char
)
0xcc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_a
,
sizeof
(
hexpacked_a
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_STR
,
0
,
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
}
ok
(
dst_len
==
0
,
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
1
]
==
(
char
)
0xcc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_a
,
sizeof
(
hexpacked_a
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_STR
,
4
,
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
2
*
sizeof
(
char
)
*
4
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_a
,
dst
,
2
*
sizeof
(
char
)
*
4
),
"got %s
\n
"
,
dst
);
ok
(
dst
[
2
*
4
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
+
1
]
==
(
char
)
0xcc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_a
,
sizeof
(
hexpacked_a
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_STR
,
sizeof
(
hexpacked_a
),
&
dst_len
,
src
,
dst
,
2
*
sizeof
(
char
)
*
4
+
sizeof
(
char
),
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_TRUNCATED
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_a
)
*
2
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_a
,
dst
,
2
*
sizeof
(
char
)
*
4
),
"got %s
\n
"
,
dst
);
ok
(
dst
[
2
*
4
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
+
1
]
==
(
char
)
0xcc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_a
,
sizeof
(
hexpacked_a
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_STR
,
sizeof
(
hexpacked_a
),
&
dst_len
,
src
,
dst
,
2
*
sizeof
(
char
)
*
4
,
0
,
&
dst_status
,
0
,
0
,
0
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_TRUNCATED
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
sizeof
(
hexpacked_a
)
*
2
,
"got %d
\n
"
,
dst_len
);
ok
(
!
memcmp
(
hexunpacked_a
,
dst
,
2
*
sizeof
(
char
)
*
4
-
2
),
"got %s
\n
"
,
dst
);
ok
(
dst
[
2
*
4
-
1
]
==
0
,
"not null terminated
\n
"
);
}
ok
(
dst
[
2
*
4
]
==
(
char
)
0xcc
,
"clobbered buffer
\n
"
);
memcpy
(
src
,
hexpacked_a
,
sizeof
(
hexpacked_a
));
memset
(
dst
,
0xcc
,
sizeof
(
dst
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_BYTES
,
DBTYPE_STR
,
0
,
&
dst_len
,
src
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
DBDATACONVERT_LENGTHFROMNTS
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
}
ok
(
dst_len
==
0
,
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
0
]
==
0
,
"not null terminated
\n
"
);
ok
(
dst
[
1
]
==
(
char
)
0xcc
,
"clobbered buffer
\n
"
);
IDataConvert_Release
(
convert
);
...
...
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