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

Side by Side Diff: src/conversions.cc

Issue 146096: Do not use common INFINITY name as it might be overriden by some other includ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | src/platform.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 if (result != 0.0 || end != cstr) { 320 if (result != 0.0 || end != cstr) {
321 // It appears that strtod worked 321 // It appears that strtod worked
322 index += end - cstr; 322 index += end - cstr;
323 } else { 323 } else {
324 // Check for {+,-,}Infinity 324 // Check for {+,-,}Infinity
325 bool is_negative = (GetChar(str, index) == '-'); 325 bool is_negative = (GetChar(str, index) == '-');
326 if (GetChar(str, index) == '+' || GetChar(str, index) == '-') 326 if (GetChar(str, index) == '+' || GetChar(str, index) == '-')
327 index++; 327 index++;
328 if (!SubStringEquals(str, index, "Infinity")) 328 if (!SubStringEquals(str, index, "Infinity"))
329 return JUNK_STRING_VALUE; 329 return JUNK_STRING_VALUE;
330 result = is_negative ? -INFINITY : INFINITY; 330 result = is_negative ? -V8_INFINITY : V8_INFINITY;
331 index += 8; 331 index += 8;
332 } 332 }
333 } 333 }
334 334
335 if ((flags & ALLOW_TRAILING_JUNK) == 0) { 335 if ((flags & ALLOW_TRAILING_JUNK) == 0) {
336 // skip trailing spaces 336 // skip trailing spaces
337 while ((index < len) && IsSpace(str, index)) index++; 337 while ((index < len) && IsSpace(str, index)) index++;
338 // string ending with junk? 338 // string ending with junk?
339 if (index < len) return JUNK_STRING_VALUE; 339 if (index < len) return JUNK_STRING_VALUE;
340 } 340 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 // Allocate result and fill in the parts. 699 // Allocate result and fill in the parts.
700 StringBuilder builder(result_size + 1); 700 StringBuilder builder(result_size + 1);
701 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); 701 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size);
702 if (decimal_pos > 0) builder.AddCharacter('.'); 702 if (decimal_pos > 0) builder.AddCharacter('.');
703 builder.AddSubstring(decimal_buffer, decimal_pos); 703 builder.AddSubstring(decimal_buffer, decimal_pos);
704 return builder.Finalize(); 704 return builder.Finalize();
705 } 705 }
706 706
707 707
708 } } // namespace v8::internal 708 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698