From 917f42a132113805bec9d9a9b3d4dfca6111d7e2 Mon Sep 17 00:00:00 2001 From: Glen Low Date: Fri, 4 Oct 2013 20:54:12 +0800 Subject: [PATCH] Update to Objective-C object subscripting --- README.markdown | 2 +- zipzap/ZZArchive.mm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 93eb0f41..056addc6 100644 --- a/README.markdown +++ b/README.markdown @@ -78,7 +78,7 @@ Require * *Foundation.framework* * *libc++.dylib* if your project doesn't already use C++ or Objective-C++. * *libz.dylib* -* **Run**: Mac OS X 10.7 (Lion) or iOS 4.0 and later. +* **Run**: Mac OS X 10.7 (Lion) or iOS 5.0 and later. Support ------- diff --git a/zipzap/ZZArchive.mm b/zipzap/ZZArchive.mm index 6bbacfb2..e152d93a 100644 --- a/zipzap/ZZArchive.mm +++ b/zipzap/ZZArchive.mm @@ -177,7 +177,7 @@ - (BOOL)updateEntries:(NSArray*)newEntries NSUInteger newEntriesCount = newEntries.count; NSUInteger skipIndex; for (skipIndex = 0; skipIndex < std::min(oldEntriesCount, newEntriesCount); ++skipIndex) - if ([newEntries objectAtIndex:skipIndex] != [_entries objectAtIndex:skipIndex]) + if (newEntries[skipIndex] != _entries[skipIndex]) break; // get an entry writer for each new entry @@ -189,7 +189,7 @@ - (BOOL)updateEntries:(NSArray*)newEntries }]; // skip the initial matching entries - uint32_t initialSkip = skipIndex > 0 ? [[newEntryWriters objectAtIndex:skipIndex - 1] offsetToLocalFileEnd] : 0; + uint32_t initialSkip = skipIndex > 0 ? [newEntryWriters[skipIndex - 1] offsetToLocalFileEnd] : 0; NSError* __autoreleasing underlyingError; @@ -209,7 +209,7 @@ - (BOOL)updateEntries:(NSArray*)newEntries { // write out local files for (NSUInteger index = skipIndex; index < newEntriesCount; ++index) - if (![[newEntryWriters objectAtIndex:index] writeLocalFileToChannelOutput:temporaryChannelOutput + if (![newEntryWriters[index] writeLocalFileToChannelOutput:temporaryChannelOutput withInitialSkip:initialSkip error:&underlyingError]) return ZZRaiseError(error, ZZLocalFileWriteErrorCode, @{NSUnderlyingErrorKey : underlyingError, ZZEntryIndexKey : @(index)}); @@ -226,7 +226,7 @@ - (BOOL)updateEntries:(NSArray*)newEntries // write out central file headers for (NSUInteger index = 0; index < newEntriesCount; ++index) - if (![[newEntryWriters objectAtIndex:index] writeCentralFileHeaderToChannelOutput:temporaryChannelOutput + if (![newEntryWriters[index] writeCentralFileHeaderToChannelOutput:temporaryChannelOutput error:&underlyingError]) return ZZRaiseError(error, ZZCentralFileHeaderWriteErrorCode, @{NSUnderlyingErrorKey : underlyingError, ZZEntryIndexKey : @(index)});