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
a88973a5
Commit
a88973a5
authored
Mar 21, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Store length of window text instead of null-terminating it.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
78846662
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
window.c
server/window.c
+13
-16
No files found.
server/window.c
View file @
a88973a5
...
...
@@ -88,6 +88,7 @@ struct window
DPI_AWARENESS
dpi_awareness
;
/* DPI awareness mode */
lparam_t
user_data
;
/* user-specific data */
WCHAR
*
text
;
/* window caption text */
data_size_t
text_len
;
/* length of window caption */
unsigned
int
paint_flags
;
/* various painting flags */
int
prop_inuse
;
/* number of in-use window properties */
int
prop_alloc
;
/* number of allocated window properties */
...
...
@@ -506,6 +507,7 @@ static struct window *create_window( struct window *parent, struct window *owner
win
->
dpi
=
0
;
win
->
user_data
=
0
;
win
->
text
=
NULL
;
win
->
text_len
=
0
;
win
->
paint_flags
=
0
;
win
->
prop_inuse
=
0
;
win
->
prop_alloc
=
0
;
...
...
@@ -2407,10 +2409,10 @@ DECL_HANDLER(get_window_text)
{
struct
window
*
win
=
get_window
(
req
->
handle
);
if
(
win
&&
win
->
text
)
if
(
win
&&
win
->
text
_len
)
{
reply
->
length
=
strlenW
(
win
->
text
);
set_reply_data
(
win
->
text
,
min
(
reply
->
length
*
sizeof
(
WCHAR
)
,
get_reply_max_size
()
));
reply
->
length
=
win
->
text_len
/
sizeof
(
WCHAR
);
set_reply_data
(
win
->
text
,
min
(
win
->
text_len
,
get_reply_max_size
()
));
}
}
...
...
@@ -2418,21 +2420,16 @@ DECL_HANDLER(get_window_text)
/* set the window text */
DECL_HANDLER
(
set_window_text
)
{
data_size_t
len
;
WCHAR
*
text
=
NULL
;
struct
window
*
win
=
get_window
(
req
->
handle
);
if
(
win
)
{
WCHAR
*
text
=
NULL
;
data_size_t
len
=
get_req_data_size
()
/
sizeof
(
WCHAR
);
if
(
len
)
{
if
(
!
(
text
=
mem_alloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
;
memcpy
(
text
,
get_req_data
(),
len
*
sizeof
(
WCHAR
)
);
text
[
len
]
=
0
;
}
free
(
win
->
text
);
win
->
text
=
text
;
}
if
(
!
win
)
return
;
len
=
(
get_req_data_size
()
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
len
&&
!
(
text
=
memdup
(
get_req_data
(),
len
)))
return
;
free
(
win
->
text
);
win
->
text
=
text
;
win
->
text_len
=
len
;
}
...
...
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