Commit Graph

31 Commits

Author SHA1 Message Date
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
Gerald Combs 9222bd77cd Remove unneeded modelines in ui.
Remove the editor modeline blocks from the source files in ui that use 4
space indentation by running

perl -i -p0e 's{ \n+ /[ *\n]+ editor \s+ modelines .* shiftwidth= .* \*/ \s+ } {\n}gsix' $( ag -l shiftwidth=4 $( ag -g '\.(c|cpp|h|m|mm)') )

This gives us one source of indentation truth for these files, and it
*shouldn't* affect anyone since

- These files match the default in our top-level .editorconfig.

- The one notable editor that's likely to be used on these files and
*doesn't* support EditorConfig (Qt Creator) defaults to 4 space
indentation.
2021-04-20 07:43:39 +00:00
Moshe Kaplan e16166a74c Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing
occurrences of `g_malloc()` and `wmem_alloc()` with
`g_new()` and `wmem_new()`, to improve the
readability of Wireshark's code, and
occurrences of
`g_malloc(sizeof(struct myobj) * foo)`
with
`g_new(struct myobj, foo)`
to prevent integer overflows

Also fixes all existing occurrences across
the codebase.
2020-12-22 14:56:38 +00:00
Roland Knall 4b00898a2a Qt: Prevent loop in renames of profiles
This prevents the case, where there are two profiles, and one is
renamed, after which the second one is renamed to the firsts original
name. This could lead to undefined behavior in the underlying data
structure.

Fixes an issue as well, where deleting the identical named duplicate
would delete the original one

Bug: 15975
Change-Id: Ia7112779f2c2ef926c3ea915852b6d7b4497f777
Reviewed-on: https://code.wireshark.org/review/34189
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-08-13 08:16:12 +00:00
Stig Bjørlykke 5d0a2ccbb7 Qt: Change from User/System to Personal/Global profile types
Change the Profile types from User/System to Personal/Global in UI
to match the terminology used in About Wireshark -> Folders.

This reverts commit 40af4aa93e.
This reverts commit f0cde7ca34.
This reverts commit c37cabe900.

Change-Id: I9012db6385707754e26a2dadb57f6003f8112f9b
Reviewed-on: https://code.wireshark.org/review/34134
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-07-30 10:11:10 +00:00
Stig Bjørlykke c37cabe900 Qt: Rename profile global to system
It's called system profiles in UI so update function names and
variables to use the same name. This will increase code readability.

Change-Id: I048e9ea85bd6ebab4a2c3ed1c685487ac8f7e40e
Reviewed-on: https://code.wireshark.org/review/34116
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-07-29 11:07:15 +00:00
Roland Knall 390071ed0b Qt: Import Profile information
Allow easy import of profiles. Profiles must be stored inside
a zip file, with no additional hierarchy.

Change-Id: I0ae77460c20ef6b3e447906e671b0cefa6b9b032
Reviewed-on: https://code.wireshark.org/review/33881
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-07-17 18:25:11 +00:00
Stig Bjørlykke 14720ace06 Fix comment end after SPDX identifier
Move */ to a separate line below the SPDX identifier.

Change-Id: Id1032215449cfccae0933147b45e04b65e0b727f
Reviewed-on: https://code.wireshark.org/review/27211
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-01 06:56:37 +00:00
Anders bb81bef535 glib: Get rid of GLIB_CHECK_VERSION as we now require 2.32.0
Change-Id: Ie95cf37f9cd283545693e290340a7489cc989c95
Reviewed-on: https://code.wireshark.org/review/26970
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-16 16:07:46 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Dario Lombardo e5f4ef0c42 ui: use SPDX identifiers.
Change-Id: I6b05399395bcc35e59b73b4030ba4a05711a7b1a
Reviewed-on: https://code.wireshark.org/review/25565
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-02 13:39:04 +00:00
Stig Bjørlykke 043b45e840 UI: Rename profiles without delete
Do not try to delete the old profile name after renaming.  In most
cases it will not exist, but when using a case-insensitive file system
this will delete the renamed profile if only changing capitalizations
(first it's renamed and then it's deleted).

Change-Id: I27d2d22d2353b09f2041d82ea1cf1bae37a1ce3d
Reviewed-on: https://code.wireshark.org/review/25515
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-31 04:53:12 +00:00
Guy Harris 3a93855b05 Make apply_profile_changes() return a non-const pointer.
It returns a pointer to a g_mallocated string, which the caller has to
free, so its return value shouldn't be a const pointer.

Change-Id: I76f288379a5c1eff580c391bdc9019ab7fe8f336
Reviewed-on: https://code.wireshark.org/review/25364
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-18 07:33:42 +00:00
AndersBroman 5eb07b35d4 [profile.c] glist_fre_full() is 2.28, include glib-compat.h
Change-Id: I4b4e39de55a30352aa965653bcdf2429efb9e146
Reviewed-on: https://code.wireshark.org/review/24709
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-05 09:09:57 +00:00
Stig Bjørlykke da91020353 ui: Sort profile names
Not all file systems returns a sorted list of filenames, so we need
to sort the entries before using the list in the Profile popup and
the Manage Profiles dialog.

Change-Id: Ic1f2bfa77fb47fb8c406d891aee49b484876b4f7
Reviewed-on: https://code.wireshark.org/review/24615
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-28 16:31:40 +00:00
Michael Mann 897c750127 Clean up some memory leaks in wsutil/filesystem.c
The fixes involve functions always returning a string that needs to be
freed by the caller.  That way the static string pointers within the functions
don't end up leaking at program end.

Change-Id: I35a8dc37536c2927d88f33217887f62efafcc8ca
Reviewed-on: https://code.wireshark.org/review/20175
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-19 01:27:14 +00:00
Stig Bjørlykke 64984b7a59 Qt: Add check for valid profile name
Add check for a valid profile name in the Profile dialog and disable
the Ok button and mark the invalid profile if error.

The GTK dialog does not close on errors but the Qt dialog does, so
ensure the user is informed beforehand.

Change-Id: If31ffe75183066cf49e2b5a082112bfe62d6c06e
Reviewed-on: https://code.wireshark.org/review/19995
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-02-08 09:07:17 +00:00
Stig Bjørlykke 1185fbab42 ui: Write recent file when applying profile changes
Write the recent file for the current profile before copying or renaming
the profile to ensure the latest changes are not lost.

Change-Id: Ib07881925b398314da0a9b2ec875da7650b84712
Reviewed-on: https://code.wireshark.org/review/19984
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-02-07 20:42:15 +00:00
João Valverde faedd049af profile_name_is_valid() returns a malloced string [-Wcast-qual]
Change-Id: I584cdbf6a09e818e0d14c951defdde2fc96787f3
Reviewed-on: https://code.wireshark.org/review/13440
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-21 02:32:46 +00:00
Guy Harris e601e01ffd Remove some apparently-unnecessary includes of emem.h.
Also update a comment to no longer speak of ep_ allocation, and add an
include of <glib.h> to ui/profile.c, which was formerly relying on the
include of emem.h to drag it in.

Change-Id: I08926699ee96cf66672836b6ee3bbb405b507ce8
Reviewed-on: https://code.wireshark.org/review/6633
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 19:47:20 +00:00
Michael Mann 5fe1f66176 Finish off emem_strbuf_t usage.
Change-Id: Ib0b911c86a7f8a7cca022e9e324c910664ce397e
Reviewed-on: https://code.wireshark.org/review/6461
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10 04:20:27 +00:00
Martin Mathieson 43f09e67b4 Remove unneeded includes from ui folder
Change-Id: Ifd1eebff9080cd3867e44e4dcb2d2681370ed60a
Reviewed-on: https://code.wireshark.org/review/6128
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-01-01 23:11:10 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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>
2014-03-04 14:27:33 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
Jörg Mayer e0d70f2ecc Include emem.h
svn path=/trunk/; revision=51999
2013-09-13 08:40:51 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Gerald Combs 4ca47864db Move profile deletion code from profile_dlg.c to profile.c. Add left
mouse and context (right mouse) signals to label stacks and use them to
pop up profile menus in the status bar. Add profile actions (manage,
new, edit, delete) to the profile dialog.

svn path=/trunk/; revision=46863
2012-12-30 19:33:05 +00:00
Gerald Combs 5bd252c44f Remove some duplicate code from ui/profile.c and move in more code from
ui/gtk/profile_dialog.c. Use the correct profile list in
profile_dialog.c so that deletion works.

Add a profile dialog to the Qt port. For some reason it crashes when
changing configuration profiles, which might be related to bug 7722.
Move the Qt configuration profile initialization from main.cpp to
wireshark_application.cpp. Make sure QMenuBar doesn't grab the
configuration profiles action on OS X. Add more role color names to
tango_colors.h.

svn path=/trunk/; revision=46834
2012-12-29 01:39:02 +00:00
Alexis La Goutte cdc79cd5e9 Fix [ 76%] Building C object ui/CMakeFiles/ui.dir/profile.c.o ui/profile.c: In function ‘init_profile_list’: ui/profile.c:194:20: error: variable ‘fl_entry’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors
svn path=/trunk/; revision=46824
2012-12-28 14:38:02 +00:00
Alexis La Goutte c4650d85c6 Fix [76%] Building C object ui/CMakeFiles/ui.dir/profile.c.o ui/profile.c: In function ‘init_profile_list’: ui/profile.c:195:20: error: variable ‘profile’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors
svn path=/trunk/; revision=46823
2012-12-28 14:37:53 +00:00
Gerald Combs cbec3bbaf7 Move common profile code to ui/profile.[ch].
svn path=/trunk/; revision=46808
2012-12-27 17:10:51 +00:00