You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/03/31 19:58:12 UTC
[03/11] cordova-plugin-file git commit: CB-8695 ios: Fix
`blob.slice()` for `asset-library` URLs (close #105)
CB-8695 ios: Fix `blob.slice()` for `asset-library` URLs (close #105)
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/2d12a2e2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/2d12a2e2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/2d12a2e2
Branch: refs/heads/old-ID
Commit: 2d12a2e2f793c3f23065f4a2bbe042f373462114
Parents: 6e91934
Author: Brad Chen <br...@hotmail.com>
Authored: Tue Mar 17 11:53:25 2015 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Mar 17 12:58:21 2015 -0400
----------------------------------------------------------------------
src/ios/CDVAssetLibraryFilesystem.m | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/2d12a2e2/src/ios/CDVAssetLibraryFilesystem.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVAssetLibraryFilesystem.m b/src/ios/CDVAssetLibraryFilesystem.m
index 5e3a20d..0b95fac 100644
--- a/src/ios/CDVAssetLibraryFilesystem.m
+++ b/src/ios/CDVAssetLibraryFilesystem.m
@@ -194,8 +194,9 @@ NSString* const kCDVAssetsLibraryScheme = @"assets-library";
if (asset) {
// We have the asset! Get the data and send it off.
ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation];
- Byte* buffer = (Byte*)malloc([assetRepresentation size]);
- NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:[assetRepresentation size] error:nil];
+ NSUInteger size = (end > start) ? (end - start) : [assetRepresentation size];
+ Byte* buffer = (Byte*)malloc(size);
+ NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:start length:size error:nil];
NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES];
NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org