examples: fix two build issues surfaced with WinCE

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 45438c8d6f #18823

Closes #18843
This commit is contained in:
Viktor Szakats 2025-10-04 04:33:49 +02:00
parent ed1e72143a
commit 4535532ed3
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 6 additions and 3 deletions

View 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
@ -52,6 +50,10 @@
#define fileno _fileno
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
/* curl stuff */
#include <curl/curl.h>

View 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