aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.mathieson@keysight.com>2020-06-29 22:16:19 +0100
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2020-06-30 12:11:15 +0000
commit570a0cb30134de8996067981841fb8899fbdecc4 (patch)
tree8bdb59546fbc69f950d3bf6dc44f84b8c30114e2
parentd70bd4489feed4035c3a35cd2e76cdf877b3f485 (diff)
Set member variables in initialiser list (rather than in CTOR bodies).
Also simplify some boolean logic in packet-dcerpc.c. All reported by cppcheck. Change-Id: I2075f2ec10dc777ad7635da4ef056d17fc5b0be0 Reviewed-on: https://code.wireshark.org/review/37609 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
-rw-r--r--epan/dissectors/packet-dcerpc.c2
-rw-r--r--ui/qt/capture_file.cpp10
-rw-r--r--ui/qt/iax2_analysis_dialog.cpp12
-rw-r--r--ui/qt/interface_toolbar_reader.h11
-rw-r--r--ui/qt/models/pref_models.cpp2
5 files changed, 19 insertions, 18 deletions
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index e0ca35e451..a4058502a5 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -4487,7 +4487,7 @@ dissect_dcerpc_cn_stub(tvbuff_t *tvb, int offset, packet_info *pinfo,
fd_head = fragment_add_seq_next(&dcerpc_co_reassembly_table,
decrypted_tvb, 0, pinfo, frame, NULL,
tvb_reported_length(decrypted_tvb),
- hdr->flags&PFC_LAST_FRAG ? FALSE : TRUE /* more_frags */);
+ !(hdr->flags & PFC_LAST_FRAG) /* more_frags */);
end_cn_stub:
diff --git a/ui/qt/capture_file.cpp b/ui/qt/capture_file.cpp
index 8d2b30d662..f0cf8912f8 100644
--- a/ui/qt/capture_file.cpp
+++ b/ui/qt/capture_file.cpp
@@ -51,12 +51,12 @@ CaptureEvent::CaptureEvent(Context ctx, EventType evt, capture_session * session
{
}
-CaptureEvent::CaptureEvent(const CaptureEvent &ce)
+CaptureEvent::CaptureEvent(const CaptureEvent &ce) :
+ _ctx(ce._ctx),
+ _evt(ce._evt),
+ _filePath(ce._filePath),
+ _session(ce._session)
{
- _ctx = ce._ctx;
- _evt = ce._evt;
- _session = ce._session;
- _filePath = ce._filePath;
}
CaptureEvent::Context CaptureEvent::captureContext() const
diff --git a/ui/qt/iax2_analysis_dialog.cpp b/ui/qt/iax2_analysis_dialog.cpp
index 617454dae3..6755bcbd86 100644
--- a/ui/qt/iax2_analysis_dialog.cpp
+++ b/ui/qt/iax2_analysis_dialog.cpp
@@ -67,11 +67,13 @@ class Iax2AnalysisTreeWidgetItem : public QTreeWidgetItem
{
public:
Iax2AnalysisTreeWidgetItem(QTreeWidget *tree, tap_iax2_stat_t *statinfo, packet_info *pinfo) :
- QTreeWidgetItem(tree, iax2_analysis_type_)
+ QTreeWidgetItem(tree, iax2_analysis_type_),
+ frame_num_(pinfo->num),
+ pkt_len_(pinfo->fd->pkt_len),
+ flags_(statinfo->flags),
+ bandwidth_(statinfo->bandwidth),
+ ok_(false)
{
- frame_num_ = pinfo->num;
- pkt_len_ = pinfo->fd->pkt_len;
- flags_ = statinfo->flags;
if (flags_ & STAT_FLAG_FIRST) {
delta_ = 0.0;
jitter_ = 0.0;
@@ -79,8 +81,6 @@ public:
delta_ = statinfo->delta;
jitter_ = statinfo->jitter;
}
- bandwidth_ = statinfo->bandwidth;
- ok_ = false;
QColor bg_color = QColor();
QString status;
diff --git a/ui/qt/interface_toolbar_reader.h b/ui/qt/interface_toolbar_reader.h
index d7dc9fe225..4e581e2b2d 100644
--- a/ui/qt/interface_toolbar_reader.h
+++ b/ui/qt/interface_toolbar_reader.h
@@ -27,14 +27,15 @@ class InterfaceToolbarReader : public QObject
public:
InterfaceToolbarReader(QString ifname, void *control_in, QObject *parent = 0) :
- QObject(parent), ifname_(ifname)
- {
+ QObject(parent),
+ ifname_(ifname),
#ifdef _WIN32
- control_in_ = (HANDLE)control_in;
+ control_in_((HANDLE)control_in)
#else
- control_in_ = (char *)control_in;
- fd_in_ = -1;
+ control_in_((char *)control_in),
+ fd_in_(-1)
#endif
+ {
}
public slots:
diff --git a/ui/qt/models/pref_models.cpp b/ui/qt/models/pref_models.cpp
index 8e8bcb63fa..2fe0c9d6ba 100644
--- a/ui/qt/models/pref_models.cpp
+++ b/ui/qt/models/pref_models.cpp
@@ -44,9 +44,9 @@ PrefsItem::PrefsItem(module_t *module, pref_t *pref, PrefsItem* parent)
: ModelHelperTreeItem<PrefsItem>(parent),
pref_(pref),
module_(module),
+ name_(module->name ? module->name : module->parent->name),
changed_(false)
{
- name_ = QString(module->name ? module->name : module->parent->name);
if (pref_ != NULL) {
name_ += QString(".%1").arg(prefs_get_name(pref_));
}