Commit Graph

5 Commits

Author SHA1 Message Date
Guy Harris 6e95a0aa47 PortsModel: don't populate it by doing a lot of weird string-pushing.
When enumerating port-to-name entries, the callback to
wmem_map_foreach() gets passed:

- a key, which is the port number for the entry;
- a value, which is a pointer to a structure containing pointers to port
names for various transport protocols;
- a user data pointer.

That's sufficient (if you work around some C++ annoyances) to append a
row to a PortsModel, if the user data pointer is a pointer to the
PortsModel.

The existing code, instead, appended to a QStringList of lines (in
effect, undoing the effort of the code that read the services file and
filled in the wmem_map, re-generating a set of lines) in the callback,
and then iterated over all the lines, splitting them with blanks and
appending rows.

Looking at that made my eyeballs bleed so badly that I decided not to
spend any time figuring out why it wasn't working.

So I just make the callback just append rows, avoiding all the
string-pushing.

Fixes #17395.
2021-05-18 01:03:04 -07:00
Gerald Combs d3f17ee08a Remove modelines in ui/qt.
Remove the editor modeline blocks from most of the source files in ui/qt
by running

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

then cleaning up the remaining files by hand.

This *shouldn't* affect anyone since

- All of the source files in ui/qt use 4 space indentation, which
  matches 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-03-08 18:11:32 +00:00
Peter Wu 0596047e3f Qt: fix missing IP hosts in Resolved Addresses dialog
Fix several issues in the Resolved Addresses dialog:
 - Missing IP hosts because the list was populated with one
   tab-separated item while the caller expected space-separated items.
 - Fix duplicate entries due to the "values" list not being cleared.
 - Remove IPv4/IPv6 Hash Tables since these are a superset of IPv4/IPv6
   Hosts, except that the former also includes mappings without a known
   name (e.g. 8.8.8.8 -> 8.8.8.8).
 - Fold both IPv4 and IPv6 hosts into one as before. Users like me
   usually look for any IP match, regardless of the address family.
 - Minor optimizations: do not construct the label every time.
 - Rename "Mac Address" [sic] to simply "Address", that covers both IP
   addresses and MAC addresses.

Bug: 16366
Change-Id: I6253fc01da7b6429ce093e7db9fe58e235b7c137
Fixes: v3.1.1rc0-244-g743f8598cd0b ("Qt: Rework Resolved Addresses dialog")
Reviewed-on: https://code.wireshark.org/review/36022
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-04 04:12:11 +00:00
Stig Bjørlykke a51c58fa1b Qt: Cleanup space inside parentheses
Remove randomly used space inside parentheses to make the coding
style uniform. Add space after if, for and while.

Change-Id: I519f5994b6f73d8a57a5004d51ca460276c618fe
Reviewed-on: https://code.wireshark.org/review/35112
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-17 20:43:10 +00:00
Roland Knall 743f8598cd Qt: Rework Resolved Addresses dialog
This is a refactoring/redesign of the "Resolved Addresses" dialog,
allowing for sorting/filtering and searching within the addresses
and ports.

Change-Id: I5071e92ff699323b6c93fc533eeaf92e0db334de
Reviewed-on: https://code.wireshark.org/review/34398
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-09-01 09:02:51 +00:00