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

Unified Diff: sdk/lib/core/duration.dart

Issue 913503003: corelib: Don't blow up in memory if a duration receives a string as argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test for microseconds. Increase size of string. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/corelib/duration2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/duration.dart
diff --git a/sdk/lib/core/duration.dart b/sdk/lib/core/duration.dart
index 402d289e12d0c7414b434d6b970e2a32b863c824..c5b73a2c86c0eaf05bfc5816dd9358802ab3a0a6 100644
--- a/sdk/lib/core/duration.dart
+++ b/sdk/lib/core/duration.dart
@@ -93,11 +93,11 @@ class Duration implements Comparable<Duration> {
int milliseconds: 0,
int microseconds: 0})
: this._microseconds(
- days * MICROSECONDS_PER_DAY +
- hours * MICROSECONDS_PER_HOUR +
- minutes * MICROSECONDS_PER_MINUTE +
- seconds * MICROSECONDS_PER_SECOND +
- milliseconds * MICROSECONDS_PER_MILLISECOND +
+ MICROSECONDS_PER_DAY * days +
+ MICROSECONDS_PER_HOUR * hours +
+ MICROSECONDS_PER_MINUTE * minutes +
+ MICROSECONDS_PER_SECOND * seconds +
+ MICROSECONDS_PER_MILLISECOND * milliseconds +
microseconds);
// Fast path internal direct constructor to avoids the optional arguments and
« no previous file with comments | « no previous file | tests/corelib/duration2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698