Chromium Code Reviews| Index: sdk/lib/convert/latin1.dart |
| diff --git a/sdk/lib/convert/latin1.dart b/sdk/lib/convert/latin1.dart |
| index 033f8dd6e5093730a8e635c1c753d011dc0bfc55..603c249b3416133bcaf37accf3a48bdd2cf96928 100644 |
| --- a/sdk/lib/convert/latin1.dart |
| +++ b/sdk/lib/convert/latin1.dart |
| @@ -127,11 +127,20 @@ class _Latin1DecoderSink extends ByteConversionSinkBase { |
| // _sink.addSlice(source, start, end, isLast). |
| // The code below is an incredibly stupid workaround until a real |
| // solution can be made. |
|
Lasse Reichstein Nielsen
2014/03/24 09:21:01
Is it still incredibly stupid, or can we downgrade
Anders Johnsen
2014/03/24 12:01:01
Done.
|
| - _sink.add(new String.fromCharCodes(source.getRange(start, end))); |
| + if (start == 0 && end == source.length) { |
| + _sink.add(new String.fromCharCodes(source)); |
| + } else { |
| + _sink.add(new String.fromCharCodes(source.sublist(start, end))); |
| + } |
| if (isLast) close(); |
| } |
| void addSlice(List<int> source, int start, int end, bool isLast) { |
| + // If Uint8List, just add dircetly. |
| + if (source is Uint8List || source is Int8List) { |
|
Lasse Reichstein Nielsen
2014/03/24 09:21:01
Int8List isn't safe. It can contain negative numbe
Anders Johnsen
2014/03/24 12:01:01
Done.
|
| + _addSliceToSink(source, start, end, isLast); |
| + return; |
| + } |
| if (start < 0 || start > source.length) { |
| throw new RangeError.range(start, 0, source.length); |
| } |