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

Side by Side Diff: sdk/lib/utf/utf32.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, 9 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.utf; 5 part of dart.utf;
6 6
7 /** 7 /**
8 * Decodes the UTF-32 bytes as an iterable. Thus, the consumer can only convert 8 * Decodes the UTF-32 bytes as an iterable. Thus, the consumer can only convert
9 * as much of the input as needed. Determines the byte order from the BOM, 9 * as much of the input as needed. Determines the byte order from the BOM,
10 * or uses big-endian as a default. This method always strips a leading BOM. 10 * or uses big-endian as a default. This method always strips a leading BOM.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } else if (hasUtf32leBom(utf32EncodedBytes, offset, length)) { 215 } else if (hasUtf32leBom(utf32EncodedBytes, offset, length)) {
216 return new Utf32leBytesDecoder(utf32EncodedBytes, offset + 4, length - 4, 216 return new Utf32leBytesDecoder(utf32EncodedBytes, offset + 4, length - 4,
217 false, replacementCodepoint); 217 false, replacementCodepoint);
218 } else { 218 } else {
219 return new Utf32beBytesDecoder(utf32EncodedBytes, offset, length, false, 219 return new Utf32beBytesDecoder(utf32EncodedBytes, offset, length, false,
220 replacementCodepoint); 220 replacementCodepoint);
221 } 221 }
222 } 222 }
223 223
224 List<int> decodeRest() { 224 List<int> decodeRest() {
225 List<int> codeunits = new List<int>.fixedLength(remaining); 225 List<int> codeunits = new List<int>(remaining);
226 int i = 0; 226 int i = 0;
227 while (moveNext()) { 227 while (moveNext()) {
228 codeunits[i++] = current; 228 codeunits[i++] = current;
229 } 229 }
230 return codeunits; 230 return codeunits;
231 } 231 }
232 232
233 int get current => _current; 233 int get current => _current;
234 234
235 bool moveNext() { 235 bool moveNext() {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 value += (utf32EncodedBytesIterator.current << 24); 329 value += (utf32EncodedBytesIterator.current << 24);
330 return value; 330 return value;
331 } 331 }
332 } 332 }
333 333
334 bool _validCodepoint(int codepoint) { 334 bool _validCodepoint(int codepoint) {
335 return (codepoint >= 0 && codepoint < UNICODE_UTF16_RESERVED_LO) || 335 return (codepoint >= 0 && codepoint < UNICODE_UTF16_RESERVED_LO) ||
336 (codepoint > UNICODE_UTF16_RESERVED_HI && 336 (codepoint > UNICODE_UTF16_RESERVED_HI &&
337 codepoint < UNICODE_VALID_RANGE_MAX); 337 codepoint < UNICODE_VALID_RANGE_MAX);
338 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698