X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f0500b3ee1255cc71624bc58b83d0d954b2d45e..6342bd1ab36c1957684c00d408d09fba65d33db6:/src/msw/utils.cpp?ds=sidebyside diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 56413e0523..14346f1413 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -36,6 +36,17 @@ #include "wx/log.h" #endif //WX_PRECOMP +// In some mingws there is a missing extern "C" int the winsock header, +// so we put it here just to be safe. Note that this must appear _before_ +// #include "wx/msw/private.h" which itself includes , as this +// one in turn includes unless we define WIN32_LEAN_AND_MEAN. +// +#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) +extern "C" { + #include // we use socket functions in wxGetFullHostName() +} +#endif + #include "wx/msw/private.h" // includes #include "wx/timer.h" @@ -61,10 +72,6 @@ #include #endif -#if defined(__WIN32__) && !defined(__TWIN32__) - #include // we use socket functions in wxGetFullHostName() -#endif - // VZ: there is some code using NetXXX() functions to get the full user name: // I don't think it's a good idea because they don't work under Win95 and // seem to return the same as wxGetUserId() under NT. If you really want @@ -120,7 +127,7 @@ #endif # if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS && wxUSE_DEBUG_NEW_ALWAYS -# define new new(__FILE__,__LINE__) +# define new new(__TFILE__,__LINE__) # endif #endif @@ -156,7 +163,7 @@ bool wxGetHostName(wxChar *buf, int maxSize) DWORD nSize = maxSize; if ( !::GetComputerName(buf, &nSize) ) { - wxLogLastError("GetComputerName"); + wxLogLastError(wxT("GetComputerName")); return FALSE; } @@ -178,7 +185,7 @@ bool wxGetHostName(wxChar *buf, int maxSize) // get full hostname (with domain name if possible) bool wxGetFullHostName(wxChar *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__TWIN32__) +#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__)) // TODO should use GetComputerNameEx() when available WSADATA wsa; if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 ) @@ -443,7 +450,7 @@ bool wxDirExists(const wxString& dir) if ( h == INVALID_HANDLE_VALUE ) { - wxLogLastError("FindFirstFile"); + wxLogLastError(wxT("FindFirstFile")); return FALSE; } @@ -584,7 +591,7 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn) *majorVsn = info.dwMajorVersion; if (minorVsn) *minorVsn = info.dwMinorVersion; - + switch ( info.dwPlatformId ) { case VER_PLATFORM_WIN32s: @@ -903,8 +910,6 @@ bool wxCheckForInterrupt(wxWindow *wnd) return TRUE; } -#endif // wxUSE_GUI - // MSW only: get user-defined resource from the .res file. // Returns NULL or newly-allocated memory, so use delete[] to clean up. @@ -1045,6 +1050,8 @@ WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) #endif // Win16/32 } +#endif // wxUSE_GUI + #if 0 //------------------------------------------------------------------------ // wild character routines @@ -1202,7 +1209,7 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) return ((*str == '\0') && (*pattern == '\0')); }; -#endif +#endif // 0 #if 0