[Libreoffice-commits] core.git: sd/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon May 31 13:24:25 UTC 2021


 sd/source/ui/remotecontrol/DiscoveryService.cxx |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 68a6c70f25762374f7aed0d4d755345c6f37c78d
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon May 31 10:56:38 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon May 31 15:23:50 2021 +0200

    Simplify construction of a hardcoded IPv4 address
    
    Change-Id: I822313ee708935dd4ecb636c13a961fdd054d660
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116434
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index 9ed2ae727761..cf0043387403 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -119,17 +119,7 @@ void DiscoveryService::setupSockets()
 
     struct ip_mreq multicastRequest;
 
-// the Win32 SDK 8.1 deprecates inet_addr()
-#if defined(_WIN32)
-    IN_ADDR addr;
-    INT ret = InetPtonW(AF_INET, L"239.0.0.1", & addr);
-    if (1 == ret)
-    {
-        multicastRequest.imr_multiaddr.s_addr = addr.S_un.S_addr;
-    }
-#else
-    multicastRequest.imr_multiaddr.s_addr = inet_addr( "239.0.0.1" );
-#endif
+    multicastRequest.imr_multiaddr.s_addr = htonl((239U << 24) | 1U); // 239.0.0.1
     multicastRequest.imr_interface.s_addr = htonl(INADDR_ANY);
 
     rc = setsockopt( mSocket, IPPROTO_IP, IP_ADD_MEMBERSHIP,


More information about the Libreoffice-commits mailing list