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
3723b786
Commit
3723b786
authored
May 01, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Compute preedit text buffer sizes in WCHAR units.
parent
6a36990f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
xim.c
dlls/winex11.drv/xim.c
+13
-18
No files found.
dlls/winex11.drv/xim.c
View file @
3723b786
...
...
@@ -44,7 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(xim);
BOOL
ximInComposeMode
=
FALSE
;
static
BYTE
*
ime_comp_buf
;
static
WCHAR
*
ime_comp_buf
;
static
DWORD
ime_comp_len
;
static
DWORD
ime_comp_max
;
...
...
@@ -73,34 +73,29 @@ static const char *debugstr_xim_style( XIMStyle style )
static
void
xim_update_comp_string
(
UINT
offset
,
UINT
old_len
,
const
WCHAR
*
text
,
UINT
new_len
)
{
/* Composition strings are edited in chunks */
unsigned
int
byte_length
=
new_len
*
sizeof
(
WCHAR
);
unsigned
int
byte_offset
=
offset
*
sizeof
(
WCHAR
);
unsigned
int
byte_selection
=
old_len
*
sizeof
(
WCHAR
);
int
byte_expansion
=
byte_length
-
byte_selection
;
BYTE
*
ptr_new
;
int
diff
=
new_len
-
old_len
;
WCHAR
*
ptr
;
TRACE
(
"
(%i, %i, %p, %d):
\n
"
,
offset
,
old_len
,
text
,
new_len
);
TRACE
(
"
offset %u, old_len %u, text %s
\n
"
,
offset
,
old_len
,
debugstr_wn
(
text
,
new_len
)
);
if
(
byte_expansion
+
ime_comp_len
>=
ime_comp_max
)
if
(
diff
+
ime_comp_len
>=
ime_comp_max
)
{
if
(
!
(
ptr
_new
=
realloc
(
ime_comp_buf
,
ime_comp_max
+
byte_expansion
)))
if
(
!
(
ptr
=
realloc
(
ime_comp_buf
,
(
ime_comp_max
+
diff
)
*
sizeof
(
WCHAR
)
)))
{
ERR
(
"Couldn't expand composition string buffer
\n
"
);
return
;
}
ime_comp_buf
=
ptr
_new
;
ime_comp_max
+=
byte_expansion
;
ime_comp_buf
=
ptr
;
ime_comp_max
+=
diff
;
}
ptr_new
=
ime_comp_buf
+
byte_offset
;
memmove
(
ptr_new
+
byte_length
,
ptr_new
+
byte_selection
,
ime_comp_len
-
byte_offset
-
byte_selection
);
if
(
text
)
memcpy
(
ptr_new
,
text
,
byte_length
);
ime_comp_len
+=
byte_expansion
;
ptr
=
ime_comp_buf
+
offset
;
memmove
(
ptr
+
new_len
,
ptr
+
old_len
,
(
ime_comp_len
-
offset
-
old_len
)
*
sizeof
(
WCHAR
)
);
if
(
text
)
memcpy
(
ptr
,
text
,
new_len
*
sizeof
(
WCHAR
)
);
ime_comp_len
+=
diff
;
x11drv_client_func
(
client_func_ime_set_composition_string
,
ime_comp_buf
,
ime_comp_len
);
x11drv_client_func
(
client_func_ime_set_composition_string
,
ime_comp_buf
,
ime_comp_len
*
sizeof
(
WCHAR
)
);
}
void
X11DRV_XIMLookupChars
(
const
char
*
str
,
UINT
count
)
...
...
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