Added class prefix OZ

This commit is contained in:
Gianluca Bertani
2015-08-27 16:30:59 +02:00
parent 433d629232
commit 5cbe4cde4d
12 changed files with 184 additions and 184 deletions
+24 -24
View File
@@ -32,11 +32,11 @@
//
#import "Objective_ZipViewController.h"
#import "../Objective-Zip/ZipFile.h"
#import "../Objective-Zip/ZipException.h"
#import "../Objective-Zip/FileInZipInfo.h"
#import "../Objective-Zip/ZipWriteStream.h"
#import "../Objective-Zip/ZipReadStream.h"
#import "../Objective-Zip/OZZipFile.h"
#import "../Objective-Zip/OZZipException.h"
#import "../Objective-Zip/OZFileInZipInfo.h"
#import "../Objective-Zip/OZZipWriteStream.h"
#import "../Objective-Zip/OZZipReadStream.h"
#define HUGE_TEST_BLOCK_LENGTH (50000)
#define HUGE_TEST_NUMBER_OF_BLOCKS (100000)
@@ -116,11 +116,11 @@
[self log:@"Test 1: opening zip file for writing..."];
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeCreate];
OZZipFile *zipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeCreate];
[self log:@"Test 1: adding first file..."];
ZipWriteStream *stream1= [zipFile writeFileInZipWithName:@"abc.txt" fileDate:[NSDate dateWithTimeIntervalSinceNow:-86400.0] compressionLevel:ZipCompressionLevelBest];
OZZipWriteStream *stream1= [zipFile writeFileInZipWithName:@"abc.txt" fileDate:[NSDate dateWithTimeIntervalSinceNow:-86400.0] compressionLevel:OZZipCompressionLevelBest];
[self log:@"Test 1: writing to first file's stream..."];
@@ -134,7 +134,7 @@
[self log:@"Test 1: adding second file..."];
NSString *file2name= @"x/y/z/xyz.txt";
ZipWriteStream *stream2= [zipFile writeFileInZipWithName:file2name compressionLevel:ZipCompressionLevelNone];
OZZipWriteStream *stream2= [zipFile writeFileInZipWithName:file2name compressionLevel:OZZipCompressionLevelNone];
[self log:@"Test 1: writing to second file's stream..."];
@@ -151,18 +151,18 @@
[self log:@"Test 1: opening zip file for reading..."];
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
OZZipFile *unzipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeUnzip];
[self log:@"Test 1: reading file infos..."];
NSArray *infos= [unzipFile listFileInZipInfos];
for (FileInZipInfo *info in infos)
for (OZFileInZipInfo *info in infos)
[self log:@"Test 1: - %@ %@ %d (%d)", info.name, info.date, info.size, info.level];
[self log:@"Test 1: opening first file..."];
[unzipFile goToFirstFileInZip];
ZipReadStream *read1= [unzipFile readCurrentFileInZip];
OZZipReadStream *read1= [unzipFile readCurrentFileInZip];
[self log:@"Test 1: reading from first file's stream..."];
@@ -188,7 +188,7 @@
[self log:@"Test 1: opening second file..."];
[unzipFile locateFileInZip:file2name];
ZipReadStream *read2= [unzipFile readCurrentFileInZip];
OZZipReadStream *read2= [unzipFile readCurrentFileInZip];
[self log:@"Test 1: reading from second file's stream..."];
@@ -217,7 +217,7 @@
[self log:@"Test 1: test terminated succesfully"];
} @catch (ZipException *ze) {
} @catch (OZZipException *ze) {
[self log:@"Test 1: caught a ZipException (see logs), terminating..."];
NSLog(@"Test 1: ZipException caught: %d - %@", ze.error, [ze reason]);
@@ -248,11 +248,11 @@
[self log:@"Test 2: opening zip file for writing..."];
ZipFile *zipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeCreate];
OZZipFile *zipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeCreate];
[self log:@"Test 2: adding file..."];
ZipWriteStream *stream= [zipFile writeFileInZipWithName:@"huge_file.txt" compressionLevel:ZipCompressionLevelBest];
OZZipWriteStream *stream= [zipFile writeFileInZipWithName:@"huge_file.txt" compressionLevel:OZZipCompressionLevelBest];
[self log:@"Test 2: writing to file's stream..."];
@@ -280,12 +280,12 @@
[self log:@"Test 2: opening zip file for reading..."];
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
OZZipFile *unzipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeUnzip];
[self log:@"Test 2: opening file..."];
[unzipFile goToFirstFileInZip];
ZipReadStream *read= [unzipFile readCurrentFileInZip];
OZZipReadStream *read= [unzipFile readCurrentFileInZip];
[self log:@"Test 2: reading from file's stream..."];
@@ -316,7 +316,7 @@
[self log:@"Test 2: test terminated succesfully"];
} @catch (ZipException *ze) {
} @catch (OZZipException *ze) {
[self log:@"Test 2: caught a ZipException (see logs), terminating..."];
NSLog(@"Test 2: ZipException caught: %d - %@", ze.error, [ze reason]);
@@ -345,12 +345,12 @@
@try {
[self log:@"Test 3: opening zip file for reading..."];
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
OZZipFile *unzipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeUnzip];
[self log:@"Test 3: opening file..."];
[unzipFile goToFirstFileInZip];
ZipReadStream *read= [unzipFile readCurrentFileInZip];
OZZipReadStream *read= [unzipFile readCurrentFileInZip];
[self log:@"Test 3: reading from file's stream..."];
@@ -374,7 +374,7 @@
[self log:@"Test 3: test terminated succesfully"];
} @catch (ZipException *ze) {
} @catch (OZZipException *ze) {
[self log:@"Test 3: caught a ZipException (see logs), terminating..."];
NSLog(@"Test 3: ZipException caught: %d - %@", ze.error, [ze reason]);
@@ -399,12 +399,12 @@
@try {
[self log:@"Test 4: opening zip file for reading..."];
ZipFile *unzipFile= [[ZipFile alloc] initWithFileName:filePath mode:ZipFileModeUnzip];
OZZipFile *unzipFile= [[OZZipFile alloc] initWithFileName:filePath mode:OZZipFileModeUnzip];
[self log:@"Test 4: opening file..."];
[unzipFile goToFirstFileInZip];
ZipReadStream *read= [unzipFile readCurrentFileInZip];
OZZipReadStream *read= [unzipFile readCurrentFileInZip];
[self log:@"Test 4: reading from file's stream..."];
@@ -428,7 +428,7 @@
[self log:@"Test 4: test terminated succesfully"];
} @catch (ZipException *ze) {
} @catch (OZZipException *ze) {
[self log:@"Test 4: caught a ZipException (see logs), terminating..."];
NSLog(@"Test 4: ZipException caught: %d - %@", ze.error, [ze reason]);
+30 -30
View File
@@ -21,13 +21,13 @@
8C6D352D10E56A9000B63EFA /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D352510E56A9000B63EFA /* ioapi.c */; };
8C6D352F10E56A9000B63EFA /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D352910E56A9000B63EFA /* unzip.c */; };
8C6D353010E56A9000B63EFA /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D352B10E56A9000B63EFA /* zip.c */; };
8C6D354010E56BD300B63EFA /* ZipFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D353F10E56BD300B63EFA /* ZipFile.m */; };
8C6D356B10E56F4D00B63EFA /* ZipException.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D356A10E56F4D00B63EFA /* ZipException.m */; };
8C6D357610E5797600B63EFA /* ZipWriteStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D357510E5797600B63EFA /* ZipWriteStream.m */; };
8C83F49510E7CBCB002FB3CB /* FileInZipInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C83F49410E7CBCB002FB3CB /* FileInZipInfo.m */; };
8C6D354010E56BD300B63EFA /* OZZipFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D353F10E56BD300B63EFA /* OZZipFile.m */; };
8C6D356B10E56F4D00B63EFA /* OZZipException.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D356A10E56F4D00B63EFA /* OZZipException.m */; };
8C6D357610E5797600B63EFA /* OZZipWriteStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6D357510E5797600B63EFA /* OZZipWriteStream.m */; };
8C83F49510E7CBCB002FB3CB /* OZFileInZipInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C83F49410E7CBCB002FB3CB /* OZFileInZipInfo.m */; };
8C8F2D3A10EBC94B00F75833 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C8F2D3910EBC94B00F75833 /* Default.png */; };
8C8F2D9310EBCE0300F75833 /* ObjectiveZipIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8C8F2D9210EBCE0300F75833 /* ObjectiveZipIcon.png */; };
8CBE431810E95FA300AC9ED3 /* ZipReadStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CBE431710E95FA300AC9ED3 /* ZipReadStream.m */; };
8CBE431810E95FA300AC9ED3 /* OZZipReadStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CBE431710E95FA300AC9ED3 /* OZZipReadStream.m */; };
8CD8B40317766067005212EC /* adler32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CD8B3E917766067005212EC /* adler32.c */; };
8CD8B40417766067005212EC /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CD8B3EA17766067005212EC /* compress.c */; };
8CD8B40517766067005212EC /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8CD8B3EB17766067005212EC /* crc32.c */; };
@@ -70,18 +70,18 @@
8C6D352A10E56A9000B63EFA /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unzip.h; path = MiniZip/unzip.h; sourceTree = "<group>"; };
8C6D352B10E56A9000B63EFA /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip.c; path = MiniZip/zip.c; sourceTree = "<group>"; };
8C6D352C10E56A9000B63EFA /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zip.h; path = MiniZip/zip.h; sourceTree = "<group>"; };
8C6D353E10E56BD300B63EFA /* ZipFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZipFile.h; path = "Objective-Zip/ZipFile.h"; sourceTree = "<group>"; };
8C6D353F10E56BD300B63EFA /* ZipFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZipFile.m; path = "Objective-Zip/ZipFile.m"; sourceTree = "<group>"; };
8C6D356910E56F4D00B63EFA /* ZipException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZipException.h; path = "Objective-Zip/ZipException.h"; sourceTree = "<group>"; };
8C6D356A10E56F4D00B63EFA /* ZipException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZipException.m; path = "Objective-Zip/ZipException.m"; sourceTree = "<group>"; };
8C6D357410E5797600B63EFA /* ZipWriteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZipWriteStream.h; path = "Objective-Zip/ZipWriteStream.h"; sourceTree = "<group>"; };
8C6D357510E5797600B63EFA /* ZipWriteStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZipWriteStream.m; path = "Objective-Zip/ZipWriteStream.m"; sourceTree = "<group>"; };
8C83F49310E7CBCB002FB3CB /* FileInZipInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileInZipInfo.h; path = "Objective-Zip/FileInZipInfo.h"; sourceTree = "<group>"; };
8C83F49410E7CBCB002FB3CB /* FileInZipInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileInZipInfo.m; path = "Objective-Zip/FileInZipInfo.m"; sourceTree = "<group>"; };
8C6D353E10E56BD300B63EFA /* OZZipFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZZipFile.h; path = "Objective-Zip/OZZipFile.h"; sourceTree = "<group>"; };
8C6D353F10E56BD300B63EFA /* OZZipFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZZipFile.m; path = "Objective-Zip/OZZipFile.m"; sourceTree = "<group>"; };
8C6D356910E56F4D00B63EFA /* OZZipException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZZipException.h; path = "Objective-Zip/OZZipException.h"; sourceTree = "<group>"; };
8C6D356A10E56F4D00B63EFA /* OZZipException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZZipException.m; path = "Objective-Zip/OZZipException.m"; sourceTree = "<group>"; };
8C6D357410E5797600B63EFA /* OZZipWriteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZZipWriteStream.h; path = "Objective-Zip/OZZipWriteStream.h"; sourceTree = "<group>"; };
8C6D357510E5797600B63EFA /* OZZipWriteStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZZipWriteStream.m; path = "Objective-Zip/OZZipWriteStream.m"; sourceTree = "<group>"; };
8C83F49310E7CBCB002FB3CB /* OZFileInZipInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZFileInZipInfo.h; path = "Objective-Zip/OZFileInZipInfo.h"; sourceTree = "<group>"; };
8C83F49410E7CBCB002FB3CB /* OZFileInZipInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZFileInZipInfo.m; path = "Objective-Zip/OZFileInZipInfo.m"; sourceTree = "<group>"; };
8C8F2D3910EBC94B00F75833 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
8C8F2D9210EBCE0300F75833 /* ObjectiveZipIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ObjectiveZipIcon.png; sourceTree = "<group>"; };
8CBE431610E95FA300AC9ED3 /* ZipReadStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZipReadStream.h; path = "Objective-Zip/ZipReadStream.h"; sourceTree = "<group>"; };
8CBE431710E95FA300AC9ED3 /* ZipReadStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZipReadStream.m; path = "Objective-Zip/ZipReadStream.m"; sourceTree = "<group>"; };
8CBE431610E95FA300AC9ED3 /* OZZipReadStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZZipReadStream.h; path = "Objective-Zip/OZZipReadStream.h"; sourceTree = "<group>"; };
8CBE431710E95FA300AC9ED3 /* OZZipReadStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZZipReadStream.m; path = "Objective-Zip/OZZipReadStream.m"; sourceTree = "<group>"; };
8CD8B3E917766067005212EC /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = adler32.c; path = ZLib/adler32.c; sourceTree = "<group>"; };
8CD8B3EA17766067005212EC /* compress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = compress.c; path = ZLib/compress.c; sourceTree = "<group>"; };
8CD8B3EB17766067005212EC /* crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crc32.c; path = ZLib/crc32.c; sourceTree = "<group>"; };
@@ -215,16 +215,16 @@
8C6D353B10E56BA400B63EFA /* Objective-Zip */ = {
isa = PBXGroup;
children = (
8C6D353E10E56BD300B63EFA /* ZipFile.h */,
8C6D353F10E56BD300B63EFA /* ZipFile.m */,
8C6D356910E56F4D00B63EFA /* ZipException.h */,
8C6D356A10E56F4D00B63EFA /* ZipException.m */,
8C6D357410E5797600B63EFA /* ZipWriteStream.h */,
8C6D357510E5797600B63EFA /* ZipWriteStream.m */,
8C83F49310E7CBCB002FB3CB /* FileInZipInfo.h */,
8C83F49410E7CBCB002FB3CB /* FileInZipInfo.m */,
8CBE431610E95FA300AC9ED3 /* ZipReadStream.h */,
8CBE431710E95FA300AC9ED3 /* ZipReadStream.m */,
8C6D353E10E56BD300B63EFA /* OZZipFile.h */,
8C6D353F10E56BD300B63EFA /* OZZipFile.m */,
8C6D356910E56F4D00B63EFA /* OZZipException.h */,
8C6D356A10E56F4D00B63EFA /* OZZipException.m */,
8C6D357410E5797600B63EFA /* OZZipWriteStream.h */,
8C6D357510E5797600B63EFA /* OZZipWriteStream.m */,
8C83F49310E7CBCB002FB3CB /* OZFileInZipInfo.h */,
8C83F49410E7CBCB002FB3CB /* OZFileInZipInfo.m */,
8CBE431610E95FA300AC9ED3 /* OZZipReadStream.h */,
8CBE431710E95FA300AC9ED3 /* OZZipReadStream.m */,
);
name = "Objective-Zip";
sourceTree = "<group>";
@@ -338,11 +338,11 @@
8C6D352D10E56A9000B63EFA /* ioapi.c in Sources */,
8C6D352F10E56A9000B63EFA /* unzip.c in Sources */,
8C6D353010E56A9000B63EFA /* zip.c in Sources */,
8C6D354010E56BD300B63EFA /* ZipFile.m in Sources */,
8C6D356B10E56F4D00B63EFA /* ZipException.m in Sources */,
8C6D357610E5797600B63EFA /* ZipWriteStream.m in Sources */,
8C83F49510E7CBCB002FB3CB /* FileInZipInfo.m in Sources */,
8CBE431810E95FA300AC9ED3 /* ZipReadStream.m in Sources */,
8C6D354010E56BD300B63EFA /* OZZipFile.m in Sources */,
8C6D356B10E56F4D00B63EFA /* OZZipException.m in Sources */,
8C6D357610E5797600B63EFA /* OZZipWriteStream.m in Sources */,
8C83F49510E7CBCB002FB3CB /* OZFileInZipInfo.m in Sources */,
8CBE431810E95FA300AC9ED3 /* OZZipReadStream.m in Sources */,
8CD8B40317766067005212EC /* adler32.c in Sources */,
8CD8B40417766067005212EC /* compress.c in Sources */,
8CD8B40517766067005212EC /* crc32.c in Sources */,
@@ -1,5 +1,5 @@
//
// FileInZipInfo.h
// OZFileInZipInfo.h
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 27/12/09.
@@ -33,14 +33,14 @@
#import <Foundation/Foundation.h>
#import "ZipFile.h"
#import "OZZipFile.h"
@interface FileInZipInfo : NSObject {
@interface OZFileInZipInfo : NSObject {
@private
NSUInteger _length;
ZipCompressionLevel _level;
OZZipCompressionLevel _level;
BOOL _crypted;
NSUInteger _size;
NSDate *_date;
@@ -48,11 +48,11 @@
NSString *_name;
}
- (id) initWithName:(NSString *)name length:(NSUInteger)length level:(ZipCompressionLevel)level crypted:(BOOL)crypted size:(NSUInteger)size date:(NSDate *)date crc32:(NSUInteger)crc32;
- (id) initWithName:(NSString *)name length:(NSUInteger)length level:(OZZipCompressionLevel)level crypted:(BOOL)crypted size:(NSUInteger)size date:(NSDate *)date crc32:(NSUInteger)crc32;
@property (nonatomic, readonly) NSString *name;
@property (nonatomic, readonly) NSUInteger length;
@property (nonatomic, readonly) ZipCompressionLevel level;
@property (nonatomic, readonly) OZZipCompressionLevel level;
@property (nonatomic, readonly) BOOL crypted;
@property (nonatomic, readonly) NSUInteger size;
@property (nonatomic, readonly) NSDate *date;
@@ -1,5 +1,5 @@
//
// FileInZipInfo.m
// OZFileInZipInfo.m
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 27/12/09.
@@ -31,12 +31,12 @@
// POSSIBILITY OF SUCH DAMAGE.
//
#import "FileInZipInfo.h"
#import "OZFileInZipInfo.h"
@implementation FileInZipInfo
@implementation OZFileInZipInfo
- (id) initWithName:(NSString *)name length:(NSUInteger)length level:(ZipCompressionLevel)level crypted:(BOOL)crypted size:(NSUInteger)size date:(NSDate *)date crc32:(NSUInteger)crc32 {
- (id) initWithName:(NSString *)name length:(NSUInteger)length level:(OZZipCompressionLevel)level crypted:(BOOL)crypted size:(NSUInteger)size date:(NSDate *)date crc32:(NSUInteger)crc32 {
if (self= [super init]) {
_name= name;
_length= length;
@@ -1,5 +1,5 @@
//
// ZipException.h
// OZZipException.h
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 25/12/09.
@@ -34,7 +34,7 @@
#import <Foundation/Foundation.h>
@interface ZipException : NSException {
@interface OZZipException : NSException {
@private
NSInteger _error;
@@ -1,5 +1,5 @@
//
// ZipException.m
// OZZipException.m
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 25/12/09.
@@ -31,13 +31,13 @@
// POSSIBILITY OF SUCH DAMAGE.
//
#import "ZipException.h"
#import "OZZipException.h"
@implementation ZipException
@implementation OZZipException
- (id) initWithReason:(NSString *)reason {
if (self= [super initWithName:@"ZipException" reason:reason userInfo:nil]) {
if (self= [super initWithName:@"OZZipException" reason:reason userInfo:nil]) {
_error= 0;
}
@@ -45,7 +45,7 @@
}
- (id) initWithError:(NSInteger)error reason:(NSString *)reason {
if (self= [super initWithName:@"ZipException" reason:reason userInfo:nil]) {
if (self= [super initWithName:@"OZZipException" reason:reason userInfo:nil]) {
_error= error;
}
@@ -1,6 +1,6 @@
//
// ZipFile.h
// Objective-Zip v.0.8.3
// OZZipFile.h
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 25/12/09.
// Copyright 2009-10 Flying Dolphin Studio. All rights reserved.
@@ -38,36 +38,36 @@
typedef enum {
ZipFileModeUnzip,
ZipFileModeCreate,
ZipFileModeAppend
} ZipFileMode;
OZZipFileModeUnzip,
OZZipFileModeCreate,
OZZipFileModeAppend
} OZZipFileMode;
typedef enum {
ZipCompressionLevelDefault= -1,
ZipCompressionLevelNone= 0,
ZipCompressionLevelFastest= 1,
ZipCompressionLevelBest= 9
} ZipCompressionLevel;
OZZipCompressionLevelDefault= -1,
OZZipCompressionLevelNone= 0,
OZZipCompressionLevelFastest= 1,
OZZipCompressionLevelBest= 9
} OZZipCompressionLevel;
@class ZipReadStream;
@class ZipWriteStream;
@class FileInZipInfo;
@class OZZipReadStream;
@class OZZipWriteStream;
@class OZFileInZipInfo;
@interface ZipFile : NSObject {
@interface OZZipFile : NSObject {
NSString *_fileName;
ZipFileMode _mode;
OZZipFileMode _mode;
@private
zipFile _zipFile;
unzFile _unzFile;
}
- (id) initWithFileName:(NSString *)fileName mode:(ZipFileMode)mode;
- (id) initWithFileName:(NSString *)fileName mode:(OZZipFileMode)mode;
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip compressionLevel:(ZipCompressionLevel)compressionLevel;
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(ZipCompressionLevel)compressionLevel;
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(ZipCompressionLevel)compressionLevel password:(NSString *)password crc32:(NSUInteger)crc32;
- (OZZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip compressionLevel:(OZZipCompressionLevel)compressionLevel;
- (OZZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel;
- (OZZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel password:(NSString *)password crc32:(NSUInteger)crc32;
- (NSString*) fileName;
- (NSUInteger) numFilesInZip;
@@ -77,10 +77,10 @@ typedef enum {
- (BOOL) goToNextFileInZip;
- (BOOL) locateFileInZip:(NSString *)fileNameInZip;
- (FileInZipInfo *) getCurrentFileInZipInfo;
- (OZFileInZipInfo *) getCurrentFileInZipInfo;
- (ZipReadStream *) readCurrentFileInZip;
- (ZipReadStream *) readCurrentFileInZipWithPassword:(NSString *)password;
- (OZZipReadStream *) readCurrentFileInZip;
- (OZZipReadStream *) readCurrentFileInZipWithPassword:(NSString *)password;
- (void) close;
@@ -1,5 +1,5 @@
//
// ZipFile.m
// OZZipFile.m
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 25/12/09.
@@ -31,51 +31,51 @@
// POSSIBILITY OF SUCH DAMAGE.
//
#import "ZipFile.h"
#import "ZipException.h"
#import "ZipReadStream.h"
#import "ZipWriteStream.h"
#import "FIleInZipInfo.h"
#import "OZZipFile.h"
#import "OZZipException.h"
#import "OZZipReadStream.h"
#import "OZZipWriteStream.h"
#import "OZFileInZipInfo.h"
#define FILE_IN_ZIP_MAX_NAME_LENGTH (256)
@implementation ZipFile
@implementation OZZipFile
- (id) initWithFileName:(NSString *)fileName mode:(ZipFileMode)mode {
- (id) initWithFileName:(NSString *)fileName mode:(OZZipFileMode)mode {
if (self= [super init]) {
_fileName= fileName;
_mode= mode;
switch (mode) {
case ZipFileModeUnzip:
case OZZipFileModeUnzip:
_unzFile= unzOpen64([_fileName cStringUsingEncoding:NSUTF8StringEncoding]);
if (_unzFile == NULL) {
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
break;
case ZipFileModeCreate:
case OZZipFileModeCreate:
_zipFile= zipOpen64([_fileName cStringUsingEncoding:NSUTF8StringEncoding], APPEND_STATUS_CREATE);
if (_zipFile == NULL) {
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
break;
case ZipFileModeAppend:
case OZZipFileModeAppend:
_zipFile= zipOpen64([_fileName cStringUsingEncoding:NSUTF8StringEncoding], APPEND_STATUS_ADDINZIP);
if (_zipFile == NULL) {
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
break;
default: {
NSString *reason= [NSString stringWithFormat:@"Unknown mode %d", _mode];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
}
}
@@ -84,10 +84,10 @@
}
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip compressionLevel:(ZipCompressionLevel)compressionLevel {
if (_mode == ZipFileModeUnzip) {
- (OZZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip compressionLevel:(OZZipCompressionLevel)compressionLevel {
if (_mode == OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted with Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
NSDate *now= [NSDate date];
@@ -109,22 +109,22 @@
[fileNameInZip cStringUsingEncoding:NSUTF8StringEncoding],
&zi,
NULL, 0, NULL, 0, NULL,
(compressionLevel != ZipCompressionLevelNone) ? Z_DEFLATED : 0,
(compressionLevel != OZZipCompressionLevelNone) ? Z_DEFLATED : 0,
compressionLevel, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, 1);
if (err != ZIP_OK) {
NSString *reason= [NSString stringWithFormat:@"Error opening '%@' in zipfile", fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return [[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
return [[OZZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
}
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(ZipCompressionLevel)compressionLevel {
if (_mode == ZipFileModeUnzip) {
- (OZZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel {
if (_mode == OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted with Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
NSCalendar *calendar= [NSCalendar currentCalendar];
@@ -145,22 +145,22 @@
[fileNameInZip cStringUsingEncoding:NSUTF8StringEncoding],
&zi,
NULL, 0, NULL, 0, NULL,
(compressionLevel != ZipCompressionLevelNone) ? Z_DEFLATED : 0,
(compressionLevel != OZZipCompressionLevelNone) ? Z_DEFLATED : 0,
compressionLevel, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
NULL, 0, 1);
if (err != ZIP_OK) {
NSString *reason= [NSString stringWithFormat:@"Error opening '%@' in zipfile", fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return [[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
return [[OZZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
}
- (ZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(ZipCompressionLevel)compressionLevel password:(NSString *)password crc32:(NSUInteger)crc32 {
if (_mode == ZipFileModeUnzip) {
- (OZZipWriteStream *) writeFileInZipWithName:(NSString *)fileNameInZip fileDate:(NSDate *)fileDate compressionLevel:(OZZipCompressionLevel)compressionLevel password:(NSString *)password crc32:(NSUInteger)crc32 {
if (_mode == OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted with Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
NSCalendar *calendar= [NSCalendar currentCalendar];
@@ -181,16 +181,16 @@
[fileNameInZip cStringUsingEncoding:NSUTF8StringEncoding],
&zi,
NULL, 0, NULL, 0, NULL,
(compressionLevel != ZipCompressionLevelNone) ? Z_DEFLATED : 0,
(compressionLevel != OZZipCompressionLevelNone) ? Z_DEFLATED : 0,
compressionLevel, 0,
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
[password cStringUsingEncoding:NSUTF8StringEncoding], crc32, 1);
if (err != ZIP_OK) {
NSString *reason= [NSString stringWithFormat:@"Error opening '%@' in zipfile", fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return [[ZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
return [[OZZipWriteStream alloc] initWithZipFileStruct:_zipFile fileNameInZip:fileNameInZip];
}
- (NSString*) fileName {
@@ -198,16 +198,16 @@
}
- (NSUInteger) numFilesInZip {
if (_mode != ZipFileModeUnzip) {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
unz_global_info64 gi;
int err= unzGetGlobalInfo64(_unzFile, &gi);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error getting global info in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return gi.number_entry;
@@ -222,7 +222,7 @@
[self goToFirstFileInZip];
for (int i= 0; i < num; i++) {
FileInZipInfo *info= [self getCurrentFileInZipInfo];
OZFileInZipInfo *info= [self getCurrentFileInZipInfo];
[files addObject:info];
if ((i +1) < num)
@@ -233,22 +233,22 @@
}
- (void) goToFirstFileInZip {
if (_mode != ZipFileModeUnzip) {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
int err= unzGoToFirstFile(_unzFile);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error going to first file in zip in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
}
- (BOOL) goToNextFileInZip {
if (_mode != ZipFileModeUnzip) {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
int err= unzGoToNextFile(_unzFile);
@@ -257,16 +257,16 @@
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error going to next file in zip in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return YES;
}
- (BOOL) locateFileInZip:(NSString *)fileNameInZip {
if (_mode != ZipFileModeUnzip) {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
int err= unzLocateFile(_unzFile, [fileNameInZip cStringUsingEncoding:NSUTF8StringEncoding], NULL);
@@ -275,16 +275,16 @@
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error localting file in zip in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return YES;
}
- (FileInZipInfo *) getCurrentFileInZipInfo {
if (_mode != ZipFileModeUnzip) {
- (OZFileInZipInfo *) getCurrentFileInZipInfo {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
char filename_inzip[FILE_IN_ZIP_MAX_NAME_LENGTH];
@@ -293,24 +293,24 @@
int err= unzGetCurrentFileInfo64(_unzFile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error getting current file info in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
NSString *name= [NSString stringWithCString:filename_inzip encoding:NSUTF8StringEncoding];
ZipCompressionLevel level= ZipCompressionLevelNone;
OZZipCompressionLevel level= OZZipCompressionLevelNone;
if (file_info.compression_method != 0) {
switch ((file_info.flag & 0x6) / 2) {
case 0:
level= ZipCompressionLevelDefault;
level= OZZipCompressionLevelDefault;
break;
case 1:
level= ZipCompressionLevelBest;
level= OZZipCompressionLevelBest;
break;
default:
level= ZipCompressionLevelFastest;
level= OZZipCompressionLevelFastest;
break;
}
}
@@ -327,14 +327,14 @@
NSCalendar *calendar= [NSCalendar currentCalendar];
NSDate *date= [calendar dateFromComponents:components];
FileInZipInfo *info= [[FileInZipInfo alloc] initWithName:name length:file_info.uncompressed_size level:level crypted:crypted size:file_info.compressed_size date:date crc32:file_info.crc];
OZFileInZipInfo *info= [[OZFileInZipInfo alloc] initWithName:name length:file_info.uncompressed_size level:level crypted:crypted size:file_info.compressed_size date:date crc32:file_info.crc];
return info;
}
- (ZipReadStream *) readCurrentFileInZip {
if (_mode != ZipFileModeUnzip) {
- (OZZipReadStream *) readCurrentFileInZip {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
char filename_inzip[FILE_IN_ZIP_MAX_NAME_LENGTH];
@@ -343,7 +343,7 @@
int err= unzGetCurrentFileInfo64(_unzFile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error getting current file info in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
NSString *fileNameInZip= [NSString stringWithCString:filename_inzip encoding:NSUTF8StringEncoding];
@@ -351,16 +351,16 @@
err= unzOpenCurrentFilePassword(_unzFile, NULL);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error opening current file in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return [[ZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip];
return [[OZZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip];
}
- (ZipReadStream *) readCurrentFileInZipWithPassword:(NSString *)password {
if (_mode != ZipFileModeUnzip) {
- (OZZipReadStream *) readCurrentFileInZipWithPassword:(NSString *)password {
if (_mode != OZZipFileModeUnzip) {
NSString *reason= [NSString stringWithFormat:@"Operation not permitted without Unzip mode"];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
char filename_inzip[FILE_IN_ZIP_MAX_NAME_LENGTH];
@@ -369,7 +369,7 @@
int err= unzGetCurrentFileInfo64(_unzFile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error getting current file info in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
NSString *fileNameInZip= [NSString stringWithCString:filename_inzip encoding:NSUTF8StringEncoding];
@@ -377,44 +377,44 @@
err= unzOpenCurrentFilePassword(_unzFile, [password cStringUsingEncoding:NSUTF8StringEncoding]);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error opening current file in '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return [[ZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip];
return [[OZZipReadStream alloc] initWithUnzFileStruct:_unzFile fileNameInZip:fileNameInZip];
}
- (void) close {
switch (_mode) {
case ZipFileModeUnzip: {
case OZZipFileModeUnzip: {
int err= unzClose(_unzFile);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error closing '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
break;
}
case ZipFileModeCreate: {
case OZZipFileModeCreate: {
int err= zipClose(_zipFile, NULL);
if (err != ZIP_OK) {
NSString *reason= [NSString stringWithFormat:@"Error closing '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
break;
}
case ZipFileModeAppend: {
case OZZipFileModeAppend: {
int err= zipClose(_zipFile, NULL);
if (err != ZIP_OK) {
NSString *reason= [NSString stringWithFormat:@"Error closing '%@'", _fileName];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
break;
}
default: {
NSString *reason= [NSString stringWithFormat:@"Unknown mode %d", _mode];
@throw [[ZipException alloc] initWithReason:reason];
@throw [[OZZipException alloc] initWithReason:reason];
}
}
}
@@ -1,5 +1,5 @@
//
// ZipReadStream.h
// OZZipReadStream.h
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 28/12/09.
@@ -36,7 +36,7 @@
#include "unzip.h"
@interface ZipReadStream : NSObject {
@interface OZZipReadStream : NSObject {
NSString *_fileNameInZip;
@private
@@ -1,5 +1,5 @@
//
// ZipReadStream.m
// OZZipReadStream.m
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 28/12/09.
@@ -31,13 +31,13 @@
// POSSIBILITY OF SUCH DAMAGE.
//
#import "ZipReadStream.h"
#import "ZipException.h"
#import "OZZipReadStream.h"
#import "OZZipException.h"
#include "unzip.h"
@implementation ZipReadStream
@implementation OZZipReadStream
- (id) initWithUnzFileStruct:(unzFile)unzFile fileNameInZip:(NSString *)fileNameInZip {
@@ -53,7 +53,7 @@
int err= unzReadCurrentFile(_unzFile, [buffer mutableBytes], [buffer length]);
if (err < 0) {
NSString *reason= [NSString stringWithFormat:@"Error reading '%@' in the zipfile", _fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
return err;
@@ -63,7 +63,7 @@
int err= unzCloseCurrentFile(_unzFile);
if (err != UNZ_OK) {
NSString *reason= [NSString stringWithFormat:@"Error closing '%@' in the zipfile", _fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
}
@@ -1,5 +1,5 @@
//
// ZipWriteStream.h
// OZZipWriteStream.h
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 25/12/09.
@@ -36,7 +36,7 @@
#include "zip.h"
@interface ZipWriteStream : NSObject {
@interface OZZipWriteStream : NSObject {
NSString *_fileNameInZip;
@private
@@ -1,5 +1,5 @@
//
// ZipWriteStream.m
// OZZipWriteStream.m
// Objective-Zip v. 0.8.3
//
// Created by Gianluca Bertani on 25/12/09.
@@ -31,13 +31,13 @@
// POSSIBILITY OF SUCH DAMAGE.
//
#import "ZipWriteStream.h"
#import "ZipException.h"
#import "OZZipWriteStream.h"
#import "OZZipException.h"
#include "zip.h"
@implementation ZipWriteStream
@implementation OZZipWriteStream
- (id) initWithZipFileStruct:(zipFile)zipFile fileNameInZip:(NSString *)fileNameInZip {
@@ -53,7 +53,7 @@
int err= zipWriteInFileInZip(_zipFile, [data bytes], [data length]);
if (err < 0) {
NSString *reason= [NSString stringWithFormat:@"Error writing '%@' in the zipfile", _fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
}
@@ -61,7 +61,7 @@
int err= zipCloseFileInZip(_zipFile);
if (err != ZIP_OK) {
NSString *reason= [NSString stringWithFormat:@"Error closing '%@' in the zipfile", _fileNameInZip];
@throw [[ZipException alloc] initWithError:err reason:reason];
@throw [[OZZipException alloc] initWithError:err reason:reason];
}
}