Fixed most issues from codacy (#3050)
This commit is contained in:
parent
3c3e6ae68a
commit
e127cb74b6
16 changed files with 26 additions and 33 deletions
|
@ -37,7 +37,7 @@ private:
|
|||
int flags;
|
||||
|
||||
public:
|
||||
compareFunctor(int _flags) : flags(_flags)
|
||||
explicit compareFunctor(int _flags) : flags(_flags)
|
||||
{
|
||||
}
|
||||
inline bool operator()(CardItem *a, CardItem *b) const
|
||||
|
|
|
@ -35,7 +35,7 @@ const FilterItemList *LogicMap::findTypeList(CardFilter::Type type) const
|
|||
{
|
||||
QList<FilterItemList *>::const_iterator i;
|
||||
|
||||
for (i = childNodes.constBegin(); i != childNodes.constEnd(); i++) {
|
||||
for (i = childNodes.constBegin(); i != childNodes.constEnd(); ++i) {
|
||||
if ((*i)->type == type) {
|
||||
return *i;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ FilterItemList *LogicMap::typeList(CardFilter::Type type)
|
|||
QList<FilterItemList *>::iterator i;
|
||||
int count = 0;
|
||||
|
||||
for (i = childNodes.begin(); i != childNodes.end(); i++) {
|
||||
for (i = childNodes.begin(); i != childNodes.end(); ++i) {
|
||||
if ((*i)->type == type) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,6 @@ QModelIndex FilterTreeModel::parent(const QModelIndex &ind) const
|
|||
{
|
||||
const FilterTreeNode *node;
|
||||
FilterTreeNode *parent;
|
||||
int row;
|
||||
QModelIndex idx;
|
||||
|
||||
if (!ind.isValid())
|
||||
|
@ -232,7 +231,7 @@ QModelIndex FilterTreeModel::parent(const QModelIndex &ind) const
|
|||
|
||||
parent = node->parent();
|
||||
if (parent) {
|
||||
row = parent->index();
|
||||
int row = parent->index();
|
||||
if (row < 0)
|
||||
return QModelIndex();
|
||||
idx = createIndex(row, 0, parent);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <QTextCursor>
|
||||
#include <QWidget>
|
||||
|
||||
LineEditCompleter::LineEditCompleter(QWidget *parent) : QLineEdit(parent)
|
||||
LineEditCompleter::LineEditCompleter(QWidget *parent) : QLineEdit(parent), c(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -796,6 +796,7 @@ MessageLogWidget::MessageLogWidget(const TabSupervisor *_tabSupervisor,
|
|||
const UserlistProxy *_userlistProxy,
|
||||
TabGame *_game,
|
||||
QWidget *parent)
|
||||
: ChatView(_tabSupervisor, _userlistProxy, _game, true, parent), currentContext(MessageContext_None)
|
||||
: ChatView(_tabSupervisor, _userlistProxy, _game, true, parent), mulliganNumber(0),
|
||||
currentContext(MessageContext_None)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ private:
|
|||
CardInfo *card;
|
||||
QList<CardSet *> sortedSets;
|
||||
int setIndex;
|
||||
bool hq;
|
||||
|
||||
public:
|
||||
PictureToLoad(CardInfo *_card = 0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "update_downloader.h"
|
||||
|
||||
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent)
|
||||
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(nullptr)
|
||||
{
|
||||
netMan = new QNetworkAccessManager(this);
|
||||
}
|
||||
|
|
|
@ -426,7 +426,7 @@ void Server::externalJoinGameCommandReceived(const Command_JoinGame &cmd,
|
|||
ResponseContainer responseContainer(cmdId);
|
||||
Response::ResponseCode responseCode = room->processJoinGameCommand(cmd, responseContainer, userInterface);
|
||||
userInterface->sendResponseContainer(responseContainer, responseCode);
|
||||
} catch (Response::ResponseCode code) {
|
||||
} catch (Response::ResponseCode &code) {
|
||||
Response response;
|
||||
response.set_cmd_id(cmdId);
|
||||
response.set_response_code(code);
|
||||
|
|
|
@ -89,7 +89,7 @@ Server_Player::Server_Player(Server_Game *_game,
|
|||
bool _spectator,
|
||||
Server_AbstractUserInterface *_userInterface)
|
||||
: ServerInfo_User_Container(_userInfo), game(_game), userInterface(_userInterface), deck(0), pingTime(0),
|
||||
playerId(_playerId), spectator(_spectator), nextCardId(0), readyStart(false), conceded(false),
|
||||
playerId(_playerId), spectator(_spectator), initialCards(0), nextCardId(0), readyStart(false), conceded(false),
|
||||
sideboardLocked(true)
|
||||
{
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ private:
|
|||
int x;
|
||||
|
||||
public:
|
||||
MoveCardCompareFunctor(int _x) : x(_x)
|
||||
explicit MoveCardCompareFunctor(int _x) : x(_x)
|
||||
{
|
||||
}
|
||||
inline bool operator()(QPair<Server_Card *, int> a, QPair<Server_Card *, int> b)
|
||||
|
@ -451,7 +451,6 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges,
|
|||
}
|
||||
}
|
||||
|
||||
int publicNewX;
|
||||
if (card->getDestroyOnZoneChange() && (startzone->getName() != targetzone->getName())) {
|
||||
Event_DestroyCard event;
|
||||
event.set_zone_name(startzone->getName().toStdString());
|
||||
|
@ -504,7 +503,7 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges,
|
|||
if (startzone->getType() == ServerInfo_Zone::HiddenZone)
|
||||
privatePosition = position;
|
||||
|
||||
publicNewX = newX;
|
||||
int publicNewX = newX;
|
||||
|
||||
Event_MoveCard eventOthers;
|
||||
eventOthers.set_start_player_id(startzone->getPlayer()->getPlayerId());
|
||||
|
@ -674,7 +673,7 @@ Server_Player::cmdDeckSelect(const Command_DeckSelect &cmd, ResponseContainer &r
|
|||
try {
|
||||
newDeck = game->getRoom()->getServer()->getDatabaseInterface()->getDeckFromDatabase(cmd.deck_id(),
|
||||
userInfo->id());
|
||||
} catch (Response::ResponseCode r) {
|
||||
} catch (Response::ResponseCode &r) {
|
||||
return r;
|
||||
}
|
||||
} else
|
||||
|
@ -1600,9 +1599,8 @@ Server_Player::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer
|
|||
if (conceded)
|
||||
return Response::RespContextError;
|
||||
|
||||
Server_Player *otherPlayer = 0;
|
||||
if (cmd.has_player_id()) {
|
||||
otherPlayer = game->getPlayers().value(cmd.player_id());
|
||||
Server_Player *otherPlayer = game->getPlayers().value(cmd.player_id());
|
||||
if (!otherPlayer)
|
||||
return Response::RespNameNotFound;
|
||||
}
|
||||
|
|
|
@ -115,11 +115,6 @@ int main(int argc, char *argv[])
|
|||
app.setApplicationName("Servatrice");
|
||||
app.setApplicationVersion(VERSION_STRING);
|
||||
|
||||
bool testRandom = false;
|
||||
bool testHashFunction = false;
|
||||
bool logToConsole = false;
|
||||
QString configPath;
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
@ -138,10 +133,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
parser.process(app);
|
||||
|
||||
testRandom = parser.isSet(testRandomOpt);
|
||||
testHashFunction = parser.isSet(testHashFunctionOpt);
|
||||
logToConsole = parser.isSet(logToConsoleOpt);
|
||||
configPath = parser.value(configPathOpt);
|
||||
bool testRandom = parser.isSet(testRandomOpt);
|
||||
bool testHashFunction = parser.isSet(testHashFunctionOpt);
|
||||
bool logToConsole = parser.isSet(logToConsoleOpt);
|
||||
QString configPath = parser.value(configPathOpt);
|
||||
|
||||
qRegisterMetaType<QList<int>>("QList<int>");
|
||||
|
||||
|
|
|
@ -178,7 +178,9 @@ void Servatrice_IslServer::incomingConnection(qintptr socketDescriptor)
|
|||
QMetaObject::invokeMethod(interface, "initServer", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Servatrice::Servatrice(QObject *parent) : Server(parent), uptime(0), shutdownTimer(0), isFirstShutdownMessage(true)
|
||||
Servatrice::Servatrice(QObject *parent)
|
||||
: Server(parent), authenticationMethod(AuthenticationNone), uptime(0), shutdownTimer(0),
|
||||
isFirstShutdownMessage(true)
|
||||
{
|
||||
qRegisterMetaType<QSqlDatabase>("QSqlDatabase");
|
||||
}
|
||||
|
@ -398,7 +400,7 @@ bool Servatrice::initServer()
|
|||
else
|
||||
throw QString("islServer->listen()");
|
||||
}
|
||||
} catch (QString error) {
|
||||
} catch (QString &error) {
|
||||
qDebug() << "ERROR --" << error;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <QThread>
|
||||
|
||||
Servatrice_ConnectionPool::Servatrice_ConnectionPool(Servatrice_DatabaseInterface *_databaseInterface)
|
||||
: databaseInterface(_databaseInterface), clientCount(0)
|
||||
: databaseInterface(_databaseInterface), threaded(false), clientCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1015,7 +1015,7 @@ void Servatrice_DatabaseInterface::updateUsersLastLoginData(const QString &userN
|
|||
}
|
||||
|
||||
if (usersID) {
|
||||
int userCount;
|
||||
int userCount = 0;
|
||||
query = prepareQuery("select count(id) from {prefix}_user_analytics where id = :user_id");
|
||||
query->bindValue(":user_id", usersID);
|
||||
if (!execSqlQuery(query))
|
||||
|
|
|
@ -564,7 +564,7 @@ Response::ResponseCode AbstractServerSocketInterface::cmdDeckDownload(const Comm
|
|||
DeckList *deck;
|
||||
try {
|
||||
deck = sqlInterface->getDeckFromDatabase(cmd.deck_id(), userInfo->id());
|
||||
} catch (Response::ResponseCode r) {
|
||||
} catch (Response::ResponseCode &r) {
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ class SettingsCache : public QSettings
|
|||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QSettings *settings;
|
||||
bool isPortableBuild;
|
||||
|
||||
public:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
int SignalHandler::sigHupFD[2];
|
||||
|
||||
SignalHandler::SignalHandler(QObject *parent) : QObject(parent)
|
||||
SignalHandler::SignalHandler(QObject *parent) : QObject(parent), snHup(nullptr)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
::socketpair(AF_UNIX, SOCK_STREAM, 0, sigHupFD);
|
||||
|
|
Loading…
Reference in a new issue