From 5fbb1aca370ee09c9cdda7f96cc771cb3e1c249d Mon Sep 17 00:00:00 2001 From: Stuart Connolly Date: Mon, 13 Jan 2014 16:00:48 +0000 Subject: Tidy up. --- Source/SPDataAdditions.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Source') diff --git a/Source/SPDataAdditions.m b/Source/SPDataAdditions.m index 401ffbc8..9b336581 100644 --- a/Source/SPDataAdditions.m +++ b/Source/SPDataAdditions.m @@ -175,11 +175,9 @@ if (deflateInit(&zlibStream, Z_DEFAULT_COMPRESSION) != Z_OK) return nil; - NSMutableData *zipData = [NSMutableData dataWithLength:16384]; - do{ - + do { if (zlibStream.total_out >= [zipData length]) [zipData increaseLengthBy: 16384]; @@ -188,11 +186,13 @@ deflate(&zlibStream, Z_FINISH); - } while(zlibStream.avail_out == 0); + } + while(zlibStream.avail_out == 0); deflateEnd(&zlibStream); [zipData setLength: zlibStream.total_out]; + return [NSData dataWithData: zipData]; } @@ -206,7 +206,8 @@ NSUInteger dataLength = [self length]; NSMutableString *hexString = [NSMutableString string]; - for (i = 0; i < dataLength; i++) { + for (i = 0; i < dataLength; i++) + { [hexString appendFormat:@"%02X", bytes[i]]; } -- cgit v1.2.3