[PATCH] D46506: [llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 9 11:24:35 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331901: [llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D46506?vs=145413&id=145965#toc
Repository:
rL LLVM
https://reviews.llvm.org/D46506
Files:
llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc
llvm/trunk/test/tools/llvm-rc/tag-dialog.test
llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
Index: llvm/trunk/test/tools/llvm-rc/tag-dialog.test
===================================================================
--- llvm/trunk/test/tools/llvm-rc/tag-dialog.test
+++ llvm/trunk/test/tools/llvm-rc/tag-dialog.test
@@ -153,7 +153,7 @@
; DIALOG-NEXT: 0030: 00000000 0B000250 00000000 07000800 |.......P........|
; DIALOG-NEXT: 0040: 09000A00 0600FFFF 82004C00 32000000 |..........L.2...|
; DIALOG-NEXT: 0050: 00000000 11000250 12000000 0D000E00 |.......P........|
-; DIALOG-NEXT: 0060: 0F001000 0C00FFFF 82004C00 33000000 |..........L.3...|
+; DIALOG-NEXT: 0060: 0F001000 FFFFFFFF 82004C00 33000000 |..........L.3...|
; DIALOG-NEXT: 0070: 00000000 00008150 00000000 14001500 |.......P........|
; DIALOG-NEXT: 0080: 16001700 1300FFFF 81000000 00000000 |................|
; DIALOG-NEXT: 0090: 1D008150 00000000 19001A00 1B001C00 |...P............|
Index: llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc
===================================================================
--- llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc
+++ llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc
@@ -50,7 +50,7 @@
ArgsOld DIALOG 1, 2, 3, 4 {
LTEXT "L", 1, 2, 3, 4, 5
LTEXT "L2", 6, 7, 8, 9, 10, 11
- LTEXT "L3", 12, 13, 14, 15, 16, 17, 18
+ LTEXT "L3", -1, 13, 14, 15, 16, 17, 18
EDITTEXT 19, 20, 21, 22, 23
EDITTEXT 24, 25, 26, 27, 28, 29
Index: llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
===================================================================
--- llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
+++ llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
@@ -1008,8 +1008,11 @@
// ID; it's 16-bit in DIALOG and 32-bit in DIALOGEX.
if (!IsExtended) {
- RETURN_IF_ERROR(checkNumberFits<uint16_t>(
- Ctl.ID, "Control ID in simple DIALOG resource"));
+ // It's common to use -1, i.e. UINT32_MAX, for controls one doesn't
+ // want to refer to later.
+ if (Ctl.ID != static_cast<uint32_t>(-1))
+ RETURN_IF_ERROR(checkNumberFits<uint16_t>(
+ Ctl.ID, "Control ID in simple DIALOG resource"));
writeInt<uint16_t>(Ctl.ID);
} else {
writeInt<uint32_t>(Ctl.ID);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46506.145965.patch
Type: text/x-patch
Size: 2155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180509/cd5abfb4/attachment.bin>
More information about the llvm-commits
mailing list