33#define ZIP_BUFFER_SIZE 8192
35@implementation NSData (OOExtensions)
37+ (instancetype) oo_dataWithOXZFile:(NSString *)path
40 NSArray *components = [path pathComponents];
41 cl = [components count];
42 for (i = 0 ; i < cl ; i++)
44 NSString *component = [components objectAtIndex:i];
45 if ([[[component pathExtension] lowercaseString] isEqualToString:
@"oxz"])
56 return [[[NSData alloc] initWithContentsOfMappedFile:path] autorelease];
58 NSFileManager *fmgr = [NSFileManager defaultManager];
61 if ([fmgr fileExistsAtPath:path isDirectory:&dir])
65 if ([[fmgr fileAttributesAtPath:path traverseLink:NO] fileSize] == 0)
71 return [[[NSData alloc] initWithContentsOfMappedFile:path] autorelease];
85 range.location = 0; range.length = i+1;
86 NSString *zipFile = [NSString pathWithComponents:[components subarrayWithRange:range]];
87 range.location = i+1; range.length = cl-(i+1);
88 NSString *containedFile = [NSString pathWithComponents:[components subarrayWithRange:range]];
91 const char* zipname = [zipFile UTF8String];
103 const char*
filename = [containedFile UTF8String];
136 NSMutableData *tmp = [NSMutableData dataWithCapacity:file_info.uncompressed_size];
150 [tmp appendBytes:buf length:err];
164 return [[tmp retain] autorelease];
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)