Ethereal-dev: [Ethereal-dev] Patch to packet-jxta.c

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

From: Peter Johansson <Peter.Johansson@xxxxxxxxxxxx>
Date: Fri, 07 Jan 2005 18:17:09 +0100
I just updated the source from anonymous svn and ethereal no longer compiles on Windows. The problem lies in the new dissector packet-jxta.c.
I have supplied a patch which remedies this problem.

/ Peter
--- h:\ethereal-win32-libs\epan\dissectors\packet-jxta.c	2005-01-07 18:10:13.875000000 +0100
+++ c:\temp\packet-jxta.c	2005-01-07 18:06:18.000000000 +0100
@@ -234,6 +234,8 @@
 static void dissect_jxta_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
   proto_tree      *jxta_tree = NULL;
   proto_item      *ti;
+  guint32 udpsignature = tvb_get_ntohl( tvb, 0 );
+  gboolean goodsig = 0 == (udpsignature ^ 0x4A585441U);
 
   if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA");
@@ -246,10 +248,6 @@
     col_add_fstr(pinfo->cinfo, COL_INFO, "%s", "UDP Message");
   }
 
-  guint32 udpsignature = tvb_get_ntohl( tvb, 0 );
-    
-  gboolean goodsig = 0 == (udpsignature ^ 0x4A585441U);
-    
   if (tree) {
     ti = proto_tree_add_item(tree, hf_jxta_udp, tvb, 0, -1, FALSE);
     jxta_tree = proto_item_add_subtree(ti, ett_jxta_udp);
@@ -283,7 +281,8 @@
   proto_tree      *jxta_tree = NULL;
   proto_item      *ti;
   guint offset = 0;
-    
+  tvbuff_t* jxta_message_tvb;
+  
   if (tree) {
     ti = proto_tree_add_item(tree, hf_jxta_framing, tvb, 0, -1, FALSE);
     jxta_tree = proto_item_add_subtree(ti, ett_jxta_framing);
@@ -331,7 +330,7 @@
     }
   } while( TRUE );
   
-  tvbuff_t* jxta_message_tvb = tvb_new_subset( tvb, offset, tvb_length(tvb) - offset, tvb_length(tvb) - offset );
+  jxta_message_tvb = tvb_new_subset( tvb, offset, tvb_length(tvb) - offset, tvb_length(tvb) - offset );
 
   /* Call it a new layer and pass the tree as we got it */
   dissect_jxta_message( jxta_message_tvb, pinfo, tree );
@@ -343,6 +342,8 @@
 static void dissect_jxta_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
   proto_tree      *jxta_tree = NULL;
   proto_item      *ti;
+  guint32 msgsignature = tvb_get_ntohl( tvb, 0 );
+  gboolean goodsig = 0 == (msgsignature ^ 0x6A786D67U);
 
   if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA");
@@ -360,10 +361,6 @@
     jxta_tree = proto_item_add_subtree(ti, ett_jxta_udp);
   }
   
-  guint32 msgsignature = tvb_get_ntohl( tvb, 0 );
-    
-  gboolean goodsig = 0 == (msgsignature ^ 0x6A786D67U);
-  
   if( tree ) {
     ti = proto_tree_add_item( jxta_tree, hf_jxta_message_sig, tvb, 0, sizeof(guint32), FALSE );