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
14de4451
Commit
14de4451
authored
Nov 07, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Add ITextStream::ReadLine implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c80e16ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
filesystem.c
dlls/scrrun/filesystem.c
+24
-9
filesystem.c
dlls/scrrun/tests/filesystem.c
+0
-6
No files found.
dlls/scrrun/filesystem.c
View file @
14de4451
...
...
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <limits.h>
#include <assert.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -499,10 +500,11 @@ static HRESULT WINAPI textstream_Read(ITextStream *iface, LONG len, BSTR *text)
static
HRESULT
WINAPI
textstream_ReadLine
(
ITextStream
*
iface
,
BSTR
*
text
)
{
struct
textstream
*
This
=
impl_from_ITextStream
(
iface
);
VARIANT_BOOL
eos
;
HRESULT
hr
;
unsigned
int
skip
=
0
;
const
WCHAR
*
nl
;
HRESULT
hr
=
S_OK
;
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
text
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
text
);
if
(
!
text
)
return
E_POINTER
;
...
...
@@ -511,15 +513,28 @@ static HRESULT WINAPI textstream_ReadLine(ITextStream *iface, BSTR *text)
if
(
textstream_check_iomode
(
This
,
IORead
))
return
CTL_E_BADFILEMODE
;
/* check for EOF */
hr
=
ITextStream_get_AtEndOfStream
(
iface
,
&
eos
);
if
(
FAILED
(
hr
))
return
hr
;
while
(
!
(
nl
=
wmemchr
(
This
->
read_buf
,
'\n'
,
This
->
read_buf_size
))
&&
!
This
->
eof
)
{
if
(
FAILED
(
hr
=
read_more_data
(
This
)))
return
hr
;
}
if
(
eos
==
VARIANT_TRUE
)
if
(
This
->
eof
&&
!
This
->
read_buf_size
)
return
CTL_E_ENDOFFILE
;
return
E_NOTIMPL
;
if
(
!
nl
)
{
nl
=
This
->
read_buf
+
This
->
read_buf_size
;
hr
=
S_FALSE
;
}
else
if
(
nl
>
This
->
read_buf
&&
nl
[
-
1
]
==
'\r'
)
{
nl
--
;
skip
=
2
;
}
else
skip
=
1
;
return
read_from_buffer
(
This
,
nl
-
This
->
read_buf
,
text
,
skip
)
?
hr
:
E_OUTOFMEMORY
;
}
static
HRESULT
WINAPI
textstream_ReadAll
(
ITextStream
*
iface
,
BSTR
*
text
)
...
...
dlls/scrrun/tests/filesystem.c
View file @
14de4451
...
...
@@ -1732,10 +1732,8 @@ static void test_ReadAll(void)
str
=
NULL
;
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
str
!=
NULL
,
"got %p
\n
"
,
str
);
}
SysFreeString
(
str
);
lstrcpyW
(
buffW
,
secondlineW
);
...
...
@@ -1743,7 +1741,6 @@ todo_wine {
str
=
NULL
;
hr
=
ITextStream_ReadAll
(
stream
,
&
str
);
ok
(
hr
==
S_FALSE
||
broken
(
hr
==
S_OK
)
/* win2k */
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpW
(
buffW
,
str
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
ITextStream_Release
(
stream
);
...
...
@@ -1880,10 +1877,8 @@ static void test_Read(void)
str
=
NULL
;
hr
=
ITextStream_ReadLine
(
stream
,
&
str
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
str
!=
NULL
,
"got %p
\n
"
,
str
);
}
SysFreeString
(
str
);
lstrcpyW
(
buffW
,
secondlineW
);
...
...
@@ -1891,7 +1886,6 @@ todo_wine {
str
=
NULL
;
hr
=
ITextStream_Read
(
stream
,
100
,
&
str
);
ok
(
hr
==
S_FALSE
||
broken
(
hr
==
S_OK
)
/* win2k */
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
ok
(
!
lstrcmpW
(
buffW
,
str
),
"got %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
ITextStream_Release
(
stream
);
...
...
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