| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 class _HelperStreamController<T> extends StreamController<T> { | 7 class _HelperStreamController<T> extends StreamController<T> { |
| 8 final Function onPauseChanged; | 8 final Function onPauseChanged; |
| 9 | 9 |
| 10 _HelperStreamController(this.onPauseChanged); | 10 _HelperStreamController(this.onPauseChanged); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 int consumed = _processBytes(getNext); | 45 int consumed = _processBytes(getNext); |
| 46 if (consumed > 0) { | 46 if (consumed > 0) { |
| 47 goodChars = _buffer.length; | 47 goodChars = _buffer.length; |
| 48 } else if (consumed == 0) { | 48 } else if (consumed == 0) { |
| 49 _buffer.length = goodChars; | 49 _buffer.length = goodChars; |
| 50 if (currentPos < 0) { | 50 if (currentPos < 0) { |
| 51 _carry = []; | 51 _carry = []; |
| 52 _carry.addAll(carry); | 52 _carry.addAll(carry); |
| 53 _carry.addAll(bytes); | 53 _carry.addAll(bytes); |
| 54 } else { | 54 } else { |
| 55 _carry = bytes.getRange(currentPos, bytes.length - currentPos); | 55 _carry = bytes.sublist(currentPos); |
| 56 } | 56 } |
| 57 break; | 57 break; |
| 58 } else { | 58 } else { |
| 59 // Invalid byte at position pos - 1 | 59 // Invalid byte at position pos - 1 |
| 60 _buffer.length = goodChars; | 60 _buffer.length = goodChars; |
| 61 _addChar(-1); | 61 _addChar(-1); |
| 62 goodChars = _buffer.length; | 62 goodChars = _buffer.length; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 if (_buffer.length > 0) { | 65 if (_buffer.length > 0) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 for (int i = additionalBytes; i > 0; i--) { | 180 for (int i = additionalBytes; i > 0; i--) { |
| 181 // 10xxxxxx (xxxxxx is next 6 bits from the top). | 181 // 10xxxxxx (xxxxxx is next 6 bits from the top). |
| 182 bytes.add(((charCode >> (6 * (i - 1))) & 0x3F) | 0x80); | 182 bytes.add(((charCode >> (6 * (i - 1))) & 0x3F) | 0x80); |
| 183 } | 183 } |
| 184 pos += additionalBytes + 1; | 184 pos += additionalBytes + 1; |
| 185 } | 185 } |
| 186 return bytes; | 186 return bytes; |
| 187 } | 187 } |
| 188 } | 188 } |
| OLD | NEW |