X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3340066af696862df9394469b341b700fe4e3a68..a9412f8f03171fdd3606a4ad3db9c9da8fe6bd7c:/src/mac/gsocket.c diff --git a/src/mac/gsocket.c b/src/mac/gsocket.c index b96cd92358..9e3ba3079a 100644 --- a/src/mac/gsocket.c +++ b/src/mac/gsocket.c @@ -36,7 +36,7 @@ #include #include #endif -#if TARGET_CARBON +#if TARGET_CARBON && !defined(OTAssert) #define OTAssert( str , cond ) /* does not exists in Carbon */ #endif @@ -87,6 +87,7 @@ extern pascal void OTDebugStr(const char* str); #endif InetSvcRef gInetSvcRef = 0 ; int gOTInited = 0 ; +OTNotifyUPP gOTNotifierUPP = NULL ; OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode); @@ -185,7 +186,7 @@ static void SetDefaultEndpointModes(EndpointRef ep , void *data ) junk = OTSetBlocking(ep); OTAssert("SetDefaultEndpointModes: Could not set blocking", junk == noErr); */ - junk = OTInstallNotifier(ep, OTInetEventHandler, data); + junk = OTInstallNotifier(ep, gOTNotifierUPP, data); OTAssert("SetDefaultEndpointModes: Could not install notifier", junk == noErr); /* junk = OTUseSyncIdleEvents(ep, true); @@ -195,6 +196,11 @@ static void SetDefaultEndpointModes(EndpointRef ep , void *data ) /* Global initialisers */ +void GSocket_SetGUIFunctions(struct GSocketGUIFunctionsTable *table) +{ + // do nothing, wxMac doesn't have wxBase-GUI separation yet +} + int GSocket_Init() { return TRUE; @@ -229,6 +235,7 @@ int GSocket_Verify_Inited() OTAssert("Could not open Inet Services", err == noErr); return FALSE ; } + gOTNotifierUPP = NewOTNotifyUPP( OTInetEventHandler ) ; return TRUE ; } @@ -243,6 +250,8 @@ void GSocket_Cleanup() #else CloseOpenTransport() ; #endif + if ( gOTNotifierUPP ) + DisposeOTNotifyUPP( gOTNotifierUPP ) ; } } @@ -1067,7 +1076,7 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size) OTByteCount sz = 0 ; OTCountDataBytes( socket->m_endpoint , &sz ) ; - if ( size > sz ) + if ( size > (int)sz ) size = sz ; res = OTRcv( socket->m_endpoint , buffer , size , &flags ) ; if ( res < 0 ) @@ -1340,7 +1349,7 @@ service_entry gServices[] = GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, const char *protocol) { - int i ; + size_t i ; assert(address != NULL); CHECK_ADDRESS(address, INET, GSOCK_INVADDR);