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

Wireshark-dev: [Wireshark-dev] Use of anonymous union in epan/dissectors/packet-usb.[ch]

Date: Mon, 6 Nov 2006 21:17:42 -0600
The Solaris C compiler, among others, do not allow anonymous unions.
Patch attached.

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)
Index: epan/dissectors/packet-usb.c
===================================================================
--- epan/dissectors/packet-usb.c	(revision 19843)
+++ epan/dissectors/packet-usb.c	(working copy)
@@ -410,7 +410,7 @@
     proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
     offset++;
 
-    if(!usb_trans_info->get_descriptor.index){
+    if(!usb_trans_info->u.get_descriptor.index){
         /* list of languanges */
         while(len>(offset-old_offset)){
             /* wLANGID */
@@ -686,16 +686,16 @@
     if(is_request){
         /* descriptor type */
         proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, FALSE);
-        usb_trans_info->get_descriptor.type=tvb_get_guint8(tvb, offset);
+        usb_trans_info->u.get_descriptor.type=tvb_get_guint8(tvb, offset);
         offset++;
         if (check_col(pinfo->cinfo, COL_INFO)) {
             col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
-                val_to_str(usb_trans_info->get_descriptor.type, descriptor_type_vals, "Unknown type %x"));
+                val_to_str(usb_trans_info->u.get_descriptor.type, descriptor_type_vals, "Unknown type %x"));
         }
 
         /* descriptor index */
         proto_tree_add_item(tree, hf_usb_descriptor_index, tvb, offset, 1, FALSE);
-        usb_trans_info->get_descriptor.index=tvb_get_guint8(tvb, offset);
+        usb_trans_info->u.get_descriptor.index=tvb_get_guint8(tvb, offset);
         offset++;
 
         /* language id */
@@ -708,9 +708,9 @@
     } else {
         if (check_col(pinfo->cinfo, COL_INFO)) {
             col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
-                val_to_str(usb_trans_info->get_descriptor.type, descriptor_type_vals, "Unknown type %x"));
+                val_to_str(usb_trans_info->u.get_descriptor.type, descriptor_type_vals, "Unknown type %x"));
         }
-        switch(usb_trans_info->get_descriptor.type){
+        switch(usb_trans_info->u.get_descriptor.type){
         case USB_DT_DEVICE:
             offset=dissect_usb_device_descriptor(pinfo, tree, tvb, offset, usb_trans_info, usb_conv_info);
             break;
Index: epan/dissectors/packet-usb.h
===================================================================
--- epan/dissectors/packet-usb.h	(revision 19843)
+++ epan/dissectors/packet-usb.h	(working copy)
@@ -37,7 +37,7 @@
             guint8 type;
             guint8 index;
         } get_descriptor;
-    };
+    } u;
 
 
     /* used to pass the interface class from the