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
5bd304bd
Commit
5bd304bd
authored
Oct 11, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Oct 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: The text extents functions fail if passed a negative count.
parent
2b1c639f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
11 deletions
+35
-11
font.c
dlls/gdi32/font.c
+26
-11
font.c
dlls/gdi32/tests/font.c
+9
-0
No files found.
dlls/gdi32/font.c
View file @
5bd304bd
...
...
@@ -920,9 +920,14 @@ BOOL WINAPI GetTextExtentPoint32A( HDC hdc, LPCSTR str, INT count,
{
BOOL
ret
=
FALSE
;
INT
wlen
;
LPWSTR
p
=
FONT_mbtowc
(
hdc
,
str
,
count
,
&
wlen
,
NULL
);
LPWSTR
p
;
if
(
count
<
0
)
return
FALSE
;
if
(
p
)
{
p
=
FONT_mbtowc
(
hdc
,
str
,
count
,
&
wlen
,
NULL
);
if
(
p
)
{
ret
=
GetTextExtentPoint32W
(
hdc
,
p
,
wlen
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
}
...
...
@@ -975,10 +980,15 @@ BOOL WINAPI GetTextExtentExPointI( HDC hdc, const WORD *indices, INT count, INT
LPINT
nfit
,
LPINT
dxs
,
LPSIZE
size
)
{
BOOL
ret
=
FALSE
;
DC
*
dc
=
get_dc_ptr
(
hdc
);
DC
*
dc
;
if
(
count
<
0
)
return
FALSE
;
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
dc
->
gdiFont
)
{
if
(
dc
->
gdiFont
)
{
ret
=
WineEngGetTextExtentExPointI
(
dc
->
gdiFont
,
indices
,
count
,
max_ext
,
nfit
,
dxs
,
size
);
size
->
cx
=
abs
(
INTERNAL_XDSTOWS
(
dc
,
size
->
cx
));
size
->
cy
=
abs
(
INTERNAL_YDSTOWS
(
dc
,
size
->
cy
));
...
...
@@ -1051,11 +1061,15 @@ BOOL WINAPI GetTextExtentExPointA( HDC hdc, LPCSTR str, INT count,
INT
wlen
;
INT
*
walpDx
=
NULL
;
LPWSTR
p
=
NULL
;
if
(
alpDx
&&
NULL
==
(
walpDx
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
INT
))))
return
FALSE
;
if
(
count
<
0
)
return
FALSE
;
if
(
alpDx
)
{
walpDx
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
INT
)
);
if
(
!
walpDx
)
return
FALSE
;
}
p
=
FONT_mbtowc
(
hdc
,
str
,
count
,
&
wlen
,
NULL
);
ret
=
GetTextExtentExPointW
(
hdc
,
p
,
wlen
,
maxExt
,
lpnFit
,
walpDx
,
size
);
if
(
walpDx
)
...
...
@@ -1118,9 +1132,10 @@ BOOL WINAPI GetTextExtentExPointW( HDC hdc, LPCWSTR str, INT count,
TRACE
(
"(%p, %s, %d)
\n
"
,
hdc
,
debugstr_wn
(
str
,
count
),
maxExt
);
if
(
count
<
0
)
return
FALSE
;
dc
=
get_dc_ptr
(
hdc
);
if
(
!
dc
)
return
FALSE
;
if
(
!
dc
)
return
FALSE
;
GetTextMetricsW
(
hdc
,
&
tm
);
...
...
dlls/gdi32/tests/font.c
View file @
5bd304bd
...
...
@@ -1054,6 +1054,7 @@ static void test_text_extents(void)
HFONT
hfont
;
SIZE
sz
;
SIZE
sz1
,
sz2
;
BOOL
ret
;
memset
(
&
lf
,
0
,
sizeof
(
lf
));
strcpy
(
lf
.
lfFaceName
,
"Arial"
);
...
...
@@ -1110,6 +1111,14 @@ static void test_text_extents(void)
"GetTextExtentExPointW with lpnFit and alpDx both NULL returns incorrect results
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
extents
);
/* extents functions fail with -ve counts (the interesting case being -1) */
ret
=
GetTextExtentPointA
(
hdc
,
"o"
,
-
1
,
&
sz
);
ok
(
ret
==
FALSE
,
"got %d
\n
"
,
ret
);
ret
=
GetTextExtentExPointA
(
hdc
,
"o"
,
-
1
,
0
,
NULL
,
NULL
,
&
sz
);
ok
(
ret
==
FALSE
,
"got %d
\n
"
,
ret
);
ret
=
GetTextExtentExPointW
(
hdc
,
wt
,
-
1
,
0
,
NULL
,
NULL
,
&
sz1
);
ok
(
ret
==
FALSE
,
"got %d
\n
"
,
ret
);
hfont
=
SelectObject
(
hdc
,
hfont
);
DeleteObject
(
hfont
);
ReleaseDC
(
NULL
,
hdc
);
...
...
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