Fix Clang Tidy warnings

This commit is contained in:
Shatur95 2020-05-17 17:50:27 +03:00
parent 076caedc23
commit fcd4fcab21
4 changed files with 14 additions and 16 deletions

View File

@ -85,7 +85,7 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
}
}
InstancesInfo* inst = static_cast<InstancesInfo*>( d->memory->data() );
auto *inst = static_cast<InstancesInfo*>( d->memory->data() );
QElapsedTimer time;
time.start();
@ -184,7 +184,7 @@ QString SingleApplication::currentUser()
return d->getUsername();
}
bool SingleApplication::sendMessage( QByteArray message, int timeout )
bool SingleApplication::sendMessage( const QByteArray &message, int timeout )
{
Q_D(SingleApplication);

View File

@ -43,7 +43,7 @@ class SingleApplication : public QAPPLICATION_CLASS
{
Q_OBJECT
typedef QAPPLICATION_CLASS app_t;
using app_t = QAPPLICATION_CLASS;
public:
/**
@ -86,7 +86,7 @@ public:
* @see See the corresponding QAPPLICATION_CLASS constructor for reference
*/
explicit SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000 );
~SingleApplication();
~SingleApplication() override;
/**
* @brief Returns if the instance is the primary instance
@ -131,7 +131,7 @@ public:
* @note sendMessage() will return false if invoked from the primary
* instance.
*/
bool sendMessage( QByteArray message, int timeout = 100 );
bool sendMessage( const QByteArray &message, int timeout = 100 );
Q_SIGNALS:
void instanceStarted();

View File

@ -71,7 +71,7 @@ SingleApplicationPrivate::~SingleApplicationPrivate()
if( memory != nullptr ) {
memory->lock();
InstancesInfo* inst = static_cast<InstancesInfo*>(memory->data());
auto *inst = static_cast<InstancesInfo*>(memory->data());
if( server != nullptr ) {
server->close();
delete server;
@ -149,7 +149,7 @@ void SingleApplicationPrivate::genBlockServerName()
void SingleApplicationPrivate::initializeMemoryBlock()
{
InstancesInfo* inst = static_cast<InstancesInfo*>( memory->data() );
auto *inst = static_cast<InstancesInfo*>( memory->data() );
inst->primary = false;
inst->secondary = 0;
inst->primaryPid = -1;
@ -183,7 +183,7 @@ void SingleApplicationPrivate::startPrimary()
);
// Reset the number of connections
InstancesInfo* inst = static_cast <InstancesInfo*>( memory->data() );
auto *inst = static_cast <InstancesInfo*>( memory->data() );
inst->primary = true;
inst->primaryPid = q->applicationPid();
@ -266,7 +266,7 @@ qint64 SingleApplicationPrivate::primaryPid()
qint64 pid;
memory->lock();
InstancesInfo* inst = static_cast<InstancesInfo*>( memory->data() );
auto *inst = static_cast<InstancesInfo*>( memory->data() );
pid = inst->primaryPid;
memory->unlock();
@ -278,7 +278,7 @@ QString SingleApplicationPrivate::primaryUser()
QByteArray username;
memory->lock();
InstancesInfo* inst = static_cast<InstancesInfo*>( memory->data() );
auto *inst = static_cast<InstancesInfo*>( memory->data() );
username = inst->primaryUser;
memory->unlock();

View File

@ -46,11 +46,9 @@ struct InstancesInfo {
};
struct ConnectionInfo {
explicit ConnectionInfo() :
msgLen(0), instanceId(0), stage(0) {}
qint64 msgLen;
quint32 instanceId;
quint8 stage;
qint64 msgLen = 0;
quint32 instanceId = 0;
quint8 stage = 0;
};
class SingleApplicationPrivate : public QObject {
@ -70,7 +68,7 @@ public:
Q_DECLARE_PUBLIC(SingleApplication)
SingleApplicationPrivate( SingleApplication *q_ptr );
~SingleApplicationPrivate();
~SingleApplicationPrivate() override;
QString getUsername();
void genBlockServerName();