Revision: 4247
Author: [email protected]
Date: Wed Mar 24 04:11:33 2010
Log: Fix conform test.

Review URL: http://codereview.chromium.org/1217007
http://code.google.com/p/v8/source/detail?r=4247

Modified:
 /branches/bleeding_edge/src/conversions.cc
 /branches/bleeding_edge/test/mjsunit/str-to-num.js

=======================================
--- /branches/bleeding_edge/src/conversions.cc  Wed Mar 24 02:48:58 2010
+++ /branches/bleeding_edge/src/conversions.cc  Wed Mar 24 04:11:33 2010
@@ -295,7 +295,7 @@
          || (*current >= 'a' && *current <= 'f')
          || (*current >= 'A' && *current <= 'F')) {
     if (significant_digits <= max_significant_digits) {
-      buffer[buffer_pos++] = *current;
+      buffer[buffer_pos++] = static_cast<char>(*current);
       significant_digits++;
     } else {
       insignificant_digits++;
@@ -425,7 +425,7 @@
   while (*current >= '0' && *current <= '9') {
     if (significant_digits < max_significant_digits) {
       ASSERT(buffer_pos < buffer_size);
-      buffer[buffer_pos++] = *current;
+      buffer[buffer_pos++] = static_cast<char>(*current);
       significant_digits++;
       // Will later check if it's an octal in the buffer.
     } else {
@@ -439,7 +439,6 @@

   if (*current == '.') {
     ASSERT(buffer_pos < buffer_size);
-    buffer[buffer_pos++] = '.';
     ++current;
     if (current == end) {
       if (significant_digits == 0 && !leading_zero) {
@@ -448,6 +447,7 @@
         goto parsing_done;
       }
     }
+    buffer[buffer_pos++] = '.';

     if (significant_digits == 0) {
       octal = false;
@@ -464,7 +464,7 @@
     while (*current >= '0' && *current <= '9') {
       if (significant_digits < max_significant_digits) {
         ASSERT(buffer_pos < buffer_size);
-        buffer[buffer_pos++] = *current;
+        buffer[buffer_pos++] = static_cast<char>(*current);
         significant_digits++;
       } else {
         // Ignore insignificant digits in the fractional part.
@@ -496,7 +496,7 @@
     }
     char sign = '+';
     if (*current == '+' || *current == '-') {
-      sign = *current;
+      sign = static_cast<char>(*current);
       ++current;
       if (current == end) {
         if (allow_trailing_junk) {
=======================================
--- /branches/bleeding_edge/test/mjsunit/str-to-num.js Wed Mar 24 01:51:03 2010 +++ /branches/bleeding_edge/test/mjsunit/str-to-num.js Wed Mar 24 04:11:33 2010
@@ -44,6 +44,8 @@

 // assertEquals(, toNumber());

+assertEquals(1, 1.);
+assertEquals(1, toNumber("1."));

 assertEquals(123, toNumber(" 123"));
 assertEquals(123, toNumber("\n123"));

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

To unsubscribe from this group, send email to v8-dev+unsubscribegooglegroups.com or reply 
to this email with the words "REMOVE ME" as the subject.

Reply via email to