Skip to content

Commit

Permalink
Remove warning in tests
Browse files Browse the repository at this point in the history
* Switch to SSToolkit MD5 implementation
* Fix warning in MD5 implementation
  • Loading branch information
soffes committed May 9, 2012
1 parent e171229 commit a46e35e
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions Tests/SSZipArchiveTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,16 @@ - (NSString *)_cachesPath:(NSString *)directory {
return path;
}

- (NSString *)_calculateMD5Digest:(NSData *)data
{
unsigned char buffer[CC_MD5_DIGEST_LENGTH];
CC_MD5([data bytes], [data length], buffer);

NSMutableString* digest = [NSMutableString string];

for(int i = 0; i < CC_MD5_DIGEST_LENGTH; ++i)
[digest appendFormat:@"%02x", buffer[i]];

return digest;

// Taken from https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSData+SSToolkitAdditions.m
- (NSString *)_calculateMD5Digest:(NSData *)data {
unsigned char digest[CC_MD5_DIGEST_LENGTH], i;
CC_MD5(data.bytes, (unsigned int)data.length, digest);
NSMutableString *ms = [NSMutableString string];
for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
[ms appendFormat: @"%02x", (int)(digest[i])];
}
return [ms copy];
}

@end

0 comments on commit a46e35e

Please sign in to comment.