Wireshark mailing list archives
Re: string manipulation
From: Gerald Combs <gerald () wireshark org>
Date: Mon, 25 Jan 2010 13:31:46 -0800
Guy Harris wrote:
On Jan 25, 2010, at 1:11 PM, Brian Oleksa wrote:char flowname[9]; strncpy(flowname, ptr, 8); flowname[8] = '\0'; ptr += 8; proto_tree_add_uint_format(helen_sub_tree, hf_helen_length, tvb, offset, 8, 0, "Flowname: %s", flowname);It's a string, not a number, so don't use proto_tree_add_uint_format(), or any other proto_tree_add_uint routine. If it's an 8-octet field containing a null-padded string (presumably the string can have 8 octets), you should use something such as proto_tree_add_string(helen_sub_tree, hf_helen_flowname, tvb, offset, 8, flowname);
Assuming hf_helen_flowname is an FT_STRING, couldn't you dispense with the string-fetching and ptr-tracking entirely and just use proto_tree_add_item(helen_sub_tree, hf_helen_flowname, tvb, offset, 8, FALSE); ? ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Re: getting the time, (continued)
- Re: getting the time Brian Oleksa (Jan 21)
- Re: getting the time Guy Harris (Jan 21)
- Re: getting the time Brian Oleksa (Jan 21)
- Re: getting the time Guy Harris (Jan 21)
- Re: getting the time Brian Oleksa (Jan 21)
- Re: getting the time Guy Harris (Jan 21)
- Re: getting the time Brian Oleksa (Jan 21)
- Re: getting the time Guy Harris (Jan 21)
- string manipulation Brian Oleksa (Jan 25)
- Re: string manipulation Guy Harris (Jan 25)
- Re: string manipulation Gerald Combs (Jan 25)
- Re: string manipulation Guy Harris (Jan 25)
- Re: string manipulation Brian Oleksa (Jan 25)
- Re: string manipulation Guy Harris (Jan 25)
- Re: getting the time Brian Oleksa (Jan 21)
- Re: string manipulation Anders Broman (Jan 25)
- Re: getting the time philippe alarcon (Jan 21)
- Re: getting the time Guy Harris (Jan 21)
- Re: getting the time Guy Harris (Jan 21)
- Re: getting the time philippe alarcon (Jan 21)
- Re: getting the time Guy Harris (Jan 21)