From 11c2ee81c1c619806329f1e8a9c37c3d70980867 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 1 Dec 2016 15:51:54 +0800 Subject: [PATCH 1/2] Fix warning C4267. conversion from 'size_t' to 'int', possible loss of data. --- src/base/bittorrent/torrentinfo.cpp | 2 +- src/gui/properties/speedplotview.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/bittorrent/torrentinfo.cpp b/src/base/bittorrent/torrentinfo.cpp index bfe89d014..f06be60f7 100644 --- a/src/base/bittorrent/torrentinfo.cpp +++ b/src/base/bittorrent/torrentinfo.cpp @@ -239,7 +239,7 @@ QVector TorrentInfo::fileIndicesForPiece(int pieceIndex) const std::vector files( nativeInfo()->map_block(pieceIndex, 0, nativeInfo()->piece_size(pieceIndex))); QVector res; - res.reserve(files.size()); + res.reserve(int(files.size())); std::transform(files.begin(), files.end(), std::back_inserter(res), [](const libt::file_slice &s) { return s.file_index; }); diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index 66115a78d..bd9ca19a3 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -159,7 +159,7 @@ int SpeedPlotView::maxYValue() if (!m_properties[static_cast(id)].enable) continue; - for (int i = queue.size() - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) + for (int i = int(queue.size()) - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) if (queue[i].y[id] > maxYValue) maxYValue = queue[i].y[id]; } @@ -241,7 +241,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *) QVector points; - for (int i = queue.size() - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) { + for (int i = int(queue.size()) - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) { int new_x = rect.right() - j * xTickSize; int new_y = rect.bottom() - queue[i].y[id] * yMultiplier; From 5d2d22a218149777be936f91fad9e01ae345e810 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Thu, 1 Dec 2016 15:52:49 +0800 Subject: [PATCH 2/2] Fix warning C4090. different '__unaligned' qualifiers. --- src/base/utils/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/utils/misc.cpp b/src/base/utils/misc.cpp index 18f06d2d7..bfc1c3747 100644 --- a/src/base/utils/misc.cpp +++ b/src/base/utils/misc.cpp @@ -580,7 +580,7 @@ void Utils::Misc::openFolderSelect(const QString &absolutePath) } #ifdef Q_OS_WIN HRESULT hresult = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED); - ITEMIDLIST *pidl = ::ILCreateFromPathW(reinterpret_cast(Utils::Fs::toNativePath(path).utf16())); + PIDLIST_ABSOLUTE pidl = ::ILCreateFromPathW(reinterpret_cast(Utils::Fs::toNativePath(path).utf16())); if (pidl) { ::SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0); ::ILFree(pidl);