summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-05-03 15:27:11 -0700
committerJesse Wilson <jessewilson@google.com>2010-05-05 14:03:05 -0700
commit4751c150542ec282f6c6d58984974edec6c0a045 (patch)
treefd11f85d87afa833581a4de469fe73442db9db1d
parentc03da3e87a0537b211f2300d594597d84898b8f7 (diff)
downloadandroid_dalvik-4751c150542ec282f6c6d58984974edec6c0a045.tar.gz
android_dalvik-4751c150542ec282f6c6d58984974edec6c0a045.tar.bz2
android_dalvik-4751c150542ec282f6c6d58984974edec6c0a045.zip
Fixing bulk reads in ByteArray.MyInputStream
This has never worked properly, but it didn't matter until recently because neither the JDK's nor early Dalvik's DataInputStream was exercising it. But in 2.0, Dalvik's DataInputStream prefers bulk reads, which exercises this code when run on-device. http://code.google.com/p/android/issues/detail?id=8115 The problem was that System.arraycopy call didn't include the start offset in the call.
-rw-r--r--dx/src/com/android/dx/util/ByteArray.java20
1 files changed, 1 insertions, 19 deletions
diff --git a/dx/src/com/android/dx/util/ByteArray.java b/dx/src/com/android/dx/util/ByteArray.java
index 6bd6e5f10..79fa1956e 100644
--- a/dx/src/com/android/dx/util/ByteArray.java
+++ b/dx/src/com/android/dx/util/ByteArray.java
@@ -321,7 +321,7 @@ public final class ByteArray {
length = maxLength;
}
- System.arraycopy(bytes, cursor, arr, offset, length);
+ System.arraycopy(bytes, cursor + start, arr, offset, length);
cursor += length;
return length;
}
@@ -341,15 +341,6 @@ public final class ByteArray {
public boolean markSupported() {
return true;
}
-
- /**
- * Gets the current cursor.
- *
- * @return {@code 0..size();} the cursor
- */
- public int getCursor() {
- return cursor;
- }
}
/**
@@ -366,14 +357,5 @@ public final class ByteArray {
this.wrapped = wrapped;
}
-
- /**
- * Gets the current cursor.
- *
- * @return {@code 0..size();} the cursor
- */
- public int getCursor() {
- return wrapped.getCursor();
- }
}
}