Skip to content

Commit a46e35e

Browse files
committed
Remove warning in tests
* Switch to SSToolkit MD5 implementation * Fix warning in MD5 implementation
1 parent e171229 commit a46e35e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Tests/SSZipArchiveTests.m

+10-11
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,16 @@ - (NSString *)_cachesPath:(NSString *)directory {
152152
return path;
153153
}
154154

155-
- (NSString *)_calculateMD5Digest:(NSData *)data
156-
{
157-
unsigned char buffer[CC_MD5_DIGEST_LENGTH];
158-
CC_MD5([data bytes], [data length], buffer);
159-
160-
NSMutableString* digest = [NSMutableString string];
161-
162-
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; ++i)
163-
[digest appendFormat:@"%02x", buffer[i]];
164-
165-
return digest;
155+
156+
// Taken from https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSData+SSToolkitAdditions.m
157+
- (NSString *)_calculateMD5Digest:(NSData *)data {
158+
unsigned char digest[CC_MD5_DIGEST_LENGTH], i;
159+
CC_MD5(data.bytes, (unsigned int)data.length, digest);
160+
NSMutableString *ms = [NSMutableString string];
161+
for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
162+
[ms appendFormat: @"%02x", (int)(digest[i])];
163+
}
164+
return [ms copy];
166165
}
167166

168167
@end

0 commit comments

Comments
 (0)