Fix most of critical issues reported by Sonar (GTK client) (#2309)

* (C++) Macros should not be used to define constants

* (C++) Memory should not be managed manually

* (C++) "void*" should not be used in typedefs, member variables, function parameters or return type

* (C++) When the "Rule-of-Zero" is not applicable, the "Rule-of-Five" should be followed

* (C++) "switch" statements should have "default" clauses

* (C++) "explicit" should be used on single-parameter constructors and conversiosn operators

* (C++) Non-const global variables should not be used
This commit is contained in:
Mike Gelfand
2021-12-14 11:43:27 +03:00
committed by GitHub
parent 7015f48798
commit 3e072f9bd4
82 changed files with 459 additions and 287 deletions

View File

@@ -30,10 +30,9 @@
#include <gtkmm.h>
#include <libtransmission/transmission.h>
#include <libtransmission/tr-macros.h>
#include <libtransmission/variant.h>
#define TR_RESOURCE_PATH "/com/transmissionbt/transmission/"
class Session : public Glib::Object
{
public:
@@ -47,6 +46,8 @@ public:
public:
~Session() override;
TR_DISABLE_COPY_MOVE(Session)
static Glib::RefPtr<Session> create(tr_session* session);
tr_session* close();
@@ -145,7 +146,7 @@ public:
sigc::signal<void(bool)>& signal_port_tested();
protected:
Session(tr_session* session);
explicit Session(tr_session* session);
private:
class Impl;
@@ -162,7 +163,7 @@ public:
TorrentModelColumns();
Gtk::TreeModelColumn<Glib::ustring> name_collated;
Gtk::TreeModelColumn<void*> torrent;
Gtk::TreeModelColumn<gpointer> torrent;
Gtk::TreeModelColumn<int> torrent_id;
Gtk::TreeModelColumn<double> speed_up;
Gtk::TreeModelColumn<double> speed_down;