Browse Source

Merge pull request #6814 from Chocobo1/defects

[QuickFix] Fix coverity issues
adaptive-webui-19844
Mike Tzou 8 years ago committed by GitHub
parent
commit
494601ea75
  1. 4
      src/base/bittorrent/torrenthandle.cpp
  2. 2
      src/base/utils/version.h

4
src/base/bittorrent/torrenthandle.cpp

@ -2053,8 +2053,10 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities) @@ -2053,8 +2053,10 @@ void TorrentHandle::prioritizeFiles(const QVector<int> &priorities)
QVector<qreal> TorrentHandle::availableFileFractions() const
{
QVector<int> piecesAvailability = pieceAvailability();
const auto filesCount = this->filesCount();
if (filesCount < 0) return {};
const QVector<int> piecesAvailability = pieceAvailability();
// libtorrent returns empty array for seeding only torrents
if (piecesAvailability.empty()) return QVector<qreal>(filesCount, -1.);

2
src/base/utils/version.h

@ -167,7 +167,7 @@ namespace Utils @@ -167,7 +167,7 @@ namespace Utils
throw std::runtime_error ("Incorrect number of version components");
bool ok = false;
ComponentsArray res;
ComponentsArray res{};
for (std::size_t i = 0; i < static_cast<std::size_t>(versionParts.size()); ++i) {
res[i] = static_cast<T>(versionParts[i].toInt(&ok));
if (!ok)

Loading…
Cancel
Save