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

Unified Diff: sdk/lib/utf/utf16.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 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
Index: sdk/lib/utf/utf16.dart
diff --git a/sdk/lib/utf/utf16.dart b/sdk/lib/utf/utf16.dart
index 65ff6dab5d32b92c59bbbcf7906acf0cc8b895fd..9794a813c70f1592ad0a232efae87efe864eb9be 100644
--- a/sdk/lib/utf/utf16.dart
+++ b/sdk/lib/utf/utf16.dart
@@ -113,7 +113,7 @@ List<int> encodeUtf16(String str) =>
List<int> encodeUtf16be(String str, [bool writeBOM = false]) {
List<int> utf16CodeUnits = _stringToUtf16CodeUnits(str);
List<int> encoding =
- new List<int>.fixedLength(2 * utf16CodeUnits.length + (writeBOM ? 2 : 0));
+ new List<int>(2 * utf16CodeUnits.length + (writeBOM ? 2 : 0));
int i = 0;
if (writeBOM) {
encoding[i++] = UNICODE_UTF_BOM_HI;
@@ -133,7 +133,7 @@ List<int> encodeUtf16be(String str, [bool writeBOM = false]) {
List<int> encodeUtf16le(String str, [bool writeBOM = false]) {
List<int> utf16CodeUnits = _stringToUtf16CodeUnits(str);
List<int> encoding =
- new List<int>.fixedLength(2 * utf16CodeUnits.length + (writeBOM ? 2 : 0));
+ new List<int>(2 * utf16CodeUnits.length + (writeBOM ? 2 : 0));
int i = 0;
if (writeBOM) {
encoding[i++] = UNICODE_UTF_BOM_LO;
@@ -238,7 +238,7 @@ abstract class Utf16BytesToCodeUnitsDecoder implements _ListRangeIterator {
* over-allocates the List containing results.
*/
List<int> decodeRest() {
- List<int> codeunits = new List<int>.fixedLength(remaining);
+ List<int> codeunits = new List<int>(remaining);
int i = 0;
while (moveNext()) {
codeunits[i++] = current;
@@ -246,7 +246,7 @@ abstract class Utf16BytesToCodeUnitsDecoder implements _ListRangeIterator {
if (i == codeunits.length) {
return codeunits;
} else {
- List<int> truncCodeunits = new List<int>.fixedLength(i);
+ List<int> truncCodeunits = new List<int>(i);
truncCodeunits.setRange(0, i, codeunits);
return truncCodeunits;
}

Powered by Google App Engine
This is Rietveld 408576698