Ethereal-dev: [Ethereal-dev] Portability patches

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Albert Chin <ethereal-dev@xxxxxxxxxxxxxxxxxx>
Date: Sun, 9 Nov 2003 04:07:35 -0600
1. HP C compiler complains about typedef before enum declared
   (HP-UX 10.20).
2. Trailing semicolons in packet-bssgp.c gives warnings from
   Tru64 UNIX compiler.
3. P_SID in <sys/procset.h> on HP-UX 10.20 and Tru64 UNIX.
4. HP C compiler on HP-UX 10.20 complains about the initializer for
   ett ("Array size must be a constant expression.").

BTW, why is ett declared static? You memset it on entry to the
function so I don't see it buying anything.

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)

-- snip snip
--- plugins/asn1/packet-asn1.c.orig	Sat Nov  8 20:10:20 2003
+++ plugins/asn1/packet-asn1.c	Sat Nov  8 20:10:36 2003
@@ -1763,7 +1763,6 @@
 typedef struct _TBLNamedNumber	TBLNamedNumber;
 typedef struct _TBLRange	TBLRange;
 
-typedef enum _tbl_t tbl_t;
 enum _tbl_t {
 	TBLTYPE_Module,
 	TBLTYPE_TypeDef,
@@ -1773,6 +1772,7 @@
 	TBLTYPE_NamedNumber,
 	TBLTYPE_Range,
 };
+typedef enum _tbl_t tbl_t;
 /* text for 'tbl_t' type for debugging */
 char *data_types[] = {	"Module",
 			"TypeDef",
@@ -1783,13 +1783,13 @@
 			"Range",
 };
 
-typedef enum _TBLTypeContent_t TBLTypeContent_t;
 enum _TBLTypeContent_t {
 	TBLTYPETYPE_None,
 	TBLTYPETYPE_Primitive,
 	TBLTYPETYPE_Elements,
 	TBLTYPETYPE_TypeRef,
 };
+typedef enum _TBLTypeContent_t TBLTypeContent_t;
 
 struct _TBLNamedNumber {
 	tbl_t	type;
--- packet-bssgp.c.orig	Sat Nov  8 21:43:37 2003
+++ packet-bssgp.c	Sat Nov  8 21:44:48 2003
@@ -823,7 +823,7 @@
 		proto_tree_add_text(bmaxms_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 /*static int dcd_bssgp_bss_aind(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 };
 */
@@ -848,7 +848,7 @@
 		proto_tree_add_text(bucklr_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 static int dcd_bssgp_bvci(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	guint8 code=0, len=0;
 	guint16 bucket=0;
@@ -869,7 +869,7 @@
 		proto_tree_add_text(bvci_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 static int dcd_bssgp_bvci_n(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	guint8 code=0, len=0;
 	guint16 bucket=0;
@@ -890,7 +890,7 @@
 		proto_tree_add_text(bvcin_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 static int dcd_bssgp_bvc_bsize(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	guint8 code=0, len=0;
 	guint16 bucket=0;
@@ -911,7 +911,7 @@
 		proto_tree_add_text(bsize_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 /*static int dcd_bssgp_bvc_meas(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 return 4;
 };
@@ -935,7 +935,7 @@
 		proto_tree_add_text(cause_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 static int dcd_bssgp_cellid(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	char mccmnc_str[8];
@@ -965,7 +965,7 @@
 	}
 	 
 	return len+2;
-};
+}
 
 /*static int dcd_bssgp_chan_need(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 };
@@ -985,7 +985,7 @@
 	}
 return len+2;
 	
-};
+}
 
 /*static int dcd_bssgp_emlpp_prio(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 };
@@ -1098,7 +1098,7 @@
 	
 dprm_p->k=offset+k;	
 return llen+k;	
-};
+}
 
 static int dcd_bssgp_llc_frdsc(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	guint8 code=0, len=0,frdsc=0;
@@ -1119,7 +1119,7 @@
 		proto_tree_add_text(frdsc_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 /*static int dcd_bssgp_la(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){		
 };
@@ -1147,7 +1147,7 @@
 		proto_tree_add_text(racc_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 /*static int dcd_bssgp_omc_id(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 };
@@ -1278,7 +1278,7 @@
 		proto_tree_add_text(racaus_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 /*static int dcd_bssgp_racap_upd(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 };
@@ -1307,7 +1307,7 @@
 		proto_tree_add_text(ra_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 static int dcd_bssgp_r_def_ms(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	guint8 code=0, len=0;
@@ -1326,7 +1326,7 @@
 		proto_tree_add_text(rdefms_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 /*static int dcd_bssgp_sus_ref_num(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){
 };
@@ -1347,7 +1347,7 @@
 		proto_tree_add_text(tag_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 static int dcd_bssgp_tlli(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){	
 	guint32 tlli;
@@ -1386,7 +1386,7 @@
 		}
 	}	  
 		  return 4 + disp;
-};
+}
 /*static int dcd_bssgp_tlli_o(tvbuff_t *tvb, int offset, dec_fu_param_stru_t *dprm_p){
 	return 6;
 };	
@@ -1424,7 +1424,7 @@
 		proto_tree_add_text(noaff_tree,tvb,offset+1,1,"Length:%u",len);
 	}
 return len+2;
-};
+}
 
 
 /* Code to actually dissect the packets */
--- packet-ansi_a.c.orig	Sat Nov  8 20:12:49 2003
+++ packet-ansi_a.c	Sun Nov  9 03:29:23 2003
@@ -5956,7 +5956,7 @@
     P_SO_LIST,	/* Service Option List */
     P_S_RED_INFO,	/* Service Redirection Info */
     P_SR_ID,	/* Session Reference Identifier (SR_ID) */
-    P_SID,	/* SID */
+    P_MY_SID,	/* SID */
     P_SIGNAL,	/* Signal */
     P_SCI,	/* Slot Cycle Index */
     P_SW_VER,	/* Software Version */
@@ -7486,7 +7486,7 @@
 
     ELEM_OPT_TLV(P_HO_POW_LEV, "");
 
-    ELEM_OPT_TV(P_SID, "");
+    ELEM_OPT_TV(P_MY_SID, "");
 
     ELEM_OPT_TLV(P_EXT_HO_DIR_PARAMS, "");
 
@@ -8399,9 +8399,11 @@
 #define	MAX_NUM_DTAP_MSG	ANSI_A_MAX(NUM_IOS401_DTAP_MSG, 0)
 #define	MAX_NUM_BSMAP_MSG	ANSI_A_MAX(NUM_IOS401_BSMAP_MSG, 0)
 #define	NUM_INDIVIDUAL_ELEMS	9
-    static gint *ett[NUM_INDIVIDUAL_ELEMS+MAX_NUM_DTAP_MSG+MAX_NUM_BSMAP_MSG+NUM_ELEM_1+NUM_MS_INFO_REC];
+    static gint **ett;
+    gint ett_len = (NUM_INDIVIDUAL_ELEMS+MAX_NUM_DTAP_MSG+MAX_NUM_BSMAP_MSG+NUM_ELEM_1+NUM_MS_INFO_REC) * sizeof (gint *);
 
-    memset((void *) ett, -1, sizeof(ett));
+    ett = g_malloc (ett_len);
+    memset((void *) ett, -1, ett_len);
 
     ett[0] = &ett_bsmap;
     ett[1] = &ett_dtap;
@@ -8467,6 +8469,8 @@
 	&a_global_variant,
 	a_variant_options,
 	FALSE);
+
+    g_free(ett);
 }