Commit Graph

578 Commits

Author SHA1 Message Date
Martin Kaiser 3b92f760ed add a NULL check to report_type_length_mismatch()
this might be called via proto_tree_add_item() with tree==NULL
which results in a crash

svn path=/trunk/; revision=51020
2013-07-29 21:10:13 +00:00
Evan Huus dbabc55955 Much simpler (and possibly faster) fix for the 64-bit value string label issue.
svn path=/trunk/; revision=50983
2013-07-28 20:05:04 +00:00
Evan Huus 4e5ac2989c As caught by Stig: 64-bit value strings could print the field name twice.
Don't do that.

svn path=/trunk/; revision=50982
2013-07-28 19:56:23 +00:00
Jakub Zawadzki 5b15390b3a Store protocol fields in single linked list, saves about 1 MB of memory.
svn path=/trunk/; revision=50967
2013-07-28 10:47:31 +00:00
Michael Mann f3dac73d38 Fix compile error that resulted from whitespace cleanup.
svn path=/trunk/; revision=50963
2013-07-28 00:11:30 +00:00
Michael Mann a87f47c02c Make many items filterable for Vines dissectors.
Add support for FT_VINES type.

svn path=/trunk/; revision=50962
2013-07-28 00:07:49 +00:00
Jakub Zawadzki 0d414ac0fd make some variables static
svn path=/trunk/; revision=50952
2013-07-27 20:57:58 +00:00
Evan Huus 5ede3bcde0 Follow-up to r50935: add support for 64-bit value strings in more places that
need it, I think this is all of them.

svn path=/trunk/; revision=50941
2013-07-26 23:51:00 +00:00
Evan Huus c0cac8611e Squelch MSVC warnings. It doesn't know that DISSECTOR_ASSERT_NOT_REACHED doesn't
return.

svn path=/trunk/; revision=50939
2013-07-26 22:52:34 +00:00
Evan Huus 6e3a30794e Add 64-bit value strings and the appropriate tooling (including yet another
overloaded use of the DISPLAY field). Thanks to Jakub for pointing out I'd done
this wrong the first time (months ago in r49357).

Fixes severity display for collectd protocol, originally filed at:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8472

svn path=/trunk/; revision=50935
2013-07-26 21:51:39 +00:00
Jeff Morriss d58c13c363 As pointed out in https://www.wireshark.org/lists/wireshark-dev/201307/msg00153.html :
The fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3290 needs
to allow for giving a length of -1 for FT_STRINGZ's.

This is another fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8960
(in addition to r50836).  There's no point in reverting that revision, though,
since there was no need to use a length of -1 in that case.

svn path=/trunk/; revision=50892
2013-07-25 18:37:18 +00:00
Jakub Zawadzki 696a79707b Optimize proto_item_append_string()
- When old string empty just pass new one (like: frame.protocols)
- if not, use ep_strconcat()

svn path=/trunk/; revision=50890
2013-07-25 17:19:17 +00:00
Guy Harris 8bd5a3649a Have get_uint_value() assume it's being passed an encoding value, which
isn't necessarily going to be zero if the item is big-endian.

The last argument to test_length() is an encoding, not a big-endian vs.
little-endian Boolean; name it appropriately.

This fixes bug 8953.

svn path=/trunk/; revision=50806
2013-07-22 23:11:07 +00:00
Jakub Zawadzki 547eabc949 Use label_fill also when boolean / bitfield.
svn path=/trunk/; revision=50682
2013-07-16 22:21:10 +00:00
Jakub Zawadzki 13e07be25f optimize: remove g_snprintf()'s from label_fill[_descr]
svn path=/trunk/; revision=50681
2013-07-16 22:09:29 +00:00
Alexis La Goutte 7c5b471584 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=50632
2013-07-15 18:06:29 +00:00
Jakub Zawadzki e26b65f0ec proto_custom_set() cleanup
- Merge _UINT / _INT into one case
- fix possible generation of wrong expression ("some_integer") for unknown value in BASE_NONE field 

svn path=/trunk/; revision=50548
2013-07-13 09:14:25 +00:00
Jeff Morriss b53ced1e6a get_hfi_and_length() hasn't returned the hfi since r50015: rename it
to get_hfi_length().

svn path=/trunk/; revision=50509
2013-07-11 15:03:43 +00:00
Jeff Morriss 160c35c8e9 For consistency:
s/hf_index/hfindex/g
s/hf_info/hfinfo/g

svn path=/trunk/; revision=50507
2013-07-11 14:58:11 +00:00
Jeff Morriss b6ee11e928 Fix the very long loop fuzz failure reported in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8923 :
Apply the fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3290
to proto_tree_add_bits_item().  That is, test that we have offset+length bytes
left in the TVB before trying to fake the item.

svn path=/trunk/; revision=50504
2013-07-11 14:46:30 +00:00
Jakub Zawadzki 87646b1126 Fixes for tmp_fld_check_value():
- FT_FRAMENUM can't have strings
- mask hfinfo->display to compare with valid BASE_ value

svn path=/trunk/; revision=50444
2013-07-08 05:59:07 +00:00
Jakub Zawadzki ed4622dc7f ups? first add + 1, then multiply.
svn path=/trunk/; revision=50438
2013-07-07 21:32:12 +00:00
Jakub Zawadzki d4f1a2c599 tree_is_expanded: make it bit array.
Right now we have about 36K of ett items, and tree_is_expanded takes: 144K of memory (36K*sizeof(gboolean))
By making tree_is_expanded bit array, it reduce size to 4.5K (36K/8)

svn path=/trunk/; revision=50434
2013-07-07 17:13:17 +00:00
Jakub Zawadzki 792f35a28c Make tree_is_expanded array static, add setter/getter function.
svn path=/trunk/; revision=50433
2013-07-07 16:33:49 +00:00
Jakub Zawadzki 5ef777c80b proto.c: add few more cases when oct/hex can show up with signed number
remove invalid comment about HEX/OCT print not supported for signed numbers.

svn path=/trunk/; revision=50427
2013-07-06 23:46:31 +00:00
Jakub Zawadzki 242e18dace PROTO_REGISTRAR_GET_NTH() not needed after TRY_TO_FAKE_THIS_ITEM
svn path=/trunk/; revision=50376
2013-07-03 22:57:53 +00:00
Jakub Zawadzki 99e03acfd8 Optimize proto_item_prepend_text: if there's no fi->rep avoid one strlcpy().
svn path=/trunk/; revision=50372
2013-07-03 17:44:46 +00:00
Jakub Zawadzki 9c58621893 - rename and optimize proto_data_add_maybe_interesting_field
- proto_tree_add_node() double checks if tree_type is valid remove second one (first one is more verbose)

svn path=/trunk/; revision=50328
2013-07-02 21:26:14 +00:00
Jakub Zawadzki 68c2c57037 Remove tree argument from TRY_TO_FAKE_THIS_REPR macro
PTREE_DATA should be the same for both *tree* and *pi*

svn path=/trunk/; revision=50326
2013-07-02 20:51:58 +00:00
Jakub Zawadzki b0e04aca73 Rewrite proto_lookup_or_create_interesting_hfids() and rename to proto_data_add_maybe_interesting_field
Now proto_data_add_maybe_interesting_field:
- it actually add field_info to interesting hash_tree
- accept only required parameters
- is called only by proto_tree_add_node

svn path=/trunk/; revision=50321
2013-07-02 19:23:10 +00:00
Jakub Zawadzki 1d2409dd69 Micro-optimize common case for proto_tree_add_pi() assume tree != NULL, pfi != NULL
Fix calles.

svn path=/trunk/; revision=50320
2013-07-02 18:56:48 +00:00
Jakub Zawadzki cce4ad3c66 tree == NULL check is already done by TRY_TO_FAKE_THIS_ITEM() macro.
svn path=/trunk/; revision=50319
2013-07-02 18:45:47 +00:00
Jakub Zawadzki 874f119225 Remove not needed TRY_TO_FAKE_THIS_ITEM() from proto_tree_*_format & proto_tree_*_format_value
Right now for proto_tree_add format & _format_value TRY_TO_FAKE_THIS_ITEM() is called twice
one from 'format' function, second time from 'no format' function.

This reduces size of .text by 10K:
   text    data     bss     dec     hex filename
  76012     112      56   76180   12994 proto-after.o
  86324     112      56   86492   151dc proto-before.o


svn path=/trunk/; revision=50318
2013-07-02 18:36:00 +00:00
Jakub Zawadzki d27f026884 cleanup, put result of decode_bitfield_value directly to fi->rep->representation
svn path=/trunk/; revision=50316
2013-07-02 17:09:38 +00:00
Jakub Zawadzki 2ab52de572 Add TRY_TO_FAKE_THIS_REPR into proto_tree_set_representation_value() call.
Remove TRY_TO_FAKE_THIS_REPR from calling functions.

svn path=/trunk/; revision=50314
2013-07-02 16:09:56 +00:00
Jakub Zawadzki d0c5a5561d snprintf -> strlcpy.
svn path=/trunk/; revision=50311
2013-07-02 14:14:52 +00:00
Jakub Zawadzki 7b5a0e4a15 Cleanup fill_label_[u]int64 to fill_label_number64
svn path=/trunk/; revision=50299
2013-07-01 15:24:42 +00:00
Jakub Zawadzki 7dc10daffe Rewrite hfinfo_numeric_value_format as a special case for _hfinfo_number_value_format
cleanup some functions.

svn path=/trunk/; revision=50290
2013-07-01 09:46:50 +00:00
Jeff Morriss 772b17a6c6 Actually use the new environment variable created in r49784--apparently I forgot to check in this file (sigh).
svn path=/trunk/; revision=50257
2013-06-30 16:16:13 +00:00
Jakub Zawadzki 33abb4e091 proto_custom_set: don't fetch values twice.
svn path=/trunk/; revision=50252
2013-06-30 13:23:31 +00:00
Guy Harris 882db1c5fb Squelch a warning.
Rename the "is_int" argument to fill_label_number() to make it clearer
what it indicates, i.e. whether the number is signed or unsigned.

svn path=/trunk/; revision=50224
2013-06-28 22:47:50 +00:00
Jakub Zawadzki d0c862bfa6 Merge fill_label_[u]int to fill_label_number, hfinfo_[u]int_value_format to hfinfo_number_value_format
svn path=/trunk/; revision=50220
2013-06-28 21:46:41 +00:00
Jakub Zawadzki 8ccfc17cf2 Merge _hfinfo_int_value_format and _hfinfo_uint_value_format to one function hfinfo_number_vals_format
In hfinfo_number_vals_format check how hf should be formatted.

svn path=/trunk/; revision=50217
2013-06-28 19:54:04 +00:00
Jakub Zawadzki eecbadecf4 #micro-optimization, remove g_snprintf()'s from _hfinfo_[u]int_value_format with some new fresh replacements.
svn path=/trunk/; revision=50216
2013-06-28 19:34:48 +00:00
Jakub Zawadzki 4504ed0bcc use hf_try_val_to_str() in two more places.
svn path=/trunk/; revision=50199
2013-06-27 22:26:34 +00:00
Jakub Zawadzki ac3f0d7483 cleanup [u]int fill proto with value_string function
Create generic int/uint fill functions from hfinfo_[u]int_value_format.

XXX: to be honest I don't get it why if dev picked up BASE_DEC_HEX and has value string we're truncating it to BASE_DEC...

svn path=/trunk/; revision=50197
2013-06-27 19:17:22 +00:00
Jakub Zawadzki c36a384b25 cleanup int/uint fill proto functions.
- hfinfo_uint_value_format(), hfinfo_int_value_format() formats value instead of returning proper format
- remove hfinfo_int_format(), hfinfo_uint_format

svn path=/trunk/; revision=50193
2013-06-27 18:40:08 +00:00
Jakub Zawadzki 3f5665a6b1 Add functions hf_try_val_to_str[_const]
svn path=/trunk/; revision=50190
2013-06-27 17:26:23 +00:00
Jakub Zawadzki f60dd85784 Pass hfinfo and not hfindex to internal proto functions.
svn path=/trunk/; revision=50015
2013-06-18 20:52:31 +00:00
Evan Huus 64a4df1963 Fix the integer overflow case Jakub caught in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3290#c26

Also use indentation consistent with the rest of the file.

svn path=/trunk/; revision=49652
2013-05-31 13:08:03 +00:00