From e202dab212ef8fd284d2745dd66496dcc3a2043e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 20 Dec 2018 19:05:44 +0100 Subject: fix undefined behavior undescore prefixes --- tracker-joystick/ftnoir_tracker_joystick.h | 2 +- tracker-joystick/ftnoir_tracker_joystick_dialog.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tracker-joystick') diff --git a/tracker-joystick/ftnoir_tracker_joystick.h b/tracker-joystick/ftnoir_tracker_joystick.h index c61a1c8f..2fd1068f 100644 --- a/tracker-joystick/ftnoir_tracker_joystick.h +++ b/tracker-joystick/ftnoir_tracker_joystick.h @@ -63,7 +63,7 @@ public: QString name; QString guid; }; - QList _joys; + QList joys_; private slots: void doOK(); void doCancel(); diff --git a/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp b/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp index aa4b783a..aaf3037b 100644 --- a/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/tracker-joystick/ftnoir_tracker_joystick_dialog.cpp @@ -12,18 +12,18 @@ dialog_joystick::dialog_joystick() : tracker(nullptr) { win32_joy_ctx joy_ctx; - _joys = QList(); + joys_ = {}; - for (auto j : joy_ctx.get_joy_info()) - _joys.push_back(joys { j.name, j.guid }); + for (const auto& j : joy_ctx.get_joy_info()) + joys_.push_back(joys { j.name, j.guid }); } { const QString guid = s.guid; int idx = 0; - for (int i = 0; i < _joys.size(); i++) + for (int i = 0; i < joys_.size(); i++) { - const joys& j = _joys[i]; + const joys& j = joys_[i]; if (j.guid == guid) idx = i; ui.joylist->addItem(j.name + " " + j.guid); @@ -41,8 +41,8 @@ dialog_joystick::dialog_joystick() : tracker(nullptr) void dialog_joystick::doOK() { int idx = ui.joylist->currentIndex(); - joys def { "", "" }; - auto val = _joys.value(idx, def); + static const joys def { {}, {} }; + auto val = joys_.value(idx, def); s.guid = val.guid; s.b->save(); close(); -- cgit v1.2.3