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

Unified Diff: sdk/lib/io/data_transformer.dart

Issue 1393013002: Ensure ZILB encoder handles all typed data lists correctly (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments Created 5 years, 2 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 | « runtime/bin/filter.cc ('k') | tests/standalone/io/zlib_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/data_transformer.dart
diff --git a/sdk/lib/io/data_transformer.dart b/sdk/lib/io/data_transformer.dart
index f9f974a8650eb7d3c665744f39854b595f49ca9a..42289244cba978ee7dda9d778f3de0191d6150cf 100644
--- a/sdk/lib/io/data_transformer.dart
+++ b/sdk/lib/io/data_transformer.dart
@@ -483,22 +483,22 @@ class _FilterSink extends ByteConversionSink {
void addSlice(List<int> data, int start, int end, bool isLast) {
if (_closed) return;
- if (start < 0 || start > data.length) {
- throw new ArgumentError("Invalid start position");
- }
- if (end < 0 || end > data.length || end < start) {
- throw new ArgumentError("Invalid end position");
- }
+ if (end == null) throw ArgumentError.notNull("end");
+ RangeError.checkValidRange(start, end, data.length);
try {
_empty = false;
- _filter.process(data, start, end);
+ _BufferAndStart bufferAndStart =
+ _ensureFastAndSerializableByteData(data, start, end);
+ _filter.process(bufferAndStart.buffer,
+ bufferAndStart.start,
+ end - (start - bufferAndStart.start));
var out;
while ((out = _filter.processed(flush: false)) != null) {
_sink.add(out);
}
} catch (e) {
_closed = true;
- throw e;
+ rethrow;
}
if (isLast) close();
« no previous file with comments | « runtime/bin/filter.cc ('k') | tests/standalone/io/zlib_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698