mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Address /W4 compiler warnings for Windows (#4910)
This commit is contained in:
parent
cb90a8356b
commit
186f4289e9
50 changed files with 279 additions and 272 deletions
|
|
@ -273,9 +273,9 @@ void IslInterface::transmitMessage(const IslMessage &item)
|
|||
{
|
||||
QByteArray buf;
|
||||
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||
unsigned int size = item.ByteSizeLong();
|
||||
unsigned int size = static_cast<unsigned int>(item.ByteSizeLong());
|
||||
#else
|
||||
unsigned int size = item.ByteSize();
|
||||
unsigned int size = static_cast<unsigned int>(item.ByteSize());
|
||||
#endif
|
||||
buf.resize(size + 4);
|
||||
item.SerializeToArray(buf.data() + 4, size);
|
||||
|
|
|
|||
|
|
@ -722,16 +722,16 @@ void Servatrice::shutdownTimeout()
|
|||
shutdownMinutes--;
|
||||
}
|
||||
|
||||
bool Servatrice::islConnectionExists(int serverId) const
|
||||
bool Servatrice::islConnectionExists(int _serverId) const
|
||||
{
|
||||
// Only call with islLock locked at least for reading
|
||||
return islInterfaces.contains(serverId);
|
||||
return islInterfaces.contains(_serverId);
|
||||
}
|
||||
|
||||
void Servatrice::addIslInterface(int serverId, IslInterface *interface)
|
||||
void Servatrice::addIslInterface(int _serverId, IslInterface *interface)
|
||||
{
|
||||
// Only call with islLock locked for writing
|
||||
islInterfaces.insert(serverId, interface);
|
||||
islInterfaces.insert(_serverId, interface);
|
||||
connect(interface, SIGNAL(externalUserJoined(ServerInfo_User)), this, SLOT(externalUserJoined(ServerInfo_User)));
|
||||
connect(interface, SIGNAL(externalUserLeft(QString)), this, SLOT(externalUserLeft(QString)));
|
||||
connect(interface, SIGNAL(externalRoomUserJoined(int, ServerInfo_User)), this,
|
||||
|
|
@ -753,24 +753,24 @@ void Servatrice::addIslInterface(int serverId, IslInterface *interface)
|
|||
SLOT(externalGameEventContainerReceived(GameEventContainer, qint64)));
|
||||
}
|
||||
|
||||
void Servatrice::removeIslInterface(int serverId)
|
||||
void Servatrice::removeIslInterface(int _serverId)
|
||||
{
|
||||
// Only call with islLock locked for writing
|
||||
// XXX we probably need to delete everything that belonged to it... <-- THIS SHOULD BE FIXED FOR ISL FUNCTIONALITY
|
||||
// TO WORK COMPLETLY!
|
||||
islInterfaces.remove(serverId);
|
||||
islInterfaces.remove(_serverId);
|
||||
}
|
||||
|
||||
void Servatrice::doSendIslMessage(const IslMessage &msg, int serverId)
|
||||
void Servatrice::doSendIslMessage(const IslMessage &msg, int _serverId)
|
||||
{
|
||||
QReadLocker locker(&islLock);
|
||||
|
||||
if (serverId == -1) {
|
||||
if (_serverId == -1) {
|
||||
QMapIterator<int, IslInterface *> islIterator(islInterfaces);
|
||||
while (islIterator.hasNext())
|
||||
islIterator.next().value()->transmitMessage(msg);
|
||||
} else {
|
||||
IslInterface *interface = islInterfaces.value(serverId);
|
||||
IslInterface *interface = islInterfaces.value(_serverId);
|
||||
if (interface)
|
||||
interface->transmitMessage(msg);
|
||||
}
|
||||
|
|
@ -811,7 +811,7 @@ bool Servatrice::getRegOnlyServerEnabled() const
|
|||
QString Servatrice::getAuthenticationMethodString() const
|
||||
{
|
||||
if (QProcessEnvironment::systemEnvironment().contains("DATABASE_URL")) {
|
||||
return QString("sql");
|
||||
return {"sql"};
|
||||
}
|
||||
return settingsCache->value("authentication/method").toString();
|
||||
}
|
||||
|
|
@ -854,7 +854,7 @@ QString Servatrice::getRequiredFeatures() const
|
|||
QString Servatrice::getDBTypeString() const
|
||||
{
|
||||
if (QProcessEnvironment::systemEnvironment().contains("DATABASE_URL")) {
|
||||
return QString("mysql");
|
||||
return {"mysql"};
|
||||
}
|
||||
return settingsCache->value("database/type").toString();
|
||||
}
|
||||
|
|
@ -862,7 +862,7 @@ QString Servatrice::getDBTypeString() const
|
|||
QString Servatrice::getDBPrefixString() const
|
||||
{
|
||||
if (QProcessEnvironment::systemEnvironment().contains("DATABASE_URL")) {
|
||||
return QString("cockatrice");
|
||||
return {"cockatrice"};
|
||||
}
|
||||
return settingsCache->value("database/prefix").toString();
|
||||
}
|
||||
|
|
@ -903,7 +903,7 @@ QString Servatrice::getDBPasswordString() const
|
|||
QString Servatrice::getRoomsMethodString() const
|
||||
{
|
||||
if (QProcessEnvironment::systemEnvironment().contains("DATABASE_URL")) {
|
||||
return QString("sql");
|
||||
return {"sql"};
|
||||
}
|
||||
return settingsCache->value("rooms/method").toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ private slots:
|
|||
void shutdownTimeout();
|
||||
|
||||
protected:
|
||||
void doSendIslMessage(const IslMessage &msg, int islServerId) override;
|
||||
void doSendIslMessage(const IslMessage &msg, int _serverId) override;
|
||||
|
||||
private:
|
||||
enum DatabaseType
|
||||
|
|
@ -276,9 +276,9 @@ public:
|
|||
void incRxBytes(quint64 num);
|
||||
void addDatabaseInterface(QThread *thread, Servatrice_DatabaseInterface *databaseInterface);
|
||||
|
||||
bool islConnectionExists(int islServerId) const;
|
||||
void addIslInterface(int islServerId, IslInterface *interface);
|
||||
void removeIslInterface(int islServerId);
|
||||
bool islConnectionExists(int _serverId) const;
|
||||
void addIslInterface(int _serverId, IslInterface *interface);
|
||||
void removeIslInterface(int _serverId);
|
||||
QReadWriteLock islLock;
|
||||
|
||||
QList<ServerProperties> getServerList() const;
|
||||
|
|
|
|||
|
|
@ -834,9 +834,9 @@ void Servatrice_DatabaseInterface::storeGameInformation(const QString &roomName,
|
|||
for (int i = 0; i < replayList.size(); ++i) {
|
||||
QByteArray blob;
|
||||
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||
const unsigned int size = replayList[i]->ByteSizeLong();
|
||||
const unsigned int size = static_cast<unsigned int>(replayList[i]->ByteSizeLong());
|
||||
#else
|
||||
const unsigned int size = replayList[i]->ByteSize();
|
||||
const unsigned int size = static_cast<unsigned int>(replayList[i]->ByteSize());
|
||||
#endif
|
||||
blob.resize(size);
|
||||
replayList[i]->SerializeToArray(blob.data(), size);
|
||||
|
|
|
|||
|
|
@ -1306,16 +1306,16 @@ Response::ResponseCode AbstractServerSocketInterface::cmdAccountEdit(const Comma
|
|||
QString queryText = QString("update {prefix}_users set %1 where name=:userName").arg(queryList.join(", "));
|
||||
QSqlQuery *query = sqlInterface->prepareQuery(queryText);
|
||||
if (cmd.has_real_name()) {
|
||||
QString realName = nameFromStdString(cmd.real_name());
|
||||
query->bindValue(":realName", realName);
|
||||
auto _realName = nameFromStdString(cmd.real_name());
|
||||
query->bindValue(":realName", _realName);
|
||||
}
|
||||
if (cmd.has_email()) {
|
||||
QString emailAddress = nameFromStdString(cmd.email());
|
||||
query->bindValue(":email", emailAddress);
|
||||
auto _emailAddress = nameFromStdString(cmd.email());
|
||||
query->bindValue(":email", _emailAddress);
|
||||
}
|
||||
if (cmd.has_country()) {
|
||||
QString country = nameFromStdString(cmd.country());
|
||||
query->bindValue(":country", country);
|
||||
auto _country = nameFromStdString(cmd.country());
|
||||
query->bindValue(":country", _country);
|
||||
}
|
||||
query->bindValue(":userName", userName);
|
||||
|
||||
|
|
@ -1752,9 +1752,9 @@ void TcpServerSocketInterface::flushOutputQueue()
|
|||
|
||||
QByteArray buf;
|
||||
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||
unsigned int size = item.ByteSizeLong();
|
||||
unsigned int size = static_cast<unsigned int>(item.ByteSizeLong());
|
||||
#else
|
||||
unsigned int size = item.ByteSize();
|
||||
unsigned int size = static_cast<unsigned int>(item.ByteSize());
|
||||
#endif
|
||||
buf.resize(size + 4);
|
||||
item.SerializeToArray(buf.data() + 4, size);
|
||||
|
|
@ -1955,9 +1955,9 @@ void WebsocketServerSocketInterface::flushOutputQueue()
|
|||
|
||||
QByteArray buf;
|
||||
#if GOOGLE_PROTOBUF_VERSION > 3001000
|
||||
unsigned int size = item.ByteSizeLong();
|
||||
unsigned int size = static_cast<unsigned int>(item.ByteSizeLong());
|
||||
#else
|
||||
unsigned int size = item.ByteSize();
|
||||
unsigned int size = static_cast<unsigned int>(item.ByteSize());
|
||||
#endif
|
||||
buf.resize(size);
|
||||
item.SerializeToArray(buf.data(), size);
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ void SignalHandler::internalSigHupHandler()
|
|||
snHup->setEnabled(true);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
void SignalHandler::sigSegvHandler(int sig)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
void *array[SIGSEGV_TRACE_LINES];
|
||||
size_t size;
|
||||
|
||||
|
|
@ -96,5 +96,9 @@ void SignalHandler::sigSegvHandler(int sig)
|
|||
delete loggerThread;
|
||||
|
||||
raise(sig);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void SignalHandler::sigSegvHandler(int /* sig */)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue