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

Unified Diff: sdk/lib/io/buffer_list.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/html/html_common/filtered_element_list.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/buffer_list.dart
diff --git a/sdk/lib/io/buffer_list.dart b/sdk/lib/io/buffer_list.dart
index 25a4fdd6102ffadf8d692f70e6fc6daf9f788f31..72dc92ff03d07d284b786402aab448d8bfe9c406 100644
--- a/sdk/lib/io/buffer_list.dart
+++ b/sdk/lib/io/buffer_list.dart
@@ -94,19 +94,15 @@ class _BufferList {
while (remaining > 0) {
int bytesInFirst = _buffers.first.length - _index;
if (bytesInFirst <= remaining) {
- result.setRange(count - remaining,
- bytesInFirst,
- _buffers.first,
- _index);
+ int startIndex = count - remaining;
+ int endIndex = startIndex + bytesInFirst;
+ result.setRange(startIndex, endIndex, _buffers.first, _index);
_buffers.removeFirst();
_index = 0;
_length -= bytesInFirst;
remaining -= bytesInFirst;
} else {
- result.setRange(count - remaining,
- remaining,
- _buffers.first,
- _index);
+ result.setRange(count - remaining, count, _buffers.first, _index);
_index = remaining;
_length -= remaining;
remaining = 0;
« no previous file with comments | « sdk/lib/html/html_common/filtered_element_list.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698