Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: src/conversions-inl.h

Issue 7792031: Fixing issue 1645, removing detection of octal numbers through 0-prefix. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/parse-int-float.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (radix == 0) { 260 if (radix == 0) {
261 // Radix detection. 261 // Radix detection.
262 if (*current == '0') { 262 if (*current == '0') {
263 ++current; 263 ++current;
264 if (current == end) return SignedZero(negative); 264 if (current == end) return SignedZero(negative);
265 if (*current == 'x' || *current == 'X') { 265 if (*current == 'x' || *current == 'X') {
266 radix = 16; 266 radix = 16;
267 ++current; 267 ++current;
268 if (current == end) return JunkStringValue(); 268 if (current == end) return JunkStringValue();
269 } else { 269 } else {
270 radix = 8; 270 radix = 10;
271 leading_zero = true; 271 leading_zero = true;
272 } 272 }
273 } else { 273 } else {
274 radix = 10; 274 radix = 10;
275 } 275 }
276 } else if (radix == 16) { 276 } else if (radix == 16) {
277 if (*current == '0') { 277 if (*current == '0') {
278 // Allow "0x" prefix. 278 // Allow "0x" prefix.
279 ++current; 279 ++current;
280 if (current == end) return SignedZero(negative); 280 if (current == end) return SignedZero(negative);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 ASSERT(buffer_pos < kBufferSize); 655 ASSERT(buffer_pos < kBufferSize);
656 buffer[buffer_pos] = '\0'; 656 buffer[buffer_pos] = '\0';
657 657
658 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); 658 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
659 return negative ? -converted : converted; 659 return negative ? -converted : converted;
660 } 660 }
661 661
662 } } // namespace v8::internal 662 } } // namespace v8::internal
663 663
664 #endif // V8_CONVERSIONS_INL_H_ 664 #endif // V8_CONVERSIONS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/parse-int-float.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698