diff --git a/src/blackmisc/collection.h b/src/blackmisc/collection.h index aaf6ddc27..fe12f1e87 100644 --- a/src/blackmisc/collection.h +++ b/src/blackmisc/collection.h @@ -24,6 +24,15 @@ #include #include +// conditions matched with pop pragmas at bottom of file +#if defined(QT_CC_CLANG) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wshorten-64-to-32" +#elif defined(Q_CC_MSVC) && defined(Q_OS_WIN64) && defined(QT_CC_WARNINGS) +#pragma warning(push) +#pragma warning(disable:4244) +#endif + namespace BlackMisc { @@ -73,7 +82,7 @@ namespace BlackMisc typedef typename Iterators::ConstForwardIterator const_iterator; typedef const_iterator iterator; // can't modify elements in-place typedef ptrdiff_t difference_type; - typedef intptr_t size_type; + typedef int size_type; //! @} //! Default constructor. @@ -336,7 +345,7 @@ namespace BlackMisc iterator end() override { return iterator::fromImpl(m_impl.end()); } const_iterator end() const override { return const_iterator::fromImpl(m_impl.cend()); } const_iterator cend() const override { return const_iterator::fromImpl(m_impl.cend()); } - size_type size() const override { return m_impl.size(); } + size_type size() const override { return static_cast(m_impl.size()); } bool empty() const override { return m_impl.empty(); } void clear() override { m_impl.clear(); } iterator insert(const T &value) override { return iterator::fromImpl(insertHelper(m_impl.insert(value))); } @@ -377,4 +386,11 @@ Q_DECLARE_METATYPE(BlackMisc::CCollection) Q_DECLARE_METATYPE(BlackMisc::CCollection) // CCollection not instantiated due to it being a dumb idea because of rounding issues +// conditions matched with pop pragmas at bottom of file +#if defined(QT_CC_CLANG) +#pragma clang diagnostic pop +#elif defined(Q_CC_MSVC) && defined(Q_OS_WIN64) && defined(QT_CC_WARNINGS) +#pragma warning(pop) +#endif + #endif // guard diff --git a/src/blackmisc/sequence.h b/src/blackmisc/sequence.h index 25bd44548..8756f13c2 100644 --- a/src/blackmisc/sequence.h +++ b/src/blackmisc/sequence.h @@ -23,6 +23,15 @@ #include #include +// conditions matched with pop pragmas at bottom of file +#if defined(QT_CC_CLANG) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wshorten-64-to-32" +#elif defined(Q_CC_MSVC) && defined(Q_OS_WIN64) && defined(QT_CC_WARNINGS) +#pragma warning(push) +#pragma warning(disable:4244) +#endif + namespace BlackMisc { @@ -49,7 +58,7 @@ namespace BlackMisc typedef typename Iterators::ConstRandomAccessIterator const_iterator; typedef typename Iterators::RandomAccessIterator iterator; typedef ptrdiff_t difference_type; - typedef intptr_t size_type; + typedef int size_type; //! @} //! Default constructor. @@ -587,7 +596,7 @@ namespace BlackMisc const_reference front() const override { return m_impl.front(); } reference back() override { return m_impl.back(); } const_reference back() const override { return m_impl.back(); } - size_type size() const override { return m_impl.size(); } + size_type size() const override { return static_cast(m_impl.size()); } bool empty() const override { return m_impl.empty(); } void clear() override { m_impl.clear(); } iterator insert(iterator pos, const T &value) override { return iterator::fromImpl(m_impl.insert(pos.template getImpl(), value)); } @@ -619,4 +628,11 @@ Q_DECLARE_METATYPE(BlackMisc::CSequence) Q_DECLARE_METATYPE(BlackMisc::CSequence) Q_DECLARE_METATYPE(BlackMisc::CSequence) +// conditions matched with pop pragmas at bottom of file +#if defined(QT_CC_CLANG) +#pragma clang diagnostic pop +#elif defined(Q_CC_MSVC) && defined(Q_OS_WIN64) && defined(QT_CC_WARNINGS) +#pragma warning(pop) +#endif + #endif //BLACKMISC_SEQUENCE_H