Wireshark-dev: [Wireshark-dev] C89 fixes for wireshark SVN
From: Albert Chin <[email protected]>
Date: Sun, 18 Jun 2006 10:03:29 -0500
Attached patch fixes some C++ comments in C source files and fixes
some non-constant initializations.

Patch against SVN head.

-- 
albert chin ([email protected])
Index: asn1/h248/packet-h248-template.c
===================================================================
--- asn1/h248/packet-h248-template.c	(revision 18488)
+++ asn1/h248/packet-h248-template.c	(working copy)
@@ -1151,11 +1151,14 @@
 	
     if (keep_persistent_data) {
 		se_tree_key_t key[] = {
-			{1,&(framenum)},
-			{1,&offset},
+			{1,NULL},
+			{1,NULL},
 			{0,NULL},
 		};
 
+	key[0].key = &(framenum);
+	key[1].key = &offset;
+
         if (( m = se_tree_lookup32_array(msgs,key) )) {
             m->commited = TRUE;
 			return m;
@@ -1224,12 +1227,16 @@
 
         } else {
 			se_tree_key_t key[] = {
-				{1,&(m->hi_addr)},
-				{1,&(m->lo_addr)},
-				{1,&(t_id)},
+				{1,NULL},
+				{1,NULL},
+				{1,NULL},
 				{0,NULL}
 			};
 			
+            key[0].key = &(m->hi_addr);
+            key[1].key = &(m->lo_addr);
+            key[2].key = &(t_id);
+
             trxmsg = se_alloc(sizeof(h248_trx_msg_t));
             t = se_tree_lookup32_array(trxs,key);
 
@@ -1288,19 +1295,27 @@
 
     if (keep_persistent_data) {
 		se_tree_key_t ctx_key[] = {
-		{1,&(m->hi_addr)},
-		{1,&(m->lo_addr)},
-		{1,&(c_id)},
+		{1,NULL},
+		{1,NULL},
+		{1,NULL},
 		{0,NULL}
 		};
 		
 		se_tree_key_t trx_key[] = {
-		{1,&(m->hi_addr)},
-		{1,&(m->lo_addr)},
-		{1,&(t->id)},
+		{1,NULL},
+		{1,NULL},
+		{1,NULL},
 		{0,NULL}
 		};
 		
+        ctx_key[0].key = &(m->hi_addr);
+        ctx_key[1].key = &(m->lo_addr);
+        ctx_key[2].key = &(c_id);
+
+        trx_key[0].key = &(m->hi_addr);
+        trx_key[1].key = &(m->lo_addr);
+        trx_key[2].key = &(t->id);
+
         if (m->commited) {
             if (( context = se_tree_lookup32_array(ctxs_by_trx,trx_key) )) {
                 return context;
Index: epan/emem.c
===================================================================
--- epan/emem.c	(revision 18488)
+++ epan/emem.c	(working copy)
@@ -1388,12 +1388,17 @@
 	guint32 div = (len-1)/4;
 	guint32 residual = 0;
 	se_tree_key_t key[] = {
-		{1,&len},
-		{div,(guint32*)(&k[0])},
-		{1,&residual},
+		{1,NULL},
+		{0,NULL},
+		{1,NULL},
 		{0,NULL}
 	};
 
+	key[0].key = &len;
+	key[1].length = div;
+	key[1].key = (guint32*)(&k[0]);
+	key[2].key = &residual;
+
 	if (! div) {
 		key[1].length = key[2].length;
 		key[1].key = key[2].key;
@@ -1423,12 +1428,17 @@
 	guint32 div = (len-1)/4;
 	guint32 residual = 0;
 	se_tree_key_t key[] = {
-		{1,&len},
-		{div,(guint32*)(&k[0])},
-		{1,&residual},
+		{1,NULL},
+		{0,NULL},
+		{1,NULL},
 		{0,NULL}
 	};
 
+	key[0].key = &len;
+	key[1].length = div;
+	key[1].key = (guint32*)(&k[0]);
+	key[2].key = &residual;
+
 	if (! div) {
 		key[1].length = key[2].length;
 		key[1].key = key[2].key;
Index: epan/dissectors/packet-sccp.c
===================================================================
--- epan/dissectors/packet-sccp.c	(revision 18488)
+++ epan/dissectors/packet-sccp.c	(working copy)
@@ -757,12 +757,16 @@
         {
 			/* Calling and called is seen from initiator of CR */
 			se_tree_key_t key[] = {
-				{1,&dpck},
-				{1,&opck},
-				{1,&src_lr},
+				{1,NULL},
+				{1,NULL},
+				{1,NULL},
 				{0,NULL}
 			};
 			
+            key[0].key = &dpck;
+            key[1].key = &opck;
+            key[2].key = &src_lr;
+
             if (! ( assoc = se_tree_lookup32_array(assocs,key) ) ) {
                 assoc = se_alloc(sizeof(sccp_assoc_info_t));
                 
@@ -783,18 +787,26 @@
         {
 			/* Calling and called is seen from initiator of CR */
 			se_tree_key_t called_key[] = {
-				{1,&opck},
-				{1,&dpck},
-				{1,&dst_lr},
+				{1,NULL},
+				{1,NULL},
+				{1,NULL},
 				{0,NULL}
 			};
 			se_tree_key_t calling_key[] = {
-				{1,&dpck},
-				{1,&opck},
-				{1,&src_lr},
+				{1,NULL},
+				{1,NULL},
+				{1,NULL},
 				{0,NULL}
 			};
 
+            called_key[0].key = &opck;
+            called_key[1].key = &dpck;
+            called_key[2].key = &dst_lr;
+
+            calling_key[0].key = &dpck;
+            calling_key[1].key = &opck;
+            calling_key[2].key = &src_lr;
+
             if (( assoc = se_tree_lookup32_array(assocs,calling_key) )) {
                 if ( ! assoc->has_called_key ) {
                     se_tree_insert32_array(assocs,called_key,assoc);
@@ -825,21 +837,28 @@
         default:
         {
 			se_tree_key_t calling_key[] = {
-				{1,&opck},
-				{1,&dpck},
-				{1,&dst_lr},
+				{1,NULL},
+				{1,NULL},
+				{1,NULL},
 				{0,NULL}
 			};
 			
+            calling_key[0].key = &opck;
+            calling_key[1].key = &dpck;
+            calling_key[2].key = &dst_lr;
+
             assoc = se_tree_lookup32_array(assocs,calling_key);
 			/* Should a check be made on pinfo->p2p_dir ??? */
 			if (!assoc){
 				se_tree_key_t called_key[] = {
-					{1,&dpck},
-					{1,&opck},
-					{1,&dst_lr},
+					{1,NULL},
+					{1,NULL},
+					{1,NULL},
 					{0,NULL}
 				};
+				called_key[0].key = &dpck;
+				called_key[1].key = &opck;
+				called_key[2].key = &dst_lr;
 				assoc = se_tree_lookup32_array(assocs,called_key);
 			}
             break;
Index: epan/dissectors/packet-h248.c
===================================================================
--- epan/dissectors/packet-h248.c	(revision 18488)
+++ epan/dissectors/packet-h248.c	(working copy)
@@ -1557,11 +1557,14 @@
 	
     if (keep_persistent_data) {
 		se_tree_key_t key[] = {
-			{1,&(framenum)},
-			{1,&offset},
+			{1,NULL},
+			{1,NULL},
 			{0,NULL},
 		};
 
+        key[0].key = &(framenum);
+        key[1].key = &offset;
+
         if (( m = se_tree_lookup32_array(msgs,key) )) {
             m->commited = TRUE;
 			return m;
@@ -1630,12 +1633,16 @@
 
         } else {
 			se_tree_key_t key[] = {
-				{1,&(m->hi_addr)},
-				{1,&(m->lo_addr)},
-				{1,&(t_id)},
+				{1,NULL},
+				{1,NULL},
+				{1,NULL},
 				{0,NULL}
 			};
 			
+            key[0].key = &(m->hi_addr);
+            key[1].key = &(m->lo_addr);
+            key[2].key = &(t_id);
+
             trxmsg = se_alloc(sizeof(h248_trx_msg_t));
             t = se_tree_lookup32_array(trxs,key);
 
@@ -1694,19 +1701,27 @@
 
     if (keep_persistent_data) {
 		se_tree_key_t ctx_key[] = {
-		{1,&(m->hi_addr)},
-		{1,&(m->lo_addr)},
-		{1,&(c_id)},
+		{1,NULL},
+		{1,NULL},
+		{1,NULL},
 		{0,NULL}
 		};
 		
 		se_tree_key_t trx_key[] = {
-		{1,&(m->hi_addr)},
-		{1,&(m->lo_addr)},
-		{1,&(t->id)},
+		{1,NULL},
+		{1,NULL},
+		{1,NULL},
 		{0,NULL}
 		};
 		
+        ctx_key[0].key = &(m->hi_addr);
+        ctx_key[1].key = &(m->lo_addr);
+        ctx_key[2].key = &(c_id);
+
+        trx_key[0].key = &(m->hi_addr);
+        trx_key[1].key = &(m->lo_addr);
+        trx_key[2].key = &(t->id);
+
         if (m->commited) {
             if (( context = se_tree_lookup32_array(ctxs_by_trx,trx_key) )) {
                 return context;
Index: epan/dissectors/packet-lapd.c
===================================================================
--- epan/dissectors/packet-lapd.c	(revision 18488)
+++ epan/dissectors/packet-lapd.c	(working copy)
@@ -157,14 +157,14 @@
 			}
 		}
 		else if (pinfo->pseudo_header->lapd.pkttype == 3 /*PACKET_OTHERHOST*/) {
-			// We must be a TE, sniffing what other TE transmit
+			/* We must be a TE, sniffing what other TE transmit */
 
 			is_response = cr ? TRUE : FALSE;
 			srcname = "Remote User";
 			dstname = "Remote Network";
 		}
 		else {
-			// The frame is incoming
+			/* The frame is incoming */
 			if (pinfo->pseudo_header->lapd.we_network) {
 				is_response = cr ? TRUE : FALSE;
 				srcname = "Remote User";