Wireshark-bugs: [Wireshark-bugs] [Bug 7493] Dissector for the Parrot AR Drone
Date: Mon, 23 Jul 2012 03:19:51 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7493

--- Comment #8 from Alexis La Goutte <alexis.lagoutte@xxxxxxxxx> 2012-07-23 03:19:49 PDT ---
Hi,
A more complete review !

There is a lot of 
            while(*LED_str_seq != ',')
            {
                LED_str_seq = tvb_get_ephemeral_string(tvb, offset,1);
                ++offset;
                ++length;
            }
            --length;
why not use led_len = tvb_find_guint8(tvb, offset, length, ','); ? 
and replace 
            proto_tree_add_string_format_value(LED_t, hf_LED_seq, tvb,
LED_off_seq, 
            LED_len_seq, LED_str_seq, "%s", LED_str_seq);
by 
proto_tree_add_item(LED_t, hf_LED_seq, tvb, offset, ENC_ASCII);


            /* Add REF ctrl */
            if(strcmp(REF_str_ctrl, "290718208")==0)
            {
                proto_tree_add_string_format_value(REF_t, hf_REF_ctrl, tvb, 
                REF_off_ctrl, REF_len_ctrl,
                REF_str_ctrl, "%s (FLYING MODE)", REF_str_ctrl);
            } else if(strcmp(REF_str_ctrl, "290717952")==0)
            {
                proto_tree_add_string_format_value(REF_t, hf_REF_ctrl, tvb, 
                REF_off_ctrl, REF_len_ctrl,
                REF_str_ctrl, "%s (EMERGENCY LANDING)", REF_str_ctrl);
            } else if(strcmp(REF_str_ctrl, "290717696")==0)
            {
                proto_tree_add_string_format_value(REF_t, hf_REF_ctrl, tvb, 
                REF_off_ctrl, REF_len_ctrl,
                REF_str_ctrl, "%s (LANDING MODE)", REF_str_ctrl);
            } else
            {
                proto_tree_add_string_format_value(REF_t, hf_REF_ctrl, tvb, 
                REF_off_ctrl, REF_len_ctrl,
                REF_str_ctrl, "%s (UNKNOWN COMMAND)", REF_str_ctrl);
            }
Look the documentation about value_string or tfs (for some other type)

There is also some Clang warning :
packet-ar_drone.c:801:4: warning: Value stored to 'noffset' is never read
packet-ar_drone.c:1105:4: warning: Value stored to 'length' is never read
packet-ar_drone.c:1104:4: warning: Value stored to 'noffset' is never read
packet-ar_drone.c:802:4: warning: Value stored to 'length' is never read
packet-ar_drone.c:622:4: warning: Value stored to 'noffset' is never read
packet-ar_drone.c:623:4: warning: Value stored to 'length' is never read
packet-ar_drone.c:1009:4: warning: Value stored to 'LED_str_flo' is never read



Also there is a mix a tab and space for indent (Please add your modelines info
: http://www.wireshark.org/tools/modelines.html )

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.