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
4a61c1d2
Commit
4a61c1d2
authored
Sep 22, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Sep 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Implement DBTYPE_STR and DBTYPE_WSTR src types.
parent
a3d947c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
17 deletions
+42
-17
convert.c
dlls/oledb32/convert.c
+42
-1
convert.c
dlls/oledb32/tests/convert.c
+0
-16
No files found.
dlls/oledb32/convert.c
View file @
4a61c1d2
...
...
@@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "ole2.h"
#include "msdadc.h"
#include "oledberr.h"
...
...
@@ -143,7 +144,7 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
convert
*
This
=
impl_from_IDataConvert
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%d, %d, %d, %p, %p, %p, %d, %d, %p, %d, %d, %x)
: stub
\n
"
,
This
,
TRACE
(
"(%p)->(%d, %d, %d, %p, %p, %p, %d, %d, %p, %d, %d, %x)
\n
"
,
This
,
src_type
,
dst_type
,
src_len
,
dst_len
,
src
,
dst
,
dst_max_len
,
src_status
,
dst_status
,
precision
,
scale
,
flags
);
...
...
@@ -155,6 +156,46 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
return
DB_E_UNSUPPORTEDCONVERSION
;
}
if
(
src_type
==
DBTYPE_STR
)
{
BSTR
b
;
DWORD
len
;
if
(
flags
&
DBDATACONVERT_LENGTHFROMNTS
)
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
NULL
,
0
)
-
1
;
else
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
src_len
,
NULL
,
0
);
b
=
SysAllocStringLen
(
NULL
,
len
);
if
(
!
b
)
return
E_OUTOFMEMORY
;
if
(
flags
&
DBDATACONVERT_LENGTHFROMNTS
)
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
b
,
len
+
1
);
else
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
src_len
,
b
,
len
);
hr
=
IDataConvert_DataConvert
(
iface
,
DBTYPE_BSTR
,
dst_type
,
0
,
dst_len
,
&
b
,
dst
,
dst_max_len
,
src_status
,
dst_status
,
precision
,
scale
,
flags
);
SysFreeString
(
b
);
return
hr
;
}
if
(
src_type
==
DBTYPE_WSTR
)
{
BSTR
b
;
if
(
flags
&
DBDATACONVERT_LENGTHFROMNTS
)
b
=
SysAllocString
(
src
);
else
b
=
SysAllocStringLen
(
src
,
src_len
/
2
);
if
(
!
b
)
return
E_OUTOFMEMORY
;
hr
=
IDataConvert_DataConvert
(
iface
,
DBTYPE_BSTR
,
dst_type
,
0
,
dst_len
,
&
b
,
dst
,
dst_max_len
,
src_status
,
dst_status
,
precision
,
scale
,
flags
);
SysFreeString
(
b
);
return
hr
;
}
switch
(
dst_type
)
{
case
DBTYPE_I4
:
...
...
dlls/oledb32/tests/convert.c
View file @
4a61c1d2
...
...
@@ -541,49 +541,33 @@ todo_wine
i4
=
0x12345678
;
strcpy
((
char
*
)
src
,
"10"
);
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_STR
,
DBTYPE_I4
,
2
,
&
dst_len
,
src
,
&
i4
,
sizeof
(
i4
),
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
(
i4
),
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
i4
==
10
,
"got %08x
\n
"
,
i4
);
i4
=
0x12345678
;
strcpy
((
char
*
)
src
,
"10"
);
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_STR
,
DBTYPE_I4
,
0
,
&
dst_len
,
src
,
&
i4
,
sizeof
(
i4
),
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
==
sizeof
(
i4
),
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
i4
==
10
,
"got %08x
\n
"
,
i4
);
i4
=
0x12345678
;
memcpy
(
src
,
ten
,
sizeof
(
ten
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_WSTR
,
DBTYPE_I4
,
4
,
&
dst_len
,
src
,
&
i4
,
sizeof
(
i4
),
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
(
i4
),
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
i4
==
10
,
"got %08x
\n
"
,
i4
);
i4
=
0x12345678
;
memcpy
(
src
,
ten
,
sizeof
(
ten
));
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_WSTR
,
DBTYPE_I4
,
0
,
&
dst_len
,
src
,
&
i4
,
sizeof
(
i4
),
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
==
sizeof
(
i4
),
"got %d
\n
"
,
dst_len
);
todo_wine
ok
(
i4
==
10
,
"got %08x
\n
"
,
i4
);
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