From 9388c8a7ee77e6450284690d26c35cdd696a28d0 Mon Sep 17 00:00:00 2001 From: omochimetaru Date: Thu, 30 May 2019 17:17:32 +0900 Subject: [PATCH 1/2] fix size 0 bug --- DCTar.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DCTar.m b/DCTar.m index 87abf33..907c6cd 100644 --- a/DCTar.m +++ b/DCTar.m @@ -313,9 +313,10 @@ +(BOOL)untarObject:(id)tarObject size:(unsigned long long)size toPath:(NSString* if(size == 0) { [@"" writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:error]; + } else { + blockCount += (size - 1) / TAR_BLOCK_SIZE + 1; // size/TAR_BLOCK_SIZE rounded up } - blockCount += (size - 1) / TAR_BLOCK_SIZE + 1; // size/TAR_BLOCK_SIZE rounded up [self writeFileDataForObject:tarObject atLocation:(location + TAR_BLOCK_SIZE) withLength:size atPath:filePath]; } else if(type == '5') { From f917e2bc22dc3b326d1612a27d1b4587f9c74dcb Mon Sep 17 00:00:00 2001 From: omochimetaru Date: Fri, 21 Jun 2019 13:58:48 +0900 Subject: [PATCH 2/2] fix invalid error --- DCTar.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCTar.m b/DCTar.m index 907c6cd..237963b 100644 --- a/DCTar.m +++ b/DCTar.m @@ -312,7 +312,7 @@ +(BOOL)untarObject:(id)tarObject size:(unsigned long long)size toPath:(NSString* //NSLog(@"file created: %@",name); if(size == 0) { - [@"" writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:error]; + [@"" writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; } else { blockCount += (size - 1) / TAR_BLOCK_SIZE + 1; // size/TAR_BLOCK_SIZE rounded up }