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
2a588697
Commit
2a588697
authored
Mar 17, 2015
by
Huw Davies
Committed by
Alexandre Julliard
Mar 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Don't resend a partial chunk to the edit stream callback.
It's basically used as a boolean to terminate the writing process if it's set to zero.
parent
cb1e8566
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
17 deletions
+37
-17
editor.c
dlls/riched20/tests/editor.c
+31
-0
writer.c
dlls/riched20/writer.c
+6
-17
No files found.
dlls/riched20/tests/editor.c
View file @
2a588697
...
...
@@ -3404,6 +3404,24 @@ static void test_WM_SETTEXT(void)
#undef TEST_SETTEXTW
}
/* Set *pcb to one to show that the remaining cb-1 bytes are not
resent to the callkack. */
static
DWORD
CALLBACK
test_esCallback_written_1
(
DWORD_PTR
dwCookie
,
LPBYTE
pbBuff
,
LONG
cb
,
LONG
*
pcb
)
{
char
**
str
=
(
char
**
)
dwCookie
;
ok
(
cb
==
*
pcb
,
"cb %d, *pcb %d
\n
"
,
cb
,
*
pcb
);
*
pcb
=
0
;
if
(
cb
>
0
)
{
memcpy
(
*
str
,
pbBuff
,
cb
);
*
str
+=
cb
;
*
pcb
=
1
;
}
return
0
;
}
static
void
test_EM_STREAMOUT
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
...
...
@@ -3452,6 +3470,19 @@ static void test_EM_STREAMOUT(void)
ok
(
strcmp
(
buf
,
TestItem3
)
==
0
,
"streamed text different, got %s
\n
"
,
buf
);
/* Use a callback that sets *pcb to one */
p
=
buf
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
p
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_esCallback_written_1
;
memset
(
buf
,
0
,
sizeof
(
buf
));
SendMessageA
(
hwndRichEdit
,
EM_STREAMOUT
,
SF_TEXT
,
(
LPARAM
)
&
es
);
r
=
strlen
(
buf
);
ok
(
r
==
14
,
"streamed text length is %d, expecting 14
\n
"
,
r
);
ok
(
strcmp
(
buf
,
TestItem3
)
==
0
,
"streamed text different, got %s
\n
"
,
buf
);
DestroyWindow
(
hwndRichEdit
);
}
...
...
dlls/riched20/writer.c
View file @
2a588697
...
...
@@ -49,29 +49,18 @@ ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream)
static
BOOL
ME_StreamOutFlush
(
ME_OutStream
*
pStream
)
{
LONG
nStart
=
0
;
LONG
nWritten
=
0
;
LONG
nRemaining
=
0
;
EDITSTREAM
*
stream
=
pStream
->
stream
;
while
(
nStart
<
pStream
->
pos
)
{
TRACE
(
"sending %u bytes
\n
"
,
pStream
->
pos
-
nStart
);
/* Some apps seem not to set *pcb unless a problem arises, relying
on initial random nWritten value, which is usually >STREAMOUT_BUFFER_SIZE */
nRemaining
=
pStream
->
pos
-
nStart
;
nWritten
=
0xDEADBEEF
;
stream
->
dwError
=
stream
->
pfnCallback
(
stream
->
dwCookie
,
(
LPBYTE
)
pStream
->
buffer
+
nStart
,
pStream
->
pos
-
nStart
,
&
nWritten
);
if
(
pStream
->
pos
)
{
TRACE
(
"sending %u bytes
\n
"
,
pStream
->
pos
);
nWritten
=
pStream
->
pos
;
stream
->
dwError
=
stream
->
pfnCallback
(
stream
->
dwCookie
,
(
LPBYTE
)
pStream
->
buffer
,
pStream
->
pos
,
&
nWritten
);
TRACE
(
"error=%u written=%u
\n
"
,
stream
->
dwError
,
nWritten
);
if
(
nWritten
>
(
pStream
->
pos
-
nStart
)
||
nWritten
<
0
)
{
FIXME
(
"Invalid returned written size *pcb: 0x%x (%d) instead of %d
\n
"
,
(
unsigned
)
nWritten
,
nWritten
,
nRemaining
);
nWritten
=
nRemaining
;
}
if
(
nWritten
==
0
||
stream
->
dwError
)
return
FALSE
;
pStream
->
written
+=
nWritten
;
nStart
+=
nWritten
;
/* Don't resend partial chunks if nWritten < pStream->pos */
}
pStream
->
pos
=
0
;
return
TRUE
;
...
...
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