diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-01-23 16:38:46 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-01-26 10:54:15 +0000 |
commit | c106f83da16726506962e19bcbc3d4c25415b81a (patch) | |
tree | 51f9e4d2b7b445e8f9dc53171d72cd6673e1a9b9 /sal | |
parent | d6587d789ac67daa94677670c6e3a001e45c139d (diff) |
sal,sd: Windows SDK 8.1 deprecates inet_addr()
Change-Id: I443f73fab48f1b66b38e2c77af0fe89f99ee4cd0
Reviewed-on: https://gerrit.libreoffice.org/14142
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/w32/socket.cxx | 22 | ||||
-rw-r--r-- | sal/osl/w32/system.h | 1 |
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> |