X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5fde6fcc9b551340a194ae4c726db5ab64b5c594..a132a1c810bea2d37b09f01524b57440c968de1c:/src/mac/gsocket.c

diff --git a/src/mac/gsocket.c b/src/mac/gsocket.c
index ed895445f2..10ee5d838d 100644
--- a/src/mac/gsocket.c
+++ b/src/mac/gsocket.c
@@ -19,7 +19,7 @@
 
 #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
 
-#ifdef __UNIX__
+#ifdef __DARWIN__
   #include <CoreServices/CoreServices.h>
 
   #ifndef FALSE
@@ -80,7 +80,7 @@ void wxCYield() ;
 #define qDebug2 1
 extern pascal void OTDebugStr(const char* str);
 #endif
-#ifndef __UNIX__
+#ifndef __DARWIN__
   #include <OTDebug.h>
 #endif
 InetSvcRef gInetSvcRef = 0 ;
@@ -121,7 +121,7 @@ OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode)
 	ret.opt.maxlen = kOTFourByteOptionSize;
 
 	opt->level	= INET_IP;					// dealing with an IP Level function
-#ifdef __UNIX__
+#ifdef __DARWIN__
 	opt->name	= kIP_REUSEADDR;
 #else
 	opt->name	= IP_REUSEADDR;
@@ -195,19 +195,25 @@ static void SetDefaultEndpointModes(EndpointRef ep , void *data )
 
 int GSocket_Init()
 {
-	OSStatus err ;
+    OSStatus err ;
 #if TARGET_CARBON
-	InitOpenTransportInContext( kInitOTForApplicationMask , NULL ) ;
+    // Marc Newsam: added the clientcontext variable
+    //              however, documentation is unclear how this works
+    OTClientContextPtr clientcontext;
+
+    InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext);
+    gInetSvcRef = OTOpenInternetServicesInContext(kDefaultInternetServicesPath,
+						NULL, &err, clientcontext);
 #else	
-	InitOpenTransport() ;
+    InitOpenTransport() ;
+    gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err);
 #endif
-	gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err);
-	if ( gInetSvcRef == NULL ||  err != kOTNoError )
-	{
-		OTAssert("Could not open Inet Services", err == noErr);
-		return FALSE ;
-	}
-  return TRUE;
+    if ( gInetSvcRef == NULL ||  err != kOTNoError )
+    {
+	OTAssert("Could not open Inet Services", err == noErr);
+	return FALSE ;
+    }
+    return TRUE;
 }
 
 void GSocket_Cleanup()