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

Unified Diff: runtime/lib/typeddata.dart

Issue 13529005: Fix view creation for byte-size types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix checked mode problems Created 7 years, 9 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 | « no previous file | tests/standalone/typed_data_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typeddata.dart
diff --git a/runtime/lib/typeddata.dart b/runtime/lib/typeddata.dart
index 4375a1c5ce3ea9a8e4e83fadfad5e9aad02b2712..d3ab9f2fa488985d025ac203764ec87438e0f572 100644
--- a/runtime/lib/typeddata.dart
+++ b/runtime/lib/typeddata.dart
@@ -278,7 +278,7 @@ patch class ByteData {
/* patch */ factory ByteData.view(ByteBuffer buffer,
[int offsetInBytes = 0, int length]) {
if (length == null) {
- length = buffer.lengthInBytes;
+ length = buffer.lengthInBytes - offsetInBytes;
}
return new _ByteDataView(buffer, offsetInBytes, length);
}
@@ -312,7 +312,7 @@ abstract class _TypedListBase {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
- Collection where(bool f(int element)) {
+ Iterable where(bool f(int element)) {
return IterableMixinWorkaround.where(this, f);
}
@@ -578,7 +578,7 @@ class _Int8Array extends _TypedList implements Int8List {
factory _Int8Array.view(ByteBuffer buffer,
[int offsetInBytes = 0, int length]) {
if (length == null) {
- length = buffer.lengthInBytes;
+ length = buffer.lengthInBytes - offsetInBytes;
}
return new _Int8ArrayView(buffer, offsetInBytes, length);
}
@@ -636,7 +636,7 @@ class _Uint8Array extends _TypedList implements Uint8List {
factory _Uint8Array.view(ByteBuffer buffer,
[int offsetInBytes = 0, int length]) {
if (length == null) {
- length = buffer.lengthInBytes;
+ length = buffer.lengthInBytes - offsetInBytes;
}
return new _Uint8ArrayView(buffer, offsetInBytes, length);
}
@@ -692,7 +692,7 @@ class _Uint8ClampedArray extends _TypedList implements Uint8ClampedList {
factory _Uint8ClampedArray.view(ByteBuffer buffer,
[int offsetInBytes = 0, int length]) {
if (length == null) {
- length = buffer.lengthInBytes;
+ length = buffer.lengthInBytes - offsetInBytes;
}
return new _Uint8ClampedArrayView(buffer, offsetInBytes, length);
}
@@ -2322,7 +2322,7 @@ class _Uint8ArrayView extends _TypedListView implements Uint8List {
}
-class _Uint8ClampedArrayView extends _TypedListView implements Uint8List {
+class _Uint8ClampedArrayView extends _TypedListView implements Uint8ClampedList {
// Constructor.
_Uint8ClampedArrayView(ByteBuffer buffer,
[int _offsetInBytes = 0, int _length])
« no previous file with comments | « no previous file | tests/standalone/typed_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698