mirror of
https://github.com/taglib/taglib.git
synced 2025-06-03 17:18:11 -04:00
Merge pull request #195 from TsudaKageyu/fix-float
Fixed GCC warnings about incompatible type conversions
This commit is contained in:
commit
23418c25a4
@ -23,6 +23,7 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tdebug.h"
|
||||
#include "ebmlelement.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
@ -849,14 +849,17 @@ float ByteVector::toFloat32BE(size_t offset) const
|
||||
{
|
||||
// float is 32-bit wide and IEEE754 compliant.
|
||||
|
||||
uint tmp;
|
||||
union {
|
||||
uint i;
|
||||
float f;
|
||||
} tmp;
|
||||
::memcpy(&tmp, data() + offset, 4);
|
||||
|
||||
# if SYSTEM_BYTEORDER == 1
|
||||
tmp = byteSwap<uint>(tmp);
|
||||
tmp.i = byteSwap<uint>(tmp.i);
|
||||
# endif
|
||||
|
||||
return *reinterpret_cast<float*>(&tmp);
|
||||
return tmp.f;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -907,14 +910,17 @@ double ByteVector::toFloat64BE(size_t offset) const
|
||||
{
|
||||
// double is 64-bit wide and IEEE754 compliant.
|
||||
|
||||
ulonglong tmp;
|
||||
union {
|
||||
ulonglong i;
|
||||
double f;
|
||||
} tmp;
|
||||
::memcpy(&tmp, data() + offset, 8);
|
||||
|
||||
# if SYSTEM_BYTEORDER == 1
|
||||
tmp = byteSwap<ulonglong>(tmp);
|
||||
tmp.i = byteSwap<ulonglong>(tmp.i);
|
||||
# endif
|
||||
|
||||
return *reinterpret_cast<double*>(&tmp);
|
||||
return tmp.f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user