Skip to content

Commit 1fb67a7

Browse files
themiswangandrewheard
authored andcommitted
remove func from codebase (#15456)
1 parent 9b3a2ae commit 1fb67a7

File tree

1 file changed

+3
-57
lines changed

1 file changed

+3
-57
lines changed

Crashlytics/Shared/FIRCLSMachO/FIRCLSMachOBinary.m

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414

1515
#import "Crashlytics/Shared/FIRCLSMachO/FIRCLSMachOBinary.h"
1616

17-
#import "Crashlytics/Shared/FIRCLSMachO/FIRCLSMachOSlice.h"
18-
1917
#import <CommonCrypto/CommonHMAC.h>
18+
#import "Crashlytics/Crashlytics/Helpers/FIRCLSUtility.h"
19+
#import "Crashlytics/Shared/FIRCLSByteUtility.h"
20+
#import "Crashlytics/Shared/FIRCLSMachO/FIRCLSMachOSlice.h"
2021

21-
static void FIRCLSSafeHexToString(const uint8_t* value, size_t length, char* outputBuffer);
22-
static NSString* FIRCLSNSDataToNSString(NSData* data);
23-
static NSString* FIRCLSHashBytes(const void* bytes, size_t length);
2422
static NSString* FIRCLSHashNSString(NSString* value);
2523

2624
@interface FIRCLSMachOBinary ()
@@ -116,58 +114,6 @@ + (NSString*)hashNSString:(NSString*)value {
116114

117115
@end
118116

119-
// TODO: Functions copied from the SDK. We should figure out a way to share this.
120-
static void FIRCLSSafeHexToString(const uint8_t* value, size_t length, char* outputBuffer) {
121-
const char hex[] = "0123456789abcdef";
122-
123-
if (!value) {
124-
outputBuffer[0] = '\0';
125-
return;
126-
}
127-
128-
for (size_t i = 0; i < length; ++i) {
129-
unsigned char c = value[i];
130-
outputBuffer[i * 2] = hex[c >> 4];
131-
outputBuffer[i * 2 + 1] = hex[c & 0x0F];
132-
}
133-
134-
outputBuffer[length * 2] = '\0'; // null terminate
135-
}
136-
137-
static NSString* FIRCLSNSDataToNSString(NSData* data) {
138-
NSString* string;
139-
char* buffer;
140-
size_t size;
141-
NSUInteger length;
142-
143-
// we need 2 hex char for every byte of data, plus one more spot for a
144-
// null terminator
145-
length = [data length];
146-
size = (length * 2) + 1;
147-
buffer = calloc(1, sizeof(char) * size);
148-
149-
if (!buffer) {
150-
return nil;
151-
}
152-
153-
FIRCLSSafeHexToString([data bytes], length, buffer);
154-
155-
string = [NSString stringWithUTF8String:buffer];
156-
157-
free(buffer);
158-
159-
return string;
160-
}
161-
162-
static NSString* FIRCLSHashBytes(const void* bytes, size_t length) {
163-
uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0};
164-
CC_SHA1(bytes, (CC_LONG)length, digest);
165-
166-
NSData* result = [NSData dataWithBytes:digest length:CC_SHA1_DIGEST_LENGTH];
167-
168-
return FIRCLSNSDataToNSString(result);
169-
}
170-
171117
static NSString* FIRCLSHashNSString(NSString* value) {
172118
const char* s = [value cStringUsingEncoding:NSUTF8StringEncoding];
173119

0 commit comments

Comments
 (0)