don't use socket function when wxUSE_SOCKETS==0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -178,6 +178,11 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
|
|||||||
{
|
{
|
||||||
#if defined(__WIN32__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__))
|
#if defined(__WIN32__) && !defined(__TWIN32__) && !defined(__WXMICROWIN__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__))
|
||||||
// TODO should use GetComputerNameEx() when available
|
// TODO should use GetComputerNameEx() when available
|
||||||
|
|
||||||
|
// the idea is that if someone had set wxUSE_SOCKETS to 0 the code
|
||||||
|
// shouldn't use winsock.dll (a.k.a. ws2_32.dll) at all so only use this
|
||||||
|
// code if we link with it anyhow
|
||||||
|
#if wxUSE_SOCKETS
|
||||||
WSADATA wsa;
|
WSADATA wsa;
|
||||||
if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 )
|
if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 )
|
||||||
{
|
{
|
||||||
@@ -206,13 +211,15 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
|
|||||||
|
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
|
|
||||||
if ( !!host )
|
if ( !host.empty() )
|
||||||
{
|
{
|
||||||
wxStrncpy(buf, host, maxSize);
|
wxStrncpy(buf, host, maxSize);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_SOCKETS
|
||||||
|
|
||||||
#endif // Win32
|
#endif // Win32
|
||||||
|
|
||||||
return wxGetHostName(buf, maxSize);
|
return wxGetHostName(buf, maxSize);
|
||||||
|
Reference in New Issue
Block a user