From c6261aee416a7eb42e8b72b368f37278537c568d Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Fri, 11 Sep 2009 18:06:50 +0000 Subject: [PATCH] From Peter Harris via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2981 : Put the git version of mesa and xcbproto in the generated header files. From me: Don't use 'which' to find git--it wouldn't work on Windows. svn path=/trunk/; revision=29865 --- epan/dissectors/process-x11-xcb.pl | 35 ++++++++++++++----- epan/dissectors/x11-extension-errors.h | 3 +- .../dissectors/x11-extension-implementation.h | 7 ++-- epan/dissectors/x11-glx-render-enum.h | 3 +- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/epan/dissectors/process-x11-xcb.pl b/epan/dissectors/process-x11-xcb.pl index dfac652efb..0a772023c1 100755 --- a/epan/dissectors/process-x11-xcb.pl +++ b/epan/dissectors/process-x11-xcb.pl @@ -514,7 +514,7 @@ sub dissect_element($$$;$$) } else { die ("Unrecognized type: $type\n"); } - + if ($adjustlength && defined($lentype)) { # Some requests end with a list of unspecified length # Adjust the length field here so that the next $lencalc will be accurate @@ -912,7 +912,7 @@ static void $header$name(tvbuff_t *tvb, int *offsetp, proto_tree *t, int little_ eot ; } - + my $varpat = $header.'_'.$name.'_%s'; my $humanpat = "$header.$name.%s"; @@ -1042,12 +1042,29 @@ eot push @register, $header; } +sub find_version { + #my $git = `which git`; + #chomp($git); + #-x $git or return 'unknown'; + + my $lib = shift; + # this will generate an error on stderr if git isn't in our $PATH + # but that's OK. The version is still set to 'unknown' in that case + # and at least the operator could see it. + my $ver = `git --git-dir=$lib/.git describe`; + $ver //= 'unknown'; + chomp $ver; + return $ver; +} + sub add_generated_header { - my ($out) = @_; + my ($out, $using) = @_; + my $ver = find_version($using); print $out < x11-extension-implementation.h' $error = new IO::File '> x11-extension-errors.h' or die ("Cannot open x11-extension-errors.h for writing\n"); -add_generated_header($impl); -add_generated_header($error); +add_generated_header($impl, 'xcbproto'); +add_generated_header($error, 'xcbproto'); # Open the files generated by process-x11-fields.pl for appending $reg = new IO::File '>> x11-register-info.h' @@ -1106,7 +1123,7 @@ print $decl "\n/* Generated by $0 below this line */\n"; if (-e 'mesa/src/mesa/glapi/gl_API.xml') { $enum = new IO::File '> x11-glx-render-enum.h' or die ("Cannot open x11-glx-render-enum.h for writing\n"); - add_generated_header($enum); + add_generated_header($enum, 'mesa'); print $enum "static const value_string mesa_enum[] = {\n"; print $impl '#include "x11-glx-render-enum.h"'."\n\n"; @@ -1155,14 +1172,14 @@ static void dispatch_glx_render(tvbuff_t *tvb, packet_info *pinfo, int *offsetp, op = VALUE16(tvb, *offsetp + 2); ti = proto_tree_add_uint(t, hf_x11_glx_render_op_name, tvb, *offsetp, len, op); - + tt = proto_item_add_subtree(ti, ett_x11_list_of_rectangle); ti = proto_tree_add_item(tt, hf_x11_request_length, tvb, *offsetp, 2, little_endian); *offsetp += 2; proto_tree_add_item(tt, hf_x11_glx_render_op_name, tvb, *offsetp, 2, little_endian); *offsetp += 2; - + if (len < 4) { expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Invalid Length"); /* Eat the rest of the packet, mark it undecoded */ diff --git a/epan/dissectors/x11-extension-errors.h b/epan/dissectors/x11-extension-errors.h index 5e64537cc6..4fc1755129 100644 --- a/epan/dissectors/x11-extension-errors.h +++ b/epan/dissectors/x11-extension-errors.h @@ -1,5 +1,6 @@ /* Do not modify this file. */ -/* It was automatically generated by process-x11-xcb.pl. */ +/* It was automatically generated by process-x11-xcb.pl + using xcbproto version 1.5-4-ga507629 */ /* $Id$ */ /* diff --git a/epan/dissectors/x11-extension-implementation.h b/epan/dissectors/x11-extension-implementation.h index afdf48e382..4b68c0b5de 100644 --- a/epan/dissectors/x11-extension-implementation.h +++ b/epan/dissectors/x11-extension-implementation.h @@ -1,5 +1,6 @@ /* Do not modify this file. */ -/* It was automatically generated by process-x11-xcb.pl. */ +/* It was automatically generated by process-x11-xcb.pl + using xcbproto version 1.5-4-ga507629 */ /* $Id$ */ /* @@ -3709,14 +3710,14 @@ static void dispatch_glx_render(tvbuff_t *tvb, packet_info *pinfo, int *offsetp, op = VALUE16(tvb, *offsetp + 2); ti = proto_tree_add_uint(t, hf_x11_glx_render_op_name, tvb, *offsetp, len, op); - + tt = proto_item_add_subtree(ti, ett_x11_list_of_rectangle); ti = proto_tree_add_item(tt, hf_x11_request_length, tvb, *offsetp, 2, little_endian); *offsetp += 2; proto_tree_add_item(tt, hf_x11_glx_render_op_name, tvb, *offsetp, 2, little_endian); *offsetp += 2; - + if (len < 4) { expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Invalid Length"); /* Eat the rest of the packet, mark it undecoded */ diff --git a/epan/dissectors/x11-glx-render-enum.h b/epan/dissectors/x11-glx-render-enum.h index b2cf7c758b..1ca886eb6a 100644 --- a/epan/dissectors/x11-glx-render-enum.h +++ b/epan/dissectors/x11-glx-render-enum.h @@ -1,5 +1,6 @@ /* Do not modify this file. */ -/* It was automatically generated by process-x11-xcb.pl. */ +/* It was automatically generated by process-x11-xcb.pl + using mesa version mesa_7_5_1-3181-gd9dc4cb */ /* $Id$ */ /*