diff --git a/src/types.cpp b/src/types.cpp index f3b740bf..2a5844bd 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -237,6 +237,9 @@ namespace Exiv2 { float getFloat(const byte* buf, ByteOrder byteOrder) { + // This algorithm assumes that the internal representation of the float + // type is the 4-byte IEEE 754 binary32 format, which is common but not + // required by the C++ standard. assert(sizeof(float) == 4); uint32_t ul = getULong(buf, byteOrder); return *reinterpret_cast(&ul); @@ -318,6 +321,9 @@ namespace Exiv2 { long f2Data(byte* buf, float f, ByteOrder byteOrder) { + // This algorithm assumes that the internal representation of the float + // type is the 4-byte IEEE 754 binary32 format, which is common but not + // required by the C++ standard. assert(sizeof(float) == 4); uint32_t ul = *reinterpret_cast(&f); return ul2Data(buf, ul, byteOrder); diff --git a/src/value.hpp b/src/value.hpp index e8d1248e..66f19cbc 100644 --- a/src/value.hpp +++ b/src/value.hpp @@ -1597,7 +1597,7 @@ namespace Exiv2 { long ValueType::toLong(long n) const { ok_ = true; - return value_[n]; + return static_cast(value_[n]); } // Specialization for rational template<>