Added static cast to prevent MSVC warning and comment highlighting non-conforming C++.

v0.27.3
Andreas Huggel 15 years ago
parent bb51bdad0e
commit 5d24f66ebd

@ -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<float*>(&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<uint32_t*>(&f);
return ul2Data(buf, ul, byteOrder);

@ -1597,7 +1597,7 @@ namespace Exiv2 {
long ValueType<T>::toLong(long n) const
{
ok_ = true;
return value_[n];
return static_cast<long>(value_[n]);
}
// Specialization for rational
template<>

Loading…
Cancel
Save