Ethereal-dev: [Ethereal-dev] mgcp plugin patch

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

From: Ed Warnicke <hagbard@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Mar 2001 00:06:03 -0500 (EST)
Please check in this mgcp plugin patch.

Ed

Index: plugins/mgcp/moduleinfo.h
===================================================================
RCS file: /cvsroot/ethereal/plugins/mgcp/moduleinfo.h,v
retrieving revision 1.5
diff -u -r1.5 moduleinfo.h
--- moduleinfo.h	2001/03/04 03:38:20	1.5
+++ moduleinfo.h	2001/03/15 05:01:32
@@ -13,5 +13,5 @@
 #endif
 
 /* Version number of package */
-#define VERSION "0.0.5"
+#define VERSION "0.0.6"
 
Index: plugins/mgcp/packet-mgcp.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/mgcp/packet-mgcp.c,v
retrieving revision 1.18
diff -u -r1.18 packet-mgcp.c
--- packet-mgcp.c	2001/03/04 03:38:20	1.18
+++ packet-mgcp.c	2001/03/15 05:01:32
@@ -296,7 +296,6 @@
   tvbuff_t *next_tvb;
 
   /* Initialize variables */
-  
   tvb_sectionend = 0;
   tvb_sectionbegin = tvb_sectionend;
   sectionlen = 0;
@@ -1118,38 +1117,23 @@
    * Loop around until we either find a line begining with a carriage return
    * or newline character or until we hit the end of the tvbuff.
    */
-  tempchar = tvb_get_guint8(tvb,tvb_linebegin);
-  while( tempchar != '\r' && tempchar != '\n' &&
-	 tvb_linebegin <= maxoffset){
+  do {
+    tvb_linebegin = tvb_lineend;
+    tvb_current_len = tvb_length_remaining(tvb,tvb_linebegin);
     tvb_find_line_end(tvb, tvb_linebegin, tvb_current_len, &tvb_lineend);
-    if(tvb_lineend < maxoffset){
-      tempchar = tvb_get_guint8(tvb,tvb_lineend);
-      tvb_current_len -= tvb_section_length(tvb,tvb_linebegin,tvb_lineend); 
-      tvb_linebegin = tvb_lineend;
-    }
-    else{
-      tvb_linebegin = tvb_lineend;
-      break;
-    }
-  }
-  /*
-   * Some cleanup.  If we actually exited the while loop at a null line
-   * and set the appropraite next_token and tvb_current_len.  Otherwise 
-   * we just grab to the end of the buffer.
-   */
-  if(tempchar == '\r' || tempchar == '\n'){
-    tvb_find_line_end(tvb,tvb_linebegin,tvb_current_len,next_offset);
-    if(*next_offset < maxoffset){
-      tvb_current_len = tvb_linebegin - offset;
-    }
-    else{
-      tvb_current_len = maxoffset + 1;
-    }
+    tempchar = tvb_get_guint8(tvb,tvb_linebegin);
+  } 
+  while( tempchar != '\r' && tempchar != '\n' &&
+	 tvb_lineend <= maxoffset);
+
+  *next_offset = tvb_lineend;
+
+  if( tvb_lineend <= maxoffset ) {
+    tvb_current_len = tvb_linebegin - offset;
   }
   else {
-    *next_offset = maxoffset + 1;
     tvb_current_len = tvb_length_remaining(tvb,offset);
-  } 
+  }
 
   return (tvb_current_len);
 }