Skip to content

Commit

Permalink
Prefer ARC-scoped release rather than autorelease in the API
Browse files Browse the repository at this point in the history
* Creating old entry stream and data is now by convention “ns_returns_retained”, which stops autoreleasing on returning large data (see @f5abe34).
  • Loading branch information
pixelglow committed Nov 12, 2013
1 parent 84f7a07 commit 7fe656b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions zipzap/ZZArchiveEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@
*
* @return The new stream: *nil* for new entries.
*/
- (NSInputStream*)stream;
- (NSInputStream*)newStream;

/**
* Creates data to represent the entry file.
*
* @return The new data: *nil* for new entries.
*/
- (NSData*)data;
- (NSData*)newData;

/**
* Creates a data provider to represent the entry file.
Expand Down
4 changes: 2 additions & 2 deletions zipzap/ZZArchiveEntry.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ - (NSString*)fileName
return nil;
}

- (NSInputStream*)stream
- (NSInputStream*)newStream
{
return nil;
}
Expand All @@ -125,7 +125,7 @@ - (BOOL)check:(NSError **)error
return YES;
}

- (NSData*)data
- (NSData*)newData
{
return nil;
}
Expand Down
4 changes: 2 additions & 2 deletions zipzap/ZZOldArchiveEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

- (BOOL)check:(NSError **)error;

- (NSInputStream*)stream;
- (NSData*)data;
- (NSInputStream*)newStream;
- (NSData*)newData;
- (CGDataProviderRef)newDataProvider;

@end
4 changes: 2 additions & 2 deletions zipzap/ZZOldArchiveEntry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ - (BOOL)check:(NSError**)error
return YES;
}

- (NSInputStream*)stream
- (NSInputStream*)newStream
{
switch (_centralFileHeader->compressionMethod)
{
Expand All @@ -201,7 +201,7 @@ - (NSInputStream*)stream
}
}

- (NSData*)data
- (NSData*)newData
{
switch (_centralFileHeader->compressionMethod)
{
Expand Down
6 changes: 3 additions & 3 deletions zipzapTests/ZZUnzipTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ - (void)checkExtractingZipEntryStreamWithChunkSize:(NSUInteger)chunkSize
ZZArchiveEntry* nextEntry = _zipFile.entries[index];
NSString* nextEntryFilePath = _entryFilePaths[index];

NSInputStream* stream = [nextEntry stream];
NSInputStream* stream = [nextEntry newStream];

[stream open];

Expand Down Expand Up @@ -210,7 +210,7 @@ - (void)testZipFromDataConsistentWithZipFromURL

XCTAssertEqual(zipEntry.crc32, zipFromDataEntry.crc32, @"zipFromDataEntry.entries[%lu].crc32 must match the reference entry.", (unsigned long)index);

XCTAssertEqualObjects(zipEntry.data, zipFromDataEntry.data, @"zipFromDataEntry.entries[%lu].data must match the reference entry.", (unsigned long)index);
XCTAssertEqualObjects([zipEntry newData], [zipFromDataEntry newData], @"zipFromDataEntry.entries[%lu].data must match the reference entry.", (unsigned long)index);

XCTAssertEqual(zipEntry.fileMode, zipFromDataEntry.fileMode, @"zipFromDataEntry.entries[%lu].fileMode must match the reference entry.", (unsigned long)index);

Expand All @@ -229,7 +229,7 @@ - (void)testExtractingZipEntryData
ZZArchiveEntry* nextEntry = _zipFile.entries[index];
NSString* nextEntryFilePath = _entryFilePaths[index];

XCTAssertEqualObjects(nextEntry.data,
XCTAssertEqualObjects([nextEntry newData],
[self dataAtFilePath:nextEntryFilePath],
@"zipFile.entries[%lu].data must match the original file data.",
(unsigned long)index);
Expand Down

0 comments on commit 7fe656b

Please sign in to comment.