Changeset 28771 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Dec 16, 2007, 9:31:35 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

http://bugs.webkit.org/show_bug.cgi?id=16162
Problems with float parsing on Linux (locale-dependent parsing was used).

  • kjs/dtoa.cpp: Removed USE_LOCALE to reduce future confusion.
  • kjs/lexer.cpp: (KJS::Lexer::lex): Parse with kjs_strtod, not the system one.
Location:
trunk/JavaScriptCore/kjs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/dtoa.cpp

    r27947 r28771  
    151151 *      is not strictly legal and can cause trouble with aggressively
    152152 *      optimizing compilers (e.g., gcc 2.95.1 under -O2).
    153  * #define USE_LOCALE to use the current locale's decimal_point value.
    154153 * #define SET_INEXACT if IEEE arithmetic is being used and extra
    155154 *      computation should be done to set the inexact flag when the
     
    202201#include <stdlib.h>
    203202#include <string.h>
    204 
    205 #ifdef USE_LOCALE
    206 #include <locale.h>
    207 #endif
    208203
    209204#ifdef MALLOC
     
    15601555        int rounding;
    15611556#endif
    1562 #ifdef USE_LOCALE
    1563         CONST_ char *s2;
    1564 #endif
    15651557
    15661558        sign = nz0 = nz = 0;
     
    16011593                        z = 10*z + c - '0';
    16021594        nd0 = nd;
    1603 #ifdef USE_LOCALE
    1604         s1 = localeconv()->decimal_point;
    1605         if (c == *s1) {
    1606                 c = '.';
    1607                 if (*++s1) {
    1608                         s2 = s;
    1609                         for(;;) {
    1610                                 if (*++s2 != *s1) {
    1611                                         c = 0;
    1612                                         break;
    1613                                         }
    1614                                 if (!*++s1) {
    1615                                         s = s2;
    1616                                         break;
    1617                                         }
    1618                                 }
    1619                         }
    1620                 }
    1621 #endif
    16221595        if (c == '.') {
    16231596                c = *++s;
  • trunk/JavaScriptCore/kjs/lexer.cpp

    r28577 r28771  
    2525#include "lexer.h"
    2626
     27#include "dtoa.h"
    2728#include "function.h"
    2829#include "nodes.h"
     
    460461  double dval = 0;
    461462  if (state == Number) {
    462     dval = strtod(m_buffer8.data(), 0L);
     463    dval = kjs_strtod(m_buffer8.data(), 0L);
    463464  } else if (state == Hex) { // scan hex numbers
    464465    const char* p = m_buffer8.data() + 2;
Note: See TracChangeset for help on using the changeset viewer.