Commit 8c24b7a5 authored by zandobersek@gmail.com's avatar zandobersek@gmail.com

Stop placing std::isfinite and std::signbit inside the global scope

https://bugs.webkit.org/show_bug.cgi?id=109817

Reviewed by Darin Adler.

Prefix calls to the isfinite and signbit methods with std:: as the two
methods are no longer being imported into the global scope.

Source/JavaScriptCore: 

* assembler/MacroAssembler.h:
(JSC::MacroAssembler::shouldBlindDouble):
* offlineasm/cloop.rb:
* runtime/BigInteger.h:
(JSC::BigInteger::BigInteger):
* runtime/DateConstructor.cpp:
(JSC::constructDate):
* runtime/DatePrototype.cpp:
(JSC::fillStructuresUsingTimeArgs):
(JSC::fillStructuresUsingDateArgs):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncSetYear):
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::JSValue):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncIsFinite):
* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):
* runtime/MathObject.cpp:
(JSC::mathProtoFuncMax): Also include an opportunistic style fix.
(JSC::mathProtoFuncMin): Ditto.
* runtime/NumberPrototype.cpp:
(JSC::toStringWithRadix):
(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToPrecision):
(JSC::numberProtoFuncToString):
* runtime/Uint16WithFraction.h:
(JSC::Uint16WithFraction::Uint16WithFraction):

Source/WebCore: 

No new tests as there's no change in functionality.

* bindings/js/JSCanvasRenderingContext2DCustom.cpp:
(WebCore::JSCanvasRenderingContext2D::setWebkitLineDash):
* bindings/js/JSDOMBinding.cpp:
(WebCore::jsDateOrNull):
* bindings/js/JSDOMBinding.h:
(WebCore::finiteInt32Value):
* bindings/v8/V8Binding.h:
(WebCore::v8DateOrNull):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::parseToNumber):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValueAsNumber):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::setMin):
(WebCore::HTMLMeterElement::setMax):
(WebCore::HTMLMeterElement::setValue):
(WebCore::HTMLMeterElement::setLow):
(WebCore::HTMLMeterElement::setHigh):
(WebCore::HTMLMeterElement::setOptimum):
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::value):
(WebCore::HTMLProgressElement::setValue):
(WebCore::HTMLProgressElement::max):
(WebCore::HTMLProgressElement::setMax):
* html/MonthInputType.cpp:
(WebCore::MonthInputType::valueAsDate):
(WebCore::MonthInputType::defaultValueForStepUp):
(WebCore::MonthInputType::parseToNumber):
* html/NumberInputType.cpp:
(WebCore::NumberInputType::typeMismatchFor):
(WebCore::NumberInputType::sanitizeValue):
(WebCore::NumberInputType::hasBadInput):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::typeMismatchFor):
* html/TimeInputType.cpp:
(WebCore::TimeInputType::defaultValueForStepUp):
* html/canvas/CanvasPathMethods.cpp:
(WebCore::CanvasPathMethods::moveTo):
(WebCore::CanvasPathMethods::lineTo):
(WebCore::CanvasPathMethods::quadraticCurveTo):
(WebCore::CanvasPathMethods::bezierCurveTo):
(WebCore::CanvasPathMethods::arcTo):
(WebCore::CanvasPathMethods::arc):
(WebCore::CanvasPathMethods::rect):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setLineWidth):
(WebCore::CanvasRenderingContext2D::setMiterLimit):
(WebCore::CanvasRenderingContext2D::setShadowOffsetX):
(WebCore::CanvasRenderingContext2D::setShadowOffsetY):
(WebCore::CanvasRenderingContext2D::setShadowBlur):
(WebCore::lineDashSequenceIsValid):
(WebCore::CanvasRenderingContext2D::setLineDashOffset):
(WebCore::CanvasRenderingContext2D::scale):
(WebCore::CanvasRenderingContext2D::rotate):
(WebCore::CanvasRenderingContext2D::translate):
(WebCore::CanvasRenderingContext2D::transform):
(WebCore::CanvasRenderingContext2D::setTransform):
(WebCore::validateRectForCanvas):
(WebCore::CanvasRenderingContext2D::isPointInPath):
(WebCore::CanvasRenderingContext2D::isPointInStroke):
(WebCore::CanvasRenderingContext2D::drawImage):
(WebCore::CanvasRenderingContext2D::createLinearGradient):
(WebCore::CanvasRenderingContext2D::createRadialGradient):
(WebCore::CanvasRenderingContext2D::createImageData):
(WebCore::CanvasRenderingContext2D::getImageData):
(WebCore::CanvasRenderingContext2D::putImageData):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseToDoubleForNumberType):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTimelineElement::setDuration):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::reset):
* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::reset):
* html/shadow/MediaControlsBlackBerry.cpp:
(WebCore::MediaControlFullscreenTimelineElement::setDuration):
(WebCore::MediaControlsBlackBerry::reset):
* inspector/InspectorValues.cpp:
(WebCore::InspectorBasicValue::writeJSON):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::currentAge):
(WebCore::CachedResource::freshnessLifetime):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect):
* platform/DateComponents.cpp:
(WebCore::DateComponents::setMillisecondsSinceEpochForDate):
(WebCore::DateComponents::setMillisecondsSinceEpochForDateTime):
(WebCore::DateComponents::setMillisecondsSinceEpochForMonth):
(WebCore::DateComponents::setMillisecondsSinceMidnight):
(WebCore::DateComponents::setMonthsSinceEpoch):
(WebCore::DateComponents::setMillisecondsSinceEpochForWeek):
* platform/Decimal.cpp:
(WebCore::Decimal::fromDouble):
* platform/FileSystem.h:
(WebCore::isValidFileTime):
* platform/LocalizedStrings.cpp:
(WebCore::localizedMediaTimeDescription):
* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::drawPatternToCairoContext):
* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::addArc):
(WebCore::Path::contains):
* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::addArc):
* platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp:
(WebCore::FullscreenVideoControllerGStreamer::timeToString):
* platform/graphics/openvg/PathOpenVG.cpp:
(WebCore::Path::addArc):
* platform/graphics/skia/SkiaUtils.h:
(WebCore::WebCoreFloatToSkScalar):
(WebCore::WebCoreDoubleToSkScalar):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::maxTimeSeekable):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::localizedMediaTimeDescription):
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(timeToString):
* platform/network/ResourceResponseBase.cpp:
(WebCore::parseDateValueInHeader):
* platform/qt/LocalizedStringsQt.cpp:
(WebCore::localizedMediaTimeDescription):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::resolveFlexibleLengths):
* rendering/RenderMediaControlsChromium.cpp:
(WebCore::formatChromiumMediaControlsTime):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::formatMediaControlsTime):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setFontSize):
* svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::decomposeArcToCubic):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunRound::round):
* xml/XPathValue.cpp:
(WebCore::XPath::Value::toString):

Source/WebKit/win: 

* FullscreenVideoController.cpp:
(timeToString):

Source/WTF: 

On Solaris and OpenBSD platforms or when using Visual C++ the two methods
are now defined (as incompatibility workarounds) inside the std namespace.

* wtf/DateMath.cpp:
(WTF::timeClip):
* wtf/DecimalNumber.h:
(WTF::DecimalNumber::DecimalNumber):
* wtf/MathExtras.h:
(std):
(std::isfinite):
(std::signbit):
(lrint):
(wtf_pow):
(decomposeDouble):
* wtf/MediaTime.cpp:
(WTF::MediaTime::createWithFloat):
(WTF::MediaTime::createWithDouble):
* wtf/dtoa.cpp:
(WTF::dtoa):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143232 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 33361bc9
2013-02-18 Zan Dobersek <zdobersek@igalia.com>
Stop placing std::isfinite and std::signbit inside the global scope
https://bugs.webkit.org/show_bug.cgi?id=109817
Reviewed by Darin Adler.
Prefix calls to the isfinite and signbit methods with std:: as the two
methods are no longer being imported into the global scope.
* assembler/MacroAssembler.h:
(JSC::MacroAssembler::shouldBlindDouble):
* offlineasm/cloop.rb:
* runtime/BigInteger.h:
(JSC::BigInteger::BigInteger):
* runtime/DateConstructor.cpp:
(JSC::constructDate):
* runtime/DatePrototype.cpp:
(JSC::fillStructuresUsingTimeArgs):
(JSC::fillStructuresUsingDateArgs):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncSetYear):
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::JSValue):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncIsFinite):
* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):
* runtime/MathObject.cpp:
(JSC::mathProtoFuncMax): Also include an opportunistic style fix.
(JSC::mathProtoFuncMin): Ditto.
* runtime/NumberPrototype.cpp:
(JSC::toStringWithRadix):
(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToPrecision):
(JSC::numberProtoFuncToString):
* runtime/Uint16WithFraction.h:
(JSC::Uint16WithFraction::Uint16WithFraction):
2013-02-18 Ádám Kallai <kadam@inf.u-szeged.hu>
[Qt] Mountain Lion buildfix after r143147.
......
......@@ -847,7 +847,7 @@ public:
bool shouldBlindDouble(double value)
{
// Don't trust NaN or +/-Infinity
if (!isfinite(value))
if (!std::isfinite(value))
return shouldConsiderBlinding();
// Try to force normalisation, and check that there's no change
......
......@@ -709,7 +709,7 @@ class Instruction
$asm.putc "{"
$asm.putc " double d = #{operands[0].clValue(:double)};"
$asm.putc " const int32_t asInt32 = int32_t(d);"
$asm.putc " if (asInt32 != d || (!asInt32 && signbit(d))) // true for -0.0"
$asm.putc " if (asInt32 != d || (!asInt32 && std::signbit(d))) // true for -0.0"
$asm.putc " goto #{operands[2].cLabel};"
$asm.putc " #{operands[1].clValue} = asInt32;"
$asm.putc " #{operands[1].clDump}.clearHighWord();"
......
......@@ -35,7 +35,7 @@ class BigInteger {
public:
BigInteger(double number)
{
ASSERT(isfinite(number) && !signbit(number));
ASSERT(std::isfinite(number) && !std::signbit(number));
ASSERT(number == floor(number));
bool sign;
......
......@@ -125,13 +125,13 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg
args.at(5).toNumber(exec),
args.at(6).toNumber(exec)
};
if (!isfinite(doubleArguments[0])
|| !isfinite(doubleArguments[1])
|| (numArgs >= 3 && !isfinite(doubleArguments[2]))
|| (numArgs >= 4 && !isfinite(doubleArguments[3]))
|| (numArgs >= 5 && !isfinite(doubleArguments[4]))
|| (numArgs >= 6 && !isfinite(doubleArguments[5]))
|| (numArgs >= 7 && !isfinite(doubleArguments[6])))
if (!std::isfinite(doubleArguments[0])
|| !std::isfinite(doubleArguments[1])
|| (numArgs >= 3 && !std::isfinite(doubleArguments[2]))
|| (numArgs >= 4 && !std::isfinite(doubleArguments[3]))
|| (numArgs >= 5 && !std::isfinite(doubleArguments[4]))
|| (numArgs >= 6 && !std::isfinite(doubleArguments[5]))
|| (numArgs >= 7 && !std::isfinite(doubleArguments[6])))
value = QNaN;
else {
GregorianDateTime t;
......
......@@ -375,7 +375,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
if (maxArgs >= 4 && idx < numArgs) {
t->setHour(0);
double hours = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(hours);
ok = std::isfinite(hours);
milliseconds += hours * msPerHour;
}
......@@ -383,7 +383,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
if (maxArgs >= 3 && idx < numArgs && ok) {
t->setMinute(0);
double minutes = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(minutes);
ok = std::isfinite(minutes);
milliseconds += minutes * msPerMinute;
}
......@@ -391,7 +391,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
if (maxArgs >= 2 && idx < numArgs && ok) {
t->setSecond(0);
double seconds = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(seconds);
ok = std::isfinite(seconds);
milliseconds += seconds * msPerSecond;
}
......@@ -401,7 +401,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, int maxArgs, double* ms
// milliseconds
if (idx < numArgs) {
double millis = exec->argument(idx).toIntegerPreserveNaN(exec);
ok = isfinite(millis);
ok = std::isfinite(millis);
milliseconds += millis;
} else
milliseconds += *ms;
......@@ -427,19 +427,19 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, int maxArgs, double *ms
// years
if (maxArgs >= 3 && idx < numArgs) {
double years = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(years);
ok = std::isfinite(years);
t->setYear(toInt32(years));
}
// months
if (maxArgs >= 2 && idx < numArgs && ok) {
double months = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(months);
ok = std::isfinite(months);
t->setMonth(toInt32(months));
}
// days
if (idx < numArgs && ok) {
double days = exec->argument(idx++).toIntegerPreserveNaN(exec);
ok = isfinite(days);
ok = std::isfinite(days);
t->setMonthDay(0);
*ms += days * msPerDay;
}
......@@ -546,7 +546,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec)
return throwVMTypeError(exec);
DateInstance* thisDateObj = asDateInstance(thisValue);
if (!isfinite(thisDateObj->internalNumber()))
if (!std::isfinite(thisDateObj->internalNumber()))
return throwVMError(exec, createRangeError(exec, ASCIILiteral("Invalid Date")));
const GregorianDateTime* gregorianDateTime = thisDateObj->gregorianDateTimeUTC(exec);
......@@ -1076,7 +1076,7 @@ EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec)
}
double year = exec->argument(0).toIntegerPreserveNaN(exec);
if (!isfinite(year)) {
if (!std::isfinite(year)) {
JSValue result = jsNaN();
thisDateObj->setInternalValue(exec->globalData(), result);
return JSValue::encode(result);
......
......@@ -136,7 +136,7 @@ inline JSValue::JSValue(unsigned long long i)
inline JSValue::JSValue(double d)
{
const int32_t asInt32 = static_cast<int32_t>(d);
if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0
if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0
*this = JSValue(EncodeAsDouble, d);
return;
}
......
......@@ -566,7 +566,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec)
EncodedJSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec)
{
double n = exec->argument(0).toNumber(exec);
return JSValue::encode(jsBoolean(isfinite(n)));
return JSValue::encode(jsBoolean(std::isfinite(n)));
}
EncodedJSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec)
......
......@@ -387,7 +387,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
if (value.isNumber()) {
double number = value.asNumber();
if (!isfinite(number))
if (!std::isfinite(number))
builder.appendLiteral("null");
else
builder.append(String::numberToStringECMAScript(number));
......
......@@ -178,7 +178,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
result = QNaN;
break;
}
if (val > result || (val == 0 && result == 0 && !signbit(val)))
if (val > result || (!val && !result && !std::signbit(val)))
result = val;
}
return JSValue::encode(jsNumber(result));
......@@ -194,7 +194,7 @@ EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
result = QNaN;
break;
}
if (val < result || (val == 0 && result == 0 && signbit(val)))
if (val < result || (!val && !result && std::signbit(val)))
result = val;
}
return JSValue::encode(jsNumber(result));
......
......@@ -151,7 +151,7 @@ static const char radixDigits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static char* toStringWithRadix(RadixBuffer& buffer, double number, unsigned radix)
{
ASSERT(isfinite(number));
ASSERT(std::isfinite(number));
ASSERT(radix >= 2 && radix <= 36);
// Position the decimal point at the center of the string, set
......@@ -161,7 +161,7 @@ static char* toStringWithRadix(RadixBuffer& buffer, double number, unsigned radi
// Extract the sign.
bool isNegative = number < 0;
if (signbit(number))
if (std::signbit(number))
number = -number;
double integerPart = floor(number);
......@@ -198,12 +198,12 @@ static char* toStringWithRadix(RadixBuffer& buffer, double number, unsigned radi
// Calculate the delta from the current number to the next & previous possible IEEE numbers.
double nextNumber = nextafter(number, std::numeric_limits<double>::infinity());
double lastNumber = nextafter(number, -std::numeric_limits<double>::infinity());
ASSERT(isfinite(nextNumber) && !signbit(nextNumber));
ASSERT(isfinite(lastNumber) && !signbit(lastNumber));
ASSERT(std::isfinite(nextNumber) && !std::signbit(nextNumber));
ASSERT(std::isfinite(lastNumber) && !std::signbit(lastNumber));
double deltaNextDouble = nextNumber - number;
double deltaLastDouble = number - lastNumber;
ASSERT(isfinite(deltaNextDouble) && !signbit(deltaNextDouble));
ASSERT(isfinite(deltaLastDouble) && !signbit(deltaLastDouble));
ASSERT(std::isfinite(deltaNextDouble) && !std::signbit(deltaNextDouble));
ASSERT(std::isfinite(deltaLastDouble) && !std::signbit(deltaLastDouble));
// We track the delta from the current value to the next, to track how many digits of the
// fraction we need to write. For example, if the value we are converting is precisely
......@@ -380,7 +380,7 @@ EncodedJSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec)
return throwVMError(exec, createRangeError(exec, ASCIILiteral("toExponential() argument must be between 0 and 20")));
// Handle NaN and Infinity.
if (!isfinite(x))
if (!std::isfinite(x))
return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
// Round if the argument is not undefined, always format as exponential.
......@@ -418,7 +418,7 @@ EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec)
// The check above will return false for NaN or Infinity, these will be
// handled by numberToString.
ASSERT(isfinite(x));
ASSERT(std::isfinite(x));
NumberToStringBuffer buffer;
return JSValue::encode(jsString(exec, String(numberToFixedWidthString(x, decimalPlaces, buffer))));
......@@ -448,7 +448,7 @@ EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec)
return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
// Handle NaN and Infinity.
if (!isfinite(x))
if (!std::isfinite(x))
return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
NumberToStringBuffer buffer;
......@@ -507,7 +507,7 @@ EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec)
return JSValue::encode(jsString(globalData, globalData->numericStrings.add(doubleValue)));
}
if (!isfinite(doubleValue))
if (!std::isfinite(doubleValue))
return JSValue::encode(jsString(exec, String::numberToStringECMAScript(doubleValue)));
RadixBuffer s;
......
......@@ -41,7 +41,7 @@ class Uint16WithFraction {
public:
explicit Uint16WithFraction(double number, uint16_t divideByExponent = 0)
{
ASSERT(number && isfinite(number) && !signbit(number));
ASSERT(number && std::isfinite(number) && !std::signbit(number));
// Check for values out of uint16_t range.
if (number >= oneGreaterThanMaxUInt16) {
......
2013-02-18 Zan Dobersek <zdobersek@igalia.com>
Stop placing std::isfinite and std::signbit inside the global scope
https://bugs.webkit.org/show_bug.cgi?id=109817
Reviewed by Darin Adler.
Prefix calls to the isfinite and signbit methods with std:: as the two
methods are no longer being imported into the global scope.
On Solaris and OpenBSD platforms or when using Visual C++ the two methods
are now defined (as incompatibility workarounds) inside the std namespace.
* wtf/DateMath.cpp:
(WTF::timeClip):
* wtf/DecimalNumber.h:
(WTF::DecimalNumber::DecimalNumber):
* wtf/MathExtras.h:
(std):
(std::isfinite):
(std::signbit):
(lrint):
(wtf_pow):
(decomposeDouble):
* wtf/MediaTime.cpp:
(WTF::MediaTime::createWithFloat):
(WTF::MediaTime::createWithDouble):
* wtf/dtoa.cpp:
(WTF::dtoa):
2013-02-18 Laszlo Gombos <l.gombos@samsung.com>
Move ENABLE macros for WebCore out from Platform.h
......
......@@ -1072,7 +1072,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString)
double timeClip(double t)
{
if (!isfinite(t))
if (!std::isfinite(t))
return std::numeric_limits<double>::quiet_NaN();
if (fabs(t) > maxECMAScriptTime)
return std::numeric_limits<double>::quiet_NaN();
......
......@@ -40,7 +40,7 @@ class DecimalNumber {
public:
DecimalNumber(double d)
{
ASSERT(isfinite(d));
ASSERT(std::isfinite(d));
dtoa(m_significand, d, m_sign, m_exponent, m_precision);
ASSERT(m_precision);
......@@ -54,7 +54,7 @@ public:
DecimalNumber(double d, RoundingSignificantFiguresType, unsigned significantFigures)
{
ASSERT(isfinite(d));
ASSERT(std::isfinite(d));
dtoaRoundSF(m_significand, d, significantFigures, m_sign, m_exponent, m_precision);
ASSERT_WITH_SECURITY_IMPLICATION(significantFigures && significantFigures <= sizeof(DtoaBuffer));
......@@ -68,7 +68,7 @@ public:
DecimalNumber(double d, RoundingDecimalPlacesType, unsigned decimalPlaces)
{
ASSERT(isfinite(d));
ASSERT(std::isfinite(d));
dtoaRoundDP(m_significand, d, decimalPlaces, m_sign, m_exponent, m_precision);
unsigned significantFigures = 1 + m_exponent + decimalPlaces;
......
......@@ -85,15 +85,14 @@ inline double wtf_ceil(double x) { return copysign(ceil(x), x); }
#if OS(SOLARIS)
namespace std {
#ifndef isfinite
inline bool isfinite(double x) { return finite(x) && !isnand(x); }
#endif
#ifndef signbit
inline bool signbit(double x) { return copysign(1.0, x) < 0; }
#endif
namespace std {
#ifndef isinf
inline bool isinf(double x) { return !finite(x) && !isnand(x); }
#endif
......@@ -104,6 +103,8 @@ inline bool isinf(double x) { return !finite(x) && !isnand(x); }
#if OS(OPENBSD)
namespace std {
#ifndef isfinite
inline bool isfinite(double x) { return finite(x); }
#endif
......@@ -111,6 +112,8 @@ inline bool isfinite(double x) { return finite(x); }
inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x; return p->dbl_sign; }
#endif
} // namespace std
#endif
#if COMPILER(MSVC)
......@@ -168,16 +171,15 @@ namespace std {
inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
inline bool isfinite(double x) { return _finite(x); }
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
} // namespace std
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
inline double nextafter(double x, double y) { return _nextafter(x, y); }
inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
inline double copysign(double x, double y) { return _copysign(x, y); }
inline int isfinite(double x) { return _finite(x); }
// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
inline double wtf_atan2(double x, double y)
......@@ -222,7 +224,7 @@ inline long int lrint(double flt)
fistp intgr
};
#else
ASSERT(isfinite(flt));
ASSERT(std::isfinite(flt));
double rounded = round(flt);
intgr = static_cast<int64_t>(rounded);
// If the fractional part is exactly 0.5, we need to check whether
......@@ -339,11 +341,6 @@ template<typename T> inline T timesThreePlusOneDividedByTwo(T value)
return value + (value >> 1) + (value & 1);
}
#if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(SOLARIS)
using std::isfinite;
using std::signbit;
#endif
#ifndef UINT64_C
#if COMPILER(MSVC)
#define UINT64_C(c) c ## ui64
......@@ -357,7 +354,7 @@ inline double wtf_pow(double x, double y)
{
// MinGW-w64 has a custom implementation for pow.
// This handles certain special cases that are different.
if ((x == 0.0 || std::isinf(x)) && isfinite(y)) {
if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) {
double f;
if (modf(y, &f) != 0.0)
return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
......@@ -380,9 +377,9 @@ inline double wtf_pow(double x, double y)
// (sign ? -1 : 1) * pow(2, exponent) * (mantissa / (1 << 52))
inline void decomposeDouble(double number, bool& sign, int32_t& exponent, uint64_t& mantissa)
{
ASSERT(isfinite(number));
ASSERT(std::isfinite(number));
sign = signbit(number);
sign = std::signbit(number);
uint64_t bits = WTF::bitwise_cast<uint64_t>(number);
exponent = (static_cast<int32_t>(bits >> 52) & 0x7ff) - 0x3ff;
......
......@@ -84,7 +84,7 @@ MediaTime MediaTime::createWithFloat(float floatTime, int32_t timeScale)
if (floatTime != floatTime)
return invalidTime();
if (std::isinf(floatTime))
return signbit(floatTime) ? negativeInfiniteTime() : positiveInfiniteTime();
return std::signbit(floatTime) ? negativeInfiniteTime() : positiveInfiniteTime();
if (floatTime > numeric_limits<int64_t>::max())
return positiveInfiniteTime();
if (floatTime < numeric_limits<int64_t>::min())
......@@ -100,7 +100,7 @@ MediaTime MediaTime::createWithDouble(double doubleTime, int32_t timeScale)
if (doubleTime != doubleTime)
return invalidTime();
if (std::isinf(doubleTime))
return signbit(doubleTime) ? negativeInfiniteTime() : positiveInfiniteTime();
return std::signbit(doubleTime) ? negativeInfiniteTime() : positiveInfiniteTime();
if (doubleTime > numeric_limits<int64_t>::max())
return positiveInfiniteTime();
if (doubleTime < numeric_limits<int64_t>::min())
......
......@@ -742,7 +742,7 @@ void dtoa(DtoaBuffer result, double dd, int ndigits, bool& signOut, int& exponen
// roundingNone only allowed (only sensible?) with leftright set.
ASSERT(!roundingNone || leftright);
ASSERT(isfinite(dd));
ASSERT(std::isfinite(dd));
int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
j, j1, k, k0, k_check, m2, m5, s2, s5,
......
2013-02-18 Zan Dobersek <zdobersek@igalia.com>
Stop placing std::isfinite and std::signbit inside the global scope
https://bugs.webkit.org/show_bug.cgi?id=109817
Reviewed by Darin Adler.
Prefix calls to the isfinite and signbit methods with std:: as the two
methods are no longer being imported into the global scope.
No new tests as there's no change in functionality.
* bindings/js/JSCanvasRenderingContext2DCustom.cpp:
(WebCore::JSCanvasRenderingContext2D::setWebkitLineDash):
* bindings/js/JSDOMBinding.cpp:
(WebCore::jsDateOrNull):
* bindings/js/JSDOMBinding.h:
(WebCore::finiteInt32Value):
* bindings/v8/V8Binding.h:
(WebCore::v8DateOrNull):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::parseToNumber):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setValueAsNumber):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::setMin):
(WebCore::HTMLMeterElement::setMax):
(WebCore::HTMLMeterElement::setValue):
(WebCore::HTMLMeterElement::setLow):
(WebCore::HTMLMeterElement::setHigh):
(WebCore::HTMLMeterElement::setOptimum):
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::value):
(WebCore::HTMLProgressElement::setValue):
(WebCore::HTMLProgressElement::max):
(WebCore::HTMLProgressElement::setMax):
* html/MonthInputType.cpp:
(WebCore::MonthInputType::valueAsDate):
(WebCore::MonthInputType::defaultValueForStepUp):
(WebCore::MonthInputType::parseToNumber):
* html/NumberInputType.cpp:
(WebCore::NumberInputType::typeMismatchFor):
(WebCore::NumberInputType::sanitizeValue):
(WebCore::NumberInputType::hasBadInput):
* html/RangeInputType.cpp:
(WebCore::RangeInputType::typeMismatchFor):
* html/TimeInputType.cpp:
(WebCore::TimeInputType::defaultValueForStepUp):
* html/canvas/CanvasPathMethods.cpp:
(WebCore::CanvasPathMethods::moveTo):
(WebCore::CanvasPathMethods::lineTo):
(WebCore::CanvasPathMethods::quadraticCurveTo):
(WebCore::CanvasPathMethods::bezierCurveTo):
(WebCore::CanvasPathMethods::arcTo):
(WebCore::CanvasPathMethods::arc):
(WebCore::CanvasPathMethods::rect):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setLineWidth):
(WebCore::CanvasRenderingContext2D::setMiterLimit):
(WebCore::CanvasRenderingContext2D::setShadowOffsetX):
(WebCore::CanvasRenderingContext2D::setShadowOffsetY):
(WebCore::CanvasRenderingContext2D::setShadowBlur):
(WebCore::lineDashSequenceIsValid):
(WebCore::CanvasRenderingContext2D::setLineDashOffset):
(WebCore::CanvasRenderingContext2D::scale):
(WebCore::CanvasRenderingContext2D::rotate):
(WebCore::CanvasRenderingContext2D::translate):
(WebCore::CanvasRenderingContext2D::transform):
(WebCore::CanvasRenderingContext2D::setTransform):
(WebCore::validateRectForCanvas):
(WebCore::CanvasRenderingContext2D::isPointInPath):
(WebCore::CanvasRenderingContext2D::isPointInStroke):
(WebCore::CanvasRenderingContext2D::drawImage):
(WebCore::CanvasRenderingContext2D::createLinearGradient):
(WebCore::CanvasRenderingContext2D::createRadialGradient):
(WebCore::CanvasRenderingContext2D::createImageData):
(WebCore::CanvasRenderingContext2D::getImageData):
(WebCore::CanvasRenderingContext2D::putImageData):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseToDoubleForNumberType):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTimelineElement::setDuration):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::reset):
* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::reset):
* html/shadow/MediaControlsBlackBerry.cpp:
(WebCore::MediaControlFullscreenTimelineElement::setDuration):
(WebCore::MediaControlsBlackBerry::reset):
* inspector/InspectorValues.cpp:
(WebCore::InspectorBasicValue::writeJSON):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::currentAge):
(WebCore::CachedResource::freshnessLifetime):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect):
* platform/DateComponents.cpp:
(WebCore::DateComponents::setMillisecondsSinceEpochForDate):
(WebCore::DateComponents::setMillisecondsSinceEpochForDateTime):
(WebCore::DateComponents::setMillisecondsSinceEpochForMonth):
(WebCore::DateComponents::setMillisecondsSinceMidnight):
(WebCore::DateComponents::setMonthsSinceEpoch):
(WebCore::DateComponents::setMillisecondsSinceEpochForWeek):
* platform/Decimal.cpp:
(WebCore::Decimal::fromDouble):
* platform/FileSystem.h:
(WebCore::isValidFileTime):
* platform/LocalizedStrings.cpp:
(WebCore::localizedMediaTimeDescription):
* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::drawPatternToCairoContext):
* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::addArc):
(WebCore::Path::contains):
* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::addArc):
* platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp:
(WebCore::FullscreenVideoControllerGStreamer::timeToString):
* platform/graphics/openvg/PathOpenVG.cpp:
(WebCore::Path::addArc):
* platform/graphics/skia/SkiaUtils.h:
(WebCore::WebCoreFloatToSkScalar):
(WebCore::WebCoreDoubleToSkScalar):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::maxTimeSeekable):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::localizedMediaTimeDescription):
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(timeToString):
* platform/network/ResourceResponseBase.cpp:
(WebCore::parseDateValueInHeader):
* platform/qt/LocalizedStringsQt.cpp:
(WebCore::localizedMediaTimeDescription):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::resolveFlexibleLengths):
* rendering/RenderMediaControlsChromium.cpp:
(WebCore::formatChromiumMediaControlsTime):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::formatMediaControlsTime):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setFontSize):
* svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::decomposeArcToCubic):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunRound::round):
* xml/XPathValue.cpp:
(WebCore::XPath::Value::toString):
2013-02-18 Chris Fleizach <cfleizach@apple.com>