Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

compatibility fixes for compiling under Objective C++ #427

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MKNetworkKit/Categories/NSData+MKBase64.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ + (NSData *)dataFromBase64String:(NSString *)aString
{
NSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding];
size_t outputLength;
void *outputBuffer = mk_NewBase64Decode([data bytes], [data length], &outputLength);
void *outputBuffer = mk_NewBase64Decode((const char*)[data bytes], [data length], &outputLength);
NSData *result = [NSData dataWithBytes:outputBuffer length:outputLength];
free(outputBuffer);
return result;
Expand Down
14 changes: 10 additions & 4 deletions MKNetworkKit/MKNetworkOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder
self.downloadedDataSize = [decoder decodeIntegerForKey:@"downloadedDataSize"];
self.downloadStreams = [decoder decodeObjectForKey:@"downloadStreams"];
self.startPosition = [decoder decodeIntegerForKey:@"startPosition"];
self.credentialPersistence = [decoder decodeIntegerForKey:@"credentialPersistence"];
self.credentialPersistence = (NSURLCredentialPersistence)[decoder decodeIntegerForKey:@"credentialPersistence"];
}
return self;
}
Expand Down Expand Up @@ -1060,7 +1060,7 @@ OSStatus extractIdentityAndTrust(CFDataRef inPKCS12Data, // 5

//
if (securityError == 0) { // 8
CFDictionaryRef myIdentityAndTrust = CFArrayGetValueAtIndex (items, 0);
CFDictionaryRef myIdentityAndTrust = (CFDictionaryRef) CFArrayGetValueAtIndex (items, 0);
const void *tempIdentity = NULL;
tempIdentity = CFDictionaryGetValue (myIdentityAndTrust,
kSecImportItemIdentity);
Expand Down Expand Up @@ -1271,7 +1271,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
for(NSOutputStream *stream in self.downloadStreams) {

if ([stream hasSpaceAvailable]) {
const uint8_t *dataBuffer = [data bytes];
const uint8_t *dataBuffer = ( const uint8_t *) [data bytes];
[stream write:&dataBuffer[0] maxLength:[data length]];
}
}
Expand Down Expand Up @@ -1406,12 +1406,18 @@ -(void) decompressedResponseImageOfSize:(CGSize) size completionHandler:(void (^
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{

CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)([self responseData]), NULL);
CGImageRef cgImage = CGImageSourceCreateImageAtIndex(source, 0, (__bridge CFDictionaryRef)(@{(id)kCGImageSourceShouldCache:@(YES)}));
CGImageRef cgImage = CGImageSourceCreateImageAtIndex(source, 0, (__bridge CFDictionaryRef)(@{(__bridge id)kCGImageSourceShouldCache:@(YES)}));
UIImage *decompressedImage = [UIImage imageWithCGImage:cgImage];

if(source)
{
CFRelease(source);
}

if(cgImage)
{
CGImageRelease(cgImage);
}

dispatch_async(dispatch_get_main_queue(), ^{
imageDecompressionHandler(decompressedImage);
Expand Down