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:
James Zern
2015-09-11 14:59:14 -07:00
parent a58c32339e
commit bff1aa512d

View File

@@ -8,6 +8,11 @@
#include "mkvparser.hpp"
#if defined(_MSC_VER) && _MSC_VER < 1800
#include <float.h> // _isnan() / _finite()
#define MSC_COMPAT
#endif
#include <cassert>
#include <climits>
#include <cmath>
@@ -23,6 +28,14 @@
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() {}
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;
}
if (std::isinf(result) || std::isnan(result))
if (mkvparser::isinf(result) || mkvparser::isnan(result))
return E_FILE_FORMAT_INVALID;
return 0;