Make the "Save only marked frames" button in the "Save As..." dialog box
[obnox/wireshark/wip.git] / packet-x11.c
index a03f2133e44fef1cc21dd17e297500149447a79b..d338abe66a38b9ca7864ebb2b51f744980dd29d9 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for X11 dissection
  * Copyright 2000, Christophe Tronche <ch.tronche@computer.org>
  *
- * $Id: packet-x11.c,v 1.23 2001/10/04 00:30:23 guy Exp $
+ * $Id: packet-x11.c,v 1.26 2001/12/03 03:59:43 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -72,6 +72,8 @@ static int proto_x11 = -1;
 static gint ett_x11 = -1;
 static gint ett_x11_request = -1;
 
+static dissector_handle_t data_handle;
+
 #define TCP_PORT_X11                   6000
 #define TCP_PORT_X11_2                 6001
 #define TCP_PORT_X11_3                 6002
@@ -1043,7 +1045,7 @@ static void stringCopy(char *dest, const char *source, int length)
 static void listOfString8(tvbuff_t *tvb, int hf, int hf_item, int length)
 {
       char *s = NULL;
-      int allocated = 0;
+      guint allocated = 0;
       proto_tree *tt;
       int i;
 
@@ -1060,7 +1062,7 @@ static void listOfString8(tvbuff_t *tvb, int hf, int hf_item, int length)
 
       while(length--) {
            unsigned l = VALUE8(tvb, cur_offset);
-           if (allocated < l + 1) {
+           if (allocated < (l + 1)) {
                  /* g_realloc doesn't work ??? */
                  g_free(s);
                  s = g_malloc(l + 1);
@@ -1103,7 +1105,7 @@ static void string16_with_buffer_preallocated(tvbuff_t *tvb, proto_tree *t,
                  truncated = TRUE;
                  l = STRING16_MAX_DISPLAYED_LENGTH;
            }
-           if (*sLength < l + 3) {
+           if (*sLength < (int) l + 3) {
                  g_free(*s);
                  *s = g_malloc(l + 3);
                  *sLength = l + 3;
@@ -1163,7 +1165,7 @@ static void listOfTextItem(tvbuff_t *tvb, int hf, int sizeIs16)
                  proto_tree *ttt;
                  gint8 delta = VALUE8(tvb, cur_offset + 1);
                  if (sizeIs16) l += l;
-                 if (allocated < l + 1) {
+                 if ((unsigned) allocated < l + 1) {
                        /* g_realloc doesn't work ??? */
                        g_free(s);
                        s = g_malloc(l + 1);
@@ -2859,7 +2861,7 @@ dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
       little_endian = guess_byte_ordering(tvb, pinfo);
       left = dissect_x11_request_loop(tvb, x11_tree);
       if (left)
-           dissect_data(tvb, cur_offset, pinfo, x11_tree);
+           call_dissector(data_handle,tvb_new_subset(tvb, cur_offset,-1, tvb_reported_length_remaining(tvb,cur_offset)), pinfo, x11_tree);
 }
 
 static void
@@ -2884,7 +2886,7 @@ dissect_x11_event(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
 /* Code to process the packet goes here */
 
-           dissect_data(tvb, 0, pinfo, x11_tree);
+           call_dissector(data_handle,tvb, pinfo, x11_tree);
       }
 }
 
@@ -2940,7 +2942,11 @@ void proto_register_x11(void)
 void
 proto_reg_handoff_x11(void)
 {
-  dissector_add("tcp.port", TCP_PORT_X11, dissect_x11, proto_x11);
-  dissector_add("tcp.port", TCP_PORT_X11_2, dissect_x11, proto_x11);
-  dissector_add("tcp.port", TCP_PORT_X11_3, dissect_x11, proto_x11);
+  dissector_handle_t x11_handle;
+
+  x11_handle = create_dissector_handle(dissect_x11, proto_x11);
+  dissector_add("tcp.port", TCP_PORT_X11, x11_handle);
+  dissector_add("tcp.port", TCP_PORT_X11_2, x11_handle);
+  dissector_add("tcp.port", TCP_PORT_X11_3, x11_handle);
+  data_handle = find_dissector("data");
 }