├── .gitignore ├── CHANGELOG.md ├── Doxyfile ├── LICENSE ├── README.md ├── ZipArchive.h ├── ZipArchive.m ├── ZipArchive.podspec ├── ZipArchive ├── ZipArchive ios Tests │ ├── ZipArchive ios Tests-Info.plist │ ├── ZipArchive ios Tests-Prefix.pch │ └── en.lproj │ │ └── InfoPlist.strings ├── ZipArchive mac Tests │ ├── ZipArchive mac Tests-Info.plist │ ├── ZipArchive mac Tests-Prefix.pch │ └── en.lproj │ │ └── InfoPlist.strings ├── ZipArchive.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── ZipArchive ios.xcscheme │ │ ├── ZipArchive mac.xcscheme │ │ └── ZipArchive.xcscheme ├── ZipArchive_Prefix.pch └── tests │ ├── en.lproj │ └── InfoPlist.strings │ ├── test-files │ ├── V3.png │ └── V3.xml │ ├── tests-Info.plist │ ├── tests-Prefix.pch │ ├── tests.h │ └── tests.m └── minizip ├── ChangeLogUnzip ├── Makefile ├── MiniZip64_Changes.txt ├── MiniZip64_info.txt ├── crypt.h ├── ioapi.c ├── ioapi.h ├── make_vms.com ├── miniunz.c ├── minizip.c ├── mztools.c ├── mztools.h ├── unzip.c ├── unzip.h ├── zip.c └── zip.h /.gitignore: -------------------------------------------------------------------------------- 1 | ZipArchive/build 2 | *.pbxuser 3 | *.mode1v3 4 | 5 | .DS_Store 6 | xcuserdata/ 7 | *.xcworkspace/ 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # ZipArchive change log 2 | 3 | ## Version 1.3.0 4 | 5 | 10 July 2014 6 | 7 | * fixes modification date is stored in wrong format. (@danielmatzke) 8 | * updated several types for osx Compatibility. (@OpenFibers) 9 | * Xcode 5 upgrade recommendations (Ryan Punt) 10 | 11 | ## Version 1.2.0 12 | 13 | 7 August 2013 14 | 15 | * Fixes bug with folders in zipfiles. Pull request #20 (@lanbozhang) 16 | * Adds "stringEncoding" property for specifying what character encoding to use for interpreting file names inside a zip file. This is used for reading and writing zip files. This now defaults to UTF8, it was previously ASCII. 17 | 18 | ## Version 1.1.1 19 | 20 | 3 June 2013 21 | 22 | * Added autoreleasepool to unzip for better memory performance (@Wert1go) 23 | * Added support for user specific NSFileManager (@namenu) 24 | 25 | ## Version 1.1.0 26 | 27 | 7 April 2013 28 | 29 | * Created cocoapod podspec file. 30 | * Updated project settings for Xcode 4.6.1 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (C) 2010-2012 Matt Connolly, Edward Patel, et al 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ZipArchive 2 | ========== 3 | 4 | ZipArchive lets Mac OS X / iOS apps read and write to ZIP archive files. 5 | 6 | 7 | Contributors 8 | ------------ 9 | 10 | Thanks to the following contributors to the Objective-C ZipArchive library: 11 | 12 | * acsolu 13 | * Matt Connolly (@mattconnolly) 14 | * Edward Patel (@epatel) 15 | * kajinka13 16 | * David Keegan (@kgn) 17 | * Yuri (@Wert1go) 18 | * Hyunwoo Nam (@namenu) 19 | * OpenFibers 20 | * Wiley Kestner (@wileykestner) 21 | * turenus 22 | * David Feshbach 23 | 24 | Special Thanks to the minizip authors: 25 | 26 | * Gilles Vollant - Original MiniZip author 27 | * Even Rouault - ZIP64 unzip Support 28 | * Daniel Borca - BZip Compression method support in unzip 29 | * Mathias Svensson - ZIP64 zip support 30 | * Mathias Svensson - BZip Compression method support in zip 31 | 32 | License 33 | ------- 34 | 35 | Portions of ZipArchive are licensed under the original minizip license. See the minizip headers for details. All other parts of this project are licensed under the MIT license, see LICENSE. 36 | -------------------------------------------------------------------------------- /ZipArchive.h: -------------------------------------------------------------------------------- 1 | /** 2 | // @header ZipArchive.h 3 | // 4 | // An objective C wrapper for minizip and libz for creating and exanding ZIP files. 5 | // 6 | // @author Created by aish on 08-9-11. 7 | // acsolu@gmail.com 8 | // @copyright Copyright 2008 Inc. All rights reserved. 9 | // 10 | */ 11 | 12 | 13 | typedef NS_ENUM(NSInteger, ZipArchiveCompression) { 14 | ZipArchiveCompressionDefault = -1, 15 | ZipArchiveCompressionNone = 0, 16 | ZipArchiveCompressionSpeed = 1, 17 | ZipArchiveCompressionBest = 9, 18 | }; 19 | 20 | 21 | /** 22 | a block that is called from UnzipFileTo:overwrite:withProgressBlock: where the percentage of 23 | files processed (as an integer from 0 to 100), the number of files processed so far and the 24 | total number of files in the archive is called after each file is processed. 25 | */ 26 | typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, unsigned long numFiles); 27 | 28 | /** 29 | @protocol 30 | @discussion methods for a delegate to receive error notifications and control overwriting of files 31 | */ 32 | 33 | @protocol ZipArchiveDelegate 34 | @optional 35 | 36 | /** 37 | @brief Delegate method to be notified of errors 38 | 39 | ZipArchive calls this selector on the delegate when errors are encountered. 40 | 41 | @param msg a string describing the error. 42 | @result void 43 | */ 44 | 45 | -(void) ErrorMessage:(NSString*) msg; 46 | 47 | /** 48 | @brief Delegate method to determine if a file should be replaced 49 | 50 | When an zip file is being expanded and a file is about to be replaced, this selector 51 | is called on the delegate to notify that file is about to be replaced. The delegate method 52 | should return YES to overwrite the file, or NO to skip it. 53 | 54 | @param file - path to the file to be overwritten. 55 | @result a BOOL - YES to replace, NO to skip 56 | */ 57 | 58 | -(BOOL) OverWriteOperation:(NSString*) file; 59 | 60 | @end 61 | 62 | /** 63 | @class 64 | @brief An object that can create zip files and expand existing ones. 65 | This class provides methods to create a zip file (optionally with a password) and 66 | add files to that zip archive. 67 | 68 | It also provides methods to expand an existing archive file (optionally with a password), 69 | and extract the files. 70 | */ 71 | 72 | @interface ZipArchive : NSObject { 73 | @private 74 | void* _zipFile; 75 | void* _unzFile; 76 | 77 | unsigned long _numFiles; 78 | NSString* _password; 79 | id _delegate; 80 | ZipArchiveProgressUpdateBlock _progressBlock; 81 | 82 | NSArray* _unzippedFiles; 83 | 84 | NSFileManager* _fileManager; 85 | NSStringEncoding _stringEncoding; 86 | } 87 | 88 | /** a delegate object conforming to ZipArchiveDelegate protocol */ 89 | @property (nonatomic, retain) id delegate; 90 | @property (nonatomic, readonly) unsigned long numFiles; 91 | @property (nonatomic, copy) ZipArchiveProgressUpdateBlock progressBlock; 92 | 93 | @property (nonatomic, assign) ZipArchiveCompression compression; 94 | 95 | /** 96 | @brief String encoding to be used when interpreting file names in the zip file. 97 | */ 98 | @property (nonatomic, assign) NSStringEncoding stringEncoding; 99 | 100 | /** an array of files that were successfully expanded. Available after calling UnzipFileTo:overWrite: */ 101 | @property (nonatomic, readonly) NSArray* unzippedFiles; 102 | 103 | -(id) initWithFileManager:(NSFileManager*) fileManager; 104 | 105 | -(BOOL) CreateZipFile2:(NSString*) zipFile; 106 | -(BOOL) CreateZipFile2:(NSString*) zipFile append:(BOOL)isAppend; 107 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password; 108 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password append:(BOOL)isAppend; 109 | -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; 110 | -(BOOL) addDataToZip:(NSData*) data fileAttributes:(NSDictionary *)attr newname:(NSString*) newname; 111 | -(BOOL) CloseZipFile2; 112 | 113 | -(BOOL) UnzipOpenFile:(NSString*) zipFile; 114 | -(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password; 115 | -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite; 116 | -(NSDictionary *)UnzipFileToMemory;//To avoid memory issue, only use this method for small zip files. 117 | -(BOOL) UnzipCloseFile; 118 | 119 | // List the contents of the zip archive. must be called after UnzipOpenFile. 120 | // If zip file was appended with `CreateZipFile2:append:` or ``CreateZipFile2:Password:append:`, 121 | // `getZipFileContents` result won't be updated until re-unzip-open after close write handle (`CloseZipFile2` then `UnzipCloseFile` then (`UnzipOpenFile:` or `UnzipOpenFile:Password`) get called). 122 | -(NSArray*) getZipFileContents; 123 | 124 | @end 125 | -------------------------------------------------------------------------------- /ZipArchive.m: -------------------------------------------------------------------------------- 1 | /** 2 | // ZipArchive.m 3 | // 4 | // 5 | // Created by aish on 08-9-11. 6 | // acsolu@gmail.com 7 | // Copyright 2008 Inc. All rights reserved. 8 | // 9 | */ 10 | 11 | #import "ZipArchive.h" 12 | #import "zlib.h" 13 | #import "zconf.h" 14 | #include "minizip/zip.h" 15 | #include "minizip/unzip.h" 16 | 17 | 18 | @interface NSFileManager(ZipArchive) 19 | - (NSDictionary *)_attributesOfItemAtPath:(NSString *)path followingSymLinks:(BOOL)followingSymLinks error:(NSError **)error; 20 | @end 21 | 22 | @interface ZipArchive () 23 | 24 | -(void) OutputErrorMessage:(NSString*) msg; 25 | -(BOOL) OverWrite:(NSString*) file; 26 | -(NSDate*) Date1980; 27 | 28 | @property (nonatomic,copy) NSString* password; 29 | @end 30 | 31 | 32 | 33 | @implementation ZipArchive 34 | @synthesize delegate = _delegate; 35 | @synthesize numFiles = _numFiles; 36 | @synthesize password = _password; 37 | @synthesize unzippedFiles = _unzippedFiles; 38 | @synthesize progressBlock = _progressBlock; 39 | @synthesize stringEncoding = _stringEncoding; 40 | 41 | -(id) init 42 | { 43 | return [self initWithFileManager:[NSFileManager defaultManager]]; 44 | } 45 | 46 | -(id) initWithFileManager:(NSFileManager*) fileManager 47 | { 48 | if( self=[super init] ) 49 | { 50 | _zipFile = NULL; 51 | _fileManager = fileManager; 52 | self.stringEncoding = NSUTF8StringEncoding; 53 | self.compression = ZipArchiveCompressionDefault; 54 | } 55 | return self; 56 | } 57 | 58 | -(void) dealloc 59 | { 60 | // close any open file operations 61 | [self CloseZipFile2]; 62 | [self UnzipCloseFile]; 63 | 64 | // release retained/copied properties. 65 | [_password release]; 66 | [_delegate release]; 67 | [_unzippedFiles release]; 68 | 69 | [super dealloc]; 70 | } 71 | 72 | /** 73 | * Create a new zip file at the specified path, ready for new files to be added. 74 | * 75 | * @param zipFile the path of the zip file to create 76 | * @returns BOOL YES on success 77 | */ 78 | 79 | -(BOOL) CreateZipFile2:(NSString*) zipFile 80 | { 81 | return [self CreateZipFile2:zipFile append:NO]; 82 | } 83 | 84 | -(BOOL) CreateZipFile2:(NSString*) zipFile append:(BOOL)isAppend 85 | { 86 | _zipFile = zipOpen( (const char*)[zipFile UTF8String], (isAppend ? APPEND_STATUS_ADDINZIP : APPEND_STATUS_CREATE) ); 87 | if( !_zipFile ) 88 | return NO; 89 | return YES; 90 | } 91 | 92 | /** 93 | * Create a new zip file at the specified path, ready for new files to be added. 94 | * 95 | * @param zipFile the path of the zip file to create 96 | * @param password a password used to encrypt the zip file 97 | * @returns BOOL YES on success 98 | */ 99 | 100 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password 101 | { 102 | self.password = password; 103 | return [self CreateZipFile2:zipFile]; 104 | } 105 | 106 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password append:(BOOL)isAppend 107 | { 108 | self.password = password; 109 | return [self CreateZipFile2:zipFile append:isAppend]; 110 | } 111 | 112 | /** 113 | * add an existing file on disk to the zip archive, compressing it. 114 | * 115 | * @param file the path to the file to compress 116 | * @param newname the name of the file in the zip archive, ie: path relative to the zip archive root. 117 | * @returns BOOL YES on success 118 | */ 119 | 120 | -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; 121 | { 122 | NSData *data = [NSData dataWithContentsOfFile:file]; 123 | NSError* error = nil; 124 | NSDictionary* attr = [_fileManager _attributesOfItemAtPath:file followingSymLinks:YES error:&error]; 125 | BOOL result = [self addDataToZip:data fileAttributes:attr newname:newname]; 126 | return result; 127 | } 128 | 129 | /** 130 | * add an existing file on disk to the zip archive, compressing it. 131 | * 132 | * @param data the data to compress 133 | * @param attr the file attribute for data to add as file 134 | * @param newname the name of the file in the zip archive, ie: path relative to the zip archive root. 135 | * @returns BOOL YES on success 136 | */ 137 | 138 | -(BOOL) addDataToZip:(NSData*) data fileAttributes:(NSDictionary *)attr newname:(NSString*) newname 139 | { 140 | if (!data) 141 | { 142 | return NO; 143 | } 144 | if( !_zipFile ) 145 | return NO; 146 | // tm_zip filetime; 147 | 148 | zip_fileinfo zipInfo = {{0}}; 149 | 150 | NSDate* fileDate = nil; 151 | 152 | if( attr ) 153 | fileDate = (NSDate*)[attr objectForKey:NSFileModificationDate]; 154 | 155 | if( fileDate == nil ) 156 | fileDate = [NSDate date]; 157 | 158 | 159 | NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 160 | NSDateComponents* components = [gregorianCalendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | 161 | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond fromDate:fileDate]; 162 | [gregorianCalendar release]; 163 | 164 | zipInfo.tmz_date.tm_sec = (uInt)components.second; 165 | zipInfo.tmz_date.tm_min = (uInt)components.minute; 166 | zipInfo.tmz_date.tm_hour = (uInt)components.hour; 167 | zipInfo.tmz_date.tm_mday = (uInt)components.day; 168 | zipInfo.tmz_date.tm_mon = (uInt)components.month; 169 | zipInfo.tmz_date.tm_year = (uInt)components.year; 170 | 171 | 172 | int ret ; 173 | if( [_password length] == 0 ) 174 | { 175 | ret = zipOpenNewFileInZip( _zipFile, 176 | (const char*) [newname cStringUsingEncoding:self.stringEncoding], 177 | &zipInfo, 178 | NULL,0, 179 | NULL,0, 180 | NULL,//comment 181 | Z_DEFLATED, 182 | self.compression ); 183 | } 184 | else 185 | { 186 | uLong crcValue = crc32( 0L,NULL, 0L ); 187 | crcValue = crc32( crcValue, (const Bytef*)[data bytes], (unsigned int)[data length] ); 188 | ret = zipOpenNewFileInZip3( _zipFile, 189 | (const char*) [newname cStringUsingEncoding:self.stringEncoding], 190 | &zipInfo, 191 | NULL,0, 192 | NULL,0, 193 | NULL,//comment 194 | Z_DEFLATED, 195 | self.compression, 196 | 0, 197 | 15, 198 | 8, 199 | Z_DEFAULT_STRATEGY, 200 | [_password cStringUsingEncoding:NSASCIIStringEncoding], 201 | crcValue ); 202 | } 203 | if( ret!=Z_OK ) 204 | { 205 | return NO; 206 | } 207 | unsigned int dataLen = (unsigned int)[data length]; 208 | ret = zipWriteInFileInZip( _zipFile, (const void*)[data bytes], dataLen); 209 | if( ret!=Z_OK ) 210 | { 211 | return NO; 212 | } 213 | ret = zipCloseFileInZip( _zipFile ); 214 | if( ret!=Z_OK ) 215 | return NO; 216 | return YES; 217 | } 218 | 219 | /** 220 | * Close a zip file after creating and added files to it. 221 | * 222 | * @returns BOOL YES on success 223 | */ 224 | 225 | -(BOOL) CloseZipFile2 226 | { 227 | self.password = nil; 228 | if( _zipFile==NULL ) 229 | return NO; 230 | BOOL ret = zipClose( _zipFile,NULL )==Z_OK?YES:NO; 231 | _zipFile = NULL; 232 | return ret; 233 | } 234 | 235 | /** 236 | * open an existing zip file ready for expanding. 237 | * 238 | * @param zipFile the path to a zip file to be opened. 239 | * @returns BOOL YES on success 240 | */ 241 | 242 | -(BOOL) UnzipOpenFile:(NSString*) zipFile 243 | { 244 | // create an array to receive the list of unzipped files. 245 | if (_unzippedFiles) [_unzippedFiles release]; 246 | _unzippedFiles = [[NSMutableArray alloc] initWithCapacity:1]; 247 | 248 | _unzFile = unzOpen( (const char*)[zipFile UTF8String] ); 249 | if( _unzFile ) 250 | { 251 | unz_global_info globalInfo = {0}; 252 | if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK ) 253 | { 254 | _numFiles = globalInfo.number_entry; 255 | NSLog(@"%lu entries in the zip file", globalInfo.number_entry); 256 | } 257 | } 258 | return _unzFile!=NULL; 259 | } 260 | 261 | /** 262 | * open an existing zip file with a password ready for expanding. 263 | * 264 | * @param zipFile the path to a zip file to be opened. 265 | * @param password the password to use decrpyting the file. 266 | * @returns BOOL YES on success 267 | */ 268 | 269 | -(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password 270 | { 271 | self.password = password; 272 | return [self UnzipOpenFile:zipFile]; 273 | } 274 | 275 | /** 276 | * Expand all files in the zip archive into the specified directory. 277 | * 278 | * If a delegate has been set and responds to OverWriteOperation: it can 279 | * return YES to overwrite a file, or NO to skip that file. 280 | * 281 | * On completion, the property `unzippedFiles` will be an array populated 282 | * with the full paths of each file that was successfully expanded. 283 | * 284 | * @param path the directory where expanded files will be created 285 | * @param overwrite should existing files be overwritten 286 | * @returns BOOL YES on success 287 | */ 288 | 289 | -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite 290 | { 291 | BOOL success = YES; 292 | int index = 0; 293 | int progress = -1; 294 | int ret = unzGoToFirstFile( _unzFile ); 295 | unsigned char buffer[4096] = {0}; 296 | if( ret!=UNZ_OK ) 297 | { 298 | [self OutputErrorMessage:@"Failed"]; 299 | } 300 | 301 | const char* password = [_password cStringUsingEncoding:NSASCIIStringEncoding]; 302 | 303 | do{ 304 | @autoreleasepool { 305 | if( [_password length]==0 ) 306 | ret = unzOpenCurrentFile( _unzFile ); 307 | else 308 | ret = unzOpenCurrentFilePassword( _unzFile, password ); 309 | if( ret!=UNZ_OK ) 310 | { 311 | [self OutputErrorMessage:@"Error occurs"]; 312 | success = NO; 313 | break; 314 | } 315 | // reading data and write to file 316 | int read ; 317 | unz_file_info fileInfo ={0}; 318 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 319 | if( ret!=UNZ_OK ) 320 | { 321 | [self OutputErrorMessage:@"Error occurs while getting file info"]; 322 | success = NO; 323 | unzCloseCurrentFile( _unzFile ); 324 | break; 325 | } 326 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 327 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 328 | filename[fileInfo.size_filename] = '\0'; 329 | 330 | // check if it contains directory 331 | NSString * strPath = [NSString stringWithCString:filename encoding:self.stringEncoding]; 332 | BOOL isDirectory = NO; 333 | if( filename[fileInfo.size_filename-1]=='/' || filename[fileInfo.size_filename-1]=='\\') 334 | isDirectory = YES; 335 | free( filename ); 336 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) 337 | {// contains a path 338 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 339 | } 340 | NSString* fullPath = [path stringByAppendingPathComponent:strPath]; 341 | 342 | if( isDirectory ) 343 | [_fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil]; 344 | else 345 | [_fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil]; 346 | 347 | FILE* fp = NULL; 348 | do 349 | { 350 | read = unzReadCurrentFile(_unzFile, buffer, 4096); 351 | if (read >= 0) 352 | { 353 | if (fp == NULL) { 354 | if( [_fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite ) 355 | { 356 | if( ![self OverWrite:fullPath] ) 357 | { 358 | // don't process any more of the file, but continue 359 | break; 360 | } 361 | } 362 | if (!isDirectory) { 363 | fp = fopen( (const char*)[fullPath UTF8String], "wb"); 364 | if (fp == NULL) { 365 | [self OutputErrorMessage:@"Failed to open output file for writing"]; 366 | break; 367 | } 368 | } 369 | } 370 | fwrite(buffer, read, 1, fp ); 371 | } 372 | else // if (read < 0) 373 | { 374 | ret = read; // result will be an error code 375 | success = NO; 376 | [self OutputErrorMessage:@"Failed to read zip file"]; 377 | } 378 | } while (read > 0); 379 | 380 | if (fp) 381 | { 382 | fclose( fp ); 383 | 384 | // add the full path of this file to the output array 385 | [(NSMutableArray*)_unzippedFiles addObject:fullPath]; 386 | 387 | // set the orignal datetime property 388 | if( fileInfo.tmu_date.tm_year!=0 ) 389 | { 390 | NSDateComponents* components = [[NSDateComponents alloc] init]; 391 | components.second = fileInfo.tmu_date.tm_sec; 392 | components.minute = fileInfo.tmu_date.tm_min; 393 | components.hour = fileInfo.tmu_date.tm_hour; 394 | components.day = fileInfo.tmu_date.tm_mday; 395 | components.month = fileInfo.tmu_date.tm_mon + 1; 396 | components.year = fileInfo.tmu_date.tm_year; 397 | 398 | NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 399 | NSDate* orgDate = [[gregorianCalendar dateFromComponents:components] retain]; 400 | [components release]; 401 | [gregorianCalendar release]; 402 | 403 | NSDictionary* attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; //[_fileManager fileAttributesAtPath:fullPath traverseLink:YES]; 404 | if( attr ) 405 | { 406 | // [attr setValue:orgDate forKey:NSFileCreationDate]; 407 | if( ![_fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] ) 408 | { 409 | // cann't set attributes 410 | NSLog(@"Failed to set attributes"); 411 | } 412 | 413 | } 414 | [orgDate release]; 415 | orgDate = nil; 416 | } 417 | 418 | } 419 | 420 | if (ret == UNZ_OK) { 421 | ret = unzCloseCurrentFile( _unzFile ); 422 | if (ret != UNZ_OK) { 423 | [self OutputErrorMessage:@"file was unzipped but failed crc check"]; 424 | success = NO; 425 | } 426 | } 427 | 428 | if (ret == UNZ_OK) { 429 | ret = unzGoToNextFile( _unzFile ); 430 | } 431 | 432 | if (_progressBlock && _numFiles) { 433 | index++; 434 | int p = index*100/_numFiles; 435 | progress = p; 436 | _progressBlock(progress, index, _numFiles); 437 | } 438 | } 439 | } while (ret==UNZ_OK && ret!=UNZ_END_OF_LIST_OF_FILE); 440 | return success; 441 | } 442 | 443 | -(NSDictionary *)UnzipFileToMemory 444 | { 445 | NSMutableDictionary *fileDictionary = [NSMutableDictionary dictionary]; 446 | 447 | BOOL success = YES; 448 | int index = 0; 449 | int progress = -1; 450 | int ret = unzGoToFirstFile( _unzFile ); 451 | unsigned char buffer[4096] = {0}; 452 | if( ret!=UNZ_OK ) 453 | { 454 | [self OutputErrorMessage:@"Failed"]; 455 | } 456 | 457 | const char* password = [_password cStringUsingEncoding:NSASCIIStringEncoding]; 458 | 459 | do{ 460 | @autoreleasepool { 461 | if( [_password length]==0 ) 462 | ret = unzOpenCurrentFile( _unzFile ); 463 | else 464 | ret = unzOpenCurrentFilePassword( _unzFile, password ); 465 | if( ret!=UNZ_OK ) 466 | { 467 | [self OutputErrorMessage:@"Error occurs"]; 468 | success = NO; 469 | break; 470 | } 471 | // reading data and write to file 472 | int read ; 473 | unz_file_info fileInfo ={0}; 474 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 475 | if( ret!=UNZ_OK ) 476 | { 477 | [self OutputErrorMessage:@"Error occurs while getting file info"]; 478 | success = NO; 479 | unzCloseCurrentFile( _unzFile ); 480 | break; 481 | } 482 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 483 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 484 | filename[fileInfo.size_filename] = '\0'; 485 | 486 | // check if it contains directory 487 | NSString * strPath = [NSString stringWithCString:filename encoding:self.stringEncoding]; 488 | free( filename ); 489 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) 490 | {// contains a path 491 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 492 | } 493 | 494 | NSMutableData *fileMutableData = [NSMutableData data]; 495 | do 496 | { 497 | read = unzReadCurrentFile(_unzFile, buffer, 4096); 498 | if (read >= 0) 499 | { 500 | if (read != 0) 501 | { 502 | [fileMutableData appendBytes:buffer length:read]; 503 | } 504 | } 505 | else // if (read < 0) 506 | { 507 | ret = read; // result will be an error code 508 | success = NO; 509 | [self OutputErrorMessage:@"Failed to read zip file"]; 510 | } 511 | } while (read > 0); 512 | 513 | 514 | if (fileMutableData.length > 0) 515 | { 516 | NSData *fileData = [NSData dataWithData:fileMutableData]; 517 | [fileDictionary setObject:fileData forKey:strPath]; 518 | } 519 | 520 | if (ret == UNZ_OK) { 521 | ret = unzCloseCurrentFile( _unzFile ); 522 | if (ret != UNZ_OK) { 523 | [self OutputErrorMessage:@"file was unzipped but failed crc check"]; 524 | success = NO; 525 | } 526 | } 527 | 528 | if (ret == UNZ_OK) { 529 | ret = unzGoToNextFile( _unzFile ); 530 | } 531 | 532 | if (_progressBlock && _numFiles) { 533 | index++; 534 | int p = index*100/_numFiles; 535 | progress = p; 536 | _progressBlock(progress, index, _numFiles); 537 | } 538 | } 539 | } while (ret==UNZ_OK && ret!=UNZ_END_OF_LIST_OF_FILE); 540 | 541 | NSDictionary *resultDictionary = [NSDictionary dictionaryWithDictionary:fileDictionary]; 542 | return resultDictionary; 543 | } 544 | 545 | /** 546 | * Close the zip file. 547 | * 548 | * @returns BOOL YES on success 549 | */ 550 | 551 | -(BOOL) UnzipCloseFile 552 | { 553 | self.password = nil; 554 | if( _unzFile ) { 555 | int err = unzClose( _unzFile ); 556 | _unzFile = nil; 557 | return err ==UNZ_OK; 558 | } 559 | return YES; 560 | } 561 | 562 | 563 | /** 564 | * Return a list of filenames that are in the zip archive. 565 | * No path information is available as this can be called before the zip is expanded. 566 | * 567 | * @returns NSArray list of filenames in the zip archive. 568 | */ 569 | 570 | -(NSArray*) getZipFileContents // list the contents of the zip archive. must be called after UnzipOpenFile 571 | { 572 | int ret = unzGoToFirstFile( _unzFile ); 573 | NSMutableArray * allFilenames = [NSMutableArray arrayWithCapacity:40]; 574 | 575 | if( ret!=UNZ_OK ) 576 | { 577 | [self OutputErrorMessage:@"Failed"]; 578 | } 579 | 580 | const char* password = [_password cStringUsingEncoding:NSASCIIStringEncoding]; 581 | 582 | do{ 583 | if( [_password length]==0 ) 584 | ret = unzOpenCurrentFile( _unzFile ); 585 | else 586 | ret = unzOpenCurrentFilePassword( _unzFile, password ); 587 | if( ret!=UNZ_OK ) 588 | { 589 | [self OutputErrorMessage:@"Error occured"]; 590 | break; 591 | } 592 | 593 | // reading data and write to file 594 | unz_file_info fileInfo ={0}; 595 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 596 | if( ret!=UNZ_OK ) 597 | { 598 | [self OutputErrorMessage:@"Error occurs while getting file info"]; 599 | unzCloseCurrentFile( _unzFile ); 600 | break; 601 | } 602 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 603 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 604 | filename[fileInfo.size_filename] = '\0'; 605 | 606 | // check if it contains directory 607 | NSString * strPath = [NSString stringWithCString:filename encoding:self.stringEncoding]; 608 | free( filename ); 609 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) 610 | {// contains a path 611 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 612 | } 613 | 614 | // Copy name to array 615 | [allFilenames addObject:strPath]; 616 | 617 | ret = unzCloseCurrentFile( _unzFile ); 618 | if( ret!=UNZ_OK ) 619 | { 620 | [self OutputErrorMessage:[NSString stringWithFormat:@"Error while closing current file %d", ret]]; 621 | break; 622 | } 623 | 624 | ret = unzGoToNextFile( _unzFile ); 625 | if( ret!=UNZ_OK && ret!=UNZ_END_OF_LIST_OF_FILE) 626 | { 627 | [self OutputErrorMessage:[NSString stringWithFormat:@"Error while going to next file %d", ret]]; 628 | break; 629 | } 630 | } while( ret==UNZ_OK ); 631 | 632 | // return an immutable array. 633 | return [NSArray arrayWithArray:allFilenames]; 634 | } 635 | 636 | 637 | #pragma mark wrapper for delegate 638 | 639 | /** 640 | * send the ErrorMessage: to the delegate if it responds to it. 641 | */ 642 | -(void) OutputErrorMessage:(NSString*) msg 643 | { 644 | if( _delegate && [_delegate respondsToSelector:@selector(ErrorMessage:)] ) 645 | [_delegate ErrorMessage:msg]; 646 | } 647 | 648 | /** 649 | * send the OverWriteOperation: selector to the delegate if it responds to it, 650 | * returning the result, or YES by default. 651 | */ 652 | 653 | -(BOOL) OverWrite:(NSString*) file 654 | { 655 | if( _delegate && [_delegate respondsToSelector:@selector(OverWriteOperation:)] ) 656 | return [_delegate OverWriteOperation:file]; 657 | return YES; 658 | } 659 | 660 | #pragma mark get NSDate object for 1980-01-01 661 | -(NSDate*) Date1980 662 | { 663 | NSDateComponents *comps = [[NSDateComponents alloc] init]; 664 | [comps setDay:1]; 665 | [comps setMonth:1]; 666 | [comps setYear:1980]; 667 | NSCalendar *gregorian = [[NSCalendar alloc] 668 | initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 669 | NSDate *date = [gregorian dateFromComponents:comps]; 670 | 671 | [comps release]; 672 | [gregorian release]; 673 | return date; 674 | } 675 | 676 | 677 | @end 678 | 679 | 680 | @implementation NSFileManager(ZipArchive) 681 | 682 | - (NSDictionary *)_attributesOfItemAtPath:(NSString *)path followingSymLinks:(BOOL)followingSymLinks error:(NSError **)error 683 | { 684 | // call file manager default action, which is to not follow symlinks 685 | NSDictionary* results = [self attributesOfItemAtPath:path error:error]; 686 | if (followingSymLinks && results && (error ? *error == nil : YES)) { 687 | if ([[results fileType] isEqualToString:NSFileTypeSymbolicLink]) { 688 | // follow the symlink 689 | NSString* realPath = [self destinationOfSymbolicLinkAtPath:path error:error]; 690 | if (realPath && (error ? *error == nil : YES)) { 691 | return [self _attributesOfItemAtPath:realPath followingSymLinks:followingSymLinks error:error]; 692 | } else { 693 | // failure to resolve symlink should be an error returning nil and error will already be set. 694 | return nil; 695 | } 696 | } 697 | } 698 | return results; 699 | } 700 | 701 | @end 702 | 703 | -------------------------------------------------------------------------------- /ZipArchive.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "ZipArchive" 3 | s.version = "1.4.0" 4 | s.summary = "An Objective C class for zip/unzip on iPhone and Mac OS X." 5 | s.description = <<-DESC 6 | ZipArchive is an Objective-C class to compress or uncompress zip files, which is base on open source code "MiniZip". 7 | 8 | It can be used for iPhone application development, and cocoa on Mac OSX as well. 9 | DESC 10 | s.homepage = "https://github.com/mattconnolly/ZipArchive" 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { "Unknown Name" => "acsolu@gmail.com", "Matt Connolly" => "matt.connolly@me.com" } 13 | s.source = { :git => 'https://github.com/mattconnolly/ZipArchive.git', :tag => '1.4.0' } 14 | s.source_files = '*.{h,m}', 'minizip/crypt.{h,c}', 'minizip/ioapi.{h,c}', 'minizip/mztools.{h,c}', 'minizip/unzip.{h,c}', 'minizip/zip.{h,c}' 15 | s.public_header_files = '*.h' 16 | s.library = 'z' 17 | s.requires_arc = false 18 | s.compiler_flags = '-Dunix' 19 | end 20 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive ios Tests/ZipArchive ios Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | au.org.CocoaHeads.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive ios Tests/ZipArchive ios Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #endif 11 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive ios Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive mac Tests/ZipArchive mac Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | au.org.CocoaHeads.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive mac Tests/ZipArchive mac Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive mac Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | C9C36EF6160AC3C0005BED39 /* ZipArchive */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = C9C36EF7160AC3C0005BED39 /* Build configuration list for PBXAggregateTarget "ZipArchive" */; 13 | buildPhases = ( 14 | ); 15 | dependencies = ( 16 | C9C36EFD160AC3C9005BED39 /* PBXTargetDependency */, 17 | C9C36EFB160AC3C6005BED39 /* PBXTargetDependency */, 18 | ); 19 | name = ZipArchive; 20 | productName = ZipArchive; 21 | }; 22 | /* End PBXAggregateTarget section */ 23 | 24 | /* Begin PBXBuildFile section */ 25 | AA747D9F0F9514B9006C5449 /* ZipArchive_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* ZipArchive_Prefix.pch */; }; 26 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 27 | C908A95C160AC26D000395DB /* ZipArchive_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* ZipArchive_Prefix.pch */; }; 28 | C908A95D160AC26D000395DB /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBE3124F3D030047C862 /* crypt.h */; }; 29 | C908A95E160AC26D000395DB /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBE5124F3D030047C862 /* ioapi.h */; }; 30 | C908A95F160AC26D000395DB /* mztools.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBE8124F3D030047C862 /* mztools.h */; }; 31 | C908A960160AC26D000395DB /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBEA124F3D030047C862 /* unzip.h */; }; 32 | C908A961160AC26D000395DB /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBEC124F3D030047C862 /* zip.h */; }; 33 | C908A962160AC26D000395DB /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBF7124F3D170047C862 /* ZipArchive.h */; settings = {ATTRIBUTES = (); }; }; 34 | C908A964160AC26D000395DB /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBE4124F3D030047C862 /* ioapi.c */; }; 35 | C908A965160AC26D000395DB /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBE7124F3D030047C862 /* mztools.c */; }; 36 | C908A966160AC26D000395DB /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBE9124F3D030047C862 /* unzip.c */; }; 37 | C908A967160AC26D000395DB /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBEB124F3D030047C862 /* zip.c */; }; 38 | C908A968160AC26D000395DB /* ZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBF8124F3D170047C862 /* ZipArchive.m */; }; 39 | C908A96A160AC26D000395DB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 40 | C908A96B160AC26D000395DB /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C9E8EBDB124F3CD70047C862 /* libz.dylib */; }; 41 | C95AB35A17E1C37800120861 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C95AB35917E1C37800120861 /* XCTest.framework */; }; 42 | C95AB35B17E1C37800120861 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; 43 | C95AB35D17E1C37800120861 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C95AB35C17E1C37800120861 /* UIKit.framework */; }; 44 | C95AB36317E1C37800120861 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C95AB36117E1C37800120861 /* InfoPlist.strings */; }; 45 | C95AB36C17E1C3D400120861 /* tests.m in Sources */ = {isa = PBXBuildFile; fileRef = C99D6913164BCC7E00B6A7C3 /* tests.m */; }; 46 | C95AB36D17E1C43400120861 /* libZipArchive-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC07E0554694100DB518D /* libZipArchive-ios.a */; }; 47 | C95AB36F17E1C44200120861 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C95AB36E17E1C44200120861 /* libz.dylib */; }; 48 | C95AB37517E1C47D00120861 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C95AB35917E1C37800120861 /* XCTest.framework */; }; 49 | C95AB37B17E1C47D00120861 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C95AB37917E1C47D00120861 /* InfoPlist.strings */; }; 50 | C95AB38417E1C49400120861 /* tests.m in Sources */ = {isa = PBXBuildFile; fileRef = C99D6913164BCC7E00B6A7C3 /* tests.m */; }; 51 | C95AB38517E1C50900120861 /* libZipArchive-mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C908A96F160AC26D000395DB /* libZipArchive-mac.a */; }; 52 | C95AB38617E1C50900120861 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C9E8EBDB124F3CD70047C862 /* libz.dylib */; }; 53 | C9E8EBED124F3D030047C862 /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBE3124F3D030047C862 /* crypt.h */; }; 54 | C9E8EBEE124F3D030047C862 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBE4124F3D030047C862 /* ioapi.c */; }; 55 | C9E8EBEF124F3D030047C862 /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBE5124F3D030047C862 /* ioapi.h */; }; 56 | C9E8EBF1124F3D030047C862 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBE7124F3D030047C862 /* mztools.c */; }; 57 | C9E8EBF2124F3D030047C862 /* mztools.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBE8124F3D030047C862 /* mztools.h */; }; 58 | C9E8EBF3124F3D030047C862 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBE9124F3D030047C862 /* unzip.c */; }; 59 | C9E8EBF4124F3D030047C862 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBEA124F3D030047C862 /* unzip.h */; }; 60 | C9E8EBF5124F3D030047C862 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBEB124F3D030047C862 /* zip.c */; }; 61 | C9E8EBF6124F3D030047C862 /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBEC124F3D030047C862 /* zip.h */; }; 62 | C9E8EBF9124F3D170047C862 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E8EBF7124F3D170047C862 /* ZipArchive.h */; settings = {ATTRIBUTES = (); }; }; 63 | C9E8EBFA124F3D170047C862 /* ZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E8EBF8124F3D170047C862 /* ZipArchive.m */; }; 64 | /* End PBXBuildFile section */ 65 | 66 | /* Begin PBXContainerItemProxy section */ 67 | C95AB36717E1C37800120861 /* PBXContainerItemProxy */ = { 68 | isa = PBXContainerItemProxy; 69 | containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 70 | proxyType = 1; 71 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 72 | remoteInfo = "ZipArchive ios"; 73 | }; 74 | C95AB37F17E1C47D00120861 /* PBXContainerItemProxy */ = { 75 | isa = PBXContainerItemProxy; 76 | containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 77 | proxyType = 1; 78 | remoteGlobalIDString = C908A95A160AC26D000395DB; 79 | remoteInfo = "ZipArchive mac"; 80 | }; 81 | C9C36EFA160AC3C6005BED39 /* PBXContainerItemProxy */ = { 82 | isa = PBXContainerItemProxy; 83 | containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 84 | proxyType = 1; 85 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 86 | remoteInfo = "ZipArchive ios"; 87 | }; 88 | C9C36EFC160AC3C9005BED39 /* PBXContainerItemProxy */ = { 89 | isa = PBXContainerItemProxy; 90 | containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 91 | proxyType = 1; 92 | remoteGlobalIDString = C908A95A160AC26D000395DB; 93 | remoteInfo = "ZipArchive mac"; 94 | }; 95 | /* End PBXContainerItemProxy section */ 96 | 97 | /* Begin PBXFileReference section */ 98 | AA747D9E0F9514B9006C5449 /* ZipArchive_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipArchive_Prefix.pch; sourceTree = SOURCE_ROOT; }; 99 | AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 100 | C908A96F160AC26D000395DB /* libZipArchive-mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libZipArchive-mac.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 101 | C95AB35017E1C14A00120861 /* V3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = V3.png; sourceTree = ""; }; 102 | C95AB35117E1C14A00120861 /* V3.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = V3.xml; sourceTree = ""; }; 103 | C95AB35817E1C37700120861 /* ZipArchive ios Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ZipArchive ios Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 104 | C95AB35917E1C37800120861 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 105 | C95AB35C17E1C37800120861 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 106 | C95AB36017E1C37800120861 /* ZipArchive ios Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ZipArchive ios Tests-Info.plist"; sourceTree = ""; }; 107 | C95AB36217E1C37800120861 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 108 | C95AB36617E1C37800120861 /* ZipArchive ios Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ZipArchive ios Tests-Prefix.pch"; sourceTree = ""; }; 109 | C95AB36E17E1C44200120861 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; 110 | C95AB37417E1C47D00120861 /* ZipArchive mac Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ZipArchive mac Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 111 | C95AB37817E1C47D00120861 /* ZipArchive mac Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ZipArchive mac Tests-Info.plist"; sourceTree = ""; }; 112 | C95AB37A17E1C47D00120861 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 113 | C95AB37E17E1C47D00120861 /* ZipArchive mac Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ZipArchive mac Tests-Prefix.pch"; sourceTree = ""; }; 114 | C99D6904164BCC7E00B6A7C3 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 115 | C99D6906164BCC7E00B6A7C3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; 116 | C99D6909164BCC7E00B6A7C3 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 117 | C99D690A164BCC7E00B6A7C3 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 118 | C99D690B164BCC7E00B6A7C3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 119 | C99D690E164BCC7E00B6A7C3 /* tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "tests-Info.plist"; sourceTree = ""; }; 120 | C99D6910164BCC7E00B6A7C3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 121 | C99D6912164BCC7E00B6A7C3 /* tests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tests.h; sourceTree = ""; }; 122 | C99D6913164BCC7E00B6A7C3 /* tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = tests.m; sourceTree = ""; }; 123 | C99D6915164BCC7E00B6A7C3 /* tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tests-Prefix.pch"; sourceTree = ""; }; 124 | C99D691F164BCCF000B6A7C3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; }; 125 | C9E8EBDB124F3CD70047C862 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 126 | C9E8EBE3124F3D030047C862 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = ""; }; 127 | C9E8EBE4124F3D030047C862 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = ""; }; 128 | C9E8EBE5124F3D030047C862 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = ""; }; 129 | C9E8EBE7124F3D030047C862 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = ""; }; 130 | C9E8EBE8124F3D030047C862 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = ""; }; 131 | C9E8EBE9124F3D030047C862 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = ""; }; 132 | C9E8EBEA124F3D030047C862 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = ""; }; 133 | C9E8EBEB124F3D030047C862 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = ""; }; 134 | C9E8EBEC124F3D030047C862 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = ""; }; 135 | C9E8EBF7124F3D170047C862 /* ZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZipArchive.h; path = ../ZipArchive.h; sourceTree = ""; }; 136 | C9E8EBF8124F3D170047C862 /* ZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZipArchive.m; path = ../ZipArchive.m; sourceTree = ""; }; 137 | D2AAC07E0554694100DB518D /* libZipArchive-ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libZipArchive-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 138 | /* End PBXFileReference section */ 139 | 140 | /* Begin PBXFrameworksBuildPhase section */ 141 | C908A969160AC26D000395DB /* Frameworks */ = { 142 | isa = PBXFrameworksBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | C908A96A160AC26D000395DB /* Foundation.framework in Frameworks */, 146 | C908A96B160AC26D000395DB /* libz.dylib in Frameworks */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | C95AB35517E1C37700120861 /* Frameworks */ = { 151 | isa = PBXFrameworksBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | C95AB36F17E1C44200120861 /* libz.dylib in Frameworks */, 155 | C95AB36D17E1C43400120861 /* libZipArchive-ios.a in Frameworks */, 156 | C95AB35A17E1C37800120861 /* XCTest.framework in Frameworks */, 157 | C95AB35D17E1C37800120861 /* UIKit.framework in Frameworks */, 158 | C95AB35B17E1C37800120861 /* Foundation.framework in Frameworks */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | C95AB37117E1C47D00120861 /* Frameworks */ = { 163 | isa = PBXFrameworksBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | C95AB38517E1C50900120861 /* libZipArchive-mac.a in Frameworks */, 167 | C95AB38617E1C50900120861 /* libz.dylib in Frameworks */, 168 | C95AB37517E1C47D00120861 /* XCTest.framework in Frameworks */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | D2AAC07C0554694100DB518D /* Frameworks */ = { 173 | isa = PBXFrameworksBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXFrameworksBuildPhase section */ 181 | 182 | /* Begin PBXGroup section */ 183 | 034768DFFF38A50411DB9C8B /* Products */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | D2AAC07E0554694100DB518D /* libZipArchive-ios.a */, 187 | C908A96F160AC26D000395DB /* libZipArchive-mac.a */, 188 | C95AB35817E1C37700120861 /* ZipArchive ios Tests.xctest */, 189 | C95AB37417E1C47D00120861 /* ZipArchive mac Tests.xctest */, 190 | ); 191 | name = Products; 192 | sourceTree = ""; 193 | }; 194 | 0867D691FE84028FC02AAC07 /* ZipArchive */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | C99D691F164BCCF000B6A7C3 /* libz.dylib */, 198 | 08FB77AEFE84172EC02AAC07 /* Source */, 199 | 32C88DFF0371C24200C91783 /* Other Sources */, 200 | C99D690C164BCC7E00B6A7C3 /* Common Tests */, 201 | C95AB35E17E1C37800120861 /* ZipArchive ios Tests */, 202 | C95AB37617E1C47D00120861 /* ZipArchive mac Tests */, 203 | 0867D69AFE84028FC02AAC07 /* Frameworks */, 204 | 034768DFFF38A50411DB9C8B /* Products */, 205 | ); 206 | name = ZipArchive; 207 | sourceTree = ""; 208 | }; 209 | 0867D69AFE84028FC02AAC07 /* Frameworks */ = { 210 | isa = PBXGroup; 211 | children = ( 212 | C95AB36E17E1C44200120861 /* libz.dylib */, 213 | AACBBE490F95108600F1A2B1 /* Foundation.framework */, 214 | C9E8EBDB124F3CD70047C862 /* libz.dylib */, 215 | C99D6904164BCC7E00B6A7C3 /* SenTestingKit.framework */, 216 | C99D6906164BCC7E00B6A7C3 /* Cocoa.framework */, 217 | C95AB35917E1C37800120861 /* XCTest.framework */, 218 | C95AB35C17E1C37800120861 /* UIKit.framework */, 219 | C99D6908164BCC7E00B6A7C3 /* Other Frameworks */, 220 | ); 221 | name = Frameworks; 222 | sourceTree = ""; 223 | }; 224 | 08FB77AEFE84172EC02AAC07 /* Source */ = { 225 | isa = PBXGroup; 226 | children = ( 227 | C9E8EBF7124F3D170047C862 /* ZipArchive.h */, 228 | C9E8EBF8124F3D170047C862 /* ZipArchive.m */, 229 | C9E8EBE1124F3D030047C862 /* minizip */, 230 | ); 231 | name = Source; 232 | sourceTree = ""; 233 | }; 234 | 32C88DFF0371C24200C91783 /* Other Sources */ = { 235 | isa = PBXGroup; 236 | children = ( 237 | AA747D9E0F9514B9006C5449 /* ZipArchive_Prefix.pch */, 238 | ); 239 | name = "Other Sources"; 240 | sourceTree = ""; 241 | }; 242 | C95AB34F17E1C14A00120861 /* test-files */ = { 243 | isa = PBXGroup; 244 | children = ( 245 | C95AB35017E1C14A00120861 /* V3.png */, 246 | C95AB35117E1C14A00120861 /* V3.xml */, 247 | ); 248 | path = "test-files"; 249 | sourceTree = ""; 250 | }; 251 | C95AB35E17E1C37800120861 /* ZipArchive ios Tests */ = { 252 | isa = PBXGroup; 253 | children = ( 254 | C95AB35F17E1C37800120861 /* Supporting Files */, 255 | ); 256 | path = "ZipArchive ios Tests"; 257 | sourceTree = ""; 258 | }; 259 | C95AB35F17E1C37800120861 /* Supporting Files */ = { 260 | isa = PBXGroup; 261 | children = ( 262 | C95AB36017E1C37800120861 /* ZipArchive ios Tests-Info.plist */, 263 | C95AB36117E1C37800120861 /* InfoPlist.strings */, 264 | C95AB36617E1C37800120861 /* ZipArchive ios Tests-Prefix.pch */, 265 | ); 266 | name = "Supporting Files"; 267 | sourceTree = ""; 268 | }; 269 | C95AB37617E1C47D00120861 /* ZipArchive mac Tests */ = { 270 | isa = PBXGroup; 271 | children = ( 272 | C95AB37717E1C47D00120861 /* Supporting Files */, 273 | ); 274 | path = "ZipArchive mac Tests"; 275 | sourceTree = ""; 276 | }; 277 | C95AB37717E1C47D00120861 /* Supporting Files */ = { 278 | isa = PBXGroup; 279 | children = ( 280 | C95AB37817E1C47D00120861 /* ZipArchive mac Tests-Info.plist */, 281 | C95AB37917E1C47D00120861 /* InfoPlist.strings */, 282 | C95AB37E17E1C47D00120861 /* ZipArchive mac Tests-Prefix.pch */, 283 | ); 284 | name = "Supporting Files"; 285 | sourceTree = ""; 286 | }; 287 | C99D6908164BCC7E00B6A7C3 /* Other Frameworks */ = { 288 | isa = PBXGroup; 289 | children = ( 290 | C99D6909164BCC7E00B6A7C3 /* AppKit.framework */, 291 | C99D690A164BCC7E00B6A7C3 /* CoreData.framework */, 292 | C99D690B164BCC7E00B6A7C3 /* Foundation.framework */, 293 | ); 294 | name = "Other Frameworks"; 295 | sourceTree = ""; 296 | }; 297 | C99D690C164BCC7E00B6A7C3 /* Common Tests */ = { 298 | isa = PBXGroup; 299 | children = ( 300 | C95AB34F17E1C14A00120861 /* test-files */, 301 | C99D6912164BCC7E00B6A7C3 /* tests.h */, 302 | C99D6913164BCC7E00B6A7C3 /* tests.m */, 303 | C99D690D164BCC7E00B6A7C3 /* Supporting Files */, 304 | ); 305 | name = "Common Tests"; 306 | path = tests; 307 | sourceTree = ""; 308 | }; 309 | C99D690D164BCC7E00B6A7C3 /* Supporting Files */ = { 310 | isa = PBXGroup; 311 | children = ( 312 | C99D690E164BCC7E00B6A7C3 /* tests-Info.plist */, 313 | C99D690F164BCC7E00B6A7C3 /* InfoPlist.strings */, 314 | C99D6915164BCC7E00B6A7C3 /* tests-Prefix.pch */, 315 | ); 316 | name = "Supporting Files"; 317 | sourceTree = ""; 318 | }; 319 | C9E8EBE1124F3D030047C862 /* minizip */ = { 320 | isa = PBXGroup; 321 | children = ( 322 | C9E8EBE3124F3D030047C862 /* crypt.h */, 323 | C9E8EBE4124F3D030047C862 /* ioapi.c */, 324 | C9E8EBE5124F3D030047C862 /* ioapi.h */, 325 | C9E8EBE7124F3D030047C862 /* mztools.c */, 326 | C9E8EBE8124F3D030047C862 /* mztools.h */, 327 | C9E8EBE9124F3D030047C862 /* unzip.c */, 328 | C9E8EBEA124F3D030047C862 /* unzip.h */, 329 | C9E8EBEB124F3D030047C862 /* zip.c */, 330 | C9E8EBEC124F3D030047C862 /* zip.h */, 331 | ); 332 | name = minizip; 333 | path = ../minizip; 334 | sourceTree = SOURCE_ROOT; 335 | }; 336 | /* End PBXGroup section */ 337 | 338 | /* Begin PBXHeadersBuildPhase section */ 339 | C908A95B160AC26D000395DB /* Headers */ = { 340 | isa = PBXHeadersBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | C908A95C160AC26D000395DB /* ZipArchive_Prefix.pch in Headers */, 344 | C908A962160AC26D000395DB /* ZipArchive.h in Headers */, 345 | C908A95D160AC26D000395DB /* crypt.h in Headers */, 346 | C908A95E160AC26D000395DB /* ioapi.h in Headers */, 347 | C908A95F160AC26D000395DB /* mztools.h in Headers */, 348 | C908A960160AC26D000395DB /* unzip.h in Headers */, 349 | C908A961160AC26D000395DB /* zip.h in Headers */, 350 | ); 351 | runOnlyForDeploymentPostprocessing = 0; 352 | }; 353 | D2AAC07A0554694100DB518D /* Headers */ = { 354 | isa = PBXHeadersBuildPhase; 355 | buildActionMask = 2147483647; 356 | files = ( 357 | AA747D9F0F9514B9006C5449 /* ZipArchive_Prefix.pch in Headers */, 358 | C9E8EBF9124F3D170047C862 /* ZipArchive.h in Headers */, 359 | C9E8EBED124F3D030047C862 /* crypt.h in Headers */, 360 | C9E8EBEF124F3D030047C862 /* ioapi.h in Headers */, 361 | C9E8EBF2124F3D030047C862 /* mztools.h in Headers */, 362 | C9E8EBF4124F3D030047C862 /* unzip.h in Headers */, 363 | C9E8EBF6124F3D030047C862 /* zip.h in Headers */, 364 | ); 365 | runOnlyForDeploymentPostprocessing = 0; 366 | }; 367 | /* End PBXHeadersBuildPhase section */ 368 | 369 | /* Begin PBXNativeTarget section */ 370 | C908A95A160AC26D000395DB /* ZipArchive mac */ = { 371 | isa = PBXNativeTarget; 372 | buildConfigurationList = C908A96C160AC26D000395DB /* Build configuration list for PBXNativeTarget "ZipArchive mac" */; 373 | buildPhases = ( 374 | C908A95B160AC26D000395DB /* Headers */, 375 | C908A963160AC26D000395DB /* Sources */, 376 | C908A969160AC26D000395DB /* Frameworks */, 377 | ); 378 | buildRules = ( 379 | ); 380 | dependencies = ( 381 | ); 382 | name = "ZipArchive mac"; 383 | productName = ZipArchive; 384 | productReference = C908A96F160AC26D000395DB /* libZipArchive-mac.a */; 385 | productType = "com.apple.product-type.library.static"; 386 | }; 387 | C95AB35717E1C37700120861 /* ZipArchive ios Tests */ = { 388 | isa = PBXNativeTarget; 389 | buildConfigurationList = C95AB36917E1C37800120861 /* Build configuration list for PBXNativeTarget "ZipArchive ios Tests" */; 390 | buildPhases = ( 391 | C95AB35417E1C37700120861 /* Sources */, 392 | C95AB35517E1C37700120861 /* Frameworks */, 393 | C95AB35617E1C37700120861 /* Resources */, 394 | ); 395 | buildRules = ( 396 | ); 397 | dependencies = ( 398 | C95AB36817E1C37800120861 /* PBXTargetDependency */, 399 | ); 400 | name = "ZipArchive ios Tests"; 401 | productName = "ZipArchive ios Tests"; 402 | productReference = C95AB35817E1C37700120861 /* ZipArchive ios Tests.xctest */; 403 | productType = "com.apple.product-type.bundle.unit-test"; 404 | }; 405 | C95AB37317E1C47D00120861 /* ZipArchive mac Tests */ = { 406 | isa = PBXNativeTarget; 407 | buildConfigurationList = C95AB38117E1C47D00120861 /* Build configuration list for PBXNativeTarget "ZipArchive mac Tests" */; 408 | buildPhases = ( 409 | C95AB37017E1C47D00120861 /* Sources */, 410 | C95AB37117E1C47D00120861 /* Frameworks */, 411 | C95AB37217E1C47D00120861 /* Resources */, 412 | ); 413 | buildRules = ( 414 | ); 415 | dependencies = ( 416 | C95AB38017E1C47D00120861 /* PBXTargetDependency */, 417 | ); 418 | name = "ZipArchive mac Tests"; 419 | productName = "ZipArchive mac Tests"; 420 | productReference = C95AB37417E1C47D00120861 /* ZipArchive mac Tests.xctest */; 421 | productType = "com.apple.product-type.bundle.unit-test"; 422 | }; 423 | D2AAC07D0554694100DB518D /* ZipArchive ios */ = { 424 | isa = PBXNativeTarget; 425 | buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "ZipArchive ios" */; 426 | buildPhases = ( 427 | D2AAC07A0554694100DB518D /* Headers */, 428 | D2AAC07B0554694100DB518D /* Sources */, 429 | D2AAC07C0554694100DB518D /* Frameworks */, 430 | ); 431 | buildRules = ( 432 | ); 433 | dependencies = ( 434 | ); 435 | name = "ZipArchive ios"; 436 | productName = ZipArchive; 437 | productReference = D2AAC07E0554694100DB518D /* libZipArchive-ios.a */; 438 | productType = "com.apple.product-type.library.static"; 439 | }; 440 | /* End PBXNativeTarget section */ 441 | 442 | /* Begin PBXProject section */ 443 | 0867D690FE84028FC02AAC07 /* Project object */ = { 444 | isa = PBXProject; 445 | attributes = { 446 | LastUpgradeCheck = 0500; 447 | TargetAttributes = { 448 | C95AB35717E1C37700120861 = { 449 | TestTargetID = D2AAC07D0554694100DB518D; 450 | }; 451 | C95AB37317E1C47D00120861 = { 452 | TestTargetID = C908A95A160AC26D000395DB; 453 | }; 454 | }; 455 | }; 456 | buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "ZipArchive" */; 457 | compatibilityVersion = "Xcode 3.2"; 458 | developmentRegion = English; 459 | hasScannedForEncodings = 1; 460 | knownRegions = ( 461 | English, 462 | Japanese, 463 | French, 464 | German, 465 | en, 466 | ); 467 | mainGroup = 0867D691FE84028FC02AAC07 /* ZipArchive */; 468 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 469 | projectDirPath = ""; 470 | projectRoot = ""; 471 | targets = ( 472 | C9C36EF6160AC3C0005BED39 /* ZipArchive */, 473 | D2AAC07D0554694100DB518D /* ZipArchive ios */, 474 | C908A95A160AC26D000395DB /* ZipArchive mac */, 475 | C95AB35717E1C37700120861 /* ZipArchive ios Tests */, 476 | C95AB37317E1C47D00120861 /* ZipArchive mac Tests */, 477 | ); 478 | }; 479 | /* End PBXProject section */ 480 | 481 | /* Begin PBXResourcesBuildPhase section */ 482 | C95AB35617E1C37700120861 /* Resources */ = { 483 | isa = PBXResourcesBuildPhase; 484 | buildActionMask = 2147483647; 485 | files = ( 486 | C95AB36317E1C37800120861 /* InfoPlist.strings in Resources */, 487 | ); 488 | runOnlyForDeploymentPostprocessing = 0; 489 | }; 490 | C95AB37217E1C47D00120861 /* Resources */ = { 491 | isa = PBXResourcesBuildPhase; 492 | buildActionMask = 2147483647; 493 | files = ( 494 | C95AB37B17E1C47D00120861 /* InfoPlist.strings in Resources */, 495 | ); 496 | runOnlyForDeploymentPostprocessing = 0; 497 | }; 498 | /* End PBXResourcesBuildPhase section */ 499 | 500 | /* Begin PBXSourcesBuildPhase section */ 501 | C908A963160AC26D000395DB /* Sources */ = { 502 | isa = PBXSourcesBuildPhase; 503 | buildActionMask = 2147483647; 504 | files = ( 505 | C908A964160AC26D000395DB /* ioapi.c in Sources */, 506 | C908A965160AC26D000395DB /* mztools.c in Sources */, 507 | C908A966160AC26D000395DB /* unzip.c in Sources */, 508 | C908A967160AC26D000395DB /* zip.c in Sources */, 509 | C908A968160AC26D000395DB /* ZipArchive.m in Sources */, 510 | ); 511 | runOnlyForDeploymentPostprocessing = 0; 512 | }; 513 | C95AB35417E1C37700120861 /* Sources */ = { 514 | isa = PBXSourcesBuildPhase; 515 | buildActionMask = 2147483647; 516 | files = ( 517 | C95AB36C17E1C3D400120861 /* tests.m in Sources */, 518 | ); 519 | runOnlyForDeploymentPostprocessing = 0; 520 | }; 521 | C95AB37017E1C47D00120861 /* Sources */ = { 522 | isa = PBXSourcesBuildPhase; 523 | buildActionMask = 2147483647; 524 | files = ( 525 | C95AB38417E1C49400120861 /* tests.m in Sources */, 526 | ); 527 | runOnlyForDeploymentPostprocessing = 0; 528 | }; 529 | D2AAC07B0554694100DB518D /* Sources */ = { 530 | isa = PBXSourcesBuildPhase; 531 | buildActionMask = 2147483647; 532 | files = ( 533 | C9E8EBEE124F3D030047C862 /* ioapi.c in Sources */, 534 | C9E8EBF1124F3D030047C862 /* mztools.c in Sources */, 535 | C9E8EBF3124F3D030047C862 /* unzip.c in Sources */, 536 | C9E8EBF5124F3D030047C862 /* zip.c in Sources */, 537 | C9E8EBFA124F3D170047C862 /* ZipArchive.m in Sources */, 538 | ); 539 | runOnlyForDeploymentPostprocessing = 0; 540 | }; 541 | /* End PBXSourcesBuildPhase section */ 542 | 543 | /* Begin PBXTargetDependency section */ 544 | C95AB36817E1C37800120861 /* PBXTargetDependency */ = { 545 | isa = PBXTargetDependency; 546 | target = D2AAC07D0554694100DB518D /* ZipArchive ios */; 547 | targetProxy = C95AB36717E1C37800120861 /* PBXContainerItemProxy */; 548 | }; 549 | C95AB38017E1C47D00120861 /* PBXTargetDependency */ = { 550 | isa = PBXTargetDependency; 551 | target = C908A95A160AC26D000395DB /* ZipArchive mac */; 552 | targetProxy = C95AB37F17E1C47D00120861 /* PBXContainerItemProxy */; 553 | }; 554 | C9C36EFB160AC3C6005BED39 /* PBXTargetDependency */ = { 555 | isa = PBXTargetDependency; 556 | target = D2AAC07D0554694100DB518D /* ZipArchive ios */; 557 | targetProxy = C9C36EFA160AC3C6005BED39 /* PBXContainerItemProxy */; 558 | }; 559 | C9C36EFD160AC3C9005BED39 /* PBXTargetDependency */ = { 560 | isa = PBXTargetDependency; 561 | target = C908A95A160AC26D000395DB /* ZipArchive mac */; 562 | targetProxy = C9C36EFC160AC3C9005BED39 /* PBXContainerItemProxy */; 563 | }; 564 | /* End PBXTargetDependency section */ 565 | 566 | /* Begin PBXVariantGroup section */ 567 | C95AB36117E1C37800120861 /* InfoPlist.strings */ = { 568 | isa = PBXVariantGroup; 569 | children = ( 570 | C95AB36217E1C37800120861 /* en */, 571 | ); 572 | name = InfoPlist.strings; 573 | sourceTree = ""; 574 | }; 575 | C95AB37917E1C47D00120861 /* InfoPlist.strings */ = { 576 | isa = PBXVariantGroup; 577 | children = ( 578 | C95AB37A17E1C47D00120861 /* en */, 579 | ); 580 | name = InfoPlist.strings; 581 | sourceTree = ""; 582 | }; 583 | C99D690F164BCC7E00B6A7C3 /* InfoPlist.strings */ = { 584 | isa = PBXVariantGroup; 585 | children = ( 586 | C99D6910164BCC7E00B6A7C3 /* en */, 587 | ); 588 | name = InfoPlist.strings; 589 | sourceTree = ""; 590 | }; 591 | /* End PBXVariantGroup section */ 592 | 593 | /* Begin XCBuildConfiguration section */ 594 | 1DEB921F08733DC00010E9CD /* Debug */ = { 595 | isa = XCBuildConfiguration; 596 | buildSettings = { 597 | ALWAYS_SEARCH_USER_PATHS = NO; 598 | COPY_PHASE_STRIP = NO; 599 | DSTROOT = /tmp/ZipArchive.dst; 600 | GCC_DYNAMIC_NO_PIC = NO; 601 | GCC_MODEL_TUNING = G5; 602 | GCC_OPTIMIZATION_LEVEL = 0; 603 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 604 | GCC_PREFIX_HEADER = ZipArchive_Prefix.pch; 605 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 606 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 607 | PRODUCT_NAME = "ZipArchive-ios"; 608 | SDKROOT = iphoneos; 609 | SKIP_INSTALL = YES; 610 | }; 611 | name = Debug; 612 | }; 613 | 1DEB922008733DC00010E9CD /* Release */ = { 614 | isa = XCBuildConfiguration; 615 | buildSettings = { 616 | ALWAYS_SEARCH_USER_PATHS = NO; 617 | DSTROOT = /tmp/ZipArchive.dst; 618 | GCC_MODEL_TUNING = G5; 619 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 620 | GCC_PREFIX_HEADER = ZipArchive_Prefix.pch; 621 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 622 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 623 | PRODUCT_NAME = "ZipArchive-ios"; 624 | SDKROOT = iphoneos; 625 | SKIP_INSTALL = YES; 626 | }; 627 | name = Release; 628 | }; 629 | 1DEB922308733DC00010E9CD /* Debug */ = { 630 | isa = XCBuildConfiguration; 631 | buildSettings = { 632 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 633 | GCC_C_LANGUAGE_STANDARD = c99; 634 | GCC_OPTIMIZATION_LEVEL = 0; 635 | GCC_VERSION = ""; 636 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 637 | GCC_WARN_UNUSED_VARIABLE = YES; 638 | MACOSX_DEPLOYMENT_TARGET = ""; 639 | ONLY_ACTIVE_ARCH = YES; 640 | OTHER_LDFLAGS = "-ObjC"; 641 | }; 642 | name = Debug; 643 | }; 644 | 1DEB922408733DC00010E9CD /* Release */ = { 645 | isa = XCBuildConfiguration; 646 | buildSettings = { 647 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 648 | GCC_C_LANGUAGE_STANDARD = c99; 649 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 650 | GCC_WARN_UNUSED_VARIABLE = YES; 651 | MACOSX_DEPLOYMENT_TARGET = ""; 652 | OTHER_LDFLAGS = "-ObjC"; 653 | }; 654 | name = Release; 655 | }; 656 | C908A96D160AC26D000395DB /* Debug */ = { 657 | isa = XCBuildConfiguration; 658 | buildSettings = { 659 | ALWAYS_SEARCH_USER_PATHS = NO; 660 | COMBINE_HIDPI_IMAGES = YES; 661 | COPY_PHASE_STRIP = NO; 662 | DSTROOT = /tmp/ZipArchive.dst; 663 | GCC_DYNAMIC_NO_PIC = NO; 664 | GCC_MODEL_TUNING = G5; 665 | GCC_OPTIMIZATION_LEVEL = 0; 666 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 667 | GCC_PREFIX_HEADER = ZipArchive_Prefix.pch; 668 | PRODUCT_NAME = "ZipArchive-mac"; 669 | SDKROOT = macosx; 670 | SKIP_INSTALL = YES; 671 | }; 672 | name = Debug; 673 | }; 674 | C908A96E160AC26D000395DB /* Release */ = { 675 | isa = XCBuildConfiguration; 676 | buildSettings = { 677 | ALWAYS_SEARCH_USER_PATHS = NO; 678 | COMBINE_HIDPI_IMAGES = YES; 679 | DSTROOT = /tmp/ZipArchive.dst; 680 | GCC_MODEL_TUNING = G5; 681 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 682 | GCC_PREFIX_HEADER = ZipArchive_Prefix.pch; 683 | PRODUCT_NAME = "ZipArchive-mac"; 684 | SDKROOT = macosx; 685 | SKIP_INSTALL = YES; 686 | }; 687 | name = Release; 688 | }; 689 | C95AB36A17E1C37800120861 /* Debug */ = { 690 | isa = XCBuildConfiguration; 691 | buildSettings = { 692 | ALWAYS_SEARCH_USER_PATHS = NO; 693 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 694 | CLANG_CXX_LIBRARY = "libc++"; 695 | CLANG_ENABLE_MODULES = YES; 696 | CLANG_ENABLE_OBJC_ARC = YES; 697 | CLANG_WARN_BOOL_CONVERSION = YES; 698 | CLANG_WARN_CONSTANT_CONVERSION = YES; 699 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 700 | CLANG_WARN_EMPTY_BODY = YES; 701 | CLANG_WARN_ENUM_CONVERSION = YES; 702 | CLANG_WARN_INT_CONVERSION = YES; 703 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 704 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 705 | COPY_PHASE_STRIP = NO; 706 | FRAMEWORK_SEARCH_PATHS = ( 707 | "$(SDKROOT)/Developer/Library/Frameworks", 708 | "$(inherited)", 709 | "$(DEVELOPER_FRAMEWORKS_DIR)", 710 | ); 711 | GCC_C_LANGUAGE_STANDARD = gnu99; 712 | GCC_DYNAMIC_NO_PIC = NO; 713 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 714 | GCC_PREFIX_HEADER = "ZipArchive ios Tests/ZipArchive ios Tests-Prefix.pch"; 715 | GCC_PREPROCESSOR_DEFINITIONS = ( 716 | "DEBUG=1", 717 | "$(inherited)", 718 | ); 719 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 720 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 721 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 722 | GCC_WARN_UNDECLARED_SELECTOR = YES; 723 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 724 | GCC_WARN_UNUSED_FUNCTION = YES; 725 | INFOPLIST_FILE = "ZipArchive ios Tests/ZipArchive ios Tests-Info.plist"; 726 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 727 | ONLY_ACTIVE_ARCH = YES; 728 | PRODUCT_NAME = "$(TARGET_NAME)"; 729 | SDKROOT = iphoneos; 730 | WRAPPER_EXTENSION = xctest; 731 | }; 732 | name = Debug; 733 | }; 734 | C95AB36B17E1C37800120861 /* Release */ = { 735 | isa = XCBuildConfiguration; 736 | buildSettings = { 737 | ALWAYS_SEARCH_USER_PATHS = NO; 738 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 739 | CLANG_CXX_LIBRARY = "libc++"; 740 | CLANG_ENABLE_MODULES = YES; 741 | CLANG_ENABLE_OBJC_ARC = YES; 742 | CLANG_WARN_BOOL_CONVERSION = YES; 743 | CLANG_WARN_CONSTANT_CONVERSION = YES; 744 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 745 | CLANG_WARN_EMPTY_BODY = YES; 746 | CLANG_WARN_ENUM_CONVERSION = YES; 747 | CLANG_WARN_INT_CONVERSION = YES; 748 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 749 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 750 | COPY_PHASE_STRIP = YES; 751 | ENABLE_NS_ASSERTIONS = NO; 752 | FRAMEWORK_SEARCH_PATHS = ( 753 | "$(SDKROOT)/Developer/Library/Frameworks", 754 | "$(inherited)", 755 | "$(DEVELOPER_FRAMEWORKS_DIR)", 756 | ); 757 | GCC_C_LANGUAGE_STANDARD = gnu99; 758 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 759 | GCC_PREFIX_HEADER = "ZipArchive ios Tests/ZipArchive ios Tests-Prefix.pch"; 760 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 761 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 762 | GCC_WARN_UNDECLARED_SELECTOR = YES; 763 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 764 | GCC_WARN_UNUSED_FUNCTION = YES; 765 | INFOPLIST_FILE = "ZipArchive ios Tests/ZipArchive ios Tests-Info.plist"; 766 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 767 | PRODUCT_NAME = "$(TARGET_NAME)"; 768 | SDKROOT = iphoneos; 769 | VALIDATE_PRODUCT = YES; 770 | WRAPPER_EXTENSION = xctest; 771 | }; 772 | name = Release; 773 | }; 774 | C95AB38217E1C47D00120861 /* Debug */ = { 775 | isa = XCBuildConfiguration; 776 | buildSettings = { 777 | ALWAYS_SEARCH_USER_PATHS = NO; 778 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 779 | CLANG_CXX_LIBRARY = "libc++"; 780 | CLANG_ENABLE_OBJC_ARC = YES; 781 | CLANG_WARN_BOOL_CONVERSION = YES; 782 | CLANG_WARN_CONSTANT_CONVERSION = YES; 783 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 784 | CLANG_WARN_EMPTY_BODY = YES; 785 | CLANG_WARN_ENUM_CONVERSION = YES; 786 | CLANG_WARN_INT_CONVERSION = YES; 787 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 788 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 789 | COMBINE_HIDPI_IMAGES = YES; 790 | COPY_PHASE_STRIP = NO; 791 | FRAMEWORK_SEARCH_PATHS = ( 792 | "$(DEVELOPER_FRAMEWORKS_DIR)", 793 | "$(inherited)", 794 | ); 795 | GCC_C_LANGUAGE_STANDARD = gnu99; 796 | GCC_DYNAMIC_NO_PIC = NO; 797 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 798 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 799 | GCC_PREFIX_HEADER = "ZipArchive mac Tests/ZipArchive mac Tests-Prefix.pch"; 800 | GCC_PREPROCESSOR_DEFINITIONS = ( 801 | "DEBUG=1", 802 | "$(inherited)", 803 | ); 804 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 805 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 806 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 807 | GCC_WARN_UNDECLARED_SELECTOR = YES; 808 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 809 | GCC_WARN_UNUSED_FUNCTION = YES; 810 | INFOPLIST_FILE = "ZipArchive mac Tests/ZipArchive mac Tests-Info.plist"; 811 | MACOSX_DEPLOYMENT_TARGET = ""; 812 | ONLY_ACTIVE_ARCH = YES; 813 | PRODUCT_NAME = "$(TARGET_NAME)"; 814 | SDKROOT = macosx; 815 | WRAPPER_EXTENSION = xctest; 816 | }; 817 | name = Debug; 818 | }; 819 | C95AB38317E1C47D00120861 /* Release */ = { 820 | isa = XCBuildConfiguration; 821 | buildSettings = { 822 | ALWAYS_SEARCH_USER_PATHS = NO; 823 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 824 | CLANG_CXX_LIBRARY = "libc++"; 825 | CLANG_ENABLE_OBJC_ARC = YES; 826 | CLANG_WARN_BOOL_CONVERSION = YES; 827 | CLANG_WARN_CONSTANT_CONVERSION = YES; 828 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 829 | CLANG_WARN_EMPTY_BODY = YES; 830 | CLANG_WARN_ENUM_CONVERSION = YES; 831 | CLANG_WARN_INT_CONVERSION = YES; 832 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 833 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 834 | COMBINE_HIDPI_IMAGES = YES; 835 | COPY_PHASE_STRIP = YES; 836 | ENABLE_NS_ASSERTIONS = NO; 837 | FRAMEWORK_SEARCH_PATHS = ( 838 | "$(DEVELOPER_FRAMEWORKS_DIR)", 839 | "$(inherited)", 840 | ); 841 | GCC_C_LANGUAGE_STANDARD = gnu99; 842 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 843 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 844 | GCC_PREFIX_HEADER = "ZipArchive mac Tests/ZipArchive mac Tests-Prefix.pch"; 845 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 846 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 847 | GCC_WARN_UNDECLARED_SELECTOR = YES; 848 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 849 | GCC_WARN_UNUSED_FUNCTION = YES; 850 | INFOPLIST_FILE = "ZipArchive mac Tests/ZipArchive mac Tests-Info.plist"; 851 | MACOSX_DEPLOYMENT_TARGET = ""; 852 | PRODUCT_NAME = "$(TARGET_NAME)"; 853 | SDKROOT = macosx; 854 | WRAPPER_EXTENSION = xctest; 855 | }; 856 | name = Release; 857 | }; 858 | C9C36EF8160AC3C0005BED39 /* Debug */ = { 859 | isa = XCBuildConfiguration; 860 | buildSettings = { 861 | COMBINE_HIDPI_IMAGES = YES; 862 | PRODUCT_NAME = "$(TARGET_NAME)"; 863 | }; 864 | name = Debug; 865 | }; 866 | C9C36EF9160AC3C0005BED39 /* Release */ = { 867 | isa = XCBuildConfiguration; 868 | buildSettings = { 869 | COMBINE_HIDPI_IMAGES = YES; 870 | PRODUCT_NAME = "$(TARGET_NAME)"; 871 | }; 872 | name = Release; 873 | }; 874 | /* End XCBuildConfiguration section */ 875 | 876 | /* Begin XCConfigurationList section */ 877 | 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "ZipArchive ios" */ = { 878 | isa = XCConfigurationList; 879 | buildConfigurations = ( 880 | 1DEB921F08733DC00010E9CD /* Debug */, 881 | 1DEB922008733DC00010E9CD /* Release */, 882 | ); 883 | defaultConfigurationIsVisible = 0; 884 | defaultConfigurationName = Release; 885 | }; 886 | 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "ZipArchive" */ = { 887 | isa = XCConfigurationList; 888 | buildConfigurations = ( 889 | 1DEB922308733DC00010E9CD /* Debug */, 890 | 1DEB922408733DC00010E9CD /* Release */, 891 | ); 892 | defaultConfigurationIsVisible = 0; 893 | defaultConfigurationName = Release; 894 | }; 895 | C908A96C160AC26D000395DB /* Build configuration list for PBXNativeTarget "ZipArchive mac" */ = { 896 | isa = XCConfigurationList; 897 | buildConfigurations = ( 898 | C908A96D160AC26D000395DB /* Debug */, 899 | C908A96E160AC26D000395DB /* Release */, 900 | ); 901 | defaultConfigurationIsVisible = 0; 902 | defaultConfigurationName = Release; 903 | }; 904 | C95AB36917E1C37800120861 /* Build configuration list for PBXNativeTarget "ZipArchive ios Tests" */ = { 905 | isa = XCConfigurationList; 906 | buildConfigurations = ( 907 | C95AB36A17E1C37800120861 /* Debug */, 908 | C95AB36B17E1C37800120861 /* Release */, 909 | ); 910 | defaultConfigurationIsVisible = 0; 911 | defaultConfigurationName = Release; 912 | }; 913 | C95AB38117E1C47D00120861 /* Build configuration list for PBXNativeTarget "ZipArchive mac Tests" */ = { 914 | isa = XCConfigurationList; 915 | buildConfigurations = ( 916 | C95AB38217E1C47D00120861 /* Debug */, 917 | C95AB38317E1C47D00120861 /* Release */, 918 | ); 919 | defaultConfigurationIsVisible = 0; 920 | defaultConfigurationName = Release; 921 | }; 922 | C9C36EF7160AC3C0005BED39 /* Build configuration list for PBXAggregateTarget "ZipArchive" */ = { 923 | isa = XCConfigurationList; 924 | buildConfigurations = ( 925 | C9C36EF8160AC3C0005BED39 /* Debug */, 926 | C9C36EF9160AC3C0005BED39 /* Release */, 927 | ); 928 | defaultConfigurationIsVisible = 0; 929 | defaultConfigurationName = Release; 930 | }; 931 | /* End XCConfigurationList section */ 932 | }; 933 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 934 | } 935 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive ios.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 52 | 53 | 54 | 55 | 61 | 62 | 64 | 65 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive mac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 52 | 53 | 54 | 55 | 61 | 62 | 64 | 65 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ZipArchive/ZipArchive_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CocoaTouchStaticLibrary' target in the 'CocoaTouchStaticLibrary' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /ZipArchive/tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ZipArchive/tests/test-files/V3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattconnolly/ZipArchive/e215573f43d7c008b9baaa0d8709363aa6445dbd/ZipArchive/tests/test-files/V3.png -------------------------------------------------------------------------------- /ZipArchive/tests/test-files/V3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /ZipArchive/tests/tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.ZipArchive.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZipArchive/tests/tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'tests' target in the 'tests' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /ZipArchive/tests/tests.h: -------------------------------------------------------------------------------- 1 | // 2 | // tests.h 3 | // tests 4 | // 5 | // Created by Matt Connolly on 8/11/12. 6 | // 7 | // 8 | 9 | #import 10 | #import "ZipArchive.h" 11 | 12 | @interface tests : XCTestCase 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ZipArchive/tests/tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // tests.m 3 | // tests 4 | // 5 | // Created by Matt Connolly on 8/11/12. 6 | // Copyright (c) 2012 Matt Connolly. All rights reserved. 7 | // 8 | 9 | #import "tests.h" 10 | #import "ZipArchive.h" 11 | 12 | const NSUInteger NUM_FILES = 10; 13 | 14 | @interface tests() 15 | { 16 | NSArray* _files; 17 | NSString* _zipFile1; // without password 18 | NSString* _zipFile2; // with password 19 | NSUInteger _errorCount; 20 | } 21 | @end 22 | 23 | @implementation tests 24 | 25 | - (void)setUp 26 | { 27 | [super setUp]; 28 | 29 | // Set-up code here. 30 | chdir("/tmp"); 31 | _files = [self createRandomFiles:NUM_FILES]; 32 | NSLog(@"Files: %@", _files); 33 | _zipFile1 = [self createZipArchiveWithFiles:_files]; 34 | NSLog(@"created zip: %@", _zipFile1); 35 | _zipFile2 = [self createZipArchiveWithFiles:_files andPassword:@"password"]; 36 | NSLog(@"created password protected zip: %@", _zipFile2); 37 | } 38 | 39 | - (void)tearDown 40 | { 41 | // Tear-down code here. 42 | 43 | NSFileManager* fm = [NSFileManager defaultManager]; 44 | [fm removeItemAtPath:_zipFile1 error:nil]; 45 | [fm removeItemAtPath:_zipFile2 error:nil]; 46 | 47 | [super tearDown]; 48 | } 49 | 50 | - (void)testExpandNormalZipFile 51 | { 52 | // unzip normal zip 53 | NSUInteger count = 0; 54 | NSFileManager* fm = [NSFileManager defaultManager]; 55 | ZipArchive* zip = [[ZipArchive alloc] init]; 56 | [zip UnzipOpenFile:_zipFile1]; 57 | NSArray* contents = [zip getZipFileContents]; 58 | XCTAssertTrue(contents && contents.count == _files.count, @"zip files has right number of contents"); 59 | NSString* outputDir = [self tempDir]; 60 | [zip UnzipFileTo:outputDir overWrite:YES]; 61 | 62 | NSDirectoryEnumerator* dirEnum = [fm enumeratorAtPath:outputDir]; 63 | NSString* file; 64 | NSError* error = nil; 65 | while ((file = [dirEnum nextObject])) { 66 | count += 1; 67 | NSString* fullPath = [outputDir stringByAppendingPathComponent:file]; 68 | NSDictionary* attrs = [fm attributesOfItemAtPath:fullPath error:&error]; 69 | XCTAssertTrue([attrs fileSize] > 0, @"file is not zero length"); 70 | } 71 | XCTAssertTrue(count == NUM_FILES, @"files extracted successfully"); 72 | } 73 | 74 | - (void)testExpandPasswordZipFileCorrectly 75 | { 76 | // unzip password zip 77 | NSUInteger count = 0; 78 | NSFileManager* fm = [NSFileManager defaultManager]; 79 | ZipArchive* zip = [[ZipArchive alloc] init]; 80 | [zip UnzipOpenFile:_zipFile2 Password:@"password"]; 81 | NSArray* contents = [zip getZipFileContents]; 82 | XCTAssertTrue(contents && contents.count == _files.count, @"zip files has right number of contents"); 83 | NSString* outputDir = [self tempDir]; 84 | _errorCount = 0; 85 | zip.delegate = self; 86 | BOOL ok = [zip UnzipFileTo:outputDir overWrite:YES]; 87 | XCTAssertTrue(ok, @"unzip should pass with wrong password"); 88 | XCTAssertTrue(_errorCount == 0, @"no errors"); 89 | NSDirectoryEnumerator* dirEnum = [fm enumeratorAtPath:outputDir]; 90 | NSString* file; 91 | NSError* error = nil; 92 | while ((file = [dirEnum nextObject])) { 93 | count += 1; 94 | NSString* fullPath = [outputDir stringByAppendingPathComponent:file]; 95 | NSDictionary* attrs = [fm attributesOfItemAtPath:fullPath error:&error]; 96 | XCTAssertTrue([attrs fileSize] > 0, @"file is not zero length"); 97 | } 98 | XCTAssertTrue(count == NUM_FILES, @"files extracted successfully"); 99 | } 100 | 101 | - (void)testExpandPasswordZipFileWithWrongPassword 102 | { 103 | // unzip with wrong password 104 | NSUInteger count = 0; 105 | NSFileManager* fm = [NSFileManager defaultManager]; 106 | ZipArchive* zip = [[ZipArchive alloc] init]; 107 | [zip UnzipOpenFile:_zipFile2 Password:@"wrong"]; 108 | NSArray* contents = [zip getZipFileContents]; 109 | XCTAssertTrue(contents && contents.count == _files.count, @"zip files has right number of contents"); 110 | NSString* outputDir = [self tempDir]; 111 | _errorCount = 0; 112 | zip.delegate = self; 113 | BOOL ok = [zip UnzipFileTo:outputDir overWrite:YES]; 114 | XCTAssertTrue(_errorCount == 1, @"we want the wrong password error reported only once"); 115 | XCTAssertFalse(ok, @"unzip should fail with wrong password"); 116 | 117 | NSDirectoryEnumerator* dirEnum = [fm enumeratorAtPath:outputDir]; 118 | NSString* file; 119 | NSError* error = nil; 120 | while ((file = [dirEnum nextObject])) { 121 | count += 1; 122 | NSString* fullPath = [outputDir stringByAppendingPathComponent:file]; 123 | NSDictionary* attrs = [fm attributesOfItemAtPath:fullPath error:&error]; 124 | XCTAssertTrue([attrs fileSize] > 0, @"file is not zero length"); 125 | } 126 | XCTAssertTrue(count == 0, @"files extracted successfully"); 127 | } 128 | 129 | 130 | -(void) ErrorMessage:(NSString*) msg 131 | { 132 | _errorCount += 1; 133 | } 134 | 135 | 136 | 137 | 138 | - (NSString*)tempDir 139 | { 140 | const char* template = "/tmp/zipunzip.XXXXXX"; 141 | char name[1000]; 142 | strcpy(name, template); 143 | mkdtemp(name); 144 | return [NSString stringWithUTF8String:name]; 145 | } 146 | 147 | 148 | 149 | - (NSArray*) createRandomFiles:(int) count 150 | { 151 | if (count <= 0) return nil; 152 | NSMutableArray* files = [NSMutableArray arrayWithCapacity:count]; 153 | char buffer[1024]; 154 | for (int i = 0; i < count; i++) { 155 | char tempName[1000]; 156 | strcpy(tempName, "/tmp/ziptest-XXXXXXXX"); 157 | mkstemp(tempName); 158 | FILE* fp = fopen(tempName, "wb"); 159 | if (fp) { 160 | int len = arc4random() % 1000; 161 | arc4random_buf(buffer, len); 162 | fwrite(buffer, 1, len, fp); 163 | fclose(fp); 164 | } 165 | [files addObject:[NSString stringWithUTF8String:tempName]]; 166 | } 167 | return [NSArray arrayWithArray:files]; 168 | } 169 | 170 | - (NSString*) createZipArchiveWithFiles:(NSArray*)files 171 | { 172 | return [self createZipArchiveWithFiles:files andPassword:nil]; 173 | } 174 | 175 | - (NSString*) createZipArchiveWithFiles:(NSArray*)files andPassword:(NSString*)password 176 | { 177 | ZipArchive* zip = [[ZipArchive alloc] init]; 178 | char tempName[1000]; 179 | strcpy(tempName, "/tmp/ziptest-XXXXXXXX"); 180 | mkstemp(tempName); 181 | BOOL ok; 182 | NSString* zipPath = [NSString stringWithFormat:@"%s.zip", tempName]; 183 | if (password && password.length > 0) { 184 | ok = [zip CreateZipFile2:zipPath Password:password]; 185 | } else { 186 | ok = [zip CreateZipFile2:zipPath]; 187 | } 188 | XCTAssertTrue(ok, @"created zip file"); 189 | for (NSString* file in files) { 190 | ok = [zip addFileToZip:file newname:[file lastPathComponent]]; 191 | XCTAssertTrue(ok, @"added file to zip archive"); 192 | } 193 | ok = [zip CloseZipFile2]; 194 | XCTAssertTrue(ok, @"closed zip file"); 195 | return zipPath; 196 | } 197 | 198 | 199 | /** 200 | This test is for some specific files that cause a crash. The files were posted on 201 | this issue: https://github.com/mattconnolly/ZipArchive/issues/14 202 | */ 203 | - (void)testForCrashWithSpecificFiles; 204 | { 205 | NSFileManager* fileManager = [NSFileManager defaultManager]; 206 | ZipArchive* theZip = [[ZipArchive alloc] init]; 207 | NSString *theZippedFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent: 208 | @"archivedFile.zip"]; 209 | 210 | if ([fileManager fileExistsAtPath:theZippedFilePath]) 211 | { 212 | [fileManager removeItemAtPath:theZippedFilePath error:nil]; 213 | } 214 | 215 | [theZip CreateZipFile2:theZippedFilePath Password:@"password"]; 216 | 217 | NSString* path = [[NSBundle bundleForClass:[self class]] bundlePath]; 218 | NSArray* testFiles = @[@"V3.png", @"V3.xml"]; 219 | for (NSString *fileName in testFiles) { 220 | NSString* theFilePath = [path stringByAppendingPathComponent:fileName]; 221 | [theZip addFileToZip:theFilePath newname:[theFilePath lastPathComponent]]; 222 | } 223 | 224 | [theZip CloseZipFile2]; 225 | NSLog(@"Zip file created at: %@", theZippedFilePath); 226 | } 227 | 228 | @end 229 | -------------------------------------------------------------------------------- /minizip/ChangeLogUnzip: -------------------------------------------------------------------------------- 1 | Change in 1.01e (12 feb 05) 2 | - Fix in zipOpen2 for globalcomment (Rolf Kalbermatter) 3 | - Fix possible memory leak in unzip.c (Zoran Stevanovic) 4 | 5 | Change in 1.01b (20 may 04) 6 | - Integrate patch from Debian package (submited by Mark Brown) 7 | - Add tools mztools from Xavier Roche 8 | 9 | Change in 1.01 (8 may 04) 10 | - fix buffer overrun risk in unzip.c (Xavier Roche) 11 | - fix a minor buffer insecurity in minizip.c (Mike Whittaker) 12 | 13 | Change in 1.00: (10 sept 03) 14 | - rename to 1.00 15 | - cosmetic code change 16 | 17 | Change in 0.22: (19 May 03) 18 | - crypting support (unless you define NOCRYPT) 19 | - append file in existing zipfile 20 | 21 | Change in 0.21: (10 Mar 03) 22 | - bug fixes 23 | 24 | Change in 0.17: (27 Jan 02) 25 | - bug fixes 26 | 27 | Change in 0.16: (19 Jan 02) 28 | - Support of ioapi for virtualize zip file access 29 | 30 | Change in 0.15: (19 Mar 98) 31 | - fix memory leak in minizip.c 32 | 33 | Change in 0.14: (10 Mar 98) 34 | - fix bugs in minizip.c sample for zipping big file 35 | - fix problem in month in date handling 36 | - fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for 37 | comment handling 38 | 39 | Change in 0.13: (6 Mar 98) 40 | - fix bugs in zip.c 41 | - add real minizip sample 42 | 43 | Change in 0.12: (4 Mar 98) 44 | - add zip.c and zip.h for creates .zip file 45 | - fix change_file_date in miniunz.c for Unix (Jean-loup Gailly) 46 | - fix miniunz.c for file without specific record for directory 47 | 48 | Change in 0.11: (3 Mar 98) 49 | - fix bug in unzGetCurrentFileInfo for get extra field and comment 50 | - enhance miniunz sample, remove the bad unztst.c sample 51 | 52 | Change in 0.10: (2 Mar 98) 53 | - fix bug in unzReadCurrentFile 54 | - rename unzip* to unz* function and structure 55 | - remove Windows-like hungary notation variable name 56 | - modify some structure in unzip.h 57 | - add somes comment in source 58 | - remove unzipGetcCurrentFile function 59 | - replace ZUNZEXPORT by ZEXPORT 60 | - add unzGetLocalExtrafield for get the local extrafield info 61 | - add a new sample, miniunz.c 62 | 63 | Change in 0.4: (25 Feb 98) 64 | - suppress the type unzipFileInZip. 65 | Only on file in the zipfile can be open at the same time 66 | - fix somes typo in code 67 | - added tm_unz structure in unzip_file_info (date/time in readable format) 68 | -------------------------------------------------------------------------------- /minizip/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-O -I../.. 3 | 4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a 5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a 6 | 7 | .c.o: 8 | $(CC) -c $(CFLAGS) $*.c 9 | 10 | all: miniunz minizip 11 | 12 | miniunz: $(UNZ_OBJS) 13 | $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) 14 | 15 | minizip: $(ZIP_OBJS) 16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) 17 | 18 | test: miniunz minizip 19 | ./minizip test readme.txt 20 | ./miniunz -l test.zip 21 | mv readme.txt readme.old 22 | ./miniunz test.zip 23 | 24 | clean: 25 | /bin/rm -f *.o *~ minizip miniunz 26 | -------------------------------------------------------------------------------- /minizip/MiniZip64_Changes.txt: -------------------------------------------------------------------------------- 1 | 2 | MiniZip 1.1 was derrived from MiniZip at version 1.01f 3 | 4 | Change in 1.0 (Okt 2009) 5 | - **TODO - Add history** 6 | 7 | -------------------------------------------------------------------------------- /minizip/MiniZip64_info.txt: -------------------------------------------------------------------------------- 1 | MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson 2 | 3 | Introduction 4 | --------------------- 5 | MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0. 8 | All possible work was done for compatibility. 9 | 10 | 11 | Background 12 | --------------------- 13 | When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64 14 | support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ ) 15 | 16 | That was used as a starting point. And after that ZIP64 support was added to zip.c 17 | some refactoring and code cleanup was also done. 18 | 19 | 20 | Changed from MiniZip 1.0 to MiniZip 1.1 21 | --------------------------------------- 22 | * Added ZIP64 support for unzip ( by Even Rouault ) 23 | * Added ZIP64 support for zip ( by Mathias Svensson ) 24 | * Reverted some changed that Even Rouault did. 25 | * Bunch of patches received from Gulles Vollant that he received for MiniZip from various users. 26 | * Added unzip patch for BZIP Compression method (patch create by Daniel Borca) 27 | * Added BZIP Compress method for zip 28 | * Did some refactoring and code cleanup 29 | 30 | 31 | Credits 32 | 33 | Gilles Vollant - Original MiniZip author 34 | Even Rouault - ZIP64 unzip Support 35 | Daniel Borca - BZip Compression method support in unzip 36 | Mathias Svensson - ZIP64 zip support 37 | Mathias Svensson - BZip Compression method support in zip 38 | 39 | Resources 40 | 41 | ZipLayout http://result42.com/projects/ZipFileLayout 42 | Command line tool for Windows that shows the layout and information of the headers in a zip archive. 43 | Used when debugging and validating the creation of zip files using MiniZip64 44 | 45 | 46 | ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT 47 | Zip File specification 48 | 49 | 50 | Notes. 51 | * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined. 52 | 53 | License 54 | ---------------------------------------------------------- 55 | Condition of use and distribution are the same than zlib : 56 | 57 | This software is provided 'as-is', without any express or implied 58 | warranty. In no event will the authors be held liable for any damages 59 | arising from the use of this software. 60 | 61 | Permission is granted to anyone to use this software for any purpose, 62 | including commercial applications, and to alter it and redistribute it 63 | freely, subject to the following restrictions: 64 | 65 | 1. The origin of this software must not be misrepresented; you must not 66 | claim that you wrote the original software. If you use this software 67 | in a product, an acknowledgment in the product documentation would be 68 | appreciated but is not required. 69 | 2. Altered source versions must be plainly marked as such, and must not be 70 | misrepresented as being the original software. 71 | 3. This notice may not be removed or altered from any source distribution. 72 | 73 | ---------------------------------------------------------- 74 | 75 | -------------------------------------------------------------------------------- /minizip/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 31 | 32 | /*********************************************************************** 33 | * Return the next byte in the pseudo-random sequence 34 | */ 35 | static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) 36 | { 37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 38 | * unpredictable manner on 16-bit systems; not a problem 39 | * with any known compiler so far, though */ 40 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 43 | } 44 | 45 | /*********************************************************************** 46 | * Update the encryption keys with the next byte of plain text 47 | */ 48 | static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) 49 | { 50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 53 | { 54 | register int keyshift = (int)((*(pkeys+1)) >> 24); 55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 56 | } 57 | return c; 58 | } 59 | 60 | 61 | /*********************************************************************** 62 | * Initialize the encryption keys and the random header according to 63 | * the given password. 64 | */ 65 | static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) 66 | { 67 | *(pkeys+0) = 305419896L; 68 | *(pkeys+1) = 591751049L; 69 | *(pkeys+2) = 878082192L; 70 | while (*passwd != '\0') { 71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 72 | passwd++; 73 | } 74 | } 75 | 76 | #define zdecode(pkeys,pcrc_32_tab,c) \ 77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 | 79 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 | 82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83 | 84 | #define RAND_HEAD_LEN 12 85 | /* "last resort" source for second part of crypt seed pattern */ 86 | # ifndef ZCR_SEED2 87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88 | # endif 89 | 90 | static int crypthead(const char* passwd, /* password string */ 91 | unsigned char* buf, /* where to write header */ 92 | int bufSize, 93 | unsigned long* pkeys, 94 | const unsigned long* pcrc_32_tab, 95 | unsigned long crcForCrypting) 96 | { 97 | int n; /* index in random header */ 98 | int t; /* temporary */ 99 | int c; /* random byte */ 100 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 | static unsigned calls = 0; /* ensure different random header each time */ 102 | 103 | if (bufSize> 7) & 0xff; 118 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 119 | } 120 | /* Encrypt random header (last two bytes is high word of crc) */ 121 | init_keys(passwd, pkeys, pcrc_32_tab); 122 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 123 | { 124 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 125 | } 126 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 127 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 128 | return n; 129 | } 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /minizip/ioapi.c: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 5 | 6 | Modifications for Zip64 support 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 8 | 9 | For more info read MiniZip_info.txt 10 | 11 | */ 12 | 13 | #if (defined(_WIN32)) 14 | #define _CRT_SECURE_NO_WARNINGS 15 | #endif 16 | 17 | #include "ioapi.h" 18 | 19 | voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) 20 | { 21 | if (pfilefunc->zfile_func64.zopen64_file != NULL) 22 | return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); 23 | else 24 | { 25 | return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); 26 | } 27 | } 28 | 29 | long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) 30 | { 31 | if (pfilefunc->zfile_func64.zseek64_file != NULL) 32 | return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); 33 | else 34 | { 35 | uLong offsetTruncated = (uLong)offset; 36 | if (offsetTruncated != offset) 37 | return -1; 38 | else 39 | return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); 40 | } 41 | } 42 | 43 | ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) 44 | { 45 | if (pfilefunc->zfile_func64.zseek64_file != NULL) 46 | return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); 47 | else 48 | { 49 | uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); 50 | if ((tell_uLong) == ((uLong)-1)) 51 | return (ZPOS64_T)-1; 52 | else 53 | return tell_uLong; 54 | } 55 | } 56 | 57 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32) 58 | { 59 | p_filefunc64_32->zfile_func64.zopen64_file = NULL; 60 | p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; 61 | p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; 62 | p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; 63 | p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; 64 | p_filefunc64_32->zfile_func64.ztell64_file = NULL; 65 | p_filefunc64_32->zfile_func64.zseek64_file = NULL; 66 | p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; 67 | p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; 68 | p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque; 69 | p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file; 70 | p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; 71 | } 72 | 73 | 74 | 75 | static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); 76 | static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 77 | static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); 78 | static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); 79 | static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); 80 | static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); 81 | static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); 82 | 83 | static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) 84 | { 85 | FILE* file = NULL; 86 | const char* mode_fopen = NULL; 87 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 88 | mode_fopen = "rb"; 89 | else 90 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 91 | mode_fopen = "r+b"; 92 | else 93 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 94 | mode_fopen = "wb"; 95 | 96 | if ((filename!=NULL) && (mode_fopen != NULL)) 97 | file = fopen(filename, mode_fopen); 98 | return file; 99 | } 100 | 101 | static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) 102 | { 103 | FILE* file = NULL; 104 | const char* mode_fopen = NULL; 105 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 106 | mode_fopen = "rb"; 107 | else 108 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 109 | mode_fopen = "r+b"; 110 | else 111 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 112 | mode_fopen = "wb"; 113 | 114 | if ((filename!=NULL) && (mode_fopen != NULL)) 115 | file = fopen((const char*)filename, mode_fopen); 116 | return file; 117 | } 118 | 119 | 120 | static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) 121 | { 122 | uLong ret; 123 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); 124 | return ret; 125 | } 126 | 127 | static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) 128 | { 129 | uLong ret; 130 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); 131 | return ret; 132 | } 133 | 134 | static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) 135 | { 136 | long ret; 137 | ret = ftell((FILE *)stream); 138 | return ret; 139 | } 140 | 141 | 142 | static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) 143 | { 144 | ZPOS64_T ret; 145 | ret = ftello((FILE *)stream); 146 | return ret; 147 | } 148 | 149 | static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) 150 | { 151 | int fseek_origin=0; 152 | long ret; 153 | switch (origin) 154 | { 155 | case ZLIB_FILEFUNC_SEEK_CUR : 156 | fseek_origin = SEEK_CUR; 157 | break; 158 | case ZLIB_FILEFUNC_SEEK_END : 159 | fseek_origin = SEEK_END; 160 | break; 161 | case ZLIB_FILEFUNC_SEEK_SET : 162 | fseek_origin = SEEK_SET; 163 | break; 164 | default: return -1; 165 | } 166 | ret = 0; 167 | if (fseek((FILE *)stream, offset, fseek_origin) != 0) 168 | ret = -1; 169 | return ret; 170 | } 171 | 172 | static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) 173 | { 174 | int fseek_origin=0; 175 | long ret; 176 | switch (origin) 177 | { 178 | case ZLIB_FILEFUNC_SEEK_CUR : 179 | fseek_origin = SEEK_CUR; 180 | break; 181 | case ZLIB_FILEFUNC_SEEK_END : 182 | fseek_origin = SEEK_END; 183 | break; 184 | case ZLIB_FILEFUNC_SEEK_SET : 185 | fseek_origin = SEEK_SET; 186 | break; 187 | default: return -1; 188 | } 189 | ret = 0; 190 | 191 | if(fseeko((FILE *)stream, offset, fseek_origin) != 0) 192 | ret = -1; 193 | 194 | return ret; 195 | } 196 | 197 | 198 | static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) 199 | { 200 | int ret; 201 | ret = fclose((FILE *)stream); 202 | return ret; 203 | } 204 | 205 | static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) 206 | { 207 | int ret; 208 | ret = ferror((FILE *)stream); 209 | return ret; 210 | } 211 | 212 | void fill_fopen_filefunc (pzlib_filefunc_def) 213 | zlib_filefunc_def* pzlib_filefunc_def; 214 | { 215 | pzlib_filefunc_def->zopen_file = fopen_file_func; 216 | pzlib_filefunc_def->zread_file = fread_file_func; 217 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 218 | pzlib_filefunc_def->ztell_file = ftell_file_func; 219 | pzlib_filefunc_def->zseek_file = fseek_file_func; 220 | pzlib_filefunc_def->zclose_file = fclose_file_func; 221 | pzlib_filefunc_def->zerror_file = ferror_file_func; 222 | pzlib_filefunc_def->opaque = NULL; 223 | } 224 | 225 | void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) 226 | { 227 | pzlib_filefunc_def->zopen64_file = fopen64_file_func; 228 | pzlib_filefunc_def->zread_file = fread_file_func; 229 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 230 | pzlib_filefunc_def->ztell64_file = ftell64_file_func; 231 | pzlib_filefunc_def->zseek64_file = fseek64_file_func; 232 | pzlib_filefunc_def->zclose_file = fclose_file_func; 233 | pzlib_filefunc_def->zerror_file = ferror_file_func; 234 | pzlib_filefunc_def->opaque = NULL; 235 | } 236 | -------------------------------------------------------------------------------- /minizip/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 5 | 6 | Modifications for Zip64 support 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 8 | 9 | For more info read MiniZip_info.txt 10 | 11 | Changes 12 | 13 | Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) 14 | Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. 15 | More if/def section may be needed to support other platforms 16 | Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. 17 | (but you should use iowin32.c for windows instead) 18 | 19 | */ 20 | 21 | #ifndef _ZLIBIOAPI64_H 22 | #define _ZLIBIOAPI64_H 23 | 24 | #if (!defined(_WIN32)) && (!defined(WIN32)) 25 | 26 | // Linux needs this to support file operation on files larger then 4+GB 27 | // But might need better if/def to select just the platforms that needs them. 28 | 29 | #ifndef __USE_FILE_OFFSET64 30 | #define __USE_FILE_OFFSET64 31 | #endif 32 | #ifndef __USE_LARGEFILE64 33 | #define __USE_LARGEFILE64 34 | #endif 35 | #ifndef _LARGEFILE64_SOURCE 36 | #define _LARGEFILE64_SOURCE 37 | #endif 38 | #ifndef _FILE_OFFSET_BIT 39 | #define _FILE_OFFSET_BIT 64 40 | #endif 41 | #endif 42 | 43 | #include 44 | #include 45 | #include "zlib.h" 46 | 47 | #if defined(USE_FILE32API) 48 | #define fopen64 fopen 49 | #define ftello64 ftell 50 | #define fseeko64 fseek 51 | #else 52 | #ifdef _MSC_VER 53 | #define fopen64 fopen 54 | #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) 55 | #define ftello64 _ftelli64 56 | #define fseeko64 _fseeki64 57 | #else // old MSC 58 | #define ftello64 ftell 59 | #define fseeko64 fseek 60 | #endif 61 | #endif 62 | #endif 63 | 64 | /* 65 | #ifndef ZPOS64_T 66 | #ifdef _WIN32 67 | #define ZPOS64_T fpos_t 68 | #else 69 | #include 70 | #define ZPOS64_T uint64_t 71 | #endif 72 | #endif 73 | */ 74 | 75 | #ifdef HAVE_MINIZIP64_CONF_H 76 | #include "mz64conf.h" 77 | #endif 78 | 79 | /* a type choosen by DEFINE */ 80 | #ifdef HAVE_64BIT_INT_CUSTOM 81 | typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; 82 | #else 83 | #ifdef HAS_STDINT_H 84 | #include "stdint.h" 85 | typedef uint64_t ZPOS64_T; 86 | #else 87 | 88 | 89 | #if defined(_MSC_VER) || defined(__BORLANDC__) 90 | typedef unsigned __int64 ZPOS64_T; 91 | #else 92 | typedef unsigned long long int ZPOS64_T; 93 | #endif 94 | #endif 95 | #endif 96 | 97 | 98 | 99 | #ifdef __cplusplus 100 | extern "C" { 101 | #endif 102 | 103 | 104 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 105 | #define ZLIB_FILEFUNC_SEEK_END (2) 106 | #define ZLIB_FILEFUNC_SEEK_SET (0) 107 | 108 | #define ZLIB_FILEFUNC_MODE_READ (1) 109 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 110 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 111 | 112 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 113 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 114 | 115 | 116 | #ifndef ZCALLBACK 117 | #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 118 | #define ZCALLBACK CALLBACK 119 | #else 120 | #define ZCALLBACK 121 | #endif 122 | #endif 123 | 124 | 125 | 126 | 127 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 128 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 129 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 130 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 131 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 132 | 133 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 134 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 135 | 136 | 137 | /* here is the "old" 32 bits structure structure */ 138 | typedef struct zlib_filefunc_def_s 139 | { 140 | open_file_func zopen_file; 141 | read_file_func zread_file; 142 | write_file_func zwrite_file; 143 | tell_file_func ztell_file; 144 | seek_file_func zseek_file; 145 | close_file_func zclose_file; 146 | testerror_file_func zerror_file; 147 | voidpf opaque; 148 | } zlib_filefunc_def; 149 | 150 | typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); 151 | typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); 152 | typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); 153 | 154 | typedef struct zlib_filefunc64_def_s 155 | { 156 | open64_file_func zopen64_file; 157 | read_file_func zread_file; 158 | write_file_func zwrite_file; 159 | tell64_file_func ztell64_file; 160 | seek64_file_func zseek64_file; 161 | close_file_func zclose_file; 162 | testerror_file_func zerror_file; 163 | voidpf opaque; 164 | } zlib_filefunc64_def; 165 | 166 | void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); 167 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 168 | 169 | /* now internal definition, only for zip.c and unzip.h */ 170 | typedef struct zlib_filefunc64_32_def_s 171 | { 172 | zlib_filefunc64_def zfile_func64; 173 | open_file_func zopen32_file; 174 | tell_file_func ztell32_file; 175 | seek_file_func zseek32_file; 176 | } zlib_filefunc64_32_def; 177 | 178 | 179 | #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 180 | #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 181 | //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) 182 | //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) 183 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) 184 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) 185 | 186 | voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); 187 | long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); 188 | ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); 189 | 190 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); 191 | 192 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) 193 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) 194 | #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) 195 | 196 | #ifdef __cplusplus 197 | } 198 | #endif 199 | 200 | #endif 201 | -------------------------------------------------------------------------------- /minizip/make_vms.com: -------------------------------------------------------------------------------- 1 | $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig 2 | $ open/write zdef vmsdefs.h 3 | $ copy sys$input: zdef 4 | $ deck 5 | #define unix 6 | #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from 7 | #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator 8 | #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord 9 | #define Write_EndOfCentralDirectoryRecord Write_EoDRecord 10 | $ eod 11 | $ close zdef 12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h 13 | $ cc/include=[--]/prefix=all ioapi.c 14 | $ cc/include=[--]/prefix=all miniunz.c 15 | $ cc/include=[--]/prefix=all unzip.c 16 | $ cc/include=[--]/prefix=all minizip.c 17 | $ cc/include=[--]/prefix=all zip.c 18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib 19 | $ link minizip,zip,ioapi,[--]libz.olb/lib 20 | $ mcr []minizip test minizip_info.txt 21 | $ mcr []miniunz -l test.zip 22 | $ rename minizip_info.txt; minizip_info.txt_old 23 | $ mcr []miniunz test.zip 24 | $ delete test.zip;* 25 | $exit 26 | -------------------------------------------------------------------------------- /minizip/miniunz.c: -------------------------------------------------------------------------------- 1 | /* 2 | miniunz.c 3 | Version 1.1, February 14h, 2010 4 | sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 5 | 6 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 7 | 8 | Modifications of Unzip for Zip64 9 | Copyright (C) 2007-2008 Even Rouault 10 | 11 | Modifications for Zip64 support on both zip and unzip 12 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 13 | */ 14 | 15 | #ifndef _WIN32 16 | #ifndef __USE_FILE_OFFSET64 17 | #define __USE_FILE_OFFSET64 18 | #endif 19 | #ifndef __USE_LARGEFILE64 20 | #define __USE_LARGEFILE64 21 | #endif 22 | #ifndef _LARGEFILE64_SOURCE 23 | #define _LARGEFILE64_SOURCE 24 | #endif 25 | #ifndef _FILE_OFFSET_BIT 26 | #define _FILE_OFFSET_BIT 64 27 | #endif 28 | #endif 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #ifdef unix 38 | # include 39 | # include 40 | # include 41 | #else 42 | # include 43 | # include 44 | #endif 45 | 46 | #include "unzip.h" 47 | 48 | #define CASESENSITIVITY (0) 49 | #define WRITEBUFFERSIZE (8192) 50 | #define MAXFILENAME (256) 51 | 52 | #ifdef _WIN32 53 | #define USEWIN32IOAPI 54 | #include "iowin32.h" 55 | #endif 56 | /* 57 | mini unzip, demo of unzip package 58 | 59 | usage : 60 | Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir] 61 | 62 | list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT 63 | if it exists 64 | */ 65 | 66 | 67 | /* change_file_date : change the date/time of a file 68 | filename : the filename of the file where date/time must be modified 69 | dosdate : the new date at the MSDos format (4 bytes) 70 | tmu_date : the SAME new date at the tm_unz format */ 71 | void change_file_date(filename,dosdate,tmu_date) 72 | const char *filename; 73 | uLong dosdate; 74 | tm_unz tmu_date; 75 | { 76 | #ifdef _WIN32 77 | HANDLE hFile; 78 | FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; 79 | 80 | hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE, 81 | 0,NULL,OPEN_EXISTING,0,NULL); 82 | GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite); 83 | DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal); 84 | LocalFileTimeToFileTime(&ftLocal,&ftm); 85 | SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); 86 | CloseHandle(hFile); 87 | #else 88 | #ifdef unix 89 | struct utimbuf ut; 90 | struct tm newdate; 91 | newdate.tm_sec = tmu_date.tm_sec; 92 | newdate.tm_min=tmu_date.tm_min; 93 | newdate.tm_hour=tmu_date.tm_hour; 94 | newdate.tm_mday=tmu_date.tm_mday; 95 | newdate.tm_mon=tmu_date.tm_mon; 96 | if (tmu_date.tm_year > 1900) 97 | newdate.tm_year=tmu_date.tm_year - 1900; 98 | else 99 | newdate.tm_year=tmu_date.tm_year ; 100 | newdate.tm_isdst=-1; 101 | 102 | ut.actime=ut.modtime=mktime(&newdate); 103 | utime(filename,&ut); 104 | #endif 105 | #endif 106 | } 107 | 108 | 109 | /* mymkdir and change_file_date are not 100 % portable 110 | As I don't know well Unix, I wait feedback for the unix portion */ 111 | 112 | int mymkdir(dirname) 113 | const char* dirname; 114 | { 115 | int ret=0; 116 | #ifdef _WIN32 117 | ret = _mkdir(dirname); 118 | #else 119 | #ifdef unix 120 | ret = mkdir (dirname,0775); 121 | #endif 122 | #endif 123 | return ret; 124 | } 125 | 126 | int makedir (newdir) 127 | char *newdir; 128 | { 129 | char *buffer ; 130 | char *p; 131 | int len = (int)strlen(newdir); 132 | 133 | if (len <= 0) 134 | return 0; 135 | 136 | buffer = (char*)malloc(len+1); 137 | if (buffer==NULL) 138 | { 139 | printf("Error allocating memory\n"); 140 | return UNZ_INTERNALERROR; 141 | } 142 | strcpy(buffer,newdir); 143 | 144 | if (buffer[len-1] == '/') { 145 | buffer[len-1] = '\0'; 146 | } 147 | if (mymkdir(buffer) == 0) 148 | { 149 | free(buffer); 150 | return 1; 151 | } 152 | 153 | p = buffer+1; 154 | while (1) 155 | { 156 | char hold; 157 | 158 | while(*p && *p != '\\' && *p != '/') 159 | p++; 160 | hold = *p; 161 | *p = 0; 162 | if ((mymkdir(buffer) == -1) && (errno == ENOENT)) 163 | { 164 | printf("couldn't create directory %s\n",buffer); 165 | free(buffer); 166 | return 0; 167 | } 168 | if (hold == 0) 169 | break; 170 | *p++ = hold; 171 | } 172 | free(buffer); 173 | return 1; 174 | } 175 | 176 | void do_banner() 177 | { 178 | printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); 179 | printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 180 | } 181 | 182 | void do_help() 183 | { 184 | printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ 185 | " -e Extract without pathname (junk paths)\n" \ 186 | " -x Extract with pathname\n" \ 187 | " -v list files\n" \ 188 | " -l list files\n" \ 189 | " -d directory to extract into\n" \ 190 | " -o overwrite files without prompting\n" \ 191 | " -p extract crypted file using password\n\n"); 192 | } 193 | 194 | void Display64BitsSize(ZPOS64_T n, int size_char) 195 | { 196 | /* to avoid compatibility problem , we do here the conversion */ 197 | char number[21]; 198 | int offset=19; 199 | int pos_string = 19; 200 | number[20]=0; 201 | for (;;) { 202 | number[offset]=(char)((n%10)+'0'); 203 | if (number[offset] != '0') 204 | pos_string=offset; 205 | n/=10; 206 | if (offset==0) 207 | break; 208 | offset--; 209 | } 210 | { 211 | int size_display_string = 19-pos_string; 212 | while (size_char > size_display_string) 213 | { 214 | size_char--; 215 | printf(" "); 216 | } 217 | } 218 | 219 | printf("%s",&number[pos_string]); 220 | } 221 | 222 | int do_list(uf) 223 | unzFile uf; 224 | { 225 | uLong i; 226 | unz_global_info64 gi; 227 | int err; 228 | 229 | err = unzGetGlobalInfo64(uf,&gi); 230 | if (err!=UNZ_OK) 231 | printf("error %d with zipfile in unzGetGlobalInfo \n",err); 232 | printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); 233 | printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); 234 | for (i=0;i0) 248 | ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size); 249 | 250 | /* display a '*' if the file is crypted */ 251 | if ((file_info.flag & 1) != 0) 252 | charCrypt='*'; 253 | 254 | if (file_info.compression_method==0) 255 | string_method="Stored"; 256 | else 257 | if (file_info.compression_method==Z_DEFLATED) 258 | { 259 | uInt iLevel=(uInt)((file_info.flag & 0x6)/2); 260 | if (iLevel==0) 261 | string_method="Defl:N"; 262 | else if (iLevel==1) 263 | string_method="Defl:X"; 264 | else if ((iLevel==2) || (iLevel==3)) 265 | string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ 266 | } 267 | else 268 | if (file_info.compression_method==Z_BZIP2ED) 269 | { 270 | string_method="BZip2 "; 271 | } 272 | else 273 | string_method="Unkn. "; 274 | 275 | Display64BitsSize(file_info.uncompressed_size,7); 276 | printf(" %6s%c",string_method,charCrypt); 277 | Display64BitsSize(file_info.compressed_size,7); 278 | printf(" %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", 279 | ratio, 280 | (uLong)file_info.tmu_date.tm_mon + 1, 281 | (uLong)file_info.tmu_date.tm_mday, 282 | (uLong)file_info.tmu_date.tm_year % 100, 283 | (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min, 284 | (uLong)file_info.crc,filename_inzip); 285 | if ((i+1)='a') && (rep<='z')) 385 | rep -= 0x20; 386 | } 387 | while ((rep!='Y') && (rep!='N') && (rep!='A')); 388 | } 389 | 390 | if (rep == 'N') 391 | skip = 1; 392 | 393 | if (rep == 'A') 394 | *popt_overwrite=1; 395 | } 396 | 397 | if ((skip==0) && (err==UNZ_OK)) 398 | { 399 | fout=fopen64(write_filename,"wb"); 400 | 401 | /* some zipfile don't contain directory alone before file */ 402 | if ((fout==NULL) && ((*popt_extract_without_path)==0) && 403 | (filename_withoutpath!=(char*)filename_inzip)) 404 | { 405 | char c=*(filename_withoutpath-1); 406 | *(filename_withoutpath-1)='\0'; 407 | makedir(write_filename); 408 | *(filename_withoutpath-1)=c; 409 | fout=fopen64(write_filename,"wb"); 410 | } 411 | 412 | if (fout==NULL) 413 | { 414 | printf("error opening %s\n",write_filename); 415 | } 416 | } 417 | 418 | if (fout!=NULL) 419 | { 420 | printf(" extracting: %s\n",write_filename); 421 | 422 | do 423 | { 424 | err = unzReadCurrentFile(uf,buf,size_buf); 425 | if (err<0) 426 | { 427 | printf("error %d with zipfile in unzReadCurrentFile\n",err); 428 | break; 429 | } 430 | if (err>0) 431 | if (fwrite(buf,err,1,fout)!=1) 432 | { 433 | printf("error in writing extracted file\n"); 434 | err=UNZ_ERRNO; 435 | break; 436 | } 437 | } 438 | while (err>0); 439 | if (fout) 440 | fclose(fout); 441 | 442 | if (err==0) 443 | change_file_date(write_filename,file_info.dosDate, 444 | file_info.tmu_date); 445 | } 446 | 447 | if (err==UNZ_OK) 448 | { 449 | err = unzCloseCurrentFile (uf); 450 | if (err!=UNZ_OK) 451 | { 452 | printf("error %d with zipfile in unzCloseCurrentFile\n",err); 453 | } 454 | } 455 | else 456 | unzCloseCurrentFile(uf); /* don't lose the error */ 457 | } 458 | 459 | free(buf); 460 | return err; 461 | } 462 | 463 | 464 | int do_extract(uf,opt_extract_without_path,opt_overwrite,password) 465 | unzFile uf; 466 | int opt_extract_without_path; 467 | int opt_overwrite; 468 | const char* password; 469 | { 470 | uLong i; 471 | unz_global_info64 gi; 472 | int err; 473 | FILE* fout=NULL; 474 | 475 | err = unzGetGlobalInfo64(uf,&gi); 476 | if (err!=UNZ_OK) 477 | printf("error %d with zipfile in unzGetGlobalInfo \n",err); 478 | 479 | for (i=0;i 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #ifdef unix 39 | # include 40 | # include 41 | # include 42 | # include 43 | #else 44 | # include 45 | # include 46 | #endif 47 | 48 | #include "zip.h" 49 | 50 | #ifdef _WIN32 51 | #define USEWIN32IOAPI 52 | #include "iowin32.h" 53 | #endif 54 | 55 | 56 | 57 | #define WRITEBUFFERSIZE (16384) 58 | #define MAXFILENAME (256) 59 | 60 | #ifdef _WIN32 61 | uLong filetime(f, tmzip, dt) 62 | char *f; /* name of file to get info on */ 63 | tm_zip *tmzip; /* return value: access, modific. and creation times */ 64 | uLong *dt; /* dostime */ 65 | { 66 | int ret = 0; 67 | { 68 | FILETIME ftLocal; 69 | HANDLE hFind; 70 | WIN32_FIND_DATAA ff32; 71 | 72 | hFind = FindFirstFileA(f,&ff32); 73 | if (hFind != INVALID_HANDLE_VALUE) 74 | { 75 | FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); 76 | FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); 77 | FindClose(hFind); 78 | ret = 1; 79 | } 80 | } 81 | return ret; 82 | } 83 | #else 84 | #ifdef unix 85 | uLong filetime(f, tmzip, dt) 86 | char *f; /* name of file to get info on */ 87 | tm_zip *tmzip; /* return value: access, modific. and creation times */ 88 | uLong *dt; /* dostime */ 89 | { 90 | int ret=0; 91 | struct stat s; /* results of stat() */ 92 | struct tm* filedate; 93 | time_t tm_t=0; 94 | 95 | if (strcmp(f,"-")!=0) 96 | { 97 | char name[MAXFILENAME+1]; 98 | int len = strlen(f); 99 | if (len > MAXFILENAME) 100 | len = MAXFILENAME; 101 | 102 | strncpy(name, f,MAXFILENAME-1); 103 | /* strncpy doesnt append the trailing NULL, of the string is too long. */ 104 | name[ MAXFILENAME ] = '\0'; 105 | 106 | if (name[len - 1] == '/') 107 | name[len - 1] = '\0'; 108 | /* not all systems allow stat'ing a file with / appended */ 109 | if (stat(name,&s)==0) 110 | { 111 | tm_t = s.st_mtime; 112 | ret = 1; 113 | } 114 | } 115 | filedate = localtime(&tm_t); 116 | 117 | tmzip->tm_sec = filedate->tm_sec; 118 | tmzip->tm_min = filedate->tm_min; 119 | tmzip->tm_hour = filedate->tm_hour; 120 | tmzip->tm_mday = filedate->tm_mday; 121 | tmzip->tm_mon = filedate->tm_mon ; 122 | tmzip->tm_year = filedate->tm_year; 123 | 124 | return ret; 125 | } 126 | #else 127 | uLong filetime(f, tmzip, dt) 128 | char *f; /* name of file to get info on */ 129 | tm_zip *tmzip; /* return value: access, modific. and creation times */ 130 | uLong *dt; /* dostime */ 131 | { 132 | return 0; 133 | } 134 | #endif 135 | #endif 136 | 137 | 138 | 139 | 140 | int check_exist_file(filename) 141 | const char* filename; 142 | { 143 | FILE* ftestexist; 144 | int ret = 1; 145 | ftestexist = fopen64(filename,"rb"); 146 | if (ftestexist==NULL) 147 | ret = 0; 148 | else 149 | fclose(ftestexist); 150 | return ret; 151 | } 152 | 153 | void do_banner() 154 | { 155 | printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); 156 | printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); 157 | } 158 | 159 | void do_help() 160 | { 161 | printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ 162 | " -o Overwrite existing file.zip\n" \ 163 | " -a Append to existing file.zip\n" \ 164 | " -0 Store only\n" \ 165 | " -1 Compress faster\n" \ 166 | " -9 Compress better\n\n" \ 167 | " -j exclude path. store only the file name.\n\n"); 168 | } 169 | 170 | /* calculate the CRC32 of a file, 171 | because to encrypt a file, we need known the CRC32 of the file before */ 172 | int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) 173 | { 174 | unsigned long calculate_crc=0; 175 | int err=ZIP_OK; 176 | FILE * fin = fopen64(filenameinzip,"rb"); 177 | unsigned long size_read = 0; 178 | unsigned long total_read = 0; 179 | if (fin==NULL) 180 | { 181 | err = ZIP_ERRNO; 182 | } 183 | 184 | if (err == ZIP_OK) 185 | do 186 | { 187 | err = ZIP_OK; 188 | size_read = (int)fread(buf,1,size_buf,fin); 189 | if (size_read < size_buf) 190 | if (feof(fin)==0) 191 | { 192 | printf("error in reading %s\n",filenameinzip); 193 | err = ZIP_ERRNO; 194 | } 195 | 196 | if (size_read>0) 197 | calculate_crc = crc32(calculate_crc,buf,size_read); 198 | total_read += size_read; 199 | 200 | } while ((err == ZIP_OK) && (size_read>0)); 201 | 202 | if (fin) 203 | fclose(fin); 204 | 205 | *result_crc=calculate_crc; 206 | printf("file %s crc %lx\n", filenameinzip, calculate_crc); 207 | return err; 208 | } 209 | 210 | int isLargeFile(const char* filename) 211 | { 212 | int largeFile = 0; 213 | ZPOS64_T pos = 0; 214 | FILE* pFile = fopen64(filename, "rb"); 215 | 216 | if(pFile != NULL) 217 | { 218 | int n = fseeko64(pFile, 0, SEEK_END); 219 | 220 | pos = ftello64(pFile); 221 | 222 | printf("File : %s is %lld bytes\n", filename, pos); 223 | 224 | if(pos >= 0xffffffff) 225 | largeFile = 1; 226 | 227 | fclose(pFile); 228 | } 229 | 230 | return largeFile; 231 | } 232 | 233 | int main(argc,argv) 234 | int argc; 235 | char *argv[]; 236 | { 237 | int i; 238 | int opt_overwrite=0; 239 | int opt_compress_level=Z_DEFAULT_COMPRESSION; 240 | int opt_exclude_path=0; 241 | int zipfilenamearg = 0; 242 | char filename_try[MAXFILENAME+16]; 243 | int zipok; 244 | int err=0; 245 | int size_buf=0; 246 | void* buf=NULL; 247 | const char* password=NULL; 248 | 249 | 250 | do_banner(); 251 | if (argc==1) 252 | { 253 | do_help(); 254 | return 0; 255 | } 256 | else 257 | { 258 | for (i=1;i='0') && (c<='9')) 272 | opt_compress_level = c-'0'; 273 | if ((c=='j') || (c=='J')) 274 | opt_exclude_path = 1; 275 | 276 | if (((c=='p') || (c=='P')) && (i+1='a') && (rep<='z')) 346 | rep -= 0x20; 347 | } 348 | while ((rep!='Y') && (rep!='N') && (rep!='A')); 349 | if (rep=='N') 350 | zipok = 0; 351 | if (rep=='A') 352 | opt_overwrite = 2; 353 | } 354 | } 355 | 356 | if (zipok==1) 357 | { 358 | zipFile zf; 359 | int errclose; 360 | # ifdef USEWIN32IOAPI 361 | zlib_filefunc64_def ffunc; 362 | fill_win32_filefunc64A(&ffunc); 363 | zf = zipOpen2_64(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc); 364 | # else 365 | zf = zipOpen64(filename_try,(opt_overwrite==2) ? 2 : 0); 366 | # endif 367 | 368 | if (zf == NULL) 369 | { 370 | printf("error opening %s\n",filename_try); 371 | err= ZIP_ERRNO; 372 | } 373 | else 374 | printf("creating %s\n",filename_try); 375 | 376 | for (i=zipfilenamearg+1;(i='0') || (argv[i][1]<='9'))) && 383 | (strlen(argv[i]) == 2))) 384 | { 385 | FILE * fin; 386 | int size_read; 387 | const char* filenameinzip = argv[i]; 388 | const char *savefilenameinzip; 389 | zip_fileinfo zi; 390 | unsigned long crcFile=0; 391 | int zip64 = 0; 392 | 393 | zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = 394 | zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; 395 | zi.dosDate = 0; 396 | zi.internal_fa = 0; 397 | zi.external_fa = 0; 398 | filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); 399 | 400 | /* 401 | err = zipOpenNewFileInZip(zf,filenameinzip,&zi, 402 | NULL,0,NULL,0,NULL / * comment * /, 403 | (opt_compress_level != 0) ? Z_DEFLATED : 0, 404 | opt_compress_level); 405 | */ 406 | if ((password != NULL) && (err==ZIP_OK)) 407 | err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); 408 | 409 | zip64 = isLargeFile(filenameinzip); 410 | 411 | /* The path name saved, should not include a leading slash. */ 412 | /*if it did, windows/xp and dynazip couldn't read the zip file. */ 413 | savefilenameinzip = filenameinzip; 414 | while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' ) 415 | { 416 | savefilenameinzip++; 417 | } 418 | 419 | /*should the zip file contain any path at all?*/ 420 | if( opt_exclude_path ) 421 | { 422 | const char *tmpptr; 423 | const char *lastslash = 0; 424 | for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++) 425 | { 426 | if( *tmpptr == '\\' || *tmpptr == '/') 427 | { 428 | lastslash = tmpptr; 429 | } 430 | } 431 | if( lastslash != NULL ) 432 | { 433 | savefilenameinzip = lastslash+1; // base filename follows last slash. 434 | } 435 | } 436 | 437 | /**/ 438 | err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi, 439 | NULL,0,NULL,0,NULL /* comment*/, 440 | (opt_compress_level != 0) ? Z_DEFLATED : 0, 441 | opt_compress_level,0, 442 | /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ 443 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, 444 | password,crcFile, zip64); 445 | 446 | if (err != ZIP_OK) 447 | printf("error in opening %s in zipfile\n",filenameinzip); 448 | else 449 | { 450 | fin = fopen64(filenameinzip,"rb"); 451 | if (fin==NULL) 452 | { 453 | err=ZIP_ERRNO; 454 | printf("error in opening %s for reading\n",filenameinzip); 455 | } 456 | } 457 | 458 | if (err == ZIP_OK) 459 | do 460 | { 461 | err = ZIP_OK; 462 | size_read = (int)fread(buf,1,size_buf,fin); 463 | if (size_read < size_buf) 464 | if (feof(fin)==0) 465 | { 466 | printf("error in reading %s\n",filenameinzip); 467 | err = ZIP_ERRNO; 468 | } 469 | 470 | if (size_read>0) 471 | { 472 | err = zipWriteInFileInZip (zf,buf,size_read); 473 | if (err<0) 474 | { 475 | printf("error in writing %s in the zipfile\n", 476 | filenameinzip); 477 | } 478 | 479 | } 480 | } while ((err == ZIP_OK) && (size_read>0)); 481 | 482 | if (fin) 483 | fclose(fin); 484 | 485 | if (err<0) 486 | err=ZIP_ERRNO; 487 | else 488 | { 489 | err = zipCloseFileInZip(zf); 490 | if (err!=ZIP_OK) 491 | printf("error in closing %s in the zipfile\n", 492 | filenameinzip); 493 | } 494 | } 495 | } 496 | errclose = zipClose(zf,NULL); 497 | if (errclose != ZIP_OK) 498 | printf("error in closing %s\n",filename_try); 499 | } 500 | else 501 | { 502 | do_help(); 503 | } 504 | 505 | free(buf); 506 | return 0; 507 | } 508 | -------------------------------------------------------------------------------- /minizip/mztools.c: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | /* Code */ 8 | #include 9 | #include 10 | #include 11 | #include "zlib.h" 12 | #include "unzip.h" 13 | 14 | #define READ_8(adr) ((unsigned char)*(adr)) 15 | #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) 16 | #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) 17 | 18 | #define WRITE_8(buff, n) do { \ 19 | *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ 20 | } while(0) 21 | #define WRITE_16(buff, n) do { \ 22 | WRITE_8((unsigned char*)(buff), n); \ 23 | WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \ 24 | } while(0) 25 | #define WRITE_32(buff, n) do { \ 26 | WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ 27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ 28 | } while(0) 29 | 30 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) 31 | const char* file; 32 | const char* fileOut; 33 | const char* fileOutTmp; 34 | uLong* nRecovered; 35 | uLong* bytesRecovered; 36 | { 37 | int err = Z_OK; 38 | FILE* fpZip = fopen(file, "rb"); 39 | FILE* fpOut = fopen(fileOut, "wb"); 40 | FILE* fpOutCD = fopen(fileOutTmp, "wb"); 41 | if (fpZip != NULL && fpOut != NULL) { 42 | int entries = 0; 43 | uLong totalBytes = 0; 44 | char header[30]; 45 | char filename[256]; 46 | char extra[1024]; 47 | int offset = 0; 48 | int offsetCD = 0; 49 | while ( fread(header, 1, 30, fpZip) == 30 ) { 50 | int currentOffset = offset; 51 | 52 | /* File entry */ 53 | if (READ_32(header) == 0x04034b50) { 54 | unsigned int version = READ_16(header + 4); 55 | unsigned int gpflag = READ_16(header + 6); 56 | unsigned int method = READ_16(header + 8); 57 | unsigned int filetime = READ_16(header + 10); 58 | unsigned int filedate = READ_16(header + 12); 59 | unsigned int crc = READ_32(header + 14); /* crc */ 60 | unsigned int cpsize = READ_32(header + 18); /* compressed size */ 61 | unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ 62 | unsigned int fnsize = READ_16(header + 26); /* file name length */ 63 | unsigned int extsize = READ_16(header + 28); /* extra field length */ 64 | filename[0] = extra[0] = '\0'; 65 | 66 | /* Header */ 67 | if (fwrite(header, 1, 30, fpOut) == 30) { 68 | offset += 30; 69 | } else { 70 | err = Z_ERRNO; 71 | break; 72 | } 73 | 74 | /* Filename */ 75 | if (fnsize > 0) { 76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { 77 | if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { 78 | offset += fnsize; 79 | } else { 80 | err = Z_ERRNO; 81 | break; 82 | } 83 | } else { 84 | err = Z_ERRNO; 85 | break; 86 | } 87 | } else { 88 | err = Z_STREAM_ERROR; 89 | break; 90 | } 91 | 92 | /* Extra field */ 93 | if (extsize > 0) { 94 | if (fread(extra, 1, extsize, fpZip) == extsize) { 95 | if (fwrite(extra, 1, extsize, fpOut) == extsize) { 96 | offset += extsize; 97 | } else { 98 | err = Z_ERRNO; 99 | break; 100 | } 101 | } else { 102 | err = Z_ERRNO; 103 | break; 104 | } 105 | } 106 | 107 | /* Data */ 108 | { 109 | int dataSize = cpsize; 110 | if (dataSize == 0) { 111 | dataSize = uncpsize; 112 | } 113 | if (dataSize > 0) { 114 | char* data = malloc(dataSize); 115 | if (data != NULL) { 116 | if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { 117 | if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { 118 | offset += dataSize; 119 | totalBytes += dataSize; 120 | } else { 121 | err = Z_ERRNO; 122 | } 123 | } else { 124 | err = Z_ERRNO; 125 | } 126 | free(data); 127 | if (err != Z_OK) { 128 | break; 129 | } 130 | } else { 131 | err = Z_MEM_ERROR; 132 | break; 133 | } 134 | } 135 | } 136 | 137 | /* Central directory entry */ 138 | { 139 | char header[46]; 140 | char* comment = ""; 141 | int comsize = (int) strlen(comment); 142 | WRITE_32(header, 0x02014b50); 143 | WRITE_16(header + 4, version); 144 | WRITE_16(header + 6, version); 145 | WRITE_16(header + 8, gpflag); 146 | WRITE_16(header + 10, method); 147 | WRITE_16(header + 12, filetime); 148 | WRITE_16(header + 14, filedate); 149 | WRITE_32(header + 16, crc); 150 | WRITE_32(header + 20, cpsize); 151 | WRITE_32(header + 24, uncpsize); 152 | WRITE_16(header + 28, fnsize); 153 | WRITE_16(header + 30, extsize); 154 | WRITE_16(header + 32, comsize); 155 | WRITE_16(header + 34, 0); /* disk # */ 156 | WRITE_16(header + 36, 0); /* int attrb */ 157 | WRITE_32(header + 38, 0); /* ext attrb */ 158 | WRITE_32(header + 42, currentOffset); 159 | /* Header */ 160 | if (fwrite(header, 1, 46, fpOutCD) == 46) { 161 | offsetCD += 46; 162 | 163 | /* Filename */ 164 | if (fnsize > 0) { 165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { 166 | offsetCD += fnsize; 167 | } else { 168 | err = Z_ERRNO; 169 | break; 170 | } 171 | } else { 172 | err = Z_STREAM_ERROR; 173 | break; 174 | } 175 | 176 | /* Extra field */ 177 | if (extsize > 0) { 178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { 179 | offsetCD += extsize; 180 | } else { 181 | err = Z_ERRNO; 182 | break; 183 | } 184 | } 185 | 186 | /* Comment field */ 187 | if (comsize > 0) { 188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { 189 | offsetCD += comsize; 190 | } else { 191 | err = Z_ERRNO; 192 | break; 193 | } 194 | } 195 | 196 | 197 | } else { 198 | err = Z_ERRNO; 199 | break; 200 | } 201 | } 202 | 203 | /* Success */ 204 | entries++; 205 | 206 | } else { 207 | break; 208 | } 209 | } 210 | 211 | /* Final central directory */ 212 | { 213 | int entriesZip = entries; 214 | char header[22]; 215 | char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; 216 | int comsize = (int) strlen(comment); 217 | if (entriesZip > 0xffff) { 218 | entriesZip = 0xffff; 219 | } 220 | WRITE_32(header, 0x06054b50); 221 | WRITE_16(header + 4, 0); /* disk # */ 222 | WRITE_16(header + 6, 0); /* disk # */ 223 | WRITE_16(header + 8, entriesZip); /* hack */ 224 | WRITE_16(header + 10, entriesZip); /* hack */ 225 | WRITE_32(header + 12, offsetCD); /* size of CD */ 226 | WRITE_32(header + 16, offset); /* offset to CD */ 227 | WRITE_16(header + 20, comsize); /* comment */ 228 | 229 | /* Header */ 230 | if (fwrite(header, 1, 22, fpOutCD) == 22) { 231 | 232 | /* Comment field */ 233 | if (comsize > 0) { 234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { 235 | err = Z_ERRNO; 236 | } 237 | } 238 | 239 | } else { 240 | err = Z_ERRNO; 241 | } 242 | } 243 | 244 | /* Final merge (file + central directory) */ 245 | fclose(fpOutCD); 246 | if (err == Z_OK) { 247 | fpOutCD = fopen(fileOutTmp, "rb"); 248 | if (fpOutCD != NULL) { 249 | int nRead; 250 | char buffer[8192]; 251 | while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { 252 | if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { 253 | err = Z_ERRNO; 254 | break; 255 | } 256 | } 257 | fclose(fpOutCD); 258 | } 259 | } 260 | 261 | /* Close */ 262 | fclose(fpZip); 263 | fclose(fpOut); 264 | 265 | /* Wipe temporary file */ 266 | (void)remove(fileOutTmp); 267 | 268 | /* Number of recovered entries */ 269 | if (err == Z_OK) { 270 | if (nRecovered != NULL) { 271 | *nRecovered = entries; 272 | } 273 | if (bytesRecovered != NULL) { 274 | *bytesRecovered = totalBytes; 275 | } 276 | } 277 | } else { 278 | err = Z_STREAM_ERROR; 279 | } 280 | return err; 281 | } 282 | -------------------------------------------------------------------------------- /minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /minizip/unzip.h: -------------------------------------------------------------------------------- 1 | /* unzip.h -- IO for uncompress .zip files using zlib 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications of Unzip for Zip64 8 | Copyright (C) 2007-2008 Even Rouault 9 | 10 | Modifications for Zip64 support on both zip and unzip 11 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 12 | 13 | For more info read MiniZip_info.txt 14 | 15 | --------------------------------------------------------------------------------- 16 | 17 | Condition of use and distribution are the same than zlib : 18 | 19 | This software is provided 'as-is', without any express or implied 20 | warranty. In no event will the authors be held liable for any damages 21 | arising from the use of this software. 22 | 23 | Permission is granted to anyone to use this software for any purpose, 24 | including commercial applications, and to alter it and redistribute it 25 | freely, subject to the following restrictions: 26 | 27 | 1. The origin of this software must not be misrepresented; you must not 28 | claim that you wrote the original software. If you use this software 29 | in a product, an acknowledgment in the product documentation would be 30 | appreciated but is not required. 31 | 2. Altered source versions must be plainly marked as such, and must not be 32 | misrepresented as being the original software. 33 | 3. This notice may not be removed or altered from any source distribution. 34 | 35 | --------------------------------------------------------------------------------- 36 | 37 | Changes 38 | 39 | See header of unzip64.c 40 | 41 | */ 42 | 43 | #ifndef _unz64_H 44 | #define _unz64_H 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | #ifndef _ZLIB_H 51 | #include "zlib.h" 52 | #endif 53 | 54 | #ifndef _ZLIBIOAPI_H 55 | #include "ioapi.h" 56 | #endif 57 | 58 | #ifdef HAVE_BZIP2 59 | #include "bzlib.h" 60 | #endif 61 | 62 | #define Z_BZIP2ED 12 63 | 64 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) 65 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 66 | from (void*) without cast */ 67 | typedef struct TagunzFile__ { int unused; } unzFile__; 68 | typedef unzFile__ *unzFile; 69 | #else 70 | typedef voidp unzFile; 71 | #endif 72 | 73 | 74 | #define UNZ_OK (0) 75 | #define UNZ_END_OF_LIST_OF_FILE (-100) 76 | #define UNZ_ERRNO (Z_ERRNO) 77 | #define UNZ_EOF (0) 78 | #define UNZ_PARAMERROR (-102) 79 | #define UNZ_BADZIPFILE (-103) 80 | #define UNZ_INTERNALERROR (-104) 81 | #define UNZ_CRCERROR (-105) 82 | 83 | /* tm_unz contain date/time info */ 84 | typedef struct tm_unz_s 85 | { 86 | uInt tm_sec; /* seconds after the minute - [0,59] */ 87 | uInt tm_min; /* minutes after the hour - [0,59] */ 88 | uInt tm_hour; /* hours since midnight - [0,23] */ 89 | uInt tm_mday; /* day of the month - [1,31] */ 90 | uInt tm_mon; /* months since January - [0,11] */ 91 | uInt tm_year; /* years - [1980..2044] */ 92 | } tm_unz; 93 | 94 | /* unz_global_info structure contain global data about the ZIPfile 95 | These data comes from the end of central dir */ 96 | typedef struct unz_global_info64_s 97 | { 98 | ZPOS64_T number_entry; /* total number of entries in 99 | the central dir on this disk */ 100 | uLong size_comment; /* size of the global comment of the zipfile */ 101 | } unz_global_info64; 102 | 103 | typedef struct unz_global_info_s 104 | { 105 | uLong number_entry; /* total number of entries in 106 | the central dir on this disk */ 107 | uLong size_comment; /* size of the global comment of the zipfile */ 108 | } unz_global_info; 109 | 110 | /* unz_file_info contain information about a file in the zipfile */ 111 | typedef struct unz_file_info64_s 112 | { 113 | uLong version; /* version made by 2 bytes */ 114 | uLong version_needed; /* version needed to extract 2 bytes */ 115 | uLong flag; /* general purpose bit flag 2 bytes */ 116 | uLong compression_method; /* compression method 2 bytes */ 117 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 118 | uLong crc; /* crc-32 4 bytes */ 119 | ZPOS64_T compressed_size; /* compressed size 8 bytes */ 120 | ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ 121 | uLong size_filename; /* filename length 2 bytes */ 122 | uLong size_file_extra; /* extra field length 2 bytes */ 123 | uLong size_file_comment; /* file comment length 2 bytes */ 124 | 125 | uLong disk_num_start; /* disk number start 2 bytes */ 126 | uLong internal_fa; /* internal file attributes 2 bytes */ 127 | uLong external_fa; /* external file attributes 4 bytes */ 128 | 129 | tm_unz tmu_date; 130 | } unz_file_info64; 131 | 132 | typedef struct unz_file_info_s 133 | { 134 | uLong version; /* version made by 2 bytes */ 135 | uLong version_needed; /* version needed to extract 2 bytes */ 136 | uLong flag; /* general purpose bit flag 2 bytes */ 137 | uLong compression_method; /* compression method 2 bytes */ 138 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 139 | uLong crc; /* crc-32 4 bytes */ 140 | uLong compressed_size; /* compressed size 4 bytes */ 141 | uLong uncompressed_size; /* uncompressed size 4 bytes */ 142 | uLong size_filename; /* filename length 2 bytes */ 143 | uLong size_file_extra; /* extra field length 2 bytes */ 144 | uLong size_file_comment; /* file comment length 2 bytes */ 145 | 146 | uLong disk_num_start; /* disk number start 2 bytes */ 147 | uLong internal_fa; /* internal file attributes 2 bytes */ 148 | uLong external_fa; /* external file attributes 4 bytes */ 149 | 150 | tm_unz tmu_date; 151 | } unz_file_info; 152 | 153 | extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, 154 | const char* fileName2, 155 | int iCaseSensitivity)); 156 | /* 157 | Compare two filename (fileName1,fileName2). 158 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) 159 | If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi 160 | or strcasecmp) 161 | If iCaseSenisivity = 0, case sensitivity is defaut of your operating system 162 | (like 1 on Unix, 2 on Windows) 163 | */ 164 | 165 | 166 | extern unzFile ZEXPORT unzOpen OF((const char *path)); 167 | extern unzFile ZEXPORT unzOpen64 OF((const void *path)); 168 | /* 169 | Open a Zip file. path contain the full pathname (by example, 170 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer 171 | "zlib/zlib113.zip". 172 | If the zipfile cannot be opened (file don't exist or in not valid), the 173 | return value is NULL. 174 | Else, the return value is a unzFile Handle, usable with other function 175 | of this unzip package. 176 | the "64" function take a const void* pointer, because the path is just the 177 | value passed to the open64_file_func callback. 178 | Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path 179 | is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* 180 | does not describe the reality 181 | */ 182 | 183 | 184 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, 185 | zlib_filefunc_def* pzlib_filefunc_def)); 186 | /* 187 | Open a Zip file, like unzOpen, but provide a set of file low level API 188 | for read/write the zip file (see ioapi.h) 189 | */ 190 | 191 | extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, 192 | zlib_filefunc64_def* pzlib_filefunc_def)); 193 | /* 194 | Open a Zip file, like unz64Open, but provide a set of file low level API 195 | for read/write the zip file (see ioapi.h) 196 | */ 197 | 198 | extern int ZEXPORT unzClose OF((unzFile file)); 199 | /* 200 | Close a ZipFile opened with unzipOpen. 201 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 202 | these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 203 | return UNZ_OK if there is no problem. */ 204 | 205 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, 206 | unz_global_info *pglobal_info)); 207 | 208 | extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, 209 | unz_global_info64 *pglobal_info)); 210 | /* 211 | Write info about the ZipFile in the *pglobal_info structure. 212 | No preparation of the structure is needed 213 | return UNZ_OK if there is no problem. */ 214 | 215 | 216 | extern int ZEXPORT unzGetGlobalComment OF((unzFile file, 217 | char *szComment, 218 | uLong uSizeBuf)); 219 | /* 220 | Get the global comment string of the ZipFile, in the szComment buffer. 221 | uSizeBuf is the size of the szComment buffer. 222 | return the number of byte copied or an error code <0 223 | */ 224 | 225 | 226 | /***************************************************************************/ 227 | /* Unzip package allow you browse the directory of the zipfile */ 228 | 229 | extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); 230 | /* 231 | Set the current file of the zipfile to the first file. 232 | return UNZ_OK if there is no problem 233 | */ 234 | 235 | extern int ZEXPORT unzGoToNextFile OF((unzFile file)); 236 | /* 237 | Set the current file of the zipfile to the next file. 238 | return UNZ_OK if there is no problem 239 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 240 | */ 241 | 242 | extern int ZEXPORT unzLocateFile OF((unzFile file, 243 | const char *szFileName, 244 | int iCaseSensitivity)); 245 | /* 246 | Try locate the file szFileName in the zipfile. 247 | For the iCaseSensitivity signification, see unzStringFileNameCompare 248 | 249 | return value : 250 | UNZ_OK if the file is found. It becomes the current file. 251 | UNZ_END_OF_LIST_OF_FILE if the file is not found 252 | */ 253 | 254 | 255 | /* ****************************************** */ 256 | /* Ryan supplied functions */ 257 | /* unz_file_info contain information about a file in the zipfile */ 258 | typedef struct unz_file_pos_s 259 | { 260 | uLong pos_in_zip_directory; /* offset in zip file directory */ 261 | uLong num_of_file; /* # of file */ 262 | } unz_file_pos; 263 | 264 | extern int ZEXPORT unzGetFilePos( 265 | unzFile file, 266 | unz_file_pos* file_pos); 267 | 268 | extern int ZEXPORT unzGoToFilePos( 269 | unzFile file, 270 | unz_file_pos* file_pos); 271 | 272 | typedef struct unz64_file_pos_s 273 | { 274 | ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ 275 | ZPOS64_T num_of_file; /* # of file */ 276 | } unz64_file_pos; 277 | 278 | extern int ZEXPORT unzGetFilePos64( 279 | unzFile file, 280 | unz64_file_pos* file_pos); 281 | 282 | extern int ZEXPORT unzGoToFilePos64( 283 | unzFile file, 284 | const unz64_file_pos* file_pos); 285 | 286 | /* ****************************************** */ 287 | 288 | extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, 289 | unz_file_info64 *pfile_info, 290 | char *szFileName, 291 | uLong fileNameBufferSize, 292 | void *extraField, 293 | uLong extraFieldBufferSize, 294 | char *szComment, 295 | uLong commentBufferSize)); 296 | 297 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, 298 | unz_file_info *pfile_info, 299 | char *szFileName, 300 | uLong fileNameBufferSize, 301 | void *extraField, 302 | uLong extraFieldBufferSize, 303 | char *szComment, 304 | uLong commentBufferSize)); 305 | /* 306 | Get Info about the current file 307 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about 308 | the current file 309 | if szFileName!=NULL, the filemane string will be copied in szFileName 310 | (fileNameBufferSize is the size of the buffer) 311 | if extraField!=NULL, the extra field information will be copied in extraField 312 | (extraFieldBufferSize is the size of the buffer). 313 | This is the Central-header version of the extra field 314 | if szComment!=NULL, the comment string of the file will be copied in szComment 315 | (commentBufferSize is the size of the buffer) 316 | */ 317 | 318 | 319 | /** Addition for GDAL : START */ 320 | 321 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); 322 | 323 | /** Addition for GDAL : END */ 324 | 325 | 326 | /***************************************************************************/ 327 | /* for reading the content of the current zipfile, you can open it, read data 328 | from it, and close it (you can close it before reading all the file) 329 | */ 330 | 331 | extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); 332 | /* 333 | Open for reading data the current file in the zipfile. 334 | If there is no error, the return value is UNZ_OK. 335 | */ 336 | 337 | extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, 338 | const char* password)); 339 | /* 340 | Open for reading data the current file in the zipfile. 341 | password is a crypting password 342 | If there is no error, the return value is UNZ_OK. 343 | */ 344 | 345 | extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, 346 | int* method, 347 | int* level, 348 | int raw)); 349 | /* 350 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 351 | if raw==1 352 | *method will receive method of compression, *level will receive level of 353 | compression 354 | note : you can set level parameter as NULL (if you did not want known level, 355 | but you CANNOT set method parameter as NULL 356 | */ 357 | 358 | extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, 359 | int* method, 360 | int* level, 361 | int raw, 362 | const char* password)); 363 | /* 364 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 365 | if raw==1 366 | *method will receive method of compression, *level will receive level of 367 | compression 368 | note : you can set level parameter as NULL (if you did not want known level, 369 | but you CANNOT set method parameter as NULL 370 | */ 371 | 372 | 373 | extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); 374 | /* 375 | Close the file in zip opened with unzOpenCurrentFile 376 | Return UNZ_CRCERROR if all the file was read but the CRC is not good 377 | */ 378 | 379 | extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 380 | voidp buf, 381 | unsigned len)); 382 | /* 383 | Read bytes from the current file (opened by unzOpenCurrentFile) 384 | buf contain buffer where data must be copied 385 | len the size of buf. 386 | 387 | return the number of byte copied if somes bytes are copied 388 | return 0 if the end of file was reached 389 | return <0 with error code if there is an error 390 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) 391 | */ 392 | 393 | extern z_off_t ZEXPORT unztell OF((unzFile file)); 394 | 395 | extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); 396 | /* 397 | Give the current position in uncompressed data 398 | */ 399 | 400 | extern int ZEXPORT unzeof OF((unzFile file)); 401 | /* 402 | return 1 if the end of file was reached, 0 elsewhere 403 | */ 404 | 405 | extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, 406 | voidp buf, 407 | unsigned len)); 408 | /* 409 | Read extra field from the current file (opened by unzOpenCurrentFile) 410 | This is the local-header version of the extra field (sometimes, there is 411 | more info in the local-header version than in the central-header) 412 | 413 | if buf==NULL, it return the size of the local extra field 414 | 415 | if buf!=NULL, len is the size of the buffer, the extra header is copied in 416 | buf. 417 | the return value is the number of bytes copied in buf, or (if <0) 418 | the error code 419 | */ 420 | 421 | /***************************************************************************/ 422 | 423 | /* Get the current file offset */ 424 | extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); 425 | extern uLong ZEXPORT unzGetOffset (unzFile file); 426 | 427 | /* Set the current file offset */ 428 | extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); 429 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); 430 | 431 | 432 | 433 | #ifdef __cplusplus 434 | } 435 | #endif 436 | 437 | #endif /* _unz64_H */ 438 | -------------------------------------------------------------------------------- /minizip/zip.h: -------------------------------------------------------------------------------- 1 | /* zip.h -- IO on .zip files using zlib 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | --------------------------------------------------------------------------- 13 | 14 | Condition of use and distribution are the same than zlib : 15 | 16 | This software is provided 'as-is', without any express or implied 17 | warranty. In no event will the authors be held liable for any damages 18 | arising from the use of this software. 19 | 20 | Permission is granted to anyone to use this software for any purpose, 21 | including commercial applications, and to alter it and redistribute it 22 | freely, subject to the following restrictions: 23 | 24 | 1. The origin of this software must not be misrepresented; you must not 25 | claim that you wrote the original software. If you use this software 26 | in a product, an acknowledgment in the product documentation would be 27 | appreciated but is not required. 28 | 2. Altered source versions must be plainly marked as such, and must not be 29 | misrepresented as being the original software. 30 | 3. This notice may not be removed or altered from any source distribution. 31 | 32 | --------------------------------------------------------------------------- 33 | 34 | Changes 35 | 36 | See header of zip.h 37 | 38 | */ 39 | 40 | #ifndef _zip12_H 41 | #define _zip12_H 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | //#define HAVE_BZIP2 48 | 49 | #ifndef _ZLIB_H 50 | #include "zlib.h" 51 | #endif 52 | 53 | #ifndef _ZLIBIOAPI_H 54 | #include "ioapi.h" 55 | #endif 56 | 57 | #ifdef HAVE_BZIP2 58 | #include "bzlib.h" 59 | #endif 60 | 61 | #define Z_BZIP2ED 12 62 | 63 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) 64 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 65 | from (void*) without cast */ 66 | typedef struct TagzipFile__ { int unused; } zipFile__; 67 | typedef zipFile__ *zipFile; 68 | #else 69 | typedef voidp zipFile; 70 | #endif 71 | 72 | #define ZIP_OK (0) 73 | #define ZIP_EOF (0) 74 | #define ZIP_ERRNO (Z_ERRNO) 75 | #define ZIP_PARAMERROR (-102) 76 | #define ZIP_BADZIPFILE (-103) 77 | #define ZIP_INTERNALERROR (-104) 78 | 79 | #ifndef DEF_MEM_LEVEL 80 | # if MAX_MEM_LEVEL >= 8 81 | # define DEF_MEM_LEVEL 8 82 | # else 83 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 84 | # endif 85 | #endif 86 | /* default memLevel */ 87 | 88 | /* tm_zip contain date/time info */ 89 | typedef struct tm_zip_s 90 | { 91 | uInt tm_sec; /* seconds after the minute - [0,59] */ 92 | uInt tm_min; /* minutes after the hour - [0,59] */ 93 | uInt tm_hour; /* hours since midnight - [0,23] */ 94 | uInt tm_mday; /* day of the month - [1,31] */ 95 | uInt tm_mon; /* months since January - [0,11] */ 96 | uInt tm_year; /* years - [1980..2044] */ 97 | } tm_zip; 98 | 99 | typedef struct 100 | { 101 | tm_zip tmz_date; /* date in understandable format */ 102 | uLong dosDate; /* if dos_date == 0, tmu_date is used */ 103 | /* uLong flag; */ /* general purpose bit flag 2 bytes */ 104 | 105 | uLong internal_fa; /* internal file attributes 2 bytes */ 106 | uLong external_fa; /* external file attributes 4 bytes */ 107 | } zip_fileinfo; 108 | 109 | typedef const char* zipcharpc; 110 | 111 | 112 | #define APPEND_STATUS_CREATE (0) 113 | #define APPEND_STATUS_CREATEAFTER (1) 114 | #define APPEND_STATUS_ADDINZIP (2) 115 | 116 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); 117 | extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); 118 | /* 119 | Create a zipfile. 120 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on 121 | an Unix computer "zlib/zlib113.zip". 122 | if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip 123 | will be created at the end of the file. 124 | (useful if the file contain a self extractor code) 125 | if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will 126 | add files in existing zip (be sure you don't add file that doesn't exist) 127 | If the zipfile cannot be opened, the return value is NULL. 128 | Else, the return value is a zipFile Handle, usable with other function 129 | of this zip package. 130 | */ 131 | 132 | /* Note : there is no delete function into a zipfile. 133 | If you want delete file into a zipfile, you must open a zipfile, and create another 134 | Of couse, you can use RAW reading and writing to copy the file you did not want delte 135 | */ 136 | 137 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, 138 | int append, 139 | zipcharpc* globalcomment, 140 | zlib_filefunc_def* pzlib_filefunc_def)); 141 | 142 | extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, 143 | int append, 144 | zipcharpc* globalcomment, 145 | zlib_filefunc64_def* pzlib_filefunc_def)); 146 | 147 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 148 | const char* filename, 149 | const zip_fileinfo* zipfi, 150 | const void* extrafield_local, 151 | uInt size_extrafield_local, 152 | const void* extrafield_global, 153 | uInt size_extrafield_global, 154 | const char* comment, 155 | int method, 156 | int level)); 157 | 158 | extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, 159 | const char* filename, 160 | const zip_fileinfo* zipfi, 161 | const void* extrafield_local, 162 | uInt size_extrafield_local, 163 | const void* extrafield_global, 164 | uInt size_extrafield_global, 165 | const char* comment, 166 | int method, 167 | int level, 168 | int zip64)); 169 | 170 | /* 171 | Open a file in the ZIP for writing. 172 | filename : the filename in zip (if NULL, '-' without quote will be used 173 | *zipfi contain supplemental information 174 | if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local 175 | contains the extrafield data the the local header 176 | if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global 177 | contains the extrafield data the the local header 178 | if comment != NULL, comment contain the comment string 179 | method contain the compression method (0 for store, Z_DEFLATED for deflate) 180 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) 181 | zip64 is set to 1 if a zip64 extended information block should be added to the local file header. 182 | this MUST be '1' if the uncompressed size is >= 0xffffffff. 183 | 184 | */ 185 | 186 | 187 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, 188 | const char* filename, 189 | const zip_fileinfo* zipfi, 190 | const void* extrafield_local, 191 | uInt size_extrafield_local, 192 | const void* extrafield_global, 193 | uInt size_extrafield_global, 194 | const char* comment, 195 | int method, 196 | int level, 197 | int raw)); 198 | 199 | 200 | extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, 201 | const char* filename, 202 | const zip_fileinfo* zipfi, 203 | const void* extrafield_local, 204 | uInt size_extrafield_local, 205 | const void* extrafield_global, 206 | uInt size_extrafield_global, 207 | const char* comment, 208 | int method, 209 | int level, 210 | int raw, 211 | int zip64)); 212 | /* 213 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file 214 | */ 215 | 216 | extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, 217 | const char* filename, 218 | const zip_fileinfo* zipfi, 219 | const void* extrafield_local, 220 | uInt size_extrafield_local, 221 | const void* extrafield_global, 222 | uInt size_extrafield_global, 223 | const char* comment, 224 | int method, 225 | int level, 226 | int raw, 227 | int windowBits, 228 | int memLevel, 229 | int strategy, 230 | const char* password, 231 | uLong crcForCrypting)); 232 | 233 | extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, 234 | const char* filename, 235 | const zip_fileinfo* zipfi, 236 | const void* extrafield_local, 237 | uInt size_extrafield_local, 238 | const void* extrafield_global, 239 | uInt size_extrafield_global, 240 | const char* comment, 241 | int method, 242 | int level, 243 | int raw, 244 | int windowBits, 245 | int memLevel, 246 | int strategy, 247 | const char* password, 248 | uLong crcForCrypting, 249 | int zip64 250 | )); 251 | 252 | /* 253 | Same than zipOpenNewFileInZip2, except 254 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 255 | password : crypting password (NULL for no crypting) 256 | crcForCrypting : crc of file to compress (needed for crypting) 257 | */ 258 | 259 | extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, 260 | const char* filename, 261 | const zip_fileinfo* zipfi, 262 | const void* extrafield_local, 263 | uInt size_extrafield_local, 264 | const void* extrafield_global, 265 | uInt size_extrafield_global, 266 | const char* comment, 267 | int method, 268 | int level, 269 | int raw, 270 | int windowBits, 271 | int memLevel, 272 | int strategy, 273 | const char* password, 274 | uLong crcForCrypting, 275 | uLong versionMadeBy, 276 | uLong flagBase 277 | )); 278 | 279 | 280 | extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, 281 | const char* filename, 282 | const zip_fileinfo* zipfi, 283 | const void* extrafield_local, 284 | uInt size_extrafield_local, 285 | const void* extrafield_global, 286 | uInt size_extrafield_global, 287 | const char* comment, 288 | int method, 289 | int level, 290 | int raw, 291 | int windowBits, 292 | int memLevel, 293 | int strategy, 294 | const char* password, 295 | uLong crcForCrypting, 296 | uLong versionMadeBy, 297 | uLong flagBase, 298 | int zip64 299 | )); 300 | /* 301 | Same than zipOpenNewFileInZip4, except 302 | versionMadeBy : value for Version made by field 303 | flag : value for flag field (compression level info will be added) 304 | */ 305 | 306 | 307 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, 308 | const void* buf, 309 | unsigned len)); 310 | /* 311 | Write data in the zipfile 312 | */ 313 | 314 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); 315 | /* 316 | Close the current file in the zipfile 317 | */ 318 | 319 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 320 | uLong uncompressed_size, 321 | uLong crc32)); 322 | 323 | extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, 324 | ZPOS64_T uncompressed_size, 325 | uLong crc32)); 326 | 327 | /* 328 | Close the current file in the zipfile, for file opened with 329 | parameter raw=1 in zipOpenNewFileInZip2 330 | uncompressed_size and crc32 are value for the uncompressed size 331 | */ 332 | 333 | extern int ZEXPORT zipClose OF((zipFile file, 334 | const char* global_comment)); 335 | /* 336 | Close the zipfile 337 | */ 338 | 339 | 340 | extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); 341 | /* 342 | zipRemoveExtraInfoBlock - Added by Mathias Svensson 343 | 344 | Remove extra information block from a extra information data for the local file header or central directory header 345 | 346 | It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. 347 | 348 | 0x0001 is the signature header for the ZIP64 extra information blocks 349 | 350 | usage. 351 | Remove ZIP64 Extra information from a central director extra field data 352 | zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001); 353 | 354 | Remove ZIP64 Extra information from a Local File Header extra field data 355 | zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); 356 | */ 357 | 358 | #ifdef __cplusplus 359 | } 360 | #endif 361 | 362 | #endif /* _zip64_H */ 363 | --------------------------------------------------------------------------------