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

Side by Side Diff: src/dateparser.h

Issue 5336005: make DateParser::TimeComposer handle milliseconds properly... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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/regress/regress-944.js » ('j') | test/mjsunit/regress/regress-944.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Read a string of digits as an unsigned number (cap just below kMaxInt). 80 // Read a string of digits as an unsigned number (cap just below kMaxInt).
81 int ReadUnsignedNumber() { 81 int ReadUnsignedNumber() {
82 has_read_number_ = true; 82 has_read_number_ = true;
83 int n; 83 int n;
84 for (n = 0; IsAsciiDigit() && n < kMaxInt / 10 - 1; Next()) { 84 for (n = 0; IsAsciiDigit() && n < kMaxInt / 10 - 1; Next()) {
85 n = n * 10 + ch_ - '0'; 85 n = n * 10 + ch_ - '0';
86 } 86 }
87 return n; 87 return n;
88 } 88 }
89 89
90 // Read a string of digits as an unsigned number of milliseconds (cap just
91 // below kMaxInt).
92 int ReadMilliseconds() {
Lasse Reichstein 2010/11/25 10:17:19 Seems like overkill (and potentially fragile) to r
93 has_read_number_ = true;
94 int n;
95 int i = 0;
96 for (n = 0; IsAsciiDigit() && n < kMaxInt / 10 - 1 && i < 3; Next()) {
97 n = n * 10 + ch_ - '0';
98 i++;
99 }
100 return n * pow(10, 3 - i);
101 }
102
90 // Read a word (sequence of chars. >= 'A'), fill the given buffer with a 103 // Read a word (sequence of chars. >= 'A'), fill the given buffer with a
91 // lower-case prefix, and pad any remainder of the buffer with zeroes. 104 // lower-case prefix, and pad any remainder of the buffer with zeroes.
92 // Return word length. 105 // Return word length.
93 int ReadWord(uint32_t* prefix, int prefix_size) { 106 int ReadWord(uint32_t* prefix, int prefix_size) {
94 int len; 107 int len;
95 for (len = 0; IsAsciiAlphaOrAbove(); Next(), len++) { 108 for (len = 0; IsAsciiAlphaOrAbove(); Next(), len++) {
96 if (len < prefix_size) prefix[len] = AsciiAlphaToLower(ch_); 109 if (len < prefix_size) prefix[len] = AsciiAlphaToLower(ch_);
97 } 110 }
98 for (int i = len; i < prefix_size; i++) prefix[i] = 0; 111 for (int i = len; i < prefix_size; i++) prefix[i] = 0;
99 return len; 112 return len;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 int comp_[kSize]; 255 int comp_[kSize];
243 int index_; 256 int index_;
244 int named_month_; 257 int named_month_;
245 }; 258 };
246 }; 259 };
247 260
248 261
249 } } // namespace v8::internal 262 } } // namespace v8::internal
250 263
251 #endif // V8_DATEPARSER_H_ 264 #endif // V8_DATEPARSER_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-944.js » ('j') | test/mjsunit/regress/regress-944.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698