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
65200440
Commit
65200440
authored
Dec 10, 2019
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msado15: Implement _Stream_ReadText and _Stream_WriteText.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3e6b9394
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
4 deletions
+105
-4
stream.c
dlls/msado15/stream.c
+54
-4
msado15.c
dlls/msado15/tests/msado15.c
+51
-0
No files found.
dlls/msado15/stream.c
View file @
65200440
...
...
@@ -400,14 +400,64 @@ static HRESULT WINAPI stream_LoadFromFile( _Stream *iface, BSTR filename )
static
HRESULT
WINAPI
stream_ReadText
(
_Stream
*
iface
,
LONG
len
,
BSTR
*
ret
)
{
FIXME
(
"%p, %d, %p
\n
"
,
iface
,
len
,
ret
);
return
E_NOTIMPL
;
struct
stream
*
stream
=
impl_from_Stream
(
iface
);
BSTR
str
;
TRACE
(
"%p, %d, %p
\n
"
,
stream
,
len
,
ret
);
if
(
len
==
adReadLine
)
{
FIXME
(
"adReadLine not supported
\n
"
);
return
E_NOTIMPL
;
}
if
(
stream
->
charset
&&
wcscmp
(
stream
->
charset
,
L"Unicode"
))
{
FIXME
(
"charset %s not supported
\n
"
,
debugstr_w
(
stream
->
charset
)
);
return
E_NOTIMPL
;
}
if
(
stream
->
type
!=
adTypeText
)
return
MAKE_ADO_HRESULT
(
adErrIllegalOperation
);
if
(
len
<
adReadLine
)
return
MAKE_ADO_HRESULT
(
adErrInvalidArgument
);
if
(
len
==
adReadAll
)
len
=
(
stream
->
size
-
stream
->
pos
)
/
sizeof
(
WCHAR
);
else
len
=
min
(
len
,
stream
->
size
-
stream
->
pos
/
sizeof
(
WCHAR
)
);
if
(
!
(
str
=
SysAllocStringLen
(
NULL
,
len
)))
return
E_OUTOFMEMORY
;
memcpy
(
str
,
stream
->
buf
+
stream
->
pos
,
len
*
sizeof
(
WCHAR
)
);
str
[
len
]
=
0
;
stream
->
pos
+=
len
*
sizeof
(
WCHAR
);
*
ret
=
str
;
return
S_OK
;
}
static
HRESULT
WINAPI
stream_WriteText
(
_Stream
*
iface
,
BSTR
data
,
StreamWriteEnum
options
)
{
FIXME
(
"%p, %s, %u
\n
"
,
iface
,
debugstr_w
(
data
),
options
);
return
E_NOTIMPL
;
struct
stream
*
stream
=
impl_from_Stream
(
iface
);
HRESULT
hr
;
LONG
size
;
TRACE
(
"%p, %s, %u
\n
"
,
stream
,
debugstr_w
(
data
),
options
);
if
(
options
!=
adWriteChar
)
{
FIXME
(
"options %u not supported
\n
"
,
options
);
return
E_NOTIMPL
;
}
if
(
stream
->
charset
&&
wcscmp
(
stream
->
charset
,
L"Unicode"
))
{
FIXME
(
"charset %s not supported
\n
"
,
debugstr_w
(
stream
->
charset
)
);
return
E_NOTIMPL
;
}
if
(
stream
->
type
!=
adTypeText
)
return
MAKE_ADO_HRESULT
(
adErrIllegalOperation
);
size
=
(
lstrlenW
(
data
)
+
1
)
*
sizeof
(
WCHAR
);
if
((
hr
=
resize_buffer
(
stream
,
stream
->
size
+
size
))
!=
S_OK
)
return
hr
;
memcpy
(
stream
->
buf
+
stream
->
pos
,
data
,
size
);
stream
->
pos
+=
size
;
return
S_OK
;
}
static
HRESULT
WINAPI
stream_Cancel
(
_Stream
*
iface
)
...
...
dlls/msado15/tests/msado15.c
View file @
65200440
...
...
@@ -162,11 +162,54 @@ static void test_Stream(void)
hr
=
_Stream_Read
(
stream
,
2
,
&
val
);
ok
(
hr
==
MAKE_ADO_HRESULT
(
adErrIllegalOperation
),
"got %08x
\n
"
,
hr
);
hr
=
_Stream_ReadText
(
stream
,
2
,
&
str
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
str
[
0
],
"got %s
\n
"
,
wine_dbgstr_w
(
str
)
);
SysFreeString
(
str
);
pos
=
-
1
;
hr
=
_Stream_get_Position
(
stream
,
&
pos
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
pos
,
"got %d
\n
"
,
pos
);
str
=
SysAllocString
(
L"test"
);
hr
=
_Stream_WriteText
(
stream
,
str
,
adWriteChar
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
str
);
hr
=
_Stream_ReadText
(
stream
,
adReadAll
,
&
str
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
str
[
0
],
"got %s
\n
"
,
wine_dbgstr_w
(
str
)
);
SysFreeString
(
str
);
hr
=
_Stream_put_Position
(
stream
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
_Stream_ReadText
(
stream
,
adReadAll
,
&
str
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
L"test"
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
)
);
SysFreeString
(
str
);
pos
=
-
1
;
hr
=
_Stream_get_Position
(
stream
,
&
pos
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
pos
==
10
,
"got %d
\n
"
,
pos
);
eos
=
VARIANT_FALSE
;
hr
=
_Stream_get_EOS
(
stream
,
&
eos
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
eos
==
VARIANT_TRUE
,
"got %04x
\n
"
,
eos
);
hr
=
_Stream_put_Position
(
stream
,
6
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
size
=
-
1
;
hr
=
_Stream_get_Size
(
stream
,
&
size
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
size
==
10
,
"got %d
\n
"
,
size
);
hr
=
_Stream_put_Position
(
stream
,
2
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
_Stream_Close
(
stream
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -191,6 +234,14 @@ static void test_Stream(void)
hr
=
_Stream_Open
(
stream
,
missing
,
adModeUnknown
,
adOpenStreamUnspecified
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
_Stream_ReadText
(
stream
,
adReadAll
,
&
str
);
ok
(
hr
==
MAKE_ADO_HRESULT
(
adErrIllegalOperation
),
"got %08x
\n
"
,
hr
);
str
=
SysAllocString
(
L"test"
);
hr
=
_Stream_WriteText
(
stream
,
str
,
adWriteChar
);
ok
(
hr
==
MAKE_ADO_HRESULT
(
adErrIllegalOperation
),
"got %08x
\n
"
,
hr
);
SysFreeString
(
str
);
VariantInit
(
&
val
);
hr
=
_Stream_Read
(
stream
,
1
,
&
val
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
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