Changeset 60328 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- May 27, 2010, 4:09:48 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r58224 r60328 242 242 243 243 if (number >= mantissaOverflowLowerBound) { 244 // FIXME: It is incorrect to use UString::ascii() here because it's not thread-safe.245 244 if (radix == 10) 246 number = WTF::strtod(s.substr(firstDigitPosition, p - firstDigitPosition). ascii(), 0);245 number = WTF::strtod(s.substr(firstDigitPosition, p - firstDigitPosition).UTF8String().data(), 0); 247 246 else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32) 248 number = parseIntOverflow(s.substr(firstDigitPosition, p - firstDigitPosition). ascii(), p - firstDigitPosition, radix);247 number = parseIntOverflow(s.substr(firstDigitPosition, p - firstDigitPosition).UTF8String().data(), p - firstDigitPosition, radix); 249 248 } 250 249 … … 271 270 return 0; 272 271 273 // FIXME: UString::toDouble will ignore leading ASCII spaces, but we need to ignore274 // other StrWhiteSpaceChar values as well.275 272 return s.toDouble(true /*tolerant*/, false /* NaN for empty string */); 276 273 } -
trunk/JavaScriptCore/runtime/UString.cpp
r59969 r60328 263 263 // non-ASCII characters to UTF-8, so the UTF8String does quite a bit of 264 264 // unnecessary work. 265 266 // FIXME: The space skipping code below skips only ASCII spaces, but callers 267 // need to skip all StrWhiteSpace. The isStrWhiteSpace function does the 268 // right thing but requires UChar, not char, for its argument. 269 265 270 CString s = UTF8String(); 266 271 if (s.isNull()) … … 325 330 } 326 331 327 // allow trailing white space328 while (isASCIISpace(*c))329 c++;330 // don't allow anything after - unless tolerant=true331 // FIXME: If string contains a U+0000 character, then this check is incorrect.332 if (!tolerateTrailingJunk && *c != '\0')333 d = NaN;332 if (!tolerateTrailingJunk) { 333 // allow trailing white space 334 while (isASCIISpace(*c)) 335 c++; 336 if (c != s.data() + s.length()) 337 d = NaN; 338 } 334 339 335 340 return d;
Note:
See TracChangeset
for help on using the changeset viewer.