summaryrefslogtreecommitdiff
path: root/docs/examples/multi-debugcallback.c
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2024-05-24 18:38:32 +0200
committerViktor Szakats <commit@vsz.me>2024-05-26 22:43:04 +0200
commitd4b85890555388bec212b75f47a5c1a48705b156 (patch)
tree441191c825105aba06dde427c1baa34239b2cf03 /docs/examples/multi-debugcallback.c
parent21eb2b55a695babec41ccb3971e5ce3019978bab (diff)
examples: fix compiling with MSVC
- `websocket.c`: use `Sleep()` on Windows. `sleep()` and `unistd.h` are not available in MSVC. - `http2-upload.c`: use local `gettimeofday()` implementation when compiled with MSVC. (Alternate solution is to disable the trace function for MSVC.) Public domain code copied and adapted from libssh2: https://github.com/libssh2/libssh2/blob/e973493f992313b3be73f51d3f7ca6d52e288558/src/misc.c#L719-L743 - silence compiler warning for deprecated `inet_addr()`. Also drop duplicate winsock2 include. ``` curl\docs\examples\externalsocket.c(125,32): error C2220: the following warning is treated as an error [curl\bld\docs\examples\curl-example-externalsocket.vcxproj] curl\docs\examples\externalsocket.c(125,32): warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings [curl\bld\docs\examples\curl-example-e ``` Ref: https://github.com/curl/curl/actions/runs/9227337318/job/25389073450#step:4:95 - silence an MSVC compiler warning. This is in conflict with `checksrc` rules, so silence the rule in favour of the warning-free C syntax. ``` curl\docs\examples\multi-legacy.c(152,1): error C2220: the following warning is treated as an error [curl\bld\docs\examples\curl-example-multi-legacy.vcxproj] curl\docs\examples\multi-legacy.c(152,1): warning C4706: assignment within conditional expression [curl\bld\docs\examples\curl-example-multi-legacy.vcxproj] ``` Ref: https://github.com/curl/curl/actions/runs/9227337318/job/25389073450#step:4:226 - do not use `sys/time.h` and `unistd.h` in Windows builds. Some of these includes look unnecessary. Subject to another PR. Cherry-picked from #13766 Closes #13771
Diffstat (limited to 'docs/examples/multi-debugcallback.c')
-rw-r--r--docs/examples/multi-debugcallback.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c
index 2feb214d5..68f30e9b0 100644
--- a/docs/examples/multi-debugcallback.c
+++ b/docs/examples/multi-debugcallback.c
@@ -30,8 +30,10 @@
#include <string.h>
/* somewhat unix-specific */
+#ifndef _WIN32
#include <sys/time.h>
#include <unistd.h>
+#endif
/* curl stuff */
#include <curl/curl.h>