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
be5105e8
Commit
be5105e8
authored
Sep 26, 2007
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Sep 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: EM_SETCHARFORMAT must return 0, not assert, on invalid struct size.
parent
cbd75d3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
2 deletions
+77
-2
editor.c
dlls/riched20/editor.c
+1
-0
style.c
dlls/riched20/style.c
+1
-2
editor.c
dlls/riched20/tests/editor.c
+75
-0
No files found.
dlls/riched20/editor.c
View file @
be5105e8
...
...
@@ -1732,6 +1732,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
CHARFORMAT2W
buf
,
*
p
;
BOOL
bRepaint
=
TRUE
;
p
=
ME_ToCF2W
(
&
buf
,
(
CHARFORMAT2W
*
)
lParam
);
if
(
p
==
NULL
)
return
0
;
if
(
!
wParam
||
(
editor
->
mode
&
TM_PLAINTEXT
))
ME_SetDefaultCharFormat
(
editor
,
p
);
else
if
(
wParam
==
(
SCF_WORD
|
SCF_SELECTION
))
...
...
dlls/riched20/style.c
View file @
be5105e8
...
...
@@ -60,8 +60,7 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
return
to
;
}
assert
(
from
->
cbSize
>=
sizeof
(
CHARFORMAT2W
));
return
from
;
return
(
from
->
cbSize
>=
sizeof
(
CHARFORMAT2W
))
?
from
:
NULL
;
}
void
ME_CopyToCF2W
(
CHARFORMAT2W
*
to
,
CHARFORMAT2W
*
from
)
...
...
dlls/riched20/tests/editor.c
View file @
be5105e8
...
...
@@ -333,6 +333,80 @@ static void test_EM_SCROLLCARET(void)
DestroyWindow
(
hwndRichEdit
);
}
static
void
test_EM_SETCHARFORMAT
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
CHARFORMAT2
cf2
;
int
rc
=
0
;
/* Invalid flags, CHARFORMAT2 structure blanked out */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
0xfffffff0
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
0
,
"EM_SETCHARFORMAT returned %d instead of 0
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure blanked out */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_DEFAULT
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
0
,
"EM_SETCHARFORMAT returned %d instead of 0
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure blanked out */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
0
,
"EM_SETCHARFORMAT returned %d instead of 0
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure blanked out */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_WORD
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
0
,
"EM_SETCHARFORMAT returned %d instead of 0
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure blanked out */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_ALL
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
0
,
"EM_SETCHARFORMAT returned %d instead of 0
\n
"
,
rc
);
/* Invalid flags, CHARFORMAT2 structure minimally filled */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
0xfffffff0
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
1
,
"EM_SETCHARFORMAT returned %d instead of 1
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure minimally filled */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_DEFAULT
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
1
,
"EM_SETCHARFORMAT returned %d instead of 1
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure minimally filled */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_SELECTION
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
1
,
"EM_SETCHARFORMAT returned %d instead of 1
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure minimally filled */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_WORD
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
1
,
"EM_SETCHARFORMAT returned %d instead of 1
\n
"
,
rc
);
/* A valid flag, CHARFORMAT2 structure minimally filled */
memset
(
&
cf2
,
0
,
sizeof
(
cf2
));
cf2
.
cbSize
=
sizeof
(
CHARFORMAT2
);
rc
=
SendMessage
(
hwndRichEdit
,
EM_SETCHARFORMAT
,
(
WPARAM
)
SCF_ALL
,
(
LPARAM
)
&
cf2
);
ok
(
rc
==
1
,
"EM_SETCHARFORMAT returned %d instead of 1
\n
"
,
rc
);
DestroyWindow
(
hwndRichEdit
);
}
static
void
test_EM_SETTEXTMODE
(
void
)
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
...
...
@@ -2125,6 +2199,7 @@ START_TEST( editor )
test_EM_SCROLLCARET
();
test_EM_SCROLL
();
test_WM_SETTEXT
();
test_EM_SETCHARFORMAT
();
test_EM_SETTEXTMODE
();
test_TM_PLAINTEXT
();
test_EM_SETOPTIONS
();
...
...
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