From c8b66b25e8d241180ed9bf621eef51c9be51e1a4 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 28 Nov 2021 19:42:35 +0800 Subject: [PATCH] Avoid potential container detachment Suppress clazy warning: warning: Don't call QList::operator[]() on temporary [-Wclazy-detaching-temporary] --- src/base/bittorrent/torrentimpl.cpp | 2 +- src/base/utils/misc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 27a968356..f2f65ab4d 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -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) diff --git a/src/base/utils/misc.cpp b/src/base/utils/misc.cpp index ad3e15665..d72db3cd1 100644 --- a/src/base/utils/misc.cpp +++ b/src/base/utils/misc.cpp @@ -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()