kjs patch: fixes regression in UString::toDouble that broke string.replace

Darin Adler darin at apple.com
Tue Dec 2 16:36:29 CET 2003


My fault entirely:

-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/JavaScriptCore/ChangeLog,v
retrieving revision 1.398
diff -p -u -u -p -r1.398 ChangeLog
--- ChangeLog	2003/12/01 23:11:22	1.398
+++ ChangeLog	2003/12/02 15:33:57
@@ -1,3 +1,12 @@
+2003-12-01  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+        - fixed 3493799: JavaScript string.replace expands $ if it's the last character in replacement string
+
+        * kjs/ustring.cpp: (KJS::UString::toDouble): Fix backwards handling of the "tolerant" boolean.
+        This indirectly caused the string.replace bug.
+
 2003-12-01  Richard Williamson   <rjw at apple.com>
 
 	Fixed mistake in method signatures used to get boolean and integer fields.
Index: kjs/ustring.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/JavaScriptCore/kjs/ustring.cpp,v
retrieving revision 1.36
diff -p -u -u -p -r1.36 kjs/ustring.cpp
--- kjs/ustring.cpp	2003/10/27 04:21:15	1.36
+++ kjs/ustring.cpp	2003/12/02 15:33:58
@@ -632,7 +632,7 @@ double UString::toDouble( bool tolerant 
 
   // empty string ?
   if (*c == '\0')
-    return tolerant ? NaN : 0.0;
+    return tolerant ? 0.0 : NaN;
 
   // hex number ?
   if (*c == '0' && (*(c+1) == 'x' || *(c+1) == 'X')) {
-------------- next part --------------


     -- Darin


More information about the Khtml-devel mailing list