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

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

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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 | « sdk/lib/io/mime_multipart_parser.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/secure_socket.dart
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index 197e87d4a889cce534049a779cf8952b6fd14381..c5fe3c2290befce7aa4df18329b5179193a77414 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -469,12 +469,17 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
return 0;
}
if (_status != CONNECTED) return 0;
+
+ if (offset == null) offset = 0;
+ if (bytes == null) bytes = data.length - offset;
+
var buffer = _secureFilter.buffers[WRITE_PLAINTEXT];
if (bytes > buffer.free) {
bytes = buffer.free;
}
if (bytes > 0) {
- buffer.data.setRange(buffer.start + buffer.length, bytes, data, offset);
+ int startIndex = buffer.start + buffer.length;
+ buffer.data.setRange(startIndex, startIndex + bytes, data, offset);
buffer.length += bytes;
}
_writeEncryptedData(); // Tries to flush all pipeline stages.
@@ -660,9 +665,8 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
List<int> data = _socket.read(encrypted.free);
if (data != null) {
int bytes = data.length;
- encrypted.data.setRange(encrypted.start + encrypted.length,
- bytes,
- data);
+ int startIndex = encrypted.start + encrypted.length;
+ encrypted.data.setRange(startIndex, startIndex + bytes, data);
encrypted.length += bytes;
progress = true;
}
« no previous file with comments | « sdk/lib/io/mime_multipart_parser.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698