Fix build on platforms without INFINITY
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 7 Feb 2013 15:52:18 +0000 (16:52 +0100)
committerLars Knoll <lars.knoll@digia.com>
Sat, 9 Feb 2013 09:47:30 +0000 (10:47 +0100)
Use Q_INFINITY from qnumeric.h as portable wrapper.

Change-Id: I2dc2ef1c5e31ace89730b010c2a884e5b532b01f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/v4/qmljs_engine.cpp
src/v4/qmljs_runtime.cpp
src/v4/qv4globalobject.cpp

index 8c5dcfc..9dd5e38 100644 (file)
@@ -201,7 +201,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
 
     glo->defineReadonlyProperty(this, QStringLiteral("undefined"), Value::undefinedValue());
     glo->defineReadonlyProperty(this, QStringLiteral("NaN"), Value::fromDouble(nan("")));
-    glo->defineReadonlyProperty(this, QStringLiteral("Infinity"), Value::fromDouble(INFINITY));
+    glo->defineReadonlyProperty(this, QStringLiteral("Infinity"), Value::fromDouble(Q_INFINITY));
 
     evalFunction = new (memoryManager) EvalFunction(rootContext);
     glo->defineDefaultProperty(rootContext, QStringLiteral("eval"), Value::fromObject(evalFunction));
index e192b40..a785f00 100644 (file)
@@ -469,9 +469,9 @@ double __qmljs_string_to_number(const String *string)
     double d = qstrtod(begin, &end, &ok);
     if (end - begin != ba.size()) {
         if (ba == "Infinity" || ba == "+Infinity")
-            d = INFINITY;
+            d = Q_INFINITY;
         else if (ba == "-Infinity")
-            d = -INFINITY;
+            d = -Q_INFINITY;
         else
             d = nan("");
     }
index fe43011..220704b 100644 (file)
@@ -589,9 +589,9 @@ Value GlobalFunctions::method_parseFloat(ExecutionContext *context)
     // 4:
     if (trimmed.startsWith(QLatin1String("Infinity"))
             || trimmed.startsWith(QLatin1String("+Infinity")))
-        return Value::fromDouble(INFINITY);
+        return Value::fromDouble(Q_INFINITY);
     if (trimmed.startsWith("-Infinity"))
-        return Value::fromDouble(-INFINITY);
+        return Value::fromDouble(-Q_INFINITY);
     QByteArray ba = trimmed.toLatin1();
     bool ok;
     const char *begin = ba.constData();