]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/sckaddr.cpp
Remove apparently erroneous -1 from DrawBitmap() in wxMSW wxGC code.
[wxWidgets.git] / src / common / sckaddr.cpp
index 9e21624fed06df1fd95b737a4949e0c62e286c9c..67ca3fbcdfa77af4a5a368ad4eb55a98f3d90bac 100644 (file)
@@ -31,6 +31,7 @@
     #include "wx/object.h"
     #include "wx/log.h"
     #include "wx/intl.h"
+    #include "wx/thread.h"
 
     #include <stdio.h>
     #include <stdlib.h>
@@ -48,7 +49,7 @@
 
 #include <errno.h>
 
-#ifdef __UNIX__
+#if defined(__UNIX__) && !defined(__CYGWIN__)
     #include <netdb.h>
     #include <arpa/inet.h>
 #endif // __UNIX__
@@ -81,8 +82,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress)
 #ifdef __WXMSW__
     #define HAVE_INET_ADDR
 
+    #ifndef HAVE_GETHOSTBYNAME
     #define HAVE_GETHOSTBYNAME
+    #endif
+    #ifndef HAVE_GETSERVBYNAME
     #define HAVE_GETSERVBYNAME
+    #endif
 
     // under MSW getxxxbyname() functions are MT-safe (but not reentrant) so
     // we don't need to serialize calls to them
@@ -734,7 +739,7 @@ int wxSockAddress::GetAddressDataLen() const
 
 void wxSockAddress::Init()
 {
-    if ( !wxSocketBase::IsInitialized() )
+    if ( wxIsMainThread() && !wxSocketBase::IsInitialized() )
     {
         // we must do it before using any socket functions
         (void)wxSocketBase::Initialize();
@@ -873,7 +878,7 @@ wxString wxIPV4address::IPAddress() const
 
     return wxString::Format
            (
-            "%lu.%lu.%lu.%lu",
+            "%u.%u.%u.%u",
             (addr >> 24) & 0xff,
             (addr >> 16) & 0xff,
             (addr >> 8) & 0xff,