Pārlūkot izejas kodu

fix inclusion order of winsock2/windows.h in amalgamation

Julius Pfrommer 8 gadi atpakaļ
vecāks
revīzija
56e7ae441f

+ 1 - 1
CMakeLists.txt

@@ -222,8 +222,8 @@ set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c
                 ${PROJECT_SOURCE_DIR}/src/server/ua_services_subscription.c
                 ${PROJECT_SOURCE_DIR}/src/client/ua_client_highlevel_subscriptions.c
                 # plugins and dependencies
-                ${PROJECT_SOURCE_DIR}/plugins/ua_clock.c
                 ${PROJECT_SOURCE_DIR}/plugins/ua_network_tcp.c
+                ${PROJECT_SOURCE_DIR}/plugins/ua_clock.c
                 ${PROJECT_SOURCE_DIR}/plugins/ua_log_stdout.c
                 ${PROJECT_SOURCE_DIR}/plugins/ua_config_standard.c
                 ${PROJECT_SOURCE_DIR}/deps/libc_time.c

+ 4 - 1
plugins/ua_clock.c

@@ -4,7 +4,10 @@
 #include "ua_types.h"
 
 #include <time.h>
-#if defined(_WIN32)
+#ifdef _WIN32
+# ifdef SLIST_ENTRY
+#  undef SLIST_ENTRY /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
+# endif
 # include <windows.h>
 #else
 # include <sys/time.h>

+ 4 - 0
plugins/ua_network_tcp.c

@@ -19,7 +19,11 @@
 #include <errno.h>
 #ifdef _WIN32
 # include <malloc.h>
+# ifdef SLIST_ENTRY
+#  undef SLIST_ENTRY /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
+# endif
 # define _WINSOCK_DEPRECATED_NO_WARNINGS /* inet_ntoa is deprecated on MSVC but used for compatibility */
+# include <winsock2.h>
 # include <ws2tcpip.h>
 # define CLOSESOCKET(S) closesocket((SOCKET)S)
 # define ssize_t int

+ 0 - 8
src/ua_util.h

@@ -61,14 +61,6 @@
 /*************************/
 /* External Dependencies */
 /*************************/
-
-/* Fix redefinition of SLIST_ENTRY on windows */
-#ifdef _WIN32
-# include <winsock2.h>
-# include <windows.h>
-# undef SLIST_ENTRY
-#endif
-
 #include "queue.h"
 
 #ifdef UA_ENABLE_MULTITHREADING

+ 4 - 4
tools/pyUANamespace/ua_builtin_types.py

@@ -65,12 +65,12 @@ class opcua_value_t():
 
   def getValueFieldByAlias(self, fieldname):
     if not isinstance(self.value, list):
-      return None
+        return None
     if not isinstance(self.value[0], opcua_value_t):
-      return None
+        return None
     for val in self.value:
-      if val.alias() == fieldname:
-	return val.value
+        if val.alias() == fieldname:
+            return val.value
     return None
 
   def setEncodingRule(self, encoding):