diff --git a/RMStore/Optional/RMAppReceipt.m b/RMStore/Optional/RMAppReceipt.m index d8224771..007e916d 100644 --- a/RMStore/Optional/RMAppReceipt.m +++ b/RMStore/Optional/RMAppReceipt.m @@ -48,10 +48,10 @@ static int RMASN1ReadInteger(const uint8_t **pp, long omax) { - int tag, class; + int tag, asn1Class; long length; int value = 0; - ASN1_get_object(pp, &length, &tag, &class, omax); + ASN1_get_object(pp, &length, &tag, &asn1Class, omax); if (tag == V_ASN1_INTEGER) { for (int i = 0; i < length; i++) @@ -65,10 +65,10 @@ static int RMASN1ReadInteger(const uint8_t **pp, long omax) static NSData* RMASN1ReadOctectString(const uint8_t **pp, long omax) { - int tag, class; + int tag, asn1Class; long length; NSData *data = nil; - ASN1_get_object(pp, &length, &tag, &class, omax); + ASN1_get_object(pp, &length, &tag, &asn1Class, omax); if (tag == V_ASN1_OCTET_STRING) { data = [NSData dataWithBytes:*pp length:length]; @@ -79,10 +79,10 @@ static int RMASN1ReadInteger(const uint8_t **pp, long omax) static NSString* RMASN1ReadString(const uint8_t **pp, long omax, int expectedTag, NSStringEncoding encoding) { - int tag, class; + int tag, asn1Class; long length; NSString *value = nil; - ASN1_get_object(pp, &length, &tag, &class, omax); + ASN1_get_object(pp, &length, &tag, &asn1Class, omax); if (tag == expectedTag) { value = [[NSString alloc] initWithBytes:*pp length:length encoding:encoding]; @@ -110,8 +110,9 @@ - (id)initWithASN1Data:(NSData*)asn1Data if (self = [super init]) { NSMutableArray *purchases = [NSMutableArray array]; - [RMAppReceipt enumerateASN1Attributes:asn1Data.bytes length:asn1Data.length usingBlock:^(NSData *data, int type) { - const uint8_t *s = data.bytes; + // Explicit casting to avoid errors when compiling as Objective-C++ + [RMAppReceipt enumerateASN1Attributes:(const uint8_t*)asn1Data.bytes length:asn1Data.length usingBlock:^(NSData *data, int type) { + const uint8_t *s = (const uint8_t*)data.bytes; const NSUInteger length = data.length; switch (type) { @@ -190,7 +191,7 @@ - (BOOL)verifyReceiptHash [data appendData:self.bundleIdentifierData]; NSMutableData *expectedHash = [NSMutableData dataWithLength:SHA_DIGEST_LENGTH]; - SHA1(data.bytes, data.length, expectedHash.mutableBytes); + SHA1((const uint8_t*)data.bytes, data.length, (uint8_t*)expectedHash.mutableBytes); // Explicit casting to avoid errors when compiling as Objective-C++ return [expectedHash isEqualToData:self.hash]; } @@ -328,8 +329,9 @@ - (id)initWithASN1Data:(NSData*)asn1Data { if (self = [super init]) { - [RMAppReceipt enumerateASN1Attributes:asn1Data.bytes length:asn1Data.length usingBlock:^(NSData *data, int type) { - const uint8_t *p = data.bytes; + // Explicit casting to avoid errors when compiling as Objective-C++ + [RMAppReceipt enumerateASN1Attributes:(const uint8_t*)asn1Data.bytes length:asn1Data.length usingBlock:^(NSData *data, int type) { + const uint8_t *p = (const uint8_t*)data.bytes; const NSUInteger length = data.length; switch (type) {