Integrated: JDK-8311113: Remove invalid pointer cast and clean up setLabel() in awt_MenuItem.cpp
Harshitha Onkar
honkar at openjdk.org
Tue Sep 19 17:40:57 UTC 2023
On Mon, 14 Aug 2023 18:03:21 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
> In awt_MenuItem.cpp (712,22): ` mii.dwTypeData = (LPTSTR)(*sb)` produces invalid pointer cast warning when complied on clang and moreover this is a no-op.
>
> `mii.dwTypeData` is used only when **MIIM_STRING** flag is set in the fMask (as per [Docs](https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-menuiteminfoa)), which is not the case in JDK [Ln#705](https://github.com/openjdk/jdk/blob/e56d3bc2dab3d32453b6eda66e8434953c436084/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp#L706). Hence the assignment ` mii.dwTypeData = (LPTSTR)(*sb)` is not required and so is the label parameter. Additionally necessary cleanup is done at the following places -
>
> - WMenuItemPeer.java - to the native function call
> - awt_MenuItem.cpp - `WMenuItemPeer__1setLabel() ,_SetLabel(), SetLabel()`
> - awt_MenuItem.h
>
> Added a test which checks setLabel() functionality on Menu, MenuItem and PopupMenu.
This pull request has now been integrated.
Changeset: 0c972468
Author: Harshitha Onkar <honkar at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/0c972468e7d72c991f28943f602232e0317ea21d
Stats: 254 lines in 4 files changed: 186 ins; 57 del; 11 mod
8311113: Remove invalid pointer cast and clean up setLabel() in awt_MenuItem.cpp
Reviewed-by: aivanov, serb
-------------
PR: https://git.openjdk.org/jdk/pull/15276
More information about the client-libs-dev
mailing list