Remove warnings (5)

This commit is contained in:
CalciteM Team 2019-08-25 19:22:53 +08:00
parent 10c1b177ce
commit 81609ddbef
7 changed files with 20 additions and 19 deletions

View File

@ -136,6 +136,7 @@
#ifdef WIN32 #ifdef WIN32
#define sscanf sscanf_s #define sscanf sscanf_s
#define sprintf sprintf_s
#endif #endif
#endif // CONFIG_H #endif // CONFIG_H

View File

@ -117,7 +117,7 @@
<AssemblerListingLocation>release\</AssemblerListingLocation> <AssemblerListingLocation>release\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation> <BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>None</DebugInformationFormat> <DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4577;4467;4125;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling> <ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName> <ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
@ -127,7 +127,7 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level4</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
@ -254,7 +254,7 @@
<AssemblerListingLocation>debug\</AssemblerListingLocation> <AssemblerListingLocation>debug\</AssemblerListingLocation>
<BrowseInformation>false</BrowseInformation> <BrowseInformation>false</BrowseInformation>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4577;4467;4125;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>Sync</ExceptionHandling> <ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName> <ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
@ -263,7 +263,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level4</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>

View File

@ -52,11 +52,11 @@ private slots:
void sessionOpened(); void sessionOpened();
void setPort(uint16_t port) void setPort(uint16_t port)
{ {
this->port = port; this->port_ = port;
} }
uint16_t getPort() uint16_t getPort()
{ {
return port; return port_;
} }
private: private:
@ -71,7 +71,7 @@ private:
QNetworkSession *networkSession = nullptr; QNetworkSession *networkSession = nullptr;
uint16_t port {}; uint16_t port_ {};
}; };
#endif // CLIENT_H #endif // CLIENT_H

View File

@ -1679,7 +1679,7 @@ void NineChess::mirror(bool cmdChange /*= true*/)
r = static_cast<int>(llp[i]) / N_SEATS; r = static_cast<int>(llp[i]) / N_SEATS;
s = static_cast<int>(llp[i]) % N_SEATS; s = static_cast<int>(llp[i]) % N_SEATS;
s = (N_SEATS - s) % N_SEATS; s = (N_SEATS - s) % N_SEATS;
llp[i] = static_cast<uint64_t>(r * N_SEATS + s); llp[i] = (static_cast<uint64_t>(r) * N_SEATS + s);
} }
move_ = static_cast<int16_t>(((llp[0] << 8) | llp[1])); move_ = static_cast<int16_t>(((llp[0] << 8) | llp[1]));

View File

@ -235,7 +235,7 @@ public:
enum NineChess::Player turn; enum NineChess::Player turn;
// 动作状态标识 // 动作状态标识
enum NineChess::Action action; enum NineChess::Action action {};
// 玩家1剩余未放置子数 // 玩家1剩余未放置子数
int nPiecesInHand_1 {}; int nPiecesInHand_1 {};

View File

@ -31,7 +31,7 @@ Server::Server(QWidget *parent, uint16_t port)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
statusLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); statusLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
this->port = port; this->port_ = port;
QNetworkConfigurationManager manager; QNetworkConfigurationManager manager;
@ -110,9 +110,9 @@ void Server::sessionOpened()
tcpServer = new QTcpServer(this); tcpServer = new QTcpServer(this);
if (!tcpServer->listen(QHostAddress::LocalHost, port)) { if (!tcpServer->listen(QHostAddress::LocalHost, port_)) {
port++; port_++;
if (!tcpServer->listen(QHostAddress::LocalHost, port)) { if (!tcpServer->listen(QHostAddress::LocalHost, port_)) {
QMessageBox::critical(this, tr("Server"), QMessageBox::critical(this, tr("Server"),
tr("Unable to start the server: %1.") tr("Unable to start the server: %1.")
.arg(tcpServer->errorString())); .arg(tcpServer->errorString()));
@ -162,10 +162,10 @@ void Server::sendAction()
out.setVersion(QDataStream::Qt_5_10); out.setVersion(QDataStream::Qt_5_10);
if (!actions.empty()) { if (!actions.empty()) {
action = actions.front(); action_ = actions.front();
} }
out << action; out << action_;
QTcpSocket *clientConnection = tcpServer->nextPendingConnection(); QTcpSocket *clientConnection = tcpServer->nextPendingConnection();

View File

@ -41,11 +41,11 @@ public:
void setAction(const QString &action); void setAction(const QString &action);
void setPort(uint16_t port) void setPort(uint16_t port)
{ {
this->port = port; this->port_ = port;
} }
uint16_t getPort() uint16_t getPort()
{ {
return port; return port_;
} }
private slots: private slots:
@ -56,9 +56,9 @@ private:
QLabel *statusLabel = nullptr; QLabel *statusLabel = nullptr;
QTcpServer *tcpServer = nullptr; QTcpServer *tcpServer = nullptr;
QNetworkSession *networkSession = nullptr; QNetworkSession *networkSession = nullptr;
uint16_t port; uint16_t port_;
std::queue<QString> actions; std::queue<QString> actions;
QString action; QString action_;
}; };
#endif // SERVER_H #endif // SERVER_H