diff --git a/src/app/qtlocalpeer/qtlocalpeer.cpp b/src/app/qtlocalpeer/qtlocalpeer.cpp index 757f6a08f..5e9dbe797 100644 --- a/src/app/qtlocalpeer/qtlocalpeer.cpp +++ b/src/app/qtlocalpeer/qtlocalpeer.cpp @@ -152,10 +152,10 @@ bool QtLocalPeer::sendMessage(const QString &message, const int timeout) break; int ms = 250; #if defined(Q_OS_WIN) - Sleep(DWORD(ms)); + ::Sleep(DWORD(ms)); #else struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; - nanosleep(&ts, NULL); + ::nanosleep(&ts, nullptr); #endif } if (!connOk) diff --git a/src/base/bittorrent/filterparserthread.cpp b/src/base/bittorrent/filterparserthread.cpp index eb599fa6b..cdd8f88b1 100644 --- a/src/base/bittorrent/filterparserthread.cpp +++ b/src/base/bittorrent/filterparserthread.cpp @@ -484,9 +484,9 @@ int FilterParserThread::parseP2BFilterFile() char buf[7]; unsigned char version; if (!stream.readRawData(buf, sizeof(buf)) - || memcmp(buf, "\xFF\xFF\xFF\xFFP2B", 7) + || (memcmp(buf, "\xFF\xFF\xFF\xFFP2B", 7) != 0) || !stream.readRawData(reinterpret_cast(&version), sizeof(version))) - { + { LogMsg(tr("Parsing Error: The filter file is not a valid PeerGuardian P2B file."), Log::CRITICAL); return ruleCount; } diff --git a/src/base/bittorrent/infohash.cpp b/src/base/bittorrent/infohash.cpp index dcef97874..e4ee0f08d 100644 --- a/src/base/bittorrent/infohash.cpp +++ b/src/base/bittorrent/infohash.cpp @@ -93,7 +93,7 @@ BitTorrent::InfoHash::operator WrappedType() const BitTorrent::TorrentID BitTorrent::TorrentID::fromString(const QString &hashString) { - return TorrentID(BaseType::fromString(hashString)); + return {BaseType::fromString(hashString)}; } BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::InfoHash &infoHash) @@ -103,7 +103,7 @@ BitTorrent::TorrentID BitTorrent::TorrentID::fromInfoHash(const BitTorrent::Info BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA1Hash(const SHA1Hash &hash) { - return TorrentID(hash); + return {hash}; } BitTorrent::TorrentID BitTorrent::TorrentID::fromSHA256Hash(const SHA256Hash &hash) diff --git a/src/base/bittorrent/sessionimpl.h b/src/base/bittorrent/sessionimpl.h index 475a31a29..449a7f44e 100644 --- a/src/base/bittorrent/sessionimpl.h +++ b/src/base/bittorrent/sessionimpl.h @@ -380,7 +380,7 @@ namespace BitTorrent bool isExcludedFileNamesEnabled() const override; void setExcludedFileNamesEnabled(bool enabled) override; QStringList excludedFileNames() const override; - void setExcludedFileNames(const QStringList &newList) override; + void setExcludedFileNames(const QStringList &excludedFileNames) override; bool isFilenameExcluded(const QString &fileName) const override; QStringList bannedIPs() const override; void setBannedIPs(const QStringList &newList) override; diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index b064fd5e7..4abc49c6a 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -98,7 +98,7 @@ namespace QString firstTrackerMessage; QString firstErrorMessage; #ifdef QBT_USES_LIBTORRENT2 - const auto numEndpoints = static_cast(nativeEntry.endpoints.size() * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1)); + const auto numEndpoints = static_cast(nativeEntry.endpoints.size()) * ((hashes.has_v1() && hashes.has_v2()) ? 2 : 1); for (const lt::announce_endpoint &endpoint : nativeEntry.endpoints) { for (const auto protocolVersion : {lt::protocol_version::V1, lt::protocol_version::V2}) diff --git a/src/base/profile_p.cpp b/src/base/profile_p.cpp index 57a56beb0..e27a232a4 100644 --- a/src/base/profile_p.cpp +++ b/src/base/profile_p.cpp @@ -116,9 +116,9 @@ Path Private::DefaultProfile::downloadLocation() const std::unique_ptr Private::DefaultProfile::applicationSettings(const QString &name) const { #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) - return std::unique_ptr(new QSettings(QSettings::IniFormat, QSettings::UserScope, profileName(), name)); + return std::make_unique(QSettings::IniFormat, QSettings::UserScope, profileName(), name); #else - return std::unique_ptr(new QSettings(profileName(), name)); + return std::make_unique(profileName(), name); #endif } diff --git a/src/gui/desktopintegration.cpp b/src/gui/desktopintegration.cpp index 825d8cb99..ad5c7cae9 100644 --- a/src/gui/desktopintegration.cpp +++ b/src/gui/desktopintegration.cpp @@ -100,8 +100,7 @@ DesktopIntegration::DesktopIntegration(QObject *parent) DesktopIntegration::~DesktopIntegration() { - if (m_menu) - delete m_menu; + delete m_menu; } bool DesktopIntegration::isActive() const