diff --git a/src/texture.cpp b/src/texture.cpp index 0fc2abe..917a414 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -22,6 +22,7 @@ #include "sdlmain.hpp" #include "physicsfswrapper.hpp" #include "compatibility.h" +#include "casts.hpp" #include #include #include @@ -151,7 +152,7 @@ namespace cloonel { parSize.x(), parSize.y(), bpp, - static_cast(stride), + checked_numcast(stride), redMask, greenMask, blueMask, @@ -185,7 +186,7 @@ namespace cloonel { return; PhysicsFSFile& rawfile = *static_cast(png_get_io_ptr(parPngPtr)); - const int64_t read = rawfile.Read(static_cast(parOutBytes), static_cast(parByteCountToRead), 1); + const int64_t read = rawfile.Read(static_cast(parOutBytes), checked_numcast(parByteCountToRead), 1); if (read != static_cast(parByteCountToRead)) return; diff --git a/src/vector.hpp b/src/vector.hpp index 48b060d..b222379 100644 --- a/src/vector.hpp +++ b/src/vector.hpp @@ -30,14 +30,24 @@ #include #endif +#if defined(__INTEL_COMPILER) +# define DONT_GUESS_NOEXCEPT +#endif + namespace cloonel { template class Vector { template friend class Vector; public: +#if defined(DONT_GUESS_NOEXCEPT) + Vector ( void ) = default; + explicit Vector ( T parValue ); + template explicit Vector ( const Vector& parOther ); +#else Vector ( void ) noexcept(noexcept(T())) = default; explicit Vector ( T parValue ) noexcept(noexcept(T()) && noexcept(parValue=parValue)); template explicit Vector ( const Vector& parOther ) noexcept(noexcept(T()) && noexcept(const_cast(parOther.m_mem[0])=T())); +#endif template > Vector ( T parX, T parY ) noexcept : m_mem {parX, parY} {} template > Vector ( T parX, T parY, T parZ ) noexcept : m_mem {parX, parY, parZ} {} template > Vector ( T parX, T parY, T parZ, T parW ) noexcept : m_mem {parX, parY, parZ, parW} {} @@ -132,4 +142,9 @@ namespace cloonel { } //namespace cloonel #include "vector.inl" + +#if defined(DONT_GUESS_NOEXCEPT) +#undef DONT_GUESS_NOEXCEPT +#endif + #endif diff --git a/src/vector.inl b/src/vector.inl index 14d8680..5d8a48c 100644 --- a/src/vector.inl +++ b/src/vector.inl @@ -21,7 +21,11 @@ namespace cloonel { ///------------------------------------------------------------------------- ///------------------------------------------------------------------------- template +#if defined(DONT_GUESS_NOEXCEPT) + Vector::Vector (T parValue) { +#else Vector::Vector (T parValue) noexcept(noexcept(T()) && noexcept(parValue=parValue)) { +#endif std::fill(m_mem, m_mem + S, parValue); } @@ -29,7 +33,11 @@ namespace cloonel { ///------------------------------------------------------------------------- template template +#if defined(DONT_GUESS_NOEXCEPT) + Vector::Vector (const Vector& parOther) { +#else Vector::Vector (const Vector& parOther) noexcept(noexcept(T()) && noexcept(const_cast(parOther.m_mem[0])=T())) { +#endif std::copy(parOther.m_mem, parOther.m_mem + S, m_mem); }