summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/socket.cxx22
-rw-r--r--sal/osl/w32/system.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 86f455e410c1..a6487fa0dae0 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -584,6 +584,15 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
if (strDottedAddr && strDottedAddr->length)
{
+// the Win32 SDK 8.1 deprecates inet_addr()
+#ifdef _WIN32_WINNT_WINBLUE
+ IN_ADDR addr;
+ INT ret = InetPtonW(AF_INET, strDottedAddr->buffer, & addr);
+ if (1 == ret)
+ {
+ nAddr = addr.S_un.S_addr;
+ }
+#else
/* Dotted host address for limited broadcast */
rtl_String *pDottedAddr = NULL;
@@ -592,7 +601,9 @@ oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
nAddr = inet_addr (pDottedAddr->buffer);
+
rtl_string_release (pDottedAddr);
+#endif
}
if (nAddr != OSL_INADDR_NONE)
@@ -635,6 +646,16 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr (
sal_Int32 Port)
{
sal_uInt32 Addr;
+
+// the Win32 SDK 8.1 deprecates inet_addr()
+#ifdef _WIN32_WINNT_WINBLUE
+ IN_ADDR addr;
+ INT ret = InetPtonW(AF_INET, strDottedAddr->buffer, & addr);
+ if (1 == ret)
+ {
+ Addr = addr.S_un.S_addr;
+ }
+#else
rtl_String *pDottedAddr=NULL;
rtl_uString2String(
@@ -643,6 +664,7 @@ oslSocketAddr SAL_CALL osl_createInetSocketAddr (
Addr= inet_addr (pDottedAddr->buffer);
rtl_string_release (pDottedAddr);
+#endif
oslSocketAddr pAddr = 0;
if(Addr != OSL_INADDR_NONE)
diff --git a/sal/osl/w32/system.h b/sal/osl/w32/system.h
index 57a7a0fb6aa4..e461ad9c5561 100644
--- a/sal/osl/w32/system.h
+++ b/sal/osl/w32/system.h
@@ -68,6 +68,7 @@
#pragma warning(disable:4917)
#include <winsock2.h>
#include <wsipx.h>
+ #include <ws2tcpip.h>
#include <shlobj.h>
#ifndef NO_DEBUG_CRT
#include <crtdbg.h>