@@ -324,16 +324,16 @@ -(XADError)extractEntryWithDictionary:(NSDictionary *)dict as:(NSString *)path f
324324}
325325
326326// FIXME: Improve extractEntryWithDictionary:as:forceDirectories:error: with an NSError value.
327- -(BOOL )extractEntryWithDictionary : (NSDictionary *)dict as : (nullable NSString *)path forceDirectories : (BOOL )force error : (NSError **)outErr
327+ -(BOOL )extractEntryWithDictionary : (NSDictionary *)dict as : (NSString *)path forceDirectories : (BOOL )force error : (NSError **)outErr
328328{
329- __strong NSError *tmpErr = nil ;
329+ NSError *tmpErr = nil ;
330330 BOOL okay;
331- @autoreleasepool {
331+ NSAutoreleasePool *pool = [[ NSAutoreleasePool alloc ] init ];
332332
333- NSNumber *dirnum=dict[ XADIsDirectoryKey];
334- NSNumber *linknum=dict[ XADIsLinkKey];
335- NSNumber *resnum=dict[ XADIsResourceForkKey];
336- NSNumber *archivenum=dict[ XADIsArchiveKey];
333+ NSNumber *dirnum=[dict objectForKey: XADIsDirectoryKey];
334+ NSNumber *linknum=[dict objectForKey: XADIsLinkKey];
335+ NSNumber *resnum=[dict objectForKey: XADIsResourceForkKey];
336+ NSNumber *archivenum=[dict objectForKey: XADIsArchiveKey];
337337 BOOL isdir=dirnum&&dirnum.boolValue ;
338338 BOOL islink=linknum&&linknum.boolValue ;
339339 BOOL isres=resnum&&resnum.boolValue ;
@@ -342,7 +342,7 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
342342 // If we were not given a path, pick one ourselves.
343343 if (!path)
344344 {
345- XADPath *name=dict[ XADFileNameKey];
345+ XADPath *name=[dict objectForKey: XADFileNameKey];
346346 NSString *namestring=name.sanitizedPathString ;
347347
348348 if (destination) path=[destination stringByAppendingPathComponent: namestring];
@@ -367,6 +367,7 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
367367 XADError error=0 ;
368368
369369 okay=[self _ensureDirectoryExists: path.stringByDeletingLastPathComponent error: &tmpErr];
370+ [tmpErr retain ];
370371 if (!okay) goto end;
371372
372373 // Attempt to extract embedded archives if requested.
@@ -377,6 +378,7 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
377378 if ([delegate unarchiver: self shouldExtractArchiveEntryWithDictionary: dict to: unarchiverpath])
378379 {
379380 okay=[self _extractArchiveEntryWithDictionary: dict to: unarchiverpath name: path.lastPathComponent error: &tmpErr];
381+ [tmpErr retain ];
380382 // If extraction was attempted, and succeeded for failed, skip everything else.
381383 // Otherwise, if the archive couldn't be opened, fall through and extract normally.
382384 if (!okay && ([tmpErr.domain isEqualToString: XADErrorDomain] && tmpErr.code != XADErrorSubArchive)) goto end;
@@ -399,7 +401,7 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
399401 tmpErr = nil ;
400402 } else {
401403 okay = NO ;
402- tmpErr = [NSError errorWithDomain : XADErrorDomain code: error userInfo: nil ];
404+ tmpErr = [[ NSError alloc ] initWithDomain : XADErrorDomain code: error userInfo: nil ];
403405 }
404406 }
405407 break ;
@@ -413,7 +415,7 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
413415 tmpErr = nil ;
414416 } else {
415417 okay = NO ;
416- tmpErr = [NSError errorWithDomain : XADErrorDomain code: error userInfo: nil ];
418+ tmpErr = [[ NSError alloc ] initWithDomain : XADErrorDomain code: error userInfo: nil ];
417419 }
418420 }
419421 break ;
@@ -443,15 +445,15 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
443445 tmpErr = nil ;
444446 } else {
445447 okay = NO ;
446- tmpErr = [NSError errorWithDomain : XADErrorDomain code: error userInfo: nil ];
448+ tmpErr = [[ NSError alloc ] initWithDomain : XADErrorDomain code: error userInfo: nil ];
447449 }
448450 break ;
449451
450452 default :
451453 // TODO: better error
452454 error=XADErrorBadParameters;
453455 okay = NO ;
454- tmpErr = [NSError errorWithDomain : XADErrorDomain code: XADErrorBadParameters userInfo: nil ];
456+ tmpErr = [[ NSError alloc ] initWithDomain : XADErrorDomain code: XADErrorBadParameters userInfo: nil ];
455457
456458 break ;
457459 }
@@ -479,18 +481,21 @@ -(BOOL)extractEntryWithDictionary:(NSDictionary *)dict as:(nullable NSString *)p
479481 tmpErr = nil ;
480482 } else {
481483 okay = NO ;
482- tmpErr = [NSError errorWithDomain : XADErrorDomain code: error userInfo: nil ];
484+ tmpErr = [[ NSError alloc ] initWithDomain : XADErrorDomain code: error userInfo: nil ];
483485 }
484486
485487 // Report success or failure
486488 end:
487- if (delegate && [delegate respondsToSelector: @selector (unarchiver:didExtractEntryWithDictionary:to:error: )])
489+ if ([delegate respondsToSelector: @selector (unarchiver:didExtractEntryWithDictionary:to:error: )])
488490 {
489491 [delegate unarchiver: self didExtractEntryWithDictionary: dict to: path nserror: okay ? nil : tmpErr];
490492 }
491- }
493+ [pool release ];
494+
492495 if (outErr && tmpErr) {
493- *outErr = tmpErr;
496+ *outErr = [tmpErr autorelease ];
497+ } else if (tmpErr) {
498+ [tmpErr release ];
494499 }
495500
496501 return okay;
@@ -877,7 +882,7 @@ -(XADError)_ensureDirectoryExists:(NSString *)path
877882 if ([delegate respondsToSelector: @selector (unarchiver:didCreateDirectory: )]) {
878883 [delegate unarchiver: self didCreateDirectory: path];
879884 }
880- return XADNoError ;
885+ return XADErrorNone ;
881886 }
882887 #endif
883888 else return XADErrorMakeDirectory;
@@ -1029,7 +1034,7 @@ -(BOOL)runExtractorWithDictionary:(NSDictionary *)dict
10291034 }
10301035
10311036 // Try to find the size of this entry.
1032- NSNumber *sizenum=dict[ XADFileSizeKey];
1037+ NSNumber *sizenum=[dict objectForKey: XADFileSizeKey];
10331038 off_t size=0 ;
10341039 if (sizenum != nil )
10351040 {
@@ -1105,7 +1110,7 @@ -(BOOL)runExtractorWithDictionary:(NSDictionary *)dict
11051110
11061111 // Check if the file has already been marked as corrupt, and
11071112 // give up without testing checksum if so.
1108- NSNumber *iscorrupt=dict[ XADIsCorruptedKey];
1113+ NSNumber *iscorrupt=[dict objectForKey: XADIsCorruptedKey];
11091114 if (iscorrupt&&iscorrupt.boolValue ) {
11101115 if (outError) {
11111116 *outError = [NSError errorWithDomain: XADErrorDomain code: XADErrorDecrunch userInfo: nil ];
0 commit comments