cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject android commit: CB-8699 Fix CordovaResourceApi copyResource creating zero-length files when src=uncompressed asset
Date Wed, 18 Mar 2015 01:36:50 GMT
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 <agrieve@chromium.org>
Authored: Tue Mar 17 21:36:11 2015 -0400
Committer: Andrew Grieve <agrieve@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


Mime
View raw message