Merge pull request #15796 from Chocobo1/clazy

Fix defects found by clazy
This commit is contained in:
Chocobo1 2021-11-30 12:02:33 +08:00 committed by GitHub
commit a7a90613c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 13 deletions

View file

@ -64,7 +64,6 @@ namespace BitTorrent
#endif
InfoHash() = default;
InfoHash(const InfoHash &other) = default;
InfoHash(const WrappedType &nativeHash);
bool isValid() const;

View file

@ -34,6 +34,9 @@
#include <QHash>
// From https://doc.qt.io/qt-6/qhash.html#the-hashing-function:
// A hashing function for a key type K may be provided in two different ways.
// The first way is by having an overload of qHash() in K's namespace.
namespace libtorrent
{
namespace aux

View file

@ -1616,7 +1616,7 @@ void TorrentImpl::renameFile(const int index, const QString &path)
m_oldPath[index].push_back(oldPath);
#endif
++m_renameCount;
m_nativeHandle.rename_file(m_torrentInfo.nativeIndexes()[index], Utils::Fs::toNativePath(path).toStdString());
m_nativeHandle.rename_file(m_torrentInfo.nativeIndexes().at(index), Utils::Fs::toNativePath(path).toStdString());
}
void TorrentImpl::handleStateUpdate(const lt::torrent_status &nativeStatus)

View file

@ -41,7 +41,6 @@ public:
using UnderlyingType = lt::digest32<N>;
Digest32() = default;
Digest32(const Digest32 &other) = default;
Digest32(const UnderlyingType &nativeDigest)
: m_valid {true}

View file

@ -498,7 +498,7 @@ QString Utils::Misc::opensslVersionString()
#else
static const auto version {QString::fromLatin1(SSLeay_version(SSLEAY_VERSION))};
#endif
return QStringView(version).split(u' ', Qt::SkipEmptyParts)[1].toString();
return QStringView(version).split(u' ', Qt::SkipEmptyParts).at(1).toString();
}
QString Utils::Misc::zlibVersionString()

View file

@ -48,12 +48,7 @@ namespace Utils
typedef T ComponentType;
typedef Version<T, N, Mandatory> ThisType;
constexpr Version()
: m_components {{}}
{
}
constexpr Version(const ThisType &other) = default;
constexpr Version() = default;
template <typename ... Other>
constexpr Version(Other ... components)
@ -187,7 +182,7 @@ namespace Utils
{
}
ComponentsArray m_components;
ComponentsArray m_components {{}};
};
template <typename T, std::size_t N, std::size_t Mandatory>

View file

@ -412,7 +412,8 @@ void CategoryFilterModel::populate()
, [](Torrent *torrent) { return torrent->category().isEmpty(); })));
using Torrent = BitTorrent::Torrent;
for (auto i = session->categories().cbegin(); i != session->categories().cend(); ++i)
const QStringMap categories = session->categories();
for (auto i = categories.cbegin(); i != categories.cend(); ++i)
{
const QString &category = i.key();
if (m_isSubcategoriesEnabled)

View file

@ -44,7 +44,6 @@ namespace Private
class FileSystemPathEdit : public QWidget
{
Q_OBJECT
Q_ENUMS(Mode)
Q_PROPERTY(Mode mode READ mode WRITE setMode)
Q_PROPERTY(QString selectedPath READ selectedPath WRITE setSelectedPath NOTIFY selectedPathChanged)
Q_PROPERTY(QString fileNameFilter READ fileNameFilter WRITE setFileNameFilter)
@ -60,6 +59,7 @@ public:
DirectoryOpen, //!< selecting existing directories
DirectorySave //!< selecting directories for saving
};
Q_ENUM(Mode)
Mode mode() const;
void setMode(Mode mode);