Permalink
Browse files

Make this build with the 10.11 SDK.

  • Loading branch information...
uliwitness committed Apr 2, 2016
1 parent 8ca52d2 commit 0567fd10ef17d755a3f5860a2bcb4d3977604885
View
@@ -10,9 +10,6 @@
[submodule "KVOWithBlocks"]
path = KVOWithBlocks
url = https://uliwitness@github.com/uliwitness/KVOWithBlocks.git
[submodule "Sparkle"]
path = Sparkle
url = https://uliwitness@github.com/uliwitness/Sparkle.git
[submodule "Stacks"]
path = Stacks
url = https://uliwitness@github.com/uliwitness/Stacks.git
@@ -40,3 +37,6 @@
[submodule "ULINetSocket"]
path = ULINetSocket
url = https://uliwitness@github.com/uliwitness/ULINetSocket.git
[submodule "Sparkle"]
path = Sparkle
url = git@github.com:uliwitness/Sparkle.git
2 Forge
Submodule Forge updated 1 files
+28 −0 .gitignore
Submodule Sparkle updated 574 files
@@ -36,6 +36,7 @@
// Array in which we keep track of all running connections, so we can return
// this information in 'the downloads'.
static NSMutableArray * sRunningConnections = nil;
static NSURLSession * sDownloadInstructionSession = nil;
void LEODownloadInstruction( LEOContext* inContext );
@@ -45,7 +46,7 @@
// Delegate class that remembers the context/context group, destination value,
// callback handler names and actual downloaded data so we can notify the script
// of download progress and actually make the downloaded data available to it.
@interface WILDURLConnectionDelegate : NSObject <NSURLConnectionDelegate,NSURLConnectionDataDelegate>
@interface WILDURLConnectionDelegate : NSObject <NSURLSessionDelegate,NSURLSessionDataDelegate>
{
union LEOValue mDestination;
LEOScript * mOwningScript;
@@ -54,7 +55,6 @@ @interface WILDURLConnectionDelegate : NSObject <NSURLConnectionDelegate,NSURLCo
LEOContext * mContext;
LEOValueArray mDownloadArrayValue; // Value for "the download" parameter, which is an array whose properties users can query.
LEOValuePtr mHeadersArrayValue; // Sub-value of mDownloadArrayValue.
NSInteger mMaxBytes;
NSMutableData * mDownloadedData;
}
@@ -69,7 +69,6 @@ -(id) initWithScript: (LEOScript*)inScript contextGroup: (LEOContextGroup*)inGro
{
if(( self = [super init] ))
{
mMaxBytes = -1;
CScriptContextUserData * ud = new CScriptContextUserData( inUserData->GetStack(), inUserData->GetTarget() );
mContext = LEOContextCreate( inGroup, ud, CScriptContextUserData::CleanUp );
mOwningScript = LEOScriptRetain( inScript );
@@ -91,6 +90,7 @@ -(id) initWithScript: (LEOScript*)inScript contextGroup: (LEOContextGroup*)inGro
-(void) dealloc
{
DESTROY_DEALLOC(mDownloadedData);
LEOCleanUpValue( &mDestination, kLEOInvalidateReferences, mContext );
if( mOwningScript )
LEOScriptRelease(mOwningScript);
@@ -105,7 +105,7 @@ -(void) dealloc
}
-(void) sendDownloadMessage: (NSString*)msgName forConnection: (NSURLConnection*)inConnection
-(void) sendDownloadMessage: (NSString*)msgName forConnection: (NSURLSessionTask*)inConnection
{
#if REMOTE_DEBUGGER
mContext->preInstructionProc = CScriptableObject::PreInstructionProc;
@@ -115,8 +115,8 @@ -(void) sendDownloadMessage: (NSString*)msgName forConnection: (NSURLConnection*
mContext->promptProc = LEODebuggerPrompt;
#endif
LEOAddIntegerArrayEntryToRoot( &mDownloadArrayValue.array, "totalSize", mMaxBytes, kLEOUnitBytes, mContext );
LEOAddIntegerArrayEntryToRoot( &mDownloadArrayValue.array, "size", mDownloadedData.length, kLEOUnitBytes, mContext );
LEOAddIntegerArrayEntryToRoot( &mDownloadArrayValue.array, "totalSize", inConnection.countOfBytesExpectedToReceive, kLEOUnitBytes, mContext );
LEOAddIntegerArrayEntryToRoot( &mDownloadArrayValue.array, "size", inConnection.countOfBytesReceived, kLEOUnitBytes, mContext );
LEOPushEmptyValueOnStack( mContext ); // Reserve space for return value.
LEOPushValueOnStack( mContext, (LEOValuePtr) &mDownloadArrayValue );
@@ -140,25 +140,20 @@ -(void) sendDownloadMessage: (NSString*)msgName forConnection: (NSURLConnection*
}
-(void) connection: (NSURLConnection *)connection didFailWithError: (NSError *)error
-(void) URLSession: (NSURLSession *)session dataTask: (NSURLSessionDataTask *)dataTask
didReceiveResponse: (NSURLResponse *)response
completionHandler: (void (^)(NSURLSessionResponseDisposition disposition))completionHandler
{
[self sendDownloadMessage: mCompletionMessage forConnection: connection];
[sRunningConnections removeObject: connection];
}
-(void) connection: (NSURLConnection *)connection didReceiveResponse: (NSURLResponse *)response
{
mMaxBytes = [response expectedContentLength];
long long maxBytes = [response expectedContentLength];
if( [response respondsToSelector: @selector(allHeaderFields)] )
{
NSDictionary * headers = [(NSHTTPURLResponse*)response allHeaderFields];
if( mMaxBytes < 0 )
if( maxBytes < 0 )
{
NSString * theLengthString = [headers objectForKey: @"Content-Length"];
if( theLengthString )
mMaxBytes = [theLengthString integerValue];
maxBytes = [theLengthString longLongValue];
}
for( NSString* currKey in headers )
@@ -177,28 +172,38 @@ -(void) connection: (NSURLConnection *)connection didReceiveResponse: (NSURLResp
LEOAddCStringArrayEntryToRoot( &mDownloadArrayValue.array, "statusMessage", errMsg, mContext );
}
[self sendDownloadMessage: mProgressMessage forConnection: connection];
[self sendDownloadMessage: mProgressMessage forConnection: dataTask];
completionHandler( NSURLSessionResponseAllow );
}
-(void) connection: (NSURLConnection *)connection didReceiveData: (NSData *)data
-(void) URLSession: (NSURLSession *)session dataTask: (NSURLSessionDataTask *)dataTask didReceiveData: (NSData *)data
{
if( !mDownloadedData )
mDownloadedData = [data mutableCopy];
else
[mDownloadedData appendData: data];
{
mDownloadedData = [NSMutableData new];
}
[mDownloadedData appendData: data];
LEOSetValueAsString( &mDestination, (const char*)[mDownloadedData bytes], mDownloadedData.length, mContext );
[self sendDownloadMessage: mProgressMessage forConnection: connection];
[self sendDownloadMessage: mProgressMessage forConnection: dataTask];
}
-(void) connectionDidFinishLoading: (NSURLConnection *)connection
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
didCompleteWithError:(nullable NSError *)error
{
[self sendDownloadMessage: mCompletionMessage forConnection: connection];
[sRunningConnections removeObject: connection];
if( error )
{
LEOAddIntegerArrayEntryToRoot( &mDownloadArrayValue.array, "statusCode", error.code, kLEOUnitBytes, mContext );
LEOAddCStringArrayEntryToRoot( &mDownloadArrayValue.array, "statusMessage", error.localizedDescription.UTF8String, mContext );
}
[self sendDownloadMessage: mCompletionMessage forConnection: task];
[sRunningConnections removeObject: task];
}
/*!
Instruction function used by the Leonie bytecode interpreter to download a
file from the web into a container, optionally executing code.
@@ -276,7 +281,7 @@ void LEODownloadInstruction( LEOContext* inContext )
NSString * completionMsgObjcString = [NSString stringWithCString: completionMsgString encoding: NSUTF8StringEncoding];
// Create URL request object & delegate:
LEOScript * theScript = LEOContextPeekCurrentScript( inContext );
LEOScript * theScript = LEOContextPeekCurrentScript( inContext );
WILDURLConnectionDelegate* theDelegate = [[[WILDURLConnectionDelegate alloc] initWithScript: theScript contextGroup: inContext->group progressMessage: progressMsgObjcString completionMessage: completionMsgObjcString urlString: urlObjcString scriptUserData: (CScriptContextUserData*) inContext->userData] autorelease];
// Now copy param 2, destination container value, to the delegate:
@@ -302,11 +307,18 @@ void LEODownloadInstruction( LEOContext* inContext )
return;
}
if( !sDownloadInstructionSession )
{
sDownloadInstructionSession = [[NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration] delegate: theDelegate delegateQueue: [NSOperationQueue mainQueue]] retain];
}
NSURLRequest * theRequest = [NSURLRequest requestWithURL: theURL];
NSURLConnection * conn = [NSURLConnection connectionWithRequest: theRequest delegate: theDelegate];
NSURLSessionDataTask * theTask = [sDownloadInstructionSession dataTaskWithRequest: theRequest];
if( !sRunningConnections )
sRunningConnections = [[NSMutableArray alloc] init];
[sRunningConnections addObject: conn];
[sRunningConnections addObject: theTask];
[theTask resume];
LEOCleanUpStackToPtr( inContext, inContext->stackEndPtr -4 );
@@ -321,7 +333,7 @@ void LEOPushDownloadsInstruction( LEOContext* inContext )
struct LEOArrayEntry *downloadsArray = NULL;
int currIdx = 0;
for( NSURLConnection* conn in sRunningConnections )
for( NSURLSessionDataTask* conn in sRunningConnections )
{
char currIdxStr[40] = {};
snprintf( currIdxStr, sizeof(currIdxStr)-1, "%d", ++currIdx );
@@ -35,7 +35,22 @@
NSInteger returnValue = 0;
@try
{
returnValue = NSRunAlertPanel( [NSString stringWithCString: inMessage.c_str() encoding:NSUTF8StringEncoding], @"", [NSString stringWithCString: button1.c_str() encoding:NSUTF8StringEncoding], [NSString stringWithCString: button2.c_str() encoding:NSUTF8StringEncoding], [NSString stringWithCString: button3.c_str() encoding:NSUTF8StringEncoding] );
NSAlert * theAlert = [[NSAlert new] autorelease];
theAlert.messageText = [NSString stringWithCString: inMessage.c_str() encoding:NSUTF8StringEncoding];
if( button1.length() > 0 )
{
[theAlert addButtonWithTitle: [NSString stringWithCString: button1.c_str() encoding:NSUTF8StringEncoding]];
if( button2.length() > 0 )
{
[theAlert addButtonWithTitle: [NSString stringWithCString: button2.c_str() encoding:NSUTF8StringEncoding]];
if( button3.length() > 0 )
{
[theAlert addButtonWithTitle: [NSString stringWithCString: button3.c_str() encoding:NSUTF8StringEncoding]];
}
}
}
returnValue = [theAlert runModal];
}
@catch( NSException * err )
{
@@ -44,11 +59,11 @@
switch( returnValue )
{
case NSAlertDefaultReturn:
case NSAlertFirstButtonReturn:
return 1;
case NSAlertAlternateReturn:
case NSAlertSecondButtonReturn:
return 2;
case NSAlertOtherReturn:
case NSAlertThirdButtonReturn:
return 3;
default:
return 0;
@@ -63,5 +78,5 @@
NSString * answerString = [inputPanel answerString];
ioInputText = [answerString UTF8String];
return returnValue == NSAlertDefaultReturn;
return returnValue == NSAlertFirstButtonReturn;
}
@@ -24,13 +24,12 @@
}
else
{
[NSURLConnection sendAsynchronousRequest: inRequest.GetMacRequest()
queue: [NSOperationQueue mainQueue]
completionHandler: ^(NSURLResponse* response, NSData* data, NSError* connectionError)
{
CAutoreleasePool pool;
CURLResponse responseObject(response);
completionBlock( responseObject, (const char*)[data bytes], [data length] );
}];
NSURLSession * session = [NSURLSession sharedSession];
NSURLSessionDataTask * theTask = [session dataTaskWithRequest: inRequest.GetMacRequest() completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
CAutoreleasePool pool;
CURLResponse responseObject(response);
completionBlock( responseObject, (const char*)[data bytes], [data length] );
}];
[theTask resume];
}
}
@@ -7,7 +7,7 @@
//
#import "WILDMoviePlayerInfoViewController.h"
#import <QTKit/QTKit.h>
#import <AVFoundation/AVFoundation.h>
#import "UKHelperMacros.h"
#import "CMoviePlayerPart.h"
@@ -40,7 +40,7 @@ -(void) loadView
-(IBAction) doChooseMovieFile: (id)sender
{
NSOpenPanel * thePanel = [NSOpenPanel openPanel];
NSArray * types = [QTMovie movieFileTypes: QTIncludeCommonTypes];
NSArray * types = [AVURLAsset audiovisualTypes];
[thePanel setAllowedFileTypes: types];
if( NSFileHandlingPanelOKButton == [thePanel runModal] )
{
@@ -472,6 +472,13 @@
remoteGlobalIDString = 5D06E8D00FD68C7C005AE3F6;
remoteInfo = BinaryDelta;
};
554E14691CAF2D5F00430706 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 55C9F958136E1E940096FC4D /* Sparkle.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 726B2B5D1C645FC900388755;
remoteInfo = "UI Tests";
};
556785E01379C8F5005CC245 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 55C9F958136E1E940096FC4D /* Sparkle.xcodeproj */;
@@ -1978,6 +1985,7 @@
55C9F969136E1E950096FC4D /* Sparkle Unit Tests.octest */,
550346DA136F435800AE7681 /* BinaryDelta */,
556785E11379C8F5005CC245 /* finish_installation.app */,
554E146A1CAF2D5F00430706 /* UI Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -2172,10 +2180,17 @@
remoteRef = 550346D9136F435800AE7681 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
554E146A1CAF2D5F00430706 /* UI Tests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "UI Tests.xctest";
remoteRef = 554E14691CAF2D5F00430706 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
556785E11379C8F5005CC245 /* finish_installation.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = finish_installation.app;
path = Autoupdate.app;
remoteRef = 556785E01379C8F5005CC245 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
@@ -2196,7 +2211,7 @@
55C9F969136E1E950096FC4D /* Sparkle Unit Tests.octest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "Sparkle Unit Tests.octest";
path = "Sparkle Unit Tests.xctest";
remoteRef = 55C9F968136E1E950096FC4D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
@@ -2920,7 +2935,7 @@
INFOPLIST_PREFIX_HEADER = StacksmithVersion.h;
INFOPLIST_PREPROCESS = YES;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_NAME = Stacksmith;
SDKROOT = macosx;
};
@@ -2963,7 +2978,7 @@
INFOPLIST_PREFIX_HEADER = StacksmithVersion.h;
INFOPLIST_PREPROCESS = YES;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_NAME = Stacksmith;
SDKROOT = macosx;
};
@@ -38,7 +38,7 @@ -(id) initWithPrompt: (NSString*)inPrompt answer: (NSString*)inAnswer
[okButton setTitle: @"OK"];
[okButton setKeyEquivalent: @"\r"];
[okButton setFont: [NSFont systemFontOfSize: [NSFont systemFontSizeForControlSize: NSRegularControlSize]]];
[okButton setTag: NSAlertDefaultReturn];
[okButton setTag: NSAlertFirstButtonReturn];
[okButton setTarget: self];
[okButton setAction: @selector(doOKButton:)];
[contentView addSubview: okButton];
@@ -52,7 +52,7 @@ -(id) initWithPrompt: (NSString*)inPrompt answer: (NSString*)inAnswer
[cancelButton setTitle: @"Cancel"];
[cancelButton setKeyEquivalent: @"\033"];
[cancelButton setFont: [NSFont systemFontOfSize: [NSFont systemFontSizeForControlSize: NSRegularControlSize]]];
[cancelButton setTag: NSAlertAlternateReturn];
[cancelButton setTag: NSAlertSecondButtonReturn];
[cancelButton setTarget: self];
[cancelButton setAction: @selector(doCancelButton:)];
[contentView addSubview: cancelButton];
@@ -146,13 +146,13 @@ -(NSString*) answerString
-(IBAction) doOKButton: (id)sender
{
[NSApp stopModalWithCode: NSAlertDefaultReturn];
[NSApp stopModalWithCode: NSAlertFirstButtonReturn];
}
-(IBAction) doCancelButton: (id)sender
{
[NSApp stopModalWithCode: NSAlertAlternateReturn];
[NSApp stopModalWithCode: NSAlertSecondButtonReturn];
}
@end
Oops, something went wrong.

0 comments on commit 0567fd1

Please sign in to comment.