X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/62e83765c26fa613df0c97f4ad9355f691b048b7..b8f2db1f34fcf92ad8a5cdf5334f2000c9f292f4:/src/mac/carbon/gsocket.c?ds=inline diff --git a/src/mac/carbon/gsocket.c b/src/mac/carbon/gsocket.c index 49b8a92142..bbeaa29fcf 100644 --- a/src/mac/carbon/gsocket.c +++ b/src/mac/carbon/gsocket.c @@ -15,6 +15,7 @@ #ifndef __GSOCKET_STANDALONE__ #include "wx/setup.h" +#include "wx/platform.h" #endif #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) @@ -29,6 +30,7 @@ #define TRUE 1 #endif #else + #include #define OTUNIXERRORS 1 #include #include @@ -84,7 +86,7 @@ extern pascal void OTDebugStr(const char* str); #include #endif InetSvcRef gInetSvcRef = 0 ; - +int gOTInited = 0 ; OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode); @@ -211,6 +213,7 @@ int GSocket_Verify_Inited() return TRUE ; InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext); + gOTInited = 1 ; gInetSvcRef = OTOpenInternetServicesInContext(kDefaultInternetServicesPath, NULL, &err, clientcontext); #else @@ -218,6 +221,7 @@ int GSocket_Verify_Inited() return TRUE ; InitOpenTransport() ; + gOTInited = 1 ; gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err); #endif if ( gInetSvcRef == NULL || err != kOTNoError ) @@ -230,13 +234,16 @@ int GSocket_Verify_Inited() void GSocket_Cleanup() { - if ( gInetSvcRef != NULL ) - OTCloseProvider( gInetSvcRef ); -#if TARGET_CARBON - CloseOpenTransportInContext( NULL ) ; -#else - CloseOpenTransport() ; -#endif + if ( gOTInited != 0 ) + { + if ( gInetSvcRef != NULL ) + OTCloseProvider( gInetSvcRef ); + #if TARGET_CARBON + CloseOpenTransportInContext( NULL ) ; + #else + CloseOpenTransport() ; + #endif + } } /* Constructors / Destructors for GSocket */ @@ -1643,10 +1650,12 @@ void _GSocket_Internal_Proc(unsigned long e , void* d ) /* Hack added for Mac OS X */ GSocketError GAddress_UNIX_GetPath(GAddress *addr, char *path, size_t buf) { + return GSOCK_INVADDR; } GSocketError GAddress_UNIX_SetPath(GAddress *addr, const char *path) { + return GSOCK_INVADDR; } #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */