Browse Source

Stack: Correct cast of SOCKET to int on Windows

Fixes #2634
Stefan Profanter 5 years ago
parent
commit
c8da8302db
2 changed files with 9 additions and 3 deletions
  1. 8 2
      arch/network_tcp.c
  2. 1 1
      src/server/ua_services_discovery_multicast.c

+ 8 - 2
arch/network_tcp.c

@@ -119,8 +119,14 @@ connection_recv(UA_Connection *connection, UA_ByteString *response,
         return UA_STATUSCODE_BADOUTOFMEMORY; /* not enough memory retry */
     }
 
-    size_t offset = connection->incompleteChunk.length;
-    size_t remaining = connection->config.recvBufferSize - offset;
+#ifdef _WIN32
+    // windows requires int parameter for length
+    int offset = (int)connection->incompleteChunk.length;
+    int remaining = connection->config.recvBufferSize - offset;
+#else
+	size_t offset = connection->incompleteChunk.length;
+	size_t remaining = connection->config.recvBufferSize - offset;
+#endif
 
     /* Get the received packet(s) */
     ssize_t ret = UA_recv(connection->sockfd, (char*)&response->data[offset],

+ 1 - 1
src/server/ua_services_discovery_multicast.c

@@ -494,7 +494,7 @@ iterateMulticastDiscoveryServer(UA_Server* server, UA_DateTime *nextRepeat,
                                 UA_Boolean processIn) {
     struct timeval next_sleep = { 0, 0 };
     unsigned short retval = mdnsd_step(server->discoveryManager.mdnsDaemon,
-                                       server->discoveryManager.mdnsSocket,
+                                       (int)server->discoveryManager.mdnsSocket,
                                        processIn, true, &next_sleep);
     if(retval == 1) {
         UA_LOG_SOCKET_ERRNO_WRAP(