diff options
author | Michael Mann <mmann78@netscape.net> | 2016-12-13 03:17:29 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-04-16 02:30:25 +0000 |
commit | b88cb666040672f7ae2e5efc385722a28a4c1e1f (patch) | |
tree | 1412aa19980133a0b042402693eabcc0f263d6d9 /tools/process-x11-xcb.pl | |
parent | c7e32fb09ca7d25ee86aeb3f627a4e5db450922b (diff) | |
download | wireshark-b88cb666040672f7ae2e5efc385722a28a4c1e1f.tar.gz |
X11: Ensure mesa_enum value_string has unique values
Also convert usage to a value_string_ext
Change-Id: Ie515591355879f8eb65faf50e7c04b30cff13519
Reviewed-on: https://code.wireshark.org/review/21124
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools/process-x11-xcb.pl')
-rwxr-xr-x | tools/process-x11-xcb.pl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/process-x11-xcb.pl b/tools/process-x11-xcb.pl index 6e6b48b19e..80e8fa22c8 100755 --- a/tools/process-x11-xcb.pl +++ b/tools/process-x11-xcb.pl @@ -196,12 +196,20 @@ sub mesa_category { $t->purge; } +#used to prevent value_string duplication +my %mesa_enum_hash = (); + sub mesa_enum { my ($t, $elt) = @_; my $name = $elt->att('name'); my $value = $elt->att('value'); + my $hex_value = hex($value); #convert string to hex value to catch leading zeros - print $enum " { $value, \"$name\" },\n" if (length($value) > 3 && length($value) < 10); + #make sure value isn't already in the hash, to prevent duplication in value_string + if (!exists($mesa_enum_hash{$hex_value})) { + $mesa_enum_hash{$hex_value} = $name; + print $enum " { $value, \"$name\" },\n" if (length($value) > 3 && length($value) < 10); + } $t->purge; } @@ -218,9 +226,9 @@ sub mesa_type { if($name eq 'enum') { # enum does not have a direct X equivalent - $gltype{'GLenum'} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX', + $gltype{'GLenum'} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX|BASE_EXT_STRING', get => 'VALUE32', list => 'listOfCard32', - val => 'VALS(mesa_enum)', }; + val => '&mesa_enum_ext', }; return; } @@ -1829,6 +1837,7 @@ if (-e "$mesadir/gl_API.xml") { print $enum " { 0, NULL }\n"; print $enum "};\n"; + print $enum "static value_string_ext mesa_enum_ext = VALUE_STRING_EXT_INIT(mesa_enum);\n"; $enum->close(); print $decl "static int hf_x11_glx_render_op_name = -1;\n\n"; |