aboutsummaryrefslogtreecommitdiffstats
path: root/epan/value_string.c
AgeCommit message (Collapse)AuthorFilesLines
2015-02-04emem is dead! Long live wmem!Michael Mann1-1/+0
Change-Id: Iddd1200e62bf3200cb1a68408378dd9d47120b77 Reviewed-on: https://code.wireshark.org/review/6939 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-04Convert val_to_str -> val_to_str_wmem.Michael Mann1-1/+1
This is mostly for GUI usage, but a few dissectors needed some "non-packet scope" conversions. val_to_str officially now uses wmem_packet_scope() Change-Id: Ic9413eeb3406d7a7683222b86709f3675d628d81 Reviewed-on: https://code.wireshark.org/review/6933 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-03Convert val_to_str_ext -> val_to_str_ext_wmem for calls that don't have ↵Michael Mann1-5/+5
valid packet scope (GUI). val_to_str_ext now officially uses wmem_packet_scope(). Removed const from val_to_str[_ext]_wmem return value since it's not really constant. Created utility functions in qt_ui_utils.h to help with the new memory management for its GUI. Change-Id: Idf2ce4a4ce78d628b2269ad23a3a48fbfc9c077c Reviewed-on: https://code.wireshark.org/review/6926 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-02Create wmem versions of val_to_str and val_to_str_extMichael Mann1-0/+28
These will be used to replace cases where packet-scope isn't valid for val_to_str/val_to_str_ext calls Change-Id: Ie8a4c423a8608548c837c1ae7edde52c4d728340 Reviewed-on: https://code.wireshark.org/review/6880 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-31Convert the value string APIs that only currently have packet-scope use to wmem.Michael Mann1-3/+3
Change-Id: I36942493ce73b49e7257edea967eddf22f21f58e Reviewed-on: https://code.wireshark.org/review/6879 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-07-27Make value_string_ext const-correct.Kevin Cox1-19/+12
There is still some const-incorrect usage of them but those can be ironed out after this change has been made. Change-Id: Iba0631c804bdab34d7c0232b49967130e3370488 Reviewed-on: https://code.wireshark.org/review/3199 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-12-13Value_string.h: Minor changes to comment textBill Meier1-6/+8
value_string.c: value_string_ext_validate() always fails on Windows when called from a different DLL (i.e. a plugin). So: Add #ifndef _WIN32 around the offending code. svn path=/trunk/; revision=54047
2013-11-21Do some constification;Bill Meier1-22/+30
Create/use value_string_ext_free(); Display certain numbers also as hex in the "forced to fall back to linear search: ..." value-string warning msg Add editor-modelines to some files; Do some whitespace changes. svn path=/trunk/; revision=53484
2013-09-29Replace some val_to_str calls with the equivalent val_to_str_const calls (andEvan Huus1-0/+16
implement rval_to_str_const to do this). The format-strings didn't have any parameter specifiers in them, so they were clearly never used (or they would have blown up) but still a bug. This is one of the first steps towards converting val_to_str and friends to wmem. I'm honestly not sure what the best approach is for the API in this case: the vast majority of usage is within dissectors, so just hard-coding packet scope (the way they currently hard-code ep_ scope) doesn't look terrible, but there are *some* uses in taps and other places that will need to be converted to something else if we go that route. Adding a wmem_pool parameter just for the uncommon case seems a bit like overkill, though perhaps it is the right thing to do. svn path=/trunk/; revision=52264
2013-08-14Include config.h first; it defines _FILE_OFFSET_BITS, and if some systemGuy Harris1-2/+2
header later causes it to be redefined - as happens on my Solaris 11 virtual machine - we get a redefinition warning, which gets treated as an error. svn path=/trunk/; revision=51349
2013-07-26Add 64-bit value strings and the appropriate tooling (including yet anotherEvan Huus1-0/+59
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-06Revert part of r50415. As pointed out by Jakub, some of the value_stringEvan Huus1-4/+5
functions are called when no dissection is going on, and so can't use wmem_packet_scope(). svn path=/trunk/; revision=50428
2013-07-06Wmem-ify value-strings. Another ~10KB gone.Evan Huus1-8/+9
svn path=/trunk/; revision=50415
2013-03-30Note to self: stop using 'index' as a variable name, it triggers -Wshadow onEvan Huus1-4/+4
some platforms. You'd think I'd have learned by now. svn path=/trunk/; revision=48646
2013-03-29Implement str_to_val, opposite of val_to_str for value_strings.Evan Huus1-0/+42
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8467 svn path=/trunk/; revision=48645
2013-03-29Remove decode_enumerated_bitfield and decode_enumerated_bitfield_shifted.Evan Huus1-36/+0
Effectively inline the only remain call (and replace a static buffer with ep memory). Much of the NFS dissector needs to be converted to use named fields at which point this code can go away, but that's a much bigger job. Also, add modelines to packet-nfs.c and mark some internal value_string functions as WS_DLL_LOCAL. svn path=/trunk/; revision=48635
2013-03-29Rename value string (and similar) functions to use a consistent pattern. ThisEvan Huus1-41/+41
was done using textual search+replace, not anything syntax-aware, so presumably it got most comments as well (except where there were typos). Use a consistent coding style, and make proper use of the WS_DLL_* defines. Group the functions appropriately in the header. I ended up getting rid of most of the explanatory comments since many of them duplicated what was in the value_string.c file (and were out of sync with the recent updates I made to those in r48633). Presumably most of the comments should be in the .h file not the .c file, but there's enough churn ahead that it's not worth fixing yet. Part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8467 svn path=/trunk/; revision=48634
2013-03-28Greatly clean up value_string.cEvan Huus1-342/+380
- use consistent indentation and coding style - add modelines - replace some g_assert calls with DISSECTOR_ASSERT where it makes sense - group related functions together and simplify many comments by referring to the 'normal' value_string as the canonical version svn path=/trunk/; revision=48633
2013-03-26Give better diagnostics for "Extended value string XXX forced to fallGuy Harris1-6/+13
back to linear search", to make it easier to find the out-of-order entries. svn path=/trunk/; revision=48555
2013-03-20 From beroset:Bill Meier1-1/+1
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397 svn path=/trunk/; revision=48438
2013-03-19Warn if an extended value string falls back to linear search.Evan Huus1-0/+2
See https://www.wireshark.org/lists/wireshark-dev/201303/msg00179.html svn path=/trunk/; revision=48415
2013-03-15Revert warning that seems to have been accidentally included in r48319.Evan Huus1-2/+0
svn path=/trunk/; revision=48323
2013-03-15[-Wmissing-prototypes]Anders Broman1-0/+2
Use explicit casts. svn path=/trunk/; revision=48319
2013-02-21String passed to val_to_str() must have int format specifier (%u, %d, %x, ↵Jakub Zawadzki1-2/+2
and so on...). Fix some cases (easy to grep) by call to val_to_str_const(). svn path=/trunk/; revision=47807
2012-12-26Fix a bunch of warnings.Guy Harris1-1/+1
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
2012-12-12Fix some indentation.Jeff Morriss1-3/+6
svn path=/trunk/; revision=46512
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45016
2012-08-24Force extended value string linear search (not binary search) in one case:Bill Meier1-1/+16
Fixed: { -2, -1, 0, 1, 3} (note gap) used a binary search (which would fail); Note: { -2, -1, 0, 1, 2 ,3 } (no gap) allowed; will still do a direct access; Also: Add a comment to README.developer extended value string section. svn path=/trunk/; revision=44659
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-04-23Fix a typo.Bill Meier1-1/+1
svn path=/trunk/; revision=42201
2011-04-28Try to fix:Jakub Zawadzki1-1/+1
value_string.c(175) : warning C4244: '=' : conversion from '__int64' to 'gint', possible loss of data svn path=/trunk/; revision=36931
2011-04-28Change value_string_ext->_vs_match to return value_string struct (instead of ↵Jakub Zawadzki1-42/+42
strptr), Now index can be easily calculated so remove idx pointer from all match functions. Just in case change names if someone is using wireshark internals. svn path=/trunk/; revision=36930
2011-01-12Fix the fuzz failure in ↵Jeff Morriss1-8/+16
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5574 : The first time a value_string_ext() is accessed, _match_strval_ext_init() is used before the real match function is called. This function was not expanded to take an idx parameter (in rev 35451). It compiled only because the function: a) previously did not match _value_string_match_t b) and the difference was being cast away when assigning _match_strval to it (So the fact that the index parameter was not added was also ignored.) To fix the problem, give _match_strval_ext_init() and index parameter and use it instead of a dummy variable when calling the real match function. That way the first call to match_strval_ext_idx() will return an actual (initialized) index. To prevent the problem in the future, make the vse argument to _match_strval_ext_init() const *and then cast away the constness* so the function can modify the vse. svn path=/trunk/; revision=35508
2011-01-10Introduce match_strval_idx_ext()Anders Broman1-17/+40
svn path=/trunk/; revision=35451
2010-11-14'tshark -G values' - Validate (somewhat) value_string_ext before use to ↵Bill Meier1-2/+14
prevent a crash. svn path=/trunk/; revision=34869
2010-11-12Enhance 'tshark -G values': Add info about extended value strings (including ↵Bill Meier1-0/+13
acess method). svn path=/trunk/; revision=34854
2010-10-29Improve g_warning text slightly.Bill Meier1-1/+3
svn path=/trunk/; revision=34697
2010-10-14Rework "extended value strings":Bill Meier1-58/+151
- Allow direct access when a range of values begins with a value other than 0; - Provide value_string_ext_new() for creating extended value strings at runtime; - Do access to value_string_ext members via a macro (all but value_string.c); - Update documentation. svn path=/trunk/; revision=34514
2010-09-17Use val_to_str_ext() & friends to access sminmpec_values[];Bill Meier1-4/+3
Also: packet-nhrp.c: #include sminmpec.h not req'd; svn path=/trunk/; revision=34143
2010-05-19Remove debugging printf from match_strval_ext_init()Gerasimos Dimitriadis1-1/+0
svn path=/trunk/; revision=32903
2010-04-27From Jakub Zawadzki:Anders Broman1-26/+78
- use function pointers instead of switch. - initalize ->match_type during first use of match_str() func. svn path=/trunk/; revision=32576
2010-04-27From Jakub Zawadzki:Anders Broman1-0/+60
Itroduce value_string_ext for faster value matching in value_strings. svn path=/trunk/; revision=32574
2010-04-03 From Yaniv Kaul: constify parametersBill Meier1-9/+9
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422 From me: Fix a number of instances where the function prototype or the function definition wasn't changed so there was a mismatch thus causing Windows (but not gcc) compilation errors. svn path=/trunk/; revision=32365
2010-04-02Revert SVN #32360 until Windows compilation errors corrected.Bill Meier1-9/+9
svn path=/trunk/; revision=32361
2010-04-02From Yaniv Kaul: constify parametersBill Meier1-9/+9
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422 svn path=/trunk/; revision=32360
2009-09-06Don't pass ep_alloc()'ed strings to col_set_str().Kovarththanan Rajaratnam1-0/+16
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3984 svn path=/trunk/; revision=29726
2009-05-26From Didier Gautheron via bug 3052:Gerald Combs1-0/+46
Add: - FIX 4.0 to 4.4 fields, auto generated with XSLT stylesheets applied on http://www.quickfixengine.org/ xml files (not included quickfixengine code is BSD but xml files have no copyright). - value_string functions for string keys, added to value_string.c. - FIX desegmentation, it doesn't work well with malformed FIX PDU. svn path=/trunk/; revision=28478
2009-04-08More size_t fixes.Gerald Combs1-2/+2
svn path=/trunk/; revision=28000
2007-10-11Allow for dynamic value string array selection.Jaap Keuter1-12/+16
svn path=/trunk/; revision=23149