mkvparser: add msvc compatibility for isnan/isinf
fixes build errors related to these functions on visual studio prior to 2013 Change-Id: I8272f9065195e5447055aad7d0f899afa0294ea9
This commit is contained in:
@@ -8,6 +8,11 @@
|
|||||||
|
|
||||||
#include "mkvparser.hpp"
|
#include "mkvparser.hpp"
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||||
|
#include <float.h> // _isnan() / _finite()
|
||||||
|
#define MSC_COMPAT
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -23,6 +28,14 @@
|
|||||||
|
|
||||||
namespace mkvparser {
|
namespace mkvparser {
|
||||||
|
|
||||||
|
#ifdef MSC_COMPAT
|
||||||
|
inline bool isnan(double val) { return !!_isnan(val); }
|
||||||
|
inline bool isinf(double val) { return !_finite(val); }
|
||||||
|
#else
|
||||||
|
inline bool isnan(double val) { return std::isnan(val); }
|
||||||
|
inline bool isinf(double val) { return std::isinf(val); }
|
||||||
|
#endif // MSC_COMPAT
|
||||||
|
|
||||||
IMkvReader::~IMkvReader() {}
|
IMkvReader::~IMkvReader() {}
|
||||||
|
|
||||||
template<typename Type> Type* SafeArrayAlloc(unsigned long long num_elements,
|
template<typename Type> Type* SafeArrayAlloc(unsigned long long num_elements,
|
||||||
@@ -267,7 +280,7 @@ long UnserializeFloat(IMkvReader* pReader, long long pos, long long size_,
|
|||||||
result = d;
|
result = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::isinf(result) || std::isnan(result))
|
if (mkvparser::isinf(result) || mkvparser::isnan(result))
|
||||||
return E_FILE_FORMAT_INVALID;
|
return E_FILE_FORMAT_INVALID;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user