]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples: fix two build issues surfaced with WinCE
authorViktor Szakats <commit@vsz.me>
Sat, 4 Oct 2025 02:33:49 +0000 (04:33 +0200)
committerViktor Szakats <commit@vsz.me>
Sat, 4 Oct 2025 09:35:44 +0000 (11:35 +0200)
Both may apply to rare non-WinCE Windows builds too.

- fix gcc 4.4.0 preprocessor error:
  ```
  docs/examples/http2-upload.c:43:8: error: "_MSC_VER" is not defined
  ```
  Ref: https://github.com/curl/curl/actions/runs/18238150607/job/51935502616

- fix wrong header order:
  Inlcude `windows.h` after `winsock2.h` via `curl/curl.h`.

Regressions from 45438c8d6f8e70385d66c029568524e9e803c539 #18823

Closes #18843

docs/examples/http2-upload.c
docs/examples/synctime.c

index 9508da694b91ff360e04ff53be2c362872a0e1b3..a22161d76dd22efecf27f3eff089edf1f396f173 100644 (file)
@@ -40,8 +40,6 @@
 #ifndef _MSC_VER
 #include <sys/time.h>
 #include <unistd.h>
-#elif (_MSC_VER < 1900)
-#define snprintf _snprintf
 #endif
 
 #ifdef _WIN32
 #define fileno _fileno
 #endif
 
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+#define snprintf _snprintf
+#endif
+
 /* curl stuff */
 #include <curl/curl.h>
 
index dd21082446a7164bb9bdb33dcf06741168c356de..d8264d012e15f4efd9f25e1d89c760df51ec3a60 100644 (file)
@@ -90,11 +90,12 @@ int main(void) { printf("Platform not supported.\n"); return 1; }
 int main(void) { printf("Platform not supported.\n"); return 1; }
 #else
 
-#include <windows.h>
 #include <time.h>
 
 #include <curl/curl.h>
 
+#include <windows.h>
+
 #if defined(_MSC_VER) && (_MSC_VER < 1900)
 #define snprintf _snprintf
 #endif