summaryrefslogtreecommitdiff
path: root/tools/process-x11-xcb.pl
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-04-30 17:52:52 -0700
committerGuy Harris <guy@alum.mit.edu>2015-05-01 00:53:53 +0000
commit510777cf78488981db12cb98267599aca9866783 (patch)
tree86eb65fb55e08506ecf4e2814c6702c7fddb11fe /tools/process-x11-xcb.pl
parentf708c5cb56135515b6b777f144e90d488870c470 (diff)
downloadwireshark-510777cf78488981db12cb98267599aca9866783.tar.gz
Fix some cases where we're shifting a signed 1 left.
Shift 1U instead, to make sure it's unsigned; the result of, for example, the result of shifting a signed value left is undefined if the value times 2^{shift count} doesn't fit in the *signed* type of the shifted value. That means, in particular, that the result of shifting 1 left by {number of bits in an int - 1} is undefined. (In *practice*, it'll probably be -2^32, with the bit you want set, but that's not guaranteed, and GCC 5.1 seems not to like it.) This fixes the generator for the X11 header files; we manually fix the header file in question, because life's too short to spend very much of it trying to debug Perl issues that cause a Can't use string ("1") as a HASH ref while "strict refs" in use at ../../tools/process-x11-xcb.pl line 675. at ../../tools/process-x11-xcb.pl line 1859 at ../../tools/process-x11-xcb.pl line 1859 failure. Change-Id: Ia903e9dacad49021bc0dfe129b9393ad426de9eb Reviewed-on: https://code.wireshark.org/review/8261 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools/process-x11-xcb.pl')
-rwxr-xr-xtools/process-x11-xcb.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/process-x11-xcb.pl b/tools/process-x11-xcb.pl
index 2e766ec0c9..bb0d4f2c5a 100755
--- a/tools/process-x11-xcb.pl
+++ b/tools/process-x11-xcb.pl
@@ -703,7 +703,7 @@ sub register_element($$$$;$)
my $itemname = $$bit{$val};
my $item = $regname . '_mask_' . $itemname;
my $itemhuman = $humanname . '.' . $itemname;
- my $bitshift = "1 << $val";
+ my $bitshift = "1U << $val";
say $decl "static int $item = -1;";
say $reg "{ &$item, { \"$itemname\", \"$itemhuman\", FT_BOOLEAN, $bitsize, NULL, $bitshift, NULL, HFILL }},";