Make it compile with C++11 support.

Reference : https://bugs.webkit.org/show_bug.cgi?id=59249
This commit is contained in:
Julien de Kozak 2014-11-01 18:35:44 +01:00 committed by Robin Gareus
parent 036b6234ac
commit cb8abbe8d2
4 changed files with 39 additions and 15 deletions

View file

@ -17,14 +17,17 @@
*/
#include <cmath>
#ifdef COMPILER_MSVC
#include <float.h>
/* isinf() & isnan() are C99 standards, which older MSVC doesn't provide */
#define isinf(val) !((bool)_finite((double)val))
#define isnan(val) (bool)_isnan((double)val)
// 'std::isnan()' is not available in MSVC.
#define isnan_local(val) (bool)_isnan((double)val)
#else
#define isnan_local std::isnan
#endif
#include <cmath>
#include <climits>
#include <vector>
#include <fstream>
@ -976,7 +979,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
model_to_view_coord (tx, ty);
if (isnan (tx) || isnan (ty)) {
if (isnan_local (tx) || isnan_local (ty)) {
warning << string_compose (_("Ignoring illegal points on AutomationLine \"%1\""),
_name) << endmsg;
continue;

View file

@ -16,6 +16,18 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cmath>
#ifdef COMPILER_MSVC
#include <float.h>
// 'std::isinf()' and 'std::isnan()' are not available in MSVC.
#define isinf_local(val) !((bool)_finite((double)val))
#define isnan_local(val) (bool)_isnan((double)val)
#else
#define isinf_local std::isinf
#define isnan_local std::isnan
#endif
#include "pbd/ffs.h"
#include "pbd/enumwriter.h"
@ -647,9 +659,9 @@ MidiTrack::MidiControl::set_value(double val)
const Evoral::Parameter &parameter = _list ? _list->parameter() : Control::parameter();
bool valid = false;
if (isinf(val)) {
if (isinf_local(val)) {
cerr << "MIDIControl value is infinity" << endl;
} else if (isnan(val)) {
} else if (isnan_local(val)) {
cerr << "MIDIControl value is NaN" << endl;
} else if (val < parameter.min()) {
cerr << "MIDIControl value is < " << parameter.min() << endl;

View file

@ -17,6 +17,16 @@
*/
#include <cmath>
#ifdef COMPILER_MSVC
#include <float.h>
// 'std::isnan()' is not available in MSVC.
#define isnan_local(val) (bool)_isnan((double)val)
#else
#define isnan_local std::isnan
#endif
#include <cassert>
#include <utility>
#include <iostream>
@ -837,8 +847,7 @@ ControlList::modify (iterator iter, double when, double val)
(*iter)->when = when;
(*iter)->value = val;
if (isnan (val)) {
if (isnan_local (val)) {
abort ();
}

View file

@ -40,11 +40,11 @@
#include <float.h>
// 'std::isinf()' and 'std::isnan()' are not available in MSVC.
#define isinf(val) !((bool)_finite((double)val))
#define isnan(val) (bool)_isnan((double)val)
#define isinf_local(val) !((bool)_finite((double)val))
#define isnan_local(val) (bool)_isnan((double)val)
#else
using std::isnan;
using std::isinf;
#define isinf_local std::isinf
#define isnan_local std::isnan
#endif
#include "SpectralCentroid.h"
@ -176,13 +176,13 @@ SpectralCentroid::process(const float *const *inputBuffers, Vamp::RealTime)
Feature feature;
feature.hasTimestamp = false;
if (!isnan(centroidLog) && !isinf(centroidLog)) {
if (!isnan_local(centroidLog) && !isinf_local(centroidLog)) {
feature.values.push_back(centroidLog);
}
returnFeatures[0].push_back(feature);
feature.values.clear();
if (!isnan(centroidLin) && !isinf(centroidLin)) {
if (!isnan_local(centroidLin) && !isinf_local(centroidLin)) {
feature.values.push_back(centroidLin);
}
returnFeatures[1].push_back(feature);