mirror of
				https://github.com/coturn/coturn.git
				synced 2025-10-31 15:00:59 +01:00 
			
		
		
		
	WINDOWS: unsigned long should not be used to store pointers (#1055)
On LLP64 systems (read Windows) unsigned long is only 4 bytes wide, which makes it very unsuitable for storing pointers. ----- Additional comments: uintptr_t since c99 or uintptr_t since C++11 see: https://cplusplus.com/reference/cstdint/, https://en.cppreference.com/w/c/types/integer, https://en.cppreference.com/w/cpp/types/integer C11 re-enabled in #1056
This commit is contained in:
		
							parent
							
								
									6ff98239f4
								
							
						
					
					
						commit
						c4f670fa24
					
				| @ -23,7 +23,7 @@ endif() | |||||||
| 
 | 
 | ||||||
| if(MSVC OR MINGW) | if(MSVC OR MINGW) | ||||||
|     list(APPEND COMMON_DEFINED WINDOWS) |     list(APPEND COMMON_DEFINED WINDOWS) | ||||||
| 	list(APPEND COMMON_LIBS Ws2_32 netapi32) | 	list(APPEND COMMON_LIBS ws2_32 netapi32) | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL) | find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL) | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #if defined(WINDOWS) | #if defined(WINDOWS) | ||||||
| 	#include <DSRole.h> | 	#include <dsrole.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ if(NOT HAVE_THREAD_BARRIERS) | |||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| if(MSVC OR MINGW) | if(MSVC OR MINGW) | ||||||
|     list(APPEND turnserver_LIBS Iphlpapi) |     list(APPEND turnserver_LIBS iphlpapi) | ||||||
| endif() | endif() | ||||||
| 
 | 
 | ||||||
| set(HEADER_FILES | set(HEADER_FILES | ||||||
|  | |||||||
| @ -34,7 +34,7 @@ | |||||||
| #include "prom_server.h" | #include "prom_server.h" | ||||||
| 
 | 
 | ||||||
| #if defined(WINDOWS) | #if defined(WINDOWS) | ||||||
|     #include <Iphlpapi.h> |     #include <iphlpapi.h> | ||||||
| 
 | 
 | ||||||
|     #define WORKING_BUFFER_SIZE 15000 |     #define WORKING_BUFFER_SIZE 15000 | ||||||
|     #define MAX_TRIES 3 |     #define MAX_TRIES 3 | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ | |||||||
| 
 | 
 | ||||||
| #if defined(WINDOWS) | #if defined(WINDOWS) | ||||||
| #include <ws2tcpip.h> | #include <ws2tcpip.h> | ||||||
| #include <Windows.h> | #include <windows.h> | ||||||
| #include <process.h> | #include <process.h> | ||||||
| #else | #else | ||||||
| #include <sys/socket.h> | #include <sys/socket.h> | ||||||
|  | |||||||
| @ -45,7 +45,7 @@ typedef struct _ur_map ur_map; | |||||||
| //////////////// Common Definitions //////
 | //////////////// Common Definitions //////
 | ||||||
| 
 | 
 | ||||||
| typedef uint64_t ur_map_key_type; | typedef uint64_t ur_map_key_type; | ||||||
| typedef unsigned long ur_map_value_type; | typedef uintptr_t ur_map_value_type; | ||||||
| 
 | 
 | ||||||
| typedef void (*ur_map_del_func)(ur_map_value_type); | typedef void (*ur_map_del_func)(ur_map_value_type); | ||||||
| 
 | 
 | ||||||
| @ -158,7 +158,7 @@ int lm_map_foreach_arg(lm_map* map, foreachcb_arg_type func, void* arg); | |||||||
| 
 | 
 | ||||||
| //////////////// UR ADDR MAP //////////////////
 | //////////////// UR ADDR MAP //////////////////
 | ||||||
| 
 | 
 | ||||||
| typedef unsigned long ur_addr_map_value_type; | typedef uintptr_t ur_addr_map_value_type; | ||||||
| 
 | 
 | ||||||
| #define ADDR_MAP_SIZE (1024) | #define ADDR_MAP_SIZE (1024) | ||||||
| #define ADDR_ARRAY_SIZE (4) | #define ADDR_ARRAY_SIZE (4) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user