From Alexis La Goutte via bug 5790: Fix 8 clang warnings, all of which were:
authorcmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 31 Mar 2011 15:17:49 +0000 (15:17 +0000)
committercmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 31 Mar 2011 15:17:49 +0000 (15:17 +0000)
"warning: Value stored to 'offset' is never read".  The 'offset' is now used.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36419 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-mongo.c

index 1bdf3fba8ed11740fc9104037f27a0a0d3c522ff..b7187d99375010d6a3ad76a96daec001246dcb16 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <epan/packet.h>
 #include <epan/prefs.h>
+#include <epan/expert.h>
 #include "packet-tcp.h"
 
 /* This is not IANA assigned nor registered */
@@ -112,11 +113,10 @@ static int hf_mongo_document_length = -1;
 static int hf_mongo_delete_flags = -1;
 static int hf_mongo_delete_flags_singleremove = -1;
 static int hf_mongo_number_of_cursor_ids = -1;
+static int hf_mongo_unknown = -1;
 
 static guint global_mongo_tcp_port = TCP_PORT_MONGO;
 
-static dissector_handle_t data_handle;
-
 static gint ett_mongo = -1;
 static gint ett_mongo_doc = -1;
 static gint ett_mongo_fcn = -1;
@@ -338,7 +338,6 @@ dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        proto_item *ti;
        proto_tree *mongo_tree;
        guint offset = 0, opcode;
-       tvbuff_t *next_tvb;
 
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "MONGO");
 
@@ -398,11 +397,14 @@ dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        offset = dissect_mongo_kill_cursors(tvb, offset, mongo_tree);
                break;
                default:
-                       next_tvb = tvb_new_subset(tvb, offset, -1, -1);
-                       call_dissector(data_handle,next_tvb, pinfo, tree);
+                       /* No default Action */
                break;
                }
-
+               if(offset < tvb_reported_length(tvb))
+               {
+                       ti = proto_tree_add_item(mongo_tree, hf_mongo_unknown, tvb, offset, -1, ENC_NA);
+                       expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, " Unknown Data (not interpreted)");
+               }
        }
 
 }
@@ -626,6 +628,11 @@ proto_register_mongo(void)
                        FT_INT32, BASE_DEC, NULL, 0x0,
                        "Number of cursorIDs in message", HFILL }
                },
+               { &hf_mongo_unknown,
+                       { "Unknown",           "mongo.unknown",
+                       FT_BYTES, BASE_NONE, NULL, 0x0,
+                       "Unknown Data type", HFILL }
+               },
        };
 
        static gint *ett[] = {
@@ -659,7 +666,6 @@ proto_reg_handoff_mongo(void)
        if (!initialized) {
 
                mongo_handle = create_dissector_handle(dissect_mongo, proto_mongo);
-               data_handle = find_dissector("data");
                initialized = TRUE;
        } else {