Wireshark-bugs: [Wireshark-bugs] [Bug 8674] [PATCH] - GigE Vision GVCP dissector
Date: Sat, 24 Aug 2013 11:59:17 +0000

changed bug 8674

What Removed Added
Attachment #11401 Flags review_for_checkin? review_for_checkin-

Comment # 11 on bug 8674 from
Comment on attachment 11401 [details]
GVCP dissector patch

Hi Warren, thanks for the patch. Unfortunately it still has a few issues:

- emem is fully deprecated at this point, you should be able to use wmem
equivalents in all places (see doc/README.wmem in the source tree for more
information)

- if you want your trees to work for multiple captures, use wmem's
auto-resetting trees "wmem_tree_new_autoreset(wmem_epan_scope(),
wmem_file_scope()". This will create a tree for the lifetime of wireshark, but
it will be automatically emptied every time a new capture is loaded.

- as a built-in dissector, there is no need for PACKAGE or VERSION defines at
the top of the file anymore

- the display_string_lookup and ftenum_string_lookup tables you use are already
included in epan/proto.c but are not public. Please feel free to just make
those tables available in proto.h so you don't have to duplicate them (or the
lookup functions) yourself.

- there are a lot of places where you create a subtree with only one child. Is
this intentional? Sub-trees are usually used for grouping related attributes,
not one for each attribute.

- I get a very large number of compiler errors when I try and build with the
patch on my version of GCC. I've pasted a snippet of them below:

packet-gvcp.c:277:2: error: initialization discards 'const' qualifier from
pointer target type [-Werror]
  {BASE_NONE,  "BASE_NONE"},
  ^
... (one for every line until) ...
packet-gvcp.c:322:2: error: initialization discards 'const' qualifier from
pointer target type [-Werror]
  {FT_EUI64,   "FT_EUI64"}
  ^
packet-gvcp.c: In function 'GetRegisterNameFromAddress':
packet-gvcp.c:904:49: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
 const gchar* GetRegisterNameFromAddress(guint32 address, gboolean*
is_custom_register)
                                                 ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c:917:19: error: request for implicit conversion from 'void *' to
'struct custom_register_data *' not permitted in C++ [-Werror=c++-compat]
   custom_register = wmem_tree_lookup32(gvcp_custom_register_table, address);
                   ^
packet-gvcp.c: In function 'check_for_resend':
packet-gvcp.c:943:90: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
 void check_for_resend(guint32 resend_type, packet_info* pinfo, gboolean*
resend, guint32 address, guint16 req_id)
                                                                               
          ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c:981:14: error: request for implicit conversion from 'void *' to
'struct data_resend *' not permitted in C++ [-Werror=c++-compat]
  resend_info = se_tree_lookup32(register_resend_tree, (pinfo->fd->num)-2);
              ^
packet-gvcp.c:997:16: error: request for implicit conversion from 'void *' to
'struct data_resend *' not permitted in C++ [-Werror=c++-compat]
    resend_info = se_tree_lookup32(register_resend_tree, (pinfo->fd->num)-1);
                ^
packet-gvcp.c: In function 'IsKnownBootstrapRegister':
packet-gvcp.c:1021:38: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
 int IsKnownBootstrapRegister(guint32 address)
                                      ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c: In function 'DissectRegister':
packet-gvcp.c:1031:29: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
 int DissectRegister(guint32 address, proto_tree *branch, tvbuff_t *tvb, gint
offset, gint length)
                             ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c: In function 'DissectRegisterData':
packet-gvcp.c:1479:33: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
 int DissectRegisterData(guint32 address, proto_tree *branch, tvbuff_t *tvb,
gint offset, gint length)
                                 ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c: In function 'DissectReadRegCmd':
packet-gvcp.c:1667:10: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
  guint32 address = 0;
          ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c:1751:21: error: request for implicit conversion from 'void *' to
'struct custom_register_data *' not permitted in C++ [-Werror=c++-compat]
     custom_register = wmem_tree_lookup32(gvcp_custom_register_table, address);
                     ^
packet-gvcp.c: In function 'DissectWriteRegCmd':
packet-gvcp.c:1779:10: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
  guint32 address = 0;
          ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c:1893:21: error: request for implicit conversion from 'void *' to
'struct custom_register_data *' not permitted in C++ [-Werror=c++-compat]
     custom_register = wmem_tree_lookup32(gvcp_custom_register_table, address);
                     ^
packet-gvcp.c: In function 'DissectReadMemCmd':
packet-gvcp.c:1929:10: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
  guint32 address = 0;
          ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c:1976:20: error: request for implicit conversion from 'void *' to
'struct custom_register_data *' not permitted in C++ [-Werror=c++-compat]
    custom_register = wmem_tree_lookup32(gvcp_custom_register_table, address);
                    ^
packet-gvcp.c: In function 'DissectWriteMemCmd':
packet-gvcp.c:2001:10: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
  guint32 address = 0;
          ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c: In function 'DissectReadRegAck':
packet-gvcp.c:2354:11: error: request for implicit conversion from 'void *' to
'struct data *' not permitted in C++ [-Werror=c++-compat]
  read_ack = se_tree_lookup32(Read_Reg_Tree, GetKey(ack_id, pinfo));
           ^
packet-gvcp.c:2404:22: error: request for implicit conversion from 'void *' to
'struct custom_register_data *' not permitted in C++ [-Werror=c++-compat]
      custom_register = wmem_tree_lookup32(gvcp_custom_register_table,
read_ack->value[i]);
                      ^
packet-gvcp.c: In function 'DissectWriteRegAck':
packet-gvcp.c:2452:12: error: request for implicit conversion from 'void *' to
'struct data *' not permitted in C++ [-Werror=c++-compat]
  write_ack = se_tree_lookup32(Write_Reg_Tree, GetKey(ack_id, pinfo));
            ^
packet-gvcp.c: In function 'DissectReadMemAck':
packet-gvcp.c:2484:10: error: declaration of 'address' shadows a global
declaration [-Werror=shadow]
  guint32 address = 0;
          ^
In file included from ../../epan/packet_info.h:30:0,
                 from ../../epan/to_str.h:32,
                 from ../../epan/packet.h:32,
                 from packet-gvcp.c:43:
../../epan/address.h:70:3: error: shadowed declaration is here [-Werror=shadow]
 } address;
   ^
packet-gvcp.c: In function 'DissectWriteMemAck':
packet-gvcp.c:2533:16: error: request for implicit conversion from 'void *' to
'struct data *' not permitted in C++ [-Werror=c++-compat]
  write_mem_ack = se_tree_lookup32(Write_Mem_Tree, ack_id);
                ^
packet-gvcp.c: In function 'dissect_gvcp':
packet-gvcp.c:2820:20: error: request for implicit conversion from 'void *' to
'struct latency_t *' not permitted in C++ [-Werror=c++-compat]
    latency_readreg = se_tree_lookup32(Latency_ReadReg_Tree, GetKey(request_id,
pinfo));
                    ^
packet-gvcp.c:2835:21: error: request for implicit conversion from 'void *' to
'struct latency_t *' not permitted in C++ [-Werror=c++-compat]
    latency_writereg = se_tree_lookup32(Latency_WriteReg_Tree,
GetKey(request_id, pinfo));
                     ^
packet-gvcp.c:2850:20: error: request for implicit conversion from 'void *' to
'struct latency_t *' not permitted in C++ [-Werror=c++-compat]
    latency_readmem = se_tree_lookup32(Latency_ReadMem_Tree, GetKey(request_id,
pinfo));
                    ^
packet-gvcp.c:2865:21: error: request for implicit conversion from 'void *' to
'struct latency_t *' not permitted in C++ [-Werror=c++-compat]
    latency_writemem = se_tree_lookup32(Latency_WriteMem_Tree,
GetKey(request_id, pinfo));
                     ^
packet-gvcp.c: In function 'register_custom_registers':
packet-gvcp.c:3080:14: error: request for implicit conversion from 'void *' to
'gchar *' not permitted in C++ [-Werror=c++-compat]
  errorString = wmem_alloc(wmem_epan_scope(), MAX_BUFFER);
              ^
packet-gvcp.c:3147:3: error: format not a string literal and no format
arguments [-Werror=format-security]
   g_snprintf(errorString, MAX_BUFFER, error->message);
   ^
packet-gvcp.c: At top level:
packet-gvcp.c:252:12: error: 'xml_read' defined but not used
[-Werror=unused-variable]
 static int xml_read = FALSE;
            ^
packet-gvcp.c:253:12: error: 'xml_dissection_started' defined but not used
[-Werror=unused-variable]
 static int xml_dissection_started = FALSE;
            ^
packet-gvcp.c:264:13: error: 'custom_hf_index_lookup' defined but not used
[-Werror=unused-variable]
 static int* custom_hf_index_lookup;


You are receiving this mail because:
  • You are watching all bug changes.