decompressed err #1

Closed
Psli opened this Issue Mar 22, 2012 · 3 comments

Projects

None yet

3 participants

@Psli
Psli commented Mar 22, 2012

iOS 4 & 5

NSError *error;
NSData *originalData = [@"Look out! It's..." dataUsingEncoding:NSUTF8StringEncoding];
NSData *compressedData = [originalData dataByGZipCompressingWithError:nil];
NSData *decompressedData = [compressedData dataByGZipDecompressingDataWithError:&error];

compressed is ok, but decompressed received err :

Error Domain=com.godzippa.zlib.error Code=-2 "The operation couldn’t be completed. (com.godzippa.zlib.error error -2.)"
@Psli
Psli commented Mar 22, 2012

https://github.com/JeremyOT/ObjectiveZlib decompressed worked OK with Godzippa compressed

NSData *originalData = [@"Look out! It's..." dataUsingEncoding:NSUTF8StringEncoding];
//use Godzippa to compressed
NSData *compressedData = [originalData dataByGZipCompressingWithError:nil];
//use ObjectiveZlib to decompressed
NSData *decompressedData = [NSData dataByDecompressingData:compressedData];
@levigroker

I'm seeing similar issues, except the error I get is -2. My test is:

NSString *content = @"Look out! It's...";
NSData *originalData = [content dataUsingEncoding:NSUTF8StringEncoding];
__autoreleasing NSError *error = nil;
NSData *compressedData = [originalData dataByGZipCompressingWithError:&error];
GHAssertNotNil(compressedData, @"Compressed data unexpectedly nil. Error: %@", error);
error = nil;
NSData *decompressedData = [compressedData dataByGZipDecompressingDataWithError:&error];
GHAssertNotNil(decompressedData, @"Decompressed data unexpectedly nil (%@). Error: %@", decompressedData, error);
NSString *result = [NSString stringWithUTF8String:[decompressedData bytes]];

GHAssertEqualObjects(content, result, @"Original content is not equal to compressed and then decompressed content.");

Which fails to decompress with this error:

2012-12-21 13:39:18.320 Tests[91958:460f] 
Name: GHTestFailureException
File: /Volumes/ValassisRepos/Scout/Scout/Scout/Scout/Tests/Tests/GZIPTest.m
Line: 59
Reason: '((decompressedData) != nil)' should be FALSE. Decompressed data unexpectedly nil ((null)). Error: Error Domain=com.godzippa.zlib.error Code=-2 "The operation couldn’t be completed. (com.godzippa.zlib.error error -2.)"

Seems Godzippa is just plain broken.

@mattt mattt added a commit that referenced this issue Jan 21, 2013
@mattt [Issue #1] Fixing Godzippa decompression
Adding example project

Significant refactoring
a1715d6
@mattt
Owner
mattt commented Jan 21, 2013

You were exactly right, that first version plain old didn't work. f42445b should fix that.

@mattt mattt closed this Jan 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment