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
d07cec30
Commit
d07cec30
authored
Feb 21, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32: Reorder control flow in ImmGetImeMenuItemsA.
parent
ad2ca1e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
50 deletions
+40
-50
imm.c
dlls/imm32/imm.c
+40
-50
No files found.
dlls/imm32/imm.c
View file @
d07cec30
...
...
@@ -2668,72 +2668,62 @@ BOOL WINAPI ImmUnregisterWordW( HKL hkl, const WCHAR *readingW, DWORD style, con
/***********************************************************************
* ImmGetImeMenuItemsA (IMM32.@)
*/
DWORD
WINAPI
ImmGetImeMenuItemsA
(
HIMC
hIMC
,
DWORD
dwFlags
,
DWORD
dwType
,
LPIMEMENUITEMINFOA
lpImeParentMenu
,
LPIMEMENUITEMINFOA
lpImeMenu
,
DWORD
dwSize
)
DWORD
WINAPI
ImmGetImeMenuItemsA
(
HIMC
himc
,
DWORD
flags
,
DWORD
type
,
IMEMENUITEMINFOA
*
parentA
,
IMEMENUITEMINFOA
*
menuA
,
DWORD
size
)
{
InputContextData
*
data
=
get_imc_data
(
hIMC
);
TRACE
(
"(%p, %li, %li, %p, %p, %li):
\n
"
,
hIMC
,
dwFlags
,
dwType
,
lpImeParentMenu
,
lpImeMenu
,
dwSize
);
InputContextData
*
data
=
get_imc_data
(
himc
);
DWORD
ret
;
TRACE
(
"himc %p, flags %#lx, type %lu, parentA %p, menuA %p, size %lu.
\n
"
,
himc
,
flags
,
type
,
parentA
,
menuA
,
size
);
if
(
!
data
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
SetLastError
(
ERROR_INVALID_HANDLE
);
return
0
;
}
if
(
data
->
immKbd
->
hIME
&&
data
->
immKbd
->
pImeGetImeMenuItems
)
if
(
!
data
->
immKbd
->
hIME
||
!
data
->
immKbd
->
pImeGetImeMenuItems
)
return
0
;
if
(
!
is_himc_ime_unicode
(
data
)
||
(
!
parentA
&&
!
menuA
))
ret
=
data
->
immKbd
->
pImeGetImeMenuItems
(
himc
,
flags
,
type
,
(
IMEMENUITEMINFOW
*
)
parentA
,
(
IMEMENUITEMINFOW
*
)
menuA
,
size
);
else
{
if
(
!
is_himc_ime_unicode
(
data
)
||
(
!
lpImeParentMenu
&&
!
lpImeMenu
))
return
data
->
immKbd
->
pImeGetImeMenuItems
(
hIMC
,
dwFlags
,
dwType
,
(
IMEMENUITEMINFOW
*
)
lpImeParentMenu
,
(
IMEMENUITEMINFOW
*
)
lpImeMenu
,
dwSize
);
IMEMENUITEMINFOW
tmpW
,
*
menuW
,
*
parentW
=
parentA
?
&
tmpW
:
NULL
;
if
(
!
menuA
)
menuW
=
NULL
;
else
{
IMEMENUITEMINFOW
lpImeParentMenuW
;
IMEMENUITEMINFOW
*
lpImeMenuW
,
*
parent
=
NULL
;
DWORD
rc
;
if
(
lpImeParentMenu
)
parent
=
&
lpImeParentMenuW
;
if
(
lpImeMenu
)
{
int
count
=
dwSize
/
sizeof
(
LPIMEMENUITEMINFOA
);
dwSize
=
count
*
sizeof
(
IMEMENUITEMINFOW
);
lpImeMenuW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
}
else
lpImeMenuW
=
NULL
;
int
count
=
size
/
sizeof
(
LPIMEMENUITEMINFOA
);
size
=
count
*
sizeof
(
IMEMENUITEMINFOW
);
menuW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
}
rc
=
data
->
immKbd
->
pImeGetImeMenuItems
(
hIMC
,
dwFlags
,
dwType
,
parent
,
lpImeMenuW
,
dwSize
);
ret
=
data
->
immKbd
->
pImeGetImeMenuItems
(
himc
,
flags
,
type
,
parentW
,
menuW
,
size
);
if
(
lpImeParentMenu
)
{
memcpy
(
lpImeParentMenu
,
&
lpImeParentMenuW
,
sizeof
(
IMEMENUITEMINFOA
));
lpImeParentMenu
->
hbmpItem
=
lpImeParentMenuW
.
hbmpItem
;
WideCharToMultiByte
(
CP_ACP
,
0
,
lpImeParentMenuW
.
szString
,
-
1
,
lpImeParentMenu
->
szString
,
IMEMENUITEM_STRING_SIZE
,
NULL
,
NULL
);
}
if
(
lpImeMenu
&&
rc
)
if
(
parentA
)
{
memcpy
(
parentA
,
parentW
,
sizeof
(
IMEMENUITEMINFOA
)
);
parentA
->
hbmpItem
=
parentW
->
hbmpItem
;
WideCharToMultiByte
(
CP_ACP
,
0
,
parentW
->
szString
,
-
1
,
parentA
->
szString
,
IMEMENUITEM_STRING_SIZE
,
NULL
,
NULL
);
}
if
(
menuA
&&
ret
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
ret
;
i
++
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
rc
;
i
++
)
{
memcpy
(
&
lpImeMenu
[
i
],
&
lpImeMenuW
[
1
],
sizeof
(
IMEMENUITEMINFOA
));
lpImeMenu
[
i
].
hbmpItem
=
lpImeMenuW
[
i
].
hbmpItem
;
WideCharToMultiByte
(
CP_ACP
,
0
,
lpImeMenuW
[
i
].
szString
,
-
1
,
lpImeMenu
[
i
].
szString
,
IMEMENUITEM_STRING_SIZE
,
NULL
,
NULL
);
}
memcpy
(
&
menuA
[
i
],
&
menuW
[
1
],
sizeof
(
IMEMENUITEMINFOA
)
);
menuA
[
i
].
hbmpItem
=
menuW
[
i
].
hbmpItem
;
WideCharToMultiByte
(
CP_ACP
,
0
,
menuW
[
i
].
szString
,
-
1
,
menuA
[
i
].
szString
,
IMEMENUITEM_STRING_SIZE
,
NULL
,
NULL
);
}
HeapFree
(
GetProcessHeap
(),
0
,
lpImeMenuW
);
return
rc
;
}
HeapFree
(
GetProcessHeap
(),
0
,
menuW
);
}
else
return
0
;
return
ret
;
}
/***********************************************************************
...
...
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