From 1442274d7d3d136bf1c661491f244d3cea282df1 Mon Sep 17 00:00:00 2001 From: openthread Date: Mon, 24 Feb 2014 11:35:07 +0800 Subject: [PATCH] updated several types for osx Compatibility --- ZipArchive.h | 14 +++++++------- ZipArchive.m | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ZipArchive.h b/ZipArchive.h index 5a1fac6..14d989f 100644 --- a/ZipArchive.h +++ b/ZipArchive.h @@ -17,7 +17,7 @@ files processed (as an integer from 0 to 100), the number of files processed so far and the total number of files in the archive is called after each file is processed. */ -typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, int numFiles); +typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, unsigned long numFiles); /** @protocol @@ -65,12 +65,12 @@ typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, @interface ZipArchive : NSObject { @private - void* _zipFile; - void* _unzFile; + void* _zipFile; + void* _unzFile; - int _numFiles; - NSString* _password; - id _delegate; + unsigned long _numFiles; + NSString* _password; + id _delegate; ZipArchiveProgressUpdateBlock _progressBlock; NSArray* _unzippedFiles; @@ -81,7 +81,7 @@ typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, /** a delegate object conforming to ZipArchiveDelegate protocol */ @property (nonatomic, retain) id delegate; -@property (nonatomic, readonly) int numFiles; +@property (nonatomic, readonly) unsigned long numFiles; @property (nonatomic, copy) ZipArchiveProgressUpdateBlock progressBlock; /** diff --git a/ZipArchive.m b/ZipArchive.m index 1e11375..9489156 100644 --- a/ZipArchive.m +++ b/ZipArchive.m @@ -144,7 +144,7 @@ -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; { data = [ NSData dataWithContentsOfFile:file]; uLong crcValue = crc32( 0L,NULL, 0L ); - crcValue = crc32( crcValue, (const Bytef*)[data bytes], [data length] ); + crcValue = crc32( crcValue, (const Bytef*)[data bytes], (unsigned int)[data length] ); ret = zipOpenNewFileInZip3( _zipFile, (const char*) [newname cStringUsingEncoding:self.stringEncoding], &zipInfo, @@ -168,7 +168,7 @@ -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; { data = [ NSData dataWithContentsOfFile:file]; } - unsigned int dataLen = [data length]; + unsigned int dataLen = (unsigned int)[data length]; ret = zipWriteInFileInZip( _zipFile, (const void*)[data bytes], dataLen); if( ret!=Z_OK ) {