Ignore:
Timestamp:
Feb 13, 2012, 3:38:44 PM (14 years ago)
Author:
[email protected]
Message:

Replace old strtod with new strtod
https://bugs.webkit.org/show_bug.cgi?id=68044

Reviewed by Geoffrey Garen.

  • parser/Lexer.cpp: Added template argument. This version allows junk after numbers.

(JSC::::lex):

  • runtime/JSGlobalObjectFunctions.cpp: Ditto.

(JSC::parseInt):
(JSC::jsStrDecimalLiteral):

  • runtime/LiteralParser.cpp: Ditto.

(JSC::::Lexer::lexNumber):

  • wtf/dtoa.cpp: Replaced old strtod with a new version that uses the new StringToDoubleConverter.

It takes a template argument to allow clients to determine statically whether it should allow
junk after the numbers or not.
(WTF):
(WTF::strtod):

  • wtf/dtoa.h:

(WTF):

  • wtf/text/WTFString.cpp: Added template argument. This version does not allow junk after numbers.

(WTF::toDoubleType):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r107544 r107625  
    298298    if (number >= mantissaOverflowLowerBound) {
    299299        if (radix == 10)
    300             number = WTF::strtod(s.substringSharingImpl(firstDigitPosition, p - firstDigitPosition).utf8().data(), 0);
     300            number = WTF::strtod<WTF::AllowTrailingJunk>(s.substringSharingImpl(firstDigitPosition, p - firstDigitPosition).utf8().data(), 0);
    301301        else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32)
    302302            number = parseIntOverflow(s.substringSharingImpl(firstDigitPosition, p - firstDigitPosition).utf8().data(), p - firstDigitPosition, radix);
     
    370370    byteBuffer.append(0);
    371371    char* endOfNumber;
    372     double number = WTF::strtod(byteBuffer.data(), &endOfNumber);
     372    double number = WTF::strtod<WTF::AllowTrailingJunk>(byteBuffer.data(), &endOfNumber);
    373373
    374374    // Check if strtod found a number; if so return it.
Note: See TracChangeset for help on using the changeset viewer.