Browse Source

Merge pull request #15796 from Chocobo1/clazy

Fix defects found by clazy
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
a7a90613c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/base/bittorrent/infohash.h
  2. 3
      src/base/bittorrent/ltqhash.h
  3. 2
      src/base/bittorrent/torrentimpl.cpp
  4. 1
      src/base/digest32.h
  5. 2
      src/base/utils/misc.cpp
  6. 9
      src/base/utils/version.h
  7. 3
      src/gui/categoryfiltermodel.cpp
  8. 2
      src/gui/fspathedit.h

1
src/base/bittorrent/infohash.h

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

3
src/base/bittorrent/ltqhash.h

@ -34,6 +34,9 @@
#include <QHash> #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 libtorrent
{ {
namespace aux namespace aux

2
src/base/bittorrent/torrentimpl.cpp

@ -1616,7 +1616,7 @@ void TorrentImpl::renameFile(const int index, const QString &path)
m_oldPath[index].push_back(oldPath); m_oldPath[index].push_back(oldPath);
#endif #endif
++m_renameCount; ++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) void TorrentImpl::handleStateUpdate(const lt::torrent_status &nativeStatus)

1
src/base/digest32.h

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

2
src/base/utils/misc.cpp

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

9
src/base/utils/version.h

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

3
src/gui/categoryfiltermodel.cpp

@ -412,7 +412,8 @@ void CategoryFilterModel::populate()
, [](Torrent *torrent) { return torrent->category().isEmpty(); }))); , [](Torrent *torrent) { return torrent->category().isEmpty(); })));
using Torrent = BitTorrent::Torrent; 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(); const QString &category = i.key();
if (m_isSubcategoriesEnabled) if (m_isSubcategoriesEnabled)

2
src/gui/fspathedit.h

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

Loading…
Cancel
Save