Clean up ahead of PR.

pull/1/head
Matthew Chen 7 years ago
parent a05acd0174
commit 149199138c

@ -1,9 +1,5 @@
// //
// NSData+hexString.m // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// TextSecureKit
//
// Created by Frederic Jacobs on 28/10/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// //
#import "NSData+hexString.h" #import "NSData+hexString.h"
@ -13,8 +9,9 @@
- (NSString *)hexadecimalString { - (NSString *)hexadecimalString {
/* Returns hexadecimal string of NSData. Empty string if data is empty. */ /* Returns hexadecimal string of NSData. Empty string if data is empty. */
const unsigned char *dataBuffer = (const unsigned char *)[self bytes]; const unsigned char *dataBuffer = (const unsigned char *)[self bytes];
if (!dataBuffer) if (!dataBuffer) {
return [NSString string]; return @"";
}
NSUInteger dataLength = [self length]; NSUInteger dataLength = [self length];
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)]; NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
@ -22,7 +19,7 @@
for (NSUInteger i = 0; i < dataLength; ++i) { for (NSUInteger i = 0; i < dataLength; ++i) {
[hexString appendFormat:@"%02x", dataBuffer[i]]; [hexString appendFormat:@"%02x", dataBuffer[i]];
} }
return [NSString stringWithString:hexString]; return [hexString copy];
} }
@end @end

Loading…
Cancel
Save