mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 08:43:08 -07:00
Suppress C4267 conversion warnings (#13307)
- warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data Caused by mismatch between size_type of std and Qt containers. It is safe to cast to int as all of those containers hold low number of objects.
This commit is contained in:
parent
6c66d02aff
commit
ccb59fbad3
7 changed files with 24 additions and 22 deletions
|
@ -39,7 +39,7 @@ namespace
|
|||
QVector<T> loadFromBuffer(const boost::circular_buffer_space_optimized<T> &src, const int offset = 0)
|
||||
{
|
||||
QVector<T> ret;
|
||||
ret.reserve(src.size() - offset);
|
||||
ret.reserve(static_cast<typename decltype(ret)::size_type>(src.size()) - offset);
|
||||
std::copy((src.begin() + offset), src.end(), std::back_inserter(ret));
|
||||
return ret;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ QVector<Log::Msg> Logger::getMessages(const int lastKnownId) const
|
|||
const QReadLocker locker(&m_lock);
|
||||
|
||||
const int diff = m_msgCounter - lastKnownId - 1;
|
||||
const int size = m_messages.size();
|
||||
const int size = static_cast<int>(m_messages.size());
|
||||
|
||||
if ((lastKnownId == -1) || (diff >= size))
|
||||
return loadFromBuffer(m_messages);
|
||||
|
@ -111,7 +111,7 @@ QVector<Log::Peer> Logger::getPeers(const int lastKnownId) const
|
|||
const QReadLocker locker(&m_lock);
|
||||
|
||||
const int diff = m_peerCounter - lastKnownId - 1;
|
||||
const int size = m_peers.size();
|
||||
const int size = static_cast<int>(m_peers.size());
|
||||
|
||||
if ((lastKnownId == -1) || (diff >= size))
|
||||
return loadFromBuffer(m_peers);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue