You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2015/03/18 02:36:50 UTC
android commit: CB-8699 Fix CordovaResourceApi copyResource creating
zero-length files when src=uncompressed asset
Repository: cordova-android
Updated Branches:
refs/heads/master 56d61eb44 -> f6e56b345
CB-8699 Fix CordovaResourceApi copyResource creating zero-length files when src=uncompressed asset
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/f6e56b34
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/f6e56b34
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/f6e56b34
Branch: refs/heads/master
Commit: f6e56b345d1e4af409760de19e6f475f06a591d6
Parents: 56d61eb
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Mar 17 21:36:11 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 21:36:11 2015 -0400
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaResourceApi.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f6e56b34/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index 9c2e708..47f936e 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -336,7 +336,10 @@ public class CordovaResourceApi {
if (input.assetFd != null) {
offset = input.assetFd.getStartOffset();
}
- outChannel.transferFrom(inChannel, offset, length);
+ // transferFrom()'s 2nd arg is a relative position. Need to set the absolute
+ // position first.
+ inChannel.position(offset);
+ outChannel.transferFrom(inChannel, 0, length);
} else {
final int BUFFER_SIZE = 8192;
byte[] buffer = new byte[BUFFER_SIZE];
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org