aboutsummaryrefslogtreecommitdiffstats
path: root/epan/color_filters.c
AgeCommit message (Collapse)AuthorFilesLines
2019-01-04epan: remove return from functions returning void.Dario Lombardo1-2/+0
Found by clang-tidy. Change-Id: Ibedfec5e5d3eca7c2e65319b7ecb4dcbe974b88b Reviewed-on: https://code.wireshark.org/review/31337 Petri-Dish: Dario Lombardo <lomato@gmail.com> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-10Qt: Add back pathLabel in some dialogsStig Bjørlykke1-3/+3
Add the pathLabel for Coloring Rules, Decode As, Display Filters and Capture Filter. Put the absolute file path into the pathLabel if the file exists. This aligns with UAT dialogs and frames. Change-Id: I72bd06e31bab220de0a0ef8df99df9a4daed667c Reviewed-on: https://code.wireshark.org/review/30089 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-29prefs: Don't remove unknown coloring rules.Stig Bjørlykke1-4/+4
When saving the colorfilters file, keep and disable unknown coloring rules instead of removing them. The user may want to correct the syntax. Change-Id: Ib27612a0601276b6ebbb467d7d253f3f72103d1c Reviewed-on: https://code.wireshark.org/review/29908 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-29prefs: Reset prefs.unknown_colorfilters before reading colorfiltersStig Bjørlykke1-0/+2
Reset prefs.unknown_colorfilters in the beginning of read_filters_file() to avoid a situation when the preference is set and never cleared. This will end up with an error message in UI even when not having unknown color filters. Change-Id: I835dbc2a57f0be6889eb5bce250987dabd796e30 Reviewed-on: https://code.wireshark.org/review/29904 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-19Try to discourage the use of APIs via counting.Gerald Combs1-2/+1
Add the ability to specify maximum function counts for each group to checkAPIs. Add maximum counts for the "termoutput" and "abort" groups where needed. Show summaries in various checkAPI targets. Switch uses of ws_g_warning back to plain g_warning. Change-Id: I5cbddc8c671729e424eed8551f69116d16491976 Reviewed-on: https://code.wireshark.org/review/29721 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-04-17glib: Use g_slist_free_full() in a couple of places.Anders1-3/+2
Change-Id: Iff833bf5c197959c8decb62d6ce794c6d0415fb7 Reviewed-on: https://code.wireshark.org/review/26978 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-17Remove some GTK+-only code.Gerald Combs1-3/+1
Change-Id: Ic2498c7acd6a1a522be45094148402ee34a6b4d1 Reviewed-on: https://code.wireshark.org/review/26958 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08epan: use SPDX indentifiers.Dario Lombardo1-13/+1
Skipping dissectors dir for now. Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa Reviewed-on: https://code.wireshark.org/review/25694 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-01Fix memleak in color_filters_read_globals()Jakub Zawadzki1-0/+1
Valgrind log: ==6102== Thread 1: ==6102== 32 bytes in 1 blocks are definitely lost in loss record 24,851 of 49,782 ==6102== at 0x4C29C4F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==6102== by 0xB17B7F7: __vasprintf_chk (vasprintf_chk.c:80) ==6102== by 0xA98C2AB: vasprintf (stdio2.h:210) ==6102== by 0xA98C2AB: g_vasprintf (gprintf.c:316) ==6102== by 0xA966DCC: g_strdup_vprintf (gstrfuncs.c:507) ==6102== by 0xA966E88: g_strdup_printf (gstrfuncs.c:533) ==6102== by 0x6A66B8C: color_filters_read_globals (color_filters.c:704) ==6102== by 0x6A66FBE: color_filters_get (color_filters.c:317) ==6102== by 0x402313: fuzz_init (fuzzshark.c:237) ==6102== by 0x40252D: LLVMFuzzerInitialize (fuzzshark.c:322) ==6102== by 0x401E33: main (StandaloneFuzzTargetMain.c:125) Change-Id: Ibc18edff6097eca736328810c903a151ddee22bc Reviewed-on: https://code.wireshark.org/review/25553 Tested-by: Jakub Zawadzki <darkjames-ws@darkjames.pl> Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl> Tested-by: Petri Dish Buildbot Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-10-15Remove superfluous null-checks before strdup/freeAhmad Fatoum1-10/+5
NULL checks were removed for following free functions: - g_free "If mem is NULL it simply returns" https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free - g_slist_free(_full)? "NULL is considered to be the empty list" https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html - g_strfreev "If str_array is NULL, this function simply returns." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev - g_slice_free "If mem is NULL, this macro does nothing." https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free - g_match_info_free "not NULL... otherwise does nothing" https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free - dfilter_free defined in Wireshark code. Returns early when passed NULL epan/dfilter/dfilter.c They were also removed around calls to g_strdup where applicable: - g_strdup "If str is NULL it returns NULL." https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04 Reviewed-on: https://code.wireshark.org/review/23406 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2017-06-09Handle filter open and read errors better.Guy Harris1-70/+67
If the user's color filter file exists but can't be opened, fail and return a failure indication. If it doesn't exist, just try reading the global color filter file. If *that* exists but can't be opened, fail and return a failure indication; if it doesn't exist, don't treat that as an error. Change-Id: I5ebdc0eb1ada3cc190990be9228639304f32147e Reviewed-on: https://code.wireshark.org/review/22054 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-12Rename routines to clarify what they do.Guy Harris1-1/+1
XXX_prime_with_YYY makes it a bit clearer than does XXX_prime_YYY that we're not priming YYY, we're priming XXX *using* YYY. Change-Id: I1686b8b5469bc0f0bd6db8551fb6301776a1b133 Reviewed-on: https://code.wireshark.org/review/21031 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-04Color filters: Initialize a variable.Gerald Combs1-1/+1
Make sure temp_dfilter is initialized so that we don't end up freeing invalid memory. Change-Id: Id31969573690574846422b67c950188fd6ee4ef3 Reviewed-on: https://code.wireshark.org/review/18066 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-10-03Be more forgiving about invalid Coloring Rules.Gerald Combs1-1/+9
In ColoringRulesDialog: Only check a rule's display filter if that rule is enabled. This keeps us from disabling the OK button when we shouldn't. Adjust the "Your coloring rules file contains unknown rules" dialog text and buttons for accuracy. In color_filters.c: Don't try to compile disabled filters in color_filters_apply. Don't warn about disabled and invalid filters in read_filters_file. Bug: 12814 Change-Id: I7143bf8e7a6162d296f1e93769344b69763195c8 Reviewed-on: https://code.wireshark.org/review/17823 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-04Report the pathname of the color filter file in "Could not compile" messages.Guy Harris1-10/+10
This also fixes some cases where we wouldn't report the path in a read error message, as we'd already freed the path up and set the path string pointer to null. Change-Id: Ia0e1ca0bf4880075bfa1957b0778a177de1a824f Reviewed-on: https://code.wireshark.org/review/16868 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-29Don't discard unknown coloring rules.Gerald Combs1-2/+2
When processing the colorfilters file, keep and disable unknown coloring rules instead of skipping over and discarding them. This should hopefully keep people from losing the standard "Checksum Errors" rule (and it's less rude in general). Change-Id: I21796c25045d9dbf7612238ce3d27b613f1ec75f Reviewed-on: https://code.wireshark.org/review/16673 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-26Fix some of the checkAPIs.pl warnings for g_warning.Michael Mann1-1/+2
1. Create ws_g_warning for legitimate uses of g_warning 2. Use proto_tree_add_debug_text 3. Comment some out Change-Id: Ida044bf40286b955fdd529c4f9907c8e09b3d7c5 Reviewed-on: https://code.wireshark.org/review/16678 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-13Use getc_unlocked in a few places.Gerald Combs1-4/+4
Use getc_unlocked or _fgetc_nolock instead of getc in a few places. This reduces startup time by about 100ms here. Change-Id: I59ceb09678457c871cce79fcc3ce71998fe4f5af Reviewed-on: https://code.wireshark.org/review/14518 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-16const gpointer -> gconstpointerJoão Valverde1-1/+1
'const gpointer' is the same as 'void *const'. Replace with gconstpointer where straightforward (assuming that was the intent) and use gpointer everywhere else for clarity (that does not change *API* constness contract; it just means a variable is not declared immutable inside the called funtion). Change-Id: Iad2ef13205bfb4ff0056b2bce056353b58942267 Reviewed-on: https://code.wireshark.org/review/13945 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-21Fix warning for epan/color-filters.c -[-Wcast-qual]João Valverde1-3/+3
Change-Id: I99ec380c844c597d397ec5d261d6bddac8d1999b Reviewed-on: https://code.wireshark.org/review/13449 Reviewed-by: João Valverde <j@v6e.pt>
2016-01-01Make color filters part of dissectionMichael Mann1-3/+4
Color filters can be seen as a function that takes a tree and display filters as input and a (possibly empty) coloring rule as output. This coloring rule is then added to the frame tree and used by the GUI for coloring the packets list. From an architectural POV, "coloring" is part of the UI component, but since it influences the tree, it is something for the dissection component. Bug: 5703 Bug: 6099 Change-Id: I73d132ec1dca7262bcb1b55c8481ca564c6161d1 Reviewed-on: https://code.wireshark.org/review/12507 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-01Get rid of trailing whitespace.Guy Harris1-3/+3
Change-Id: If6347938525194c08465b9b383edf8fb7eaf1e49 Reviewed-on: https://code.wireshark.org/review/12986 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-01No need for toolkit-dependent color initialization.Guy Harris1-48/+63
We're not allocating colors ourselves in GTK+ (and haven't been doing so since at least 1.12), and all color_t values are valid colors, so we don't need any toolkit-specific processing to fill in a color_t. While we're at it, catch read errors when reading color filter files. Change-Id: Ieb520d141cf15e371a31a01459d466c95ba2209b Reviewed-on: https://code.wireshark.org/review/12985 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-28Refactor GUI dependencies out of color_filters.[ch] and move it to epan ↵Michael Mann1-0/+843
directory. This also moved color.h into color_filters.h Change-Id: Ic19e27aa1b3ec67e764aa7ee8bbef7b1187bb12e Reviewed-on: https://code.wireshark.org/review/12831 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>