summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-22 09:37:31 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-22 21:05:30 +0000
commit8f1bbcf83e23286ebdfd17b83d886fc8f0a3eb2a (patch)
tree8b73a35a6104159f5055f1e0b42a63004758bc8f
parente6c04ef0287a69c453f129778ef35932e0dff4b2 (diff)
Use <stdlib.h> for alloca on FreeBSD.
https://www.freebsd.org/cgi/man.cgi?alloca If stdlib.h does not define alloca, and we're using GCC (or Clang), we define the macro ourselves in terms of a GCC builtin.
-rw-r--r--.travis.yml1
-rw-r--r--CMakeLists.txt61
-rw-r--r--cmake/ModulePackage.cmake24
-rw-r--r--other/travis/env-windows.sh2
-rwxr-xr-xother/travis/toxcore-script12
-rw-r--r--toxcore/DHT.c4
-rw-r--r--toxcore/Messenger.c12
-rw-r--r--toxcore/Messenger.h4
-rw-r--r--toxcore/ccompat.h5
-rw-r--r--toxcore/network.c1
10 files changed, 58 insertions, 68 deletions
diff --git a/.travis.yml b/.travis.yml
index 484f41cf..5100e0a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,6 +37,7 @@ matrix:
37 addons: 37 addons:
38 apt: *apt-dependencies 38 apt: *apt-dependencies
39 - stage: "Stage 1" 39 - stage: "Stage 1"
40 if: type IN (push, api, cron)
40 env: JOB=toxcore ENV=windows ARCH=i686 41 env: JOB=toxcore ENV=windows ARCH=i686
41 group: deprecated-2017Q4 42 group: deprecated-2017Q4
42 services: 43 services:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89b25f9d..6b99510f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,17 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
74 # Warn on non-ISO C. 74 # Warn on non-ISO C.
75 add_cflag("-pedantic") 75 add_cflag("-pedantic")
76 76
77 option(ERROR_ON_WARNING "Make compilation error on a warning" OFF)
78 if(ERROR_ON_WARNING)
79 add_flag("-Werror")
80 endif()
81
82 option(DEBUG "Enable assertions and other debugging facilities" OFF)
83 if(DEBUG)
84 set(MIN_LOGGER_LEVEL DEBUG)
85 add_cflag("-g3")
86 endif()
87
77 option(WARNINGS "Enable additional compiler warnings" ON) 88 option(WARNINGS "Enable additional compiler warnings" ON)
78 if(WARNINGS) 89 if(WARNINGS)
79 # Add all warning flags we can. 90 # Add all warning flags we can.
@@ -91,12 +102,13 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
91 add_flag("-Wno-format-nonliteral") 102 add_flag("-Wno-format-nonliteral")
92 add_flag("-Wno-missing-field-initializers") 103 add_flag("-Wno-missing-field-initializers")
93 add_flag("-Wno-missing-prototypes") 104 add_flag("-Wno-missing-prototypes")
105 add_flag("-Wno-packed")
94 add_flag("-Wno-padded") 106 add_flag("-Wno-padded")
95 add_flag("-Wno-parentheses") 107 add_flag("-Wno-parentheses")
108 add_flag("-Wno-reserved-id-macro")
96 add_flag("-Wno-return-type") 109 add_flag("-Wno-return-type")
97 add_flag("-Wno-sign-compare") 110 add_flag("-Wno-sign-compare")
98 add_flag("-Wno-sign-conversion") 111 add_flag("-Wno-sign-conversion")
99 add_flag("-Wno-tautological-constant-out-of-range-compare")
100 # Our use of mutexes results in a false positive, see 1bbe446 112 # Our use of mutexes results in a false positive, see 1bbe446
101 add_flag("-Wno-thread-safety-analysis") 113 add_flag("-Wno-thread-safety-analysis")
102 add_flag("-Wno-type-limits") 114 add_flag("-Wno-type-limits")
@@ -112,7 +124,6 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
112 add_cflag("-Wno-double-promotion") 124 add_cflag("-Wno-double-promotion")
113 add_cflag("-Wno-gnu-zero-variadic-macro-arguments") 125 add_cflag("-Wno-gnu-zero-variadic-macro-arguments")
114 add_cflag("-Wno-packed") 126 add_cflag("-Wno-packed")
115 add_cflag("-Wno-reserved-id-macro")
116 add_cflag("-Wno-shadow") 127 add_cflag("-Wno-shadow")
117 add_cflag("-Wno-shorten-64-to-32") 128 add_cflag("-Wno-shorten-64-to-32")
118 add_cflag("-Wno-unreachable-code-return") 129 add_cflag("-Wno-unreachable-code-return")
@@ -120,28 +131,20 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
120 add_cflag("-Wno-used-but-marked-unused") 131 add_cflag("-Wno-used-but-marked-unused")
121 132
122 # Disable specific warning flags for C++. 133 # Disable specific warning flags for C++.
123 add_cxxflag("-Wno-c++11-compat") 134 add_cxxflag("-Wno-c++98-compat")
124 add_cxxflag("-Wno-c++11-extensions") 135 add_cxxflag("-Wno-c++98-compat-pedantic")
125 add_cxxflag("-Wno-c++11-narrowing")
126 add_cxxflag("-Wno-c99-extensions") 136 add_cxxflag("-Wno-c99-extensions")
137 add_cxxflag("-Wno-double-promotion")
127 add_cxxflag("-Wno-narrowing") 138 add_cxxflag("-Wno-narrowing")
128 add_cxxflag("-Wno-old-style-cast") 139 add_cxxflag("-Wno-old-style-cast")
140 add_cxxflag("-Wno-shadow")
141 add_cxxflag("-Wno-used-but-marked-unused")
129 add_cxxflag("-Wno-variadic-macros") 142 add_cxxflag("-Wno-variadic-macros")
130 add_cxxflag("-Wno-vla-extension") 143 add_cxxflag("-Wno-vla-extension")
131 endif()
132
133 option(ERROR_ON_WARNING "Make compilation error on a warning" OFF)
134 if(ERROR_ON_WARNING)
135 # Set error-on-warn for C compilation. C++ compilation can't use this because
136 # treating 'c' input as 'c++' when in C++ mode is deprecated in clang and
137 # there is no way to turn off that warning.
138 add_cflag("-Werror")
139 endif()
140 144
141 option(DEBUG "Enable assertions and other debugging facilities" OFF) 145 # Downgrade to warning so we still see it.
142 if(DEBUG) 146 add_flag("-Wno-error=unused-variable")
143 set(MIN_LOGGER_LEVEL DEBUG) 147 add_cxxflag("-Wno-error=zero-as-null-pointer-constant")
144 add_cflag("-g3")
145 endif() 148 endif()
146endif() 149endif()
147 150
@@ -403,7 +406,7 @@ install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tox)
403# endif() 406# endif()
404# 407#
405# if(MSGPACK_FOUND) 408# if(MSGPACK_FOUND)
406# add_binary(toxcore-sut 409# add_executable(toxcore-sut
407# testing/hstox/binary_decode.c 410# testing/hstox/binary_decode.c
408# testing/hstox/binary_encode.c 411# testing/hstox/binary_encode.c
409# testing/hstox/driver.c 412# testing/hstox/driver.c
@@ -445,7 +448,7 @@ endif()
445 448
446function(auto_test target) 449function(auto_test target)
447 if(CHECK_FOUND AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND ARGV1 STREQUAL "MSVC_DONT_BUILD")) 450 if(CHECK_FOUND AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND ARGV1 STREQUAL "MSVC_DONT_BUILD"))
448 add_binary(auto_${target}_test auto_tests/${target}_test.c) 451 add_executable(auto_${target}_test auto_tests/${target}_test.c)
449 target_link_modules(auto_${target}_test 452 target_link_modules(auto_${target}_test
450 toxcore 453 toxcore
451 toxcrypto 454 toxcrypto
@@ -460,7 +463,7 @@ function(auto_test target)
460endfunction() 463endfunction()
461 464
462if(BUILD_TOXAV) 465if(BUILD_TOXAV)
463 add_binary(auto_monolith_test 466 add_executable(auto_monolith_test
464 auto_tests/monolith_test.cpp 467 auto_tests/monolith_test.cpp
465 ${ANDROID_CPU_FEATURES}) 468 ${ANDROID_CPU_FEATURES})
466 target_link_modules(auto_monolith_test 469 target_link_modules(auto_monolith_test
@@ -511,7 +514,7 @@ endif()
511 514
512option(DHT_BOOTSTRAP "Enable building of DHT_bootstrap" ON) 515option(DHT_BOOTSTRAP "Enable building of DHT_bootstrap" ON)
513if(DHT_BOOTSTRAP) 516if(DHT_BOOTSTRAP)
514 add_binary(DHT_bootstrap 517 add_executable(DHT_bootstrap
515 other/DHT_bootstrap.c 518 other/DHT_bootstrap.c
516 other/bootstrap_node_packets.c) 519 other/bootstrap_node_packets.c)
517 target_link_modules(DHT_bootstrap toxnetcrypto) 520 target_link_modules(DHT_bootstrap toxnetcrypto)
@@ -523,7 +526,7 @@ if(BOOTSTRAP_DAEMON)
523 message(FATAL_ERROR "Building tox-bootstrapd for Windows is not supported") 526 message(FATAL_ERROR "Building tox-bootstrapd for Windows is not supported")
524 endif() 527 endif()
525 if(LIBCONFIG_FOUND) 528 if(LIBCONFIG_FOUND)
526 add_binary(tox-bootstrapd 529 add_executable(tox-bootstrapd
527 other/bootstrap_daemon/src/command_line_arguments.c 530 other/bootstrap_daemon/src/command_line_arguments.c
528 other/bootstrap_daemon/src/command_line_arguments.h 531 other/bootstrap_daemon/src/command_line_arguments.h
529 other/bootstrap_daemon/src/config.c 532 other/bootstrap_daemon/src/config.c
@@ -554,7 +557,7 @@ option(BUILD_AV_TEST "Build toxav test" ON)
554if(NOT WIN32 557if(NOT WIN32
555 AND BUILD_AV_TEST AND BUILD_TOXAV 558 AND BUILD_AV_TEST AND BUILD_TOXAV
556 AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND) 559 AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND)
557 add_binary(av_test testing/av_test.c) 560 add_executable(av_test testing/av_test.c)
558 target_link_modules(av_test 561 target_link_modules(av_test
559 toxcore 562 toxcore
560 ${OPENCV_LIBRARIES} 563 ${OPENCV_LIBRARIES}
@@ -567,23 +570,23 @@ if(NOT WIN32
567 endif() 570 endif()
568endif() 571endif()
569 572
570add_binary(DHT_test testing/DHT_test.c) 573add_executable(DHT_test testing/DHT_test.c)
571target_link_modules(DHT_test toxdht) 574target_link_modules(DHT_test toxdht)
572 575
573add_binary(Messenger_test testing/Messenger_test.c) 576add_executable(Messenger_test testing/Messenger_test.c)
574target_link_modules(Messenger_test toxmessenger) 577target_link_modules(Messenger_test toxmessenger)
575 578
576if(NOT WIN32) 579if(NOT WIN32)
577 add_binary(tox_sync testing/tox_sync.c) 580 add_executable(tox_sync testing/tox_sync.c)
578 target_link_modules(tox_sync toxcore) 581 target_link_modules(tox_sync toxcore)
579endif() 582endif()
580 583
581if(UTIL_LIBRARIES) 584if(UTIL_LIBRARIES)
582 add_binary(tox_shell testing/tox_shell.c) 585 add_executable(tox_shell testing/tox_shell.c)
583 target_link_modules(tox_shell toxcore ${UTIL_LIBRARIES}) 586 target_link_modules(tox_shell toxcore ${UTIL_LIBRARIES})
584endif() 587endif()
585 588
586if(NOT WIN32) 589if(NOT WIN32)
587 add_binary(irc_syncbot testing/irc_syncbot.c) 590 add_executable(irc_syncbot testing/irc_syncbot.c)
588 target_link_modules(irc_syncbot toxcore toxnetwork) 591 target_link_modules(irc_syncbot toxcore toxnetwork)
589endif() 592endif()
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake
index 8867fc45..245e41eb 100644
--- a/cmake/ModulePackage.cmake
+++ b/cmake/ModulePackage.cmake
@@ -1,6 +1,5 @@
1option(ENABLE_SHARED "Build shared (dynamic) libraries for all modules" ON) 1option(ENABLE_SHARED "Build shared (dynamic) libraries for all modules" ON)
2option(ENABLE_STATIC "Build static libraries for all modules" ON) 2option(ENABLE_STATIC "Build static libraries for all modules" ON)
3option(COMPILE_AS_CXX "Compile all C code as C++ code" OFF)
4 3
5if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC) 4if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC)
6 message(WARNING 5 message(WARNING
@@ -12,28 +11,6 @@ endif()
12 11
13find_package(PkgConfig) 12find_package(PkgConfig)
14 13
15if(COMPILE_AS_CXX)
16 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1")
17 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_LIMIT_MACROS=1")
18endif()
19
20macro(set_source_language)
21 if(COMPILE_AS_CXX)
22 foreach(srcfile ${ARGN})
23 get_filename_component(srcext ${srcfile} EXT)
24 if(${srcext} STREQUAL ".c")
25 set_source_files_properties(${srcfile} PROPERTIES LANGUAGE CXX)
26 endif()
27 endforeach()
28 endif()
29endmacro()
30
31function(add_binary exec)
32 set_source_language(${ARGN})
33
34 add_executable(${exec} ${ARGN})
35endfunction()
36
37function(pkg_use_module mod pkg) 14function(pkg_use_module mod pkg)
38 if(PKG_CONFIG_FOUND) 15 if(PKG_CONFIG_FOUND)
39 pkg_search_module(${mod} ${pkg}) 16 pkg_search_module(${mod} ${pkg})
@@ -58,7 +35,6 @@ macro(add_submodule super lib)
58endmacro() 35endmacro()
59 36
60function(add_module lib) 37function(add_module lib)
61 set_source_language(${ARGN})
62 set(${lib}_SOURCES ${ARGN} PARENT_SCOPE) 38 set(${lib}_SOURCES ${ARGN} PARENT_SCOPE)
63 39
64 if(ENABLE_SHARED) 40 if(ENABLE_SHARED)
diff --git a/other/travis/env-windows.sh b/other/travis/env-windows.sh
index 6f7f0914..d5e485f1 100644
--- a/other/travis/env-windows.sh
+++ b/other/travis/env-windows.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3CMAKE=$ARCH-w64-mingw32.shared-cmake 3CMAKE=$ARCH-w64-mingw32.shared-cmake
4CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DBOOTSTRAP_DAEMON=OFF -DCOMPILE_AS_CXX=ON" 4CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DBOOTSTRAP_DAEMON=OFF -DERROR_ON_WARNING=OFF"
5NPROC=`nproc` 5NPROC=`nproc`
6CURDIR=/work 6CURDIR=/work
7RUN_TESTS=true 7RUN_TESTS=true
diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script
index 54ee41a9..763be2e4 100755
--- a/other/travis/toxcore-script
+++ b/other/travis/toxcore-script
@@ -10,18 +10,6 @@ set_opt() {
10 set -e 10 set -e
11} 11}
12 12
13# Try some combinations of cmake options.
14for i in `seq 0 7`; do
15 set +x
16 opts="$CMAKE_EXTRA_FLAGS -DWARNINGS=OFF"
17 set_opt STRICT_ABI
18 set_opt ENABLE_STATIC
19 set_opt ENABLE_SHARED
20 set -x
21 RUN $CMAKE -B$BUILD_DIR -H. $opts
22 RUN rm -rf $BUILD_DIR
23done
24
25if perl -e ' 13if perl -e '
26 use Socket qw(PF_INET6 SOCK_STREAM pack_sockaddr_in6 IN6ADDR_LOOPBACK); 14 use Socket qw(PF_INET6 SOCK_STREAM pack_sockaddr_in6 IN6ADDR_LOOPBACK);
27 15
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index 33ebc690..747f7328 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -535,7 +535,7 @@ int pack_nodes(uint8_t *data, uint16_t length, const Node_format *nodes, uint16_
535 memcpy(data + packed_length, nodes[i].public_key, CRYPTO_PUBLIC_KEY_SIZE); 535 memcpy(data + packed_length, nodes[i].public_key, CRYPTO_PUBLIC_KEY_SIZE);
536 packed_length += CRYPTO_PUBLIC_KEY_SIZE; 536 packed_length += CRYPTO_PUBLIC_KEY_SIZE;
537 537
538 uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE; 538 const uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE;
539 assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6); 539 assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6);
540 } 540 }
541 541
@@ -571,7 +571,7 @@ int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed
571 len_processed += CRYPTO_PUBLIC_KEY_SIZE; 571 len_processed += CRYPTO_PUBLIC_KEY_SIZE;
572 ++num; 572 ++num;
573 573
574 uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE; 574 const uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE;
575 assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6); 575 assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6);
576 } 576 }
577 577
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 3cb0fbb6..bc7d055b 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -2258,10 +2258,14 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
2258 2258
2259 uint8_t filenumber = data[0]; 2259 uint8_t filenumber = data[0];
2260 2260
2261#if UINT8_MAX >= MAX_CONCURRENT_FILE_PIPES
2262
2261 if (filenumber >= MAX_CONCURRENT_FILE_PIPES) { 2263 if (filenumber >= MAX_CONCURRENT_FILE_PIPES) {
2262 break; 2264 break;
2263 } 2265 }
2264 2266
2267#endif
2268
2265 uint64_t filesize; 2269 uint64_t filesize;
2266 uint32_t file_type; 2270 uint32_t file_type;
2267 uint16_t filename_length = data_length - head_length; 2271 uint16_t filename_length = data_length - head_length;
@@ -2318,10 +2322,14 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
2318 uint8_t filenumber = data[1]; 2322 uint8_t filenumber = data[1];
2319 uint8_t control_type = data[2]; 2323 uint8_t control_type = data[2];
2320 2324
2325#if UINT8_MAX >= MAX_CONCURRENT_FILE_PIPES
2326
2321 if (filenumber >= MAX_CONCURRENT_FILE_PIPES) { 2327 if (filenumber >= MAX_CONCURRENT_FILE_PIPES) {
2322 break; 2328 break;
2323 } 2329 }
2324 2330
2331#endif
2332
2325 if (handle_filecontrol(m, i, send_receive, filenumber, control_type, data + 3, data_length - 3, userdata) == -1) { 2333 if (handle_filecontrol(m, i, send_receive, filenumber, control_type, data + 3, data_length - 3, userdata) == -1) {
2326 // TODO(iphydf): Do something different here? Right now, this 2334 // TODO(iphydf): Do something different here? Right now, this
2327 // check is pointless. 2335 // check is pointless.
@@ -2338,10 +2346,14 @@ static int m_handle_packet(void *object, int i, const uint8_t *temp, uint16_t le
2338 2346
2339 uint8_t filenumber = data[0]; 2347 uint8_t filenumber = data[0];
2340 2348
2349#if UINT8_MAX >= MAX_CONCURRENT_FILE_PIPES
2350
2341 if (filenumber >= MAX_CONCURRENT_FILE_PIPES) { 2351 if (filenumber >= MAX_CONCURRENT_FILE_PIPES) {
2342 break; 2352 break;
2343 } 2353 }
2344 2354
2355#endif
2356
2345 struct File_Transfers *ft = &m->friendlist[i].file_receiving[filenumber]; 2357 struct File_Transfers *ft = &m->friendlist[i].file_receiving[filenumber];
2346 2358
2347 if (ft->status != FILESTATUS_TRANSFERRING) { 2359 if (ft->status != FILESTATUS_TRANSFERRING) {
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index a261a507..26977036 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -37,6 +37,10 @@
37/* This cannot be bigger than 256 */ 37/* This cannot be bigger than 256 */
38#define MAX_CONCURRENT_FILE_PIPES 256 38#define MAX_CONCURRENT_FILE_PIPES 256
39 39
40#if MAX_CONCURRENT_FILE_PIPES > UINT8_MAX + 1
41#error "uint8_t cannot represent all file transfer numbers"
42#endif
43
40 44
41#define FRIEND_ADDRESS_SIZE (CRYPTO_PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t)) 45#define FRIEND_ADDRESS_SIZE (CRYPTO_PUBLIC_KEY_SIZE + sizeof(uint32_t) + sizeof(uint16_t))
42 46
diff --git a/toxcore/ccompat.h b/toxcore/ccompat.h
index e72e66ae..05212ec5 100644
--- a/toxcore/ccompat.h
+++ b/toxcore/ccompat.h
@@ -29,6 +29,11 @@
29// Emulation using alloca. 29// Emulation using alloca.
30#ifdef _WIN32 30#ifdef _WIN32
31#include <malloc.h> 31#include <malloc.h>
32#elif defined(__FreeBSD__)
33#include <stdlib.h>
34#if !defined(alloca) && defined(__GNUC__)
35#define alloca __builtin_alloca
36#endif
32#else 37#else
33#include <alloca.h> 38#include <alloca.h>
34#endif 39#endif
diff --git a/toxcore/network.c b/toxcore/network.c
index 7d6e415a..56f9aea0 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -31,6 +31,7 @@
31#endif 31#endif
32 32
33#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP 33#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP
34#undef _WIN32_WINNT
34#define _WIN32_WINNT 0x501 35#define _WIN32_WINNT 0x501
35#endif 36#endif
36 37