Wireshark-dev: [Wireshark-dev] Solaris C compiler doesn't like anonymous unions
Date: Thu, 12 Jul 2007 18:18:59 -0500
Fix to avoid anonymous union which Sun Studio 11 C compiler doesn't
like.

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)
Index: epan/asn1.h
===================================================================
--- epan/asn1.h	(revision 22293)
+++ epan/asn1.h	(working copy)
@@ -65,7 +65,7 @@
       struct {
         int (*type_cb)(tvbuff_t*, int, struct _asn1_ctx_t*, proto_tree*, int);
       } per;
-    };
+    } u;
   } external;
 } asn1_ctx_t;
 
Index: epan/dissectors/packet-per.c
===================================================================
--- epan/dissectors/packet-per.c	(revision 22293)
+++ epan/dissectors/packet-per.c	(working copy)
@@ -1942,7 +1942,7 @@
 
 static int
 dissect_per_T_single_ASN1_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-  offset = dissect_per_open_type(tvb, offset, actx, tree, actx->external.hf_index, actx->external.per.type_cb);
+  offset = dissect_per_open_type(tvb, offset, actx, tree, actx->external.hf_index, actx->external.u.per.type_cb);
 
   return offset;
 }
@@ -1954,8 +1954,8 @@
   offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
                                        NO_BOUND, NO_BOUND, &actx->external.octet_aligned);
 
-  if (actx->external.per.type_cb) {
-    actx->external.per.type_cb(actx->external.octet_aligned, 0, actx, tree, actx->external.hf_index);
+  if (actx->external.u.per.type_cb) {
+    actx->external.u.per.type_cb(actx->external.octet_aligned, 0, actx, tree, actx->external.hf_index);
     } else {
         actx->created_item = proto_tree_add_text(tree, actx->external.octet_aligned, 0, -1, "Unknown EXTERNAL Type");
     }
@@ -1969,8 +1969,8 @@
   offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
                                      NO_BOUND, NO_BOUND, FALSE, &actx->external.arbitrary);
 
-  if (actx->external.per.type_cb) {
-    actx->external.per.type_cb(actx->external.arbitrary, 0, actx, tree, actx->external.hf_index);
+  if (actx->external.u.per.type_cb) {
+    actx->external.u.per.type_cb(actx->external.arbitrary, 0, actx, tree, actx->external.hf_index);
     } else {
         actx->created_item = proto_tree_add_text(tree, actx->external.arbitrary, 0, -1, "Unknown EXTERNAL Type");
     }
@@ -2022,7 +2022,7 @@
 dissect_per_external_type(tvbuff_t *tvb _U_, guint32 offset, asn1_ctx_t *actx, proto_tree *tree _U_, int hf_index _U_, per_type_fn type_cb)
 {
   asn1_ctx_clean_external(actx);
-  actx->external.per.type_cb = type_cb;
+  actx->external.u.per.type_cb = type_cb;
   offset = dissect_per_External(tvb, offset, actx, tree, hf_index);
 
   asn1_ctx_clean_external(actx);
Index: epan/dissectors/packet-ber.c
===================================================================
--- epan/dissectors/packet-ber.c	(revision 22293)
+++ epan/dissectors/packet-ber.c	(working copy)
@@ -3845,7 +3845,7 @@
 static int
 dissect_ber_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 
-	if(!actx->external.ber.ber_callback){
+	if(!actx->external.u.ber.ber_callback){
 		offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
 	}else{
 		/* FIX ME */
@@ -3905,7 +3905,7 @@
 int
 dissect_ber_external_type(gboolean implicit_tag, proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, gint hf_id, ber_callback func){
 
-	actx->external.ber.ber_callback =  func;
+	actx->external.u.ber.ber_callback =  func;
 
   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
                                       hf_id, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, TRUE, dissect_ber_external_U);