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
0ec13316
Commit
0ec13316
authored
Jun 15, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Validate format property values.
parent
8dd93c7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
layout.c
dlls/dwrite/layout.c
+20
-0
layout.c
dlls/dwrite/tests/layout.c
+18
-0
No files found.
dlls/dwrite/layout.c
View file @
0ec13316
...
...
@@ -3615,7 +3615,12 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat1 *iface)
static
HRESULT
WINAPI
dwritetextformat_SetTextAlignment
(
IDWriteTextFormat1
*
iface
,
DWRITE_TEXT_ALIGNMENT
alignment
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
alignment
);
if
((
UINT32
)
alignment
>
DWRITE_TEXT_ALIGNMENT_JUSTIFIED
)
return
E_INVALIDARG
;
This
->
format
.
textalignment
=
alignment
;
return
S_OK
;
}
...
...
@@ -3623,7 +3628,12 @@ static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat1 *ifac
static
HRESULT
WINAPI
dwritetextformat_SetParagraphAlignment
(
IDWriteTextFormat1
*
iface
,
DWRITE_PARAGRAPH_ALIGNMENT
alignment
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
alignment
);
if
((
UINT32
)
alignment
>
DWRITE_PARAGRAPH_ALIGNMENT_CENTER
)
return
E_INVALIDARG
;
This
->
format
.
paralign
=
alignment
;
return
S_OK
;
}
...
...
@@ -3631,7 +3641,12 @@ static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat1
static
HRESULT
WINAPI
dwritetextformat_SetWordWrapping
(
IDWriteTextFormat1
*
iface
,
DWRITE_WORD_WRAPPING
wrapping
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
wrapping
);
if
((
UINT32
)
wrapping
>
DWRITE_WORD_WRAPPING_CHARACTER
)
return
E_INVALIDARG
;
This
->
format
.
wrapping
=
wrapping
;
return
S_OK
;
}
...
...
@@ -3688,7 +3703,12 @@ static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat1 *iface,
FLOAT
spacing
,
FLOAT
baseline
)
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
TRACE
(
"(%p)->(%d %f %f)
\n
"
,
This
,
method
,
spacing
,
baseline
);
if
(
spacing
<
0
.
0
||
(
UINT32
)
method
>
DWRITE_LINE_SPACING_METHOD_UNIFORM
)
return
E_INVALIDARG
;
This
->
format
.
spacingmethod
=
method
;
This
->
format
.
spacing
=
spacing
;
This
->
format
.
baseline
=
baseline
;
...
...
dlls/dwrite/tests/layout.c
View file @
0ec13316
...
...
@@ -849,12 +849,21 @@ if (0) /* crashes on native */
hr
=
IDWriteTextFormat_SetTextAlignment
(
format
,
DWRITE_TEXT_ALIGNMENT_LEADING
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetTextAlignment
(
format
,
DWRITE_TEXT_ALIGNMENT_JUSTIFIED
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetParagraphAlignment
(
format
,
DWRITE_PARAGRAPH_ALIGNMENT_NEAR
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetParagraphAlignment
(
format
,
DWRITE_PARAGRAPH_ALIGNMENT_CENTER
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetWordWrapping
(
format
,
DWRITE_WORD_WRAPPING_WRAP
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetWordWrapping
(
format
,
DWRITE_WORD_WRAPPING_CHARACTER
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetReadingDirection
(
format
,
DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
...
...
@@ -864,6 +873,15 @@ if (0) /* crashes on native */
hr
=
IDWriteTextFormat_SetLineSpacing
(
format
,
DWRITE_LINE_SPACING_METHOD_DEFAULT
,
0
.
0
,
0
.
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetLineSpacing
(
format
,
DWRITE_LINE_SPACING_METHOD_DEFAULT
,
0
.
0
,
-
10
.
0
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetLineSpacing
(
format
,
DWRITE_LINE_SPACING_METHOD_DEFAULT
,
-
10
.
0
,
0
.
0
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetLineSpacing
(
format
,
DWRITE_LINE_SPACING_METHOD_UNIFORM
+
1
,
0
.
0
,
0
.
0
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IDWriteTextFormat_SetTrimming
(
format
,
&
trimming
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%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