ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 2981] Patch to add extension support to the X11 dissector

Date: Sun, 1 Mar 2009 18:55:30 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2981





--- Comment #11 from Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>  2009-03-01 18:55:28 PDT ---
No need to cover everything, though the more the better--especially so it can
be used for reference.  (Maybe you could put the captures on the Wiki's
SampleCaptures page, too?)

Regarding the patch, I think it mostly looks good.  I didn't review the Perl
script but the code it puts out looks sane.  One exception is the code coming
out of:

+    # The length parameter may be unused. Shut up compiler warning.
+    # (Worse than that, since wireshark uses -Werror)
+    print $impl "    (void)length;\n";
+    if (!@elements) {
+       print $impl "    (void)tvb;\n";
+          print $impl "    (void)offsetp;\n";
+          print $impl "    (void)t;\n";
+          print $impl "    (void)little_endian;\n";
+    }

The preferred method is to append _U_ to the unused parameter.  In the case of
'tvb' and the others, this can be done since you know when they won't be used. 
'length' is problematic because you don't really know if it will be used or
not.  I'm a little uncomfortable with the code as it is--I have this vague
memory of some compilers warning about statements like that (something about
statements with no effect?).

Is it safe to mark a parameter with _U_ even if it may be used?  Another way
would be to simply assign the variable to itself.  I forget what's the
preferred method (assuming that we want to keep this dissector clean).


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.