mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[llvm-rc] Allow -1 for menu item IDs
This seems to be used in some resource files, e.g.
f3217573d7/include/wx/msw/wx.rc (L28)
.
MSVC rc.exe and GNU windres both allow any value here, and silently
just truncate to uint16_t range. This just explicitly allows the
-1 value and errors out on others - the same was done for control
IDs in dialogs in c1a67857ba0a6ba558818b589fe7c0fcc8f238ae.
Differential Revision: https://reviews.llvm.org/D76951
This commit is contained in:
parent
9a08f36592
commit
e24fbfb6df
Binary file not shown.
@ -69,7 +69,7 @@
|
||||
; MENU-NEXT: 0060: 61002600 62006300 64006500 00000000 |a.&.b.c.d.e.....|
|
||||
; MENU-NEXT: 0070: 03006100 62002600 63006400 65000000 |..a.b.&.c.d.e...|
|
||||
; MENU-NEXT: 0080: 00000400 61006200 63002600 64006500 |....a.b.c.&.d.e.|
|
||||
; MENU-NEXT: 0090: 00008000 05006100 62006300 64002600 |......a.b.c.d.&.|
|
||||
; MENU-NEXT: 0090: 00008000 FFFF6100 62006300 64002600 |......a.b.c.d.&.|
|
||||
; MENU-NEXT: 00A0: 65000000 |e...|
|
||||
; MENU-NEXT: )
|
||||
|
||||
|
@ -1180,8 +1180,10 @@ Error ResourceFileWriter::writeMenuDefinition(
|
||||
|
||||
if (auto *MenuItemPtr = dyn_cast<MenuItem>(DefPtr)) {
|
||||
writeInt<uint16_t>(Flags);
|
||||
RETURN_IF_ERROR(
|
||||
checkNumberFits<uint16_t>(MenuItemPtr->Id, "MENUITEM action ID"));
|
||||
// Some resource files use -1, i.e. UINT32_MAX, for empty menu items.
|
||||
if (MenuItemPtr->Id != static_cast<uint32_t>(-1))
|
||||
RETURN_IF_ERROR(
|
||||
checkNumberFits<uint16_t>(MenuItemPtr->Id, "MENUITEM action ID"));
|
||||
writeInt<uint16_t>(MenuItemPtr->Id);
|
||||
RETURN_IF_ERROR(writeCString(MenuItemPtr->Name));
|
||||
return Error::success();
|
||||
|
Loading…
Reference in New Issue
Block a user