Commit Graph

77 Commits

Author SHA1 Message Date
Ahmad Fatoum 9d49e13166 Remove superfluous null-checks before strdup/free
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-10-15 12:38:51 +00:00
Guy Harris 10ca4c7527 More checks for localtime() and gmtime() returning NULL.
And some comments in the case where we're converting the result of
time() - if your machine's idea of time predates January 1, 1970,
00:00:00 UTC, it'll crash on Windows, but that's not a case where a
*file* can cause the problem due either to a bad file time stamp or bad
time stamps in the file.

Change-Id: I837a438e4b875dd8c4f3ec2137df7a16ee4e9498
Reviewed-on: https://code.wireshark.org/review/18369
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22 02:27:32 +00:00
Michael Mann ee7f9c33f6 Pacify GTK checkAPIs.pl warnings.
Add "Wireshark" macros to old-gtk-compat.h for GTK APIs that have been deprecated.
The macros are setup by version number to limit their proliferation (not that I
suspect much development will really be done there since GTK is deprecated).
Just want to make buildbots happy for the time being.

Change-Id: I095f850065166a0bc2e2456fb2e886ab64fdd97d
Reviewed-on: https://code.wireshark.org/review/16635
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-24 20:03:29 +00:00
Pascal Quantin a383e692c8 Revert "tap: change glib functions to wmem."
This reverts commit 2e9f3c5d36.

It breaks the registration of codec, dissector and libwiretap plugins.

Change-Id: I4ef91dd192f765adf87ea9fe9f3693e25dbd24de
Reviewed-on: https://code.wireshark.org/review/16012
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-19 10:47:10 +00:00
Dario Lombardo 2e9f3c5d36 tap: change glib functions to wmem.
Change-Id: I878ae6b121a669f9b7f4e1e57bc079f0cb44c0bf
Reviewed-on: https://code.wireshark.org/review/15270
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-17 15:38:03 +00:00
Guy Harris a7f470fa24 More pinfo->fd->abs_ts to pinfo->abs_ts.
Change-Id: I70db0a345cc4c5c57c454371deb4f92f9ac4b9ac
Reviewed-on: https://code.wireshark.org/review/13501
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-23 03:58:56 +00:00
Guy Harris 5e67ae78ba Get rid of an unused structure member.
Change-Id: I2941bb7e6dc0fce3e1256af6e5e19d2997de5801
Reviewed-on: https://code.wireshark.org/review/7573
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-07 04:41:09 +00:00
Bill Meier bfde04b845 ui/gtk/*.c: Add editor modelines; As needed: Fix indentation
Change-Id: I8cd9d9fe5f12c284f46b8f725766f681faccd753
Reviewed-on: https://code.wireshark.org/review/7138
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-15 19:02:30 +00:00
Alexis La Goutte a9aba9408b GTK: fix no previous prototype for ... [-Wmissing-prototypes]
Add by commit g43f09e67b (Remove unneeded includes from ui folder)

Change-Id: I7c9d9e2bbd76d062f96422c74ee8eb8c6ecd328b
Reviewed-on: https://code.wireshark.org/review/6808
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-27 12:35:39 +00:00
Guy Harris cfcbb28671 Clean up ftype-conversion and dfilter error message string handling.
Have dfilter_compile() take an additional gchar ** argument, pointing to
a gchar * item that, on error, gets set to point to a g_malloc()ed error
string.  That removes one bit of global state from the display filter
parser, and doesn't impose a fixed limit on the error message strings.

Have fvalue_from_string() and fvalue_from_unparsed() take a gchar **
argument, pointer to a gchar * item, rather than an error-reporting
function, and set the gchar * item to point to a g_malloc()ed error
string on an error.

Allow either gchar ** argument to be null; if the argument is null, no
error message is allocated or provided.

Change-Id: Ibd36b8aaa9bf4234aa6efa1e7fb95f7037493b4c
Reviewed-on: https://code.wireshark.org/review/6608
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 10:22:59 +00:00
AndersBroman 872a239732 Add missing #include ( "ui/gtk/old-gtk-compat.h" )
Change-Id: Ic53c3cd4a38c587ab3c0dcb9f8349ca50e338f80
Reviewed-on: https://code.wireshark.org/review/6443
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-09 09:17:42 +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
Dario Lombardo 63ebe918d9 Removed duplicated #include lines
Change-Id: I9cafa3cd5c74121168777d8c656e7e94e89efd3c
Reviewed-on: https://code.wireshark.org/review/6065
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-28 00:02:39 +00:00
Guy Harris 4d3c4c4f12 Rename stat_cmd_args.[ch] to stat_tap_ui.[ch].
The intent is to handle more than just command-line arguments; reflect that.

Change-Id: Ia10efda85a9d11c6579d1bec6f789cee30d9e825
Reviewed-on: https://code.wireshark.org/review/5304
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-14 18:52:06 +00:00
Guy Harris a21436eaed tap_ui -> stat_tap_ui.
The old routine had stat_ in the name, as the expectation was that they
were for statistics taps; that's still the expectation, so have stat_ in
the data structure and routine names.

Change-Id: Ic98d011012b8641173d41fa0ec4f4e625614370a
Reviewed-on: https://code.wireshark.org/review/5303
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-14 18:42:50 +00:00
Guy Harris 7390516f61 For tap UIs, register a list of parameters and some menu information.
The intent here is to centralize more UI information so that we can move
more tap UI stuff to common code.  This is a beginning.

Change-Id: Ic35ac0c01bc7b942aab88177db4065847a5e6c30
Reviewed-on: https://code.wireshark.org/review/5301
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-14 18:31:34 +00:00
Guy Harris 87545f39da Remove unnecessary includes of <ctype.h>.
Change-Id: I8eacec5fa8d57b10d40a3627197461dae89c6cb2
Reviewed-on: https://code.wireshark.org/review/4768
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17 06:57:41 +00:00
Bill Meier a379ac74d2 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2
Reviewed-on: https://code.wireshark.org/review/4126
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 15:31:58 +00:00
Guy Harris 1c297771c3 Rename and move ui/stat_menu.h to epan/stat_groups.h.
The groups are, technically, independent of the notion of a menu, and,
if we have mechanisms by which taps that are not only GUI
toolkit-independent but independent of the *existence* of a GUI can be
registered, they might want to register themselves in a group just in
case they're running in a program that has a GUI.

Also, this might fix the Debian package build.

Change-Id: I29435681e79748fd4f2e0c5ac872cd11f831d172
Reviewed-on: https://code.wireshark.org/review/2830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 20:30:42 +00:00
Balint Reczey 147db828d5 Log2() and exp2() are missing on Windows
Change-Id: I8a970f9030fafd8fdcb4e2a24620033ec8005da7
Reviewed-on: https://code.wireshark.org/review/2744
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2014-07-01 10:33:36 +00:00
Guy Harris deeb1de24c Squelch some warnings.
Make some arguments and structure members gsize, as that's what stored
into them or passed to them.  (And move a newly-widened-on-LP64 item, to
avoid extra structure padding.)

Add a cast, which also appears necessary to squelch a warning.

Clean up indentation while we're at it.

Change-Id: I0cc92e7d2904c5af1f3f3d93f51b6ecb3aed464d
Reviewed-on: https://code.wireshark.org/review/2741
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-01 10:03:20 +00:00
Balint Reczey f90bf8ae2a Increase space allocated for IO Graph slower after 1 million items
Change-Id: I691070b572e519f412a80db5d7415331f07e8e50
Reviewed-on: https://code.wireshark.org/review/2689
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2014-07-01 09:24:39 +00:00
Balint Reczey 524583298b GTK: Unlimited, dynamically allocated IO Graph
Bug: 8460
Change-Id: Id9aad3f5f69bee9e5a62601ecac28a6a7019e623
Reviewed-on: https://code.wireshark.org/review/2672
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2014-07-01 09:24:05 +00:00
Balint Reczey 9a676acbd2 Fix access to uninitialised values
Change-Id: Id3592fed0cca5133d493f26d3b8ce27a3cf8505c
Reviewed-on: https://code.wireshark.org/review/2723
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-01 02:04:51 +00:00
Guy Harris 5e28386540 Move stat_menu.h to libui.
Change-Id: I7bed7f7931845bc41035535cc62e1fe17c71047d
Reviewed-on: https://code.wireshark.org/review/2726
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 21:37:34 +00:00
Gerald Combs a5cb72fe9e Add a Qt I/O Graph dialog.
For each graph you can set:
- Its visibility
- A name
- A display filter
- Color, from a fixed list
- Plot style: Line, Impulse, Bar, Stacked Bar, Dot, Square, Diamond
- Basic Y Axes (packets/s, bytes/s, bits/s)
- Computed Y Axes (SUM, MIN, AVG, MAX)
- Smoothing

You can pan and zoom using the mouse and keyboard. Clicking on a graph
selects the last packet for that interval. If all graphs have the same Y
axis a single label is shown, otherwise a legend is shown.

The time scale (X axis) can be toggled between relative seconds and the
time of day.

Graphs can be saved as PDF, PNG, BMP, and JPEG. Settings are "sticky"
via the io_graphs UAT.

To do:
- Minimize graph drawing delays.
- Figure out why smoothing differs from GTK+
- Everything else at the top of io_graph_dialog.cpp
- Fix empty resets.

A fair amount of code was copied from TCPStreamDialog. We might want to
subclass QCustomPlot and place the shared code there.

Move common syntax checking to SyntaxLineEdit.

Move some common code from ui/gtk/io_stat.c to ui/io_graph_item.[ch] and
use it in both GTK+ and Qt.

Make the io_graph_item_t array allocation in io_stat.c static. The
behavior should be identical and this gives us additional compile-time
checks.

Change-Id: I9a3d544469b7048f0761fdbf7bcf20f44ae76577
Reviewed-on: https://code.wireshark.org/review/435
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
2014-04-07 20:56:42 +00:00
Balint Reczey 00be1d31ce Migrate GTK icon handling to GTK 3.10 API
GtkStockItem usage is deprecated with all the GTK_STOCK_.* stock ids.
We keep a stock id based approach but without relying on GTK's
GtkStockItem system.

We create our own internal stock ids for {icon, label} tuples and keep
the original GTK stock id #define-s and values to preserve backward
compatibility.

Change-Id: Ia0b35a5903f079e92c8026e3df21bbf0be2d06b0
Reviewed-on: https://code.wireshark.org/review/302
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-11 05:38:01 +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
Anders Broman 43595fa3f0 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54833
2014-01-17 19:21:41 +00:00
Jakub Zawadzki 2c85a33442 Fix bug #8980 - IO graph/advanced, max/min/summ error on frames with multiple Diameter messages
tap_iostat_packet() was fetching only first item for FT_RELATIVE_TIME.

svn path=/trunk/; revision=50923
2013-07-26 18:10:55 +00:00
Jakub Zawadzki c702e92121 Replace relative timestamp with reference frame number. Saves 16B per frame.
svn path=/trunk/; revision=50772
2013-07-21 23:07:33 +00:00
Chris Maynard e8fed416a2 Another change that should have been part of r50465, which removed the limits to the number of characters in the display filter(s). [Technically, there is still the inherent 65535 limit.]
#BACKPORT(1.10,1.8)

svn path=/trunk/; revision=50469
2013-07-09 18:01:44 +00:00
Chris Maynard 9c9864976f Use sizeof() instead of hard-coded values. Other minor whitespace cleanup.
svn path=/trunk/; revision=50466
2013-07-09 16:58:07 +00:00
Chris Maynard dacf47c217 Remove the advanced filter field arbitrary text limit of 100 and remove the filter field arbitrary text limit of 256.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8909
#BACKPORT(1.10,1.8)

svn path=/trunk/; revision=50465
2013-07-09 16:44:47 +00:00
Ronnie Sahlberg eb8217a371 IOSTAT: plot LOAD y-axis in number of I/O not number of I/O times 1000
svn path=/trunk/; revision=49647
2013-05-31 02:14:19 +00:00
Evan Huus b13e702709 Cast scrolling values to gdoubles, not gfloats - GtkAdjustment have
always taken doubles that I've been able to find, and casting to floats
causes loss of precision and weird bugs when the values get enormous.

Should fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8460

svn path=/trunk/; revision=48893
2013-04-17 15:07:48 +00:00
Evan Huus f8f078744b Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8583
IO graph was misbehaving if the packets covered too much real time.
It's still ungodly slow, but at least it seems to work.

svn path=/trunk/; revision=48882
2013-04-16 16:16:15 +00:00
Jaap Keuter 42c71a3261 Follow up on bug 8416.
Remove C++ incompatibilities in GTK+ 3 code.

svn path=/trunk/; revision=48606
2013-03-28 06:36:44 +00:00
Bill Meier 35d1b406d7 From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10408

Note: The following parts of the patch had been previously done:
 asn1/snmp/packet-snmp-template.c
 epan/dissectors/packet-snmp.c
 epan/dissectors/packet-x11.c

svn path=/trunk/; revision=48448
2013-03-21 02:58:59 +00:00
Bill Meier 3adfacfea6 Cleanup: indentation, whitespace, long-lines, formatting & etc.
svn path=/trunk/; revision=47092
2013-01-15 15:16:53 +00:00
Bill Meier ef4749d4e2 Minor cleanup:
- remove severl gtk_box_set_child_packing() statements which "do nothing";
 - replace several gtk_container_add()/gtk_box_set_child_packing() sequences
    by gtk_box_pack_start().

svn path=/trunk/; revision=47087
2013-01-15 01:42:09 +00:00
Anders Broman d9d58c34f2 Add a wrapper for gdk_cairo_set_source_rgba() in GTK2 and use it in io_stat.c
svn path=/trunk/; revision=46932
2013-01-04 17:07:26 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
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-26 05:57:06 +00:00
Anders Broman b3dbedd144 From Edwin Groothuis:
IO Stats - Smooth should be per graph.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8090

svn path=/trunk/; revision=46631
2012-12-20 13:15:20 +00:00
Bill Meier 7cd0417af5 Fix numerous instances of a variable/parameter name "shadowing" a library function name;
(At least some (gcc ?) compilers give a "shadow" warning for these).

svn path=/trunk/; revision=46402
2012-12-05 15:56:36 +00:00
Anders Broman 3e9e6f040e Remove one more instance of destroy/create cr.
svn path=/trunk/; revision=45972
2012-11-08 13:42:34 +00:00
Anders Broman 8d482cf161 Create cr once per axis when drawing x,y axels.
svn path=/trunk/; revision=45971
2012-11-08 13:18:23 +00:00
Anders Broman d17b5fb251 gdk_cairo_set_source_color() needs to be set inside the loop.
svn path=/trunk/; revision=45970
2012-11-08 13:10:07 +00:00
Anders Broman 07c850676d Create cr once when drawing the graphs
svn path=/trunk/; revision=45969
2012-11-08 12:52:08 +00:00
Anders Broman 849fbd1e04 Reindent section.
svn path=/trunk/; revision=45968
2012-11-08 12:37:42 +00:00