summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/curl_setup.h
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2025-04-21 09:33:29 +0300
committerdartraiden <wowemuh@gmail.com>2025-04-21 09:50:38 +0300
commitcf6ba06cd445f1f4554701637d5bab581acfba98 (patch)
tree0d9b618df1c8f888cb37221be0590f4a677fe477 /libs/libcurl/src/curl_setup.h
parent842ec200cd37ae05f2a9c56f2a4040088d2ac917 (diff)
libcurl: update to 8.13.0
Diffstat (limited to 'libs/libcurl/src/curl_setup.h')
-rw-r--r--libs/libcurl/src/curl_setup.h105
1 files changed, 85 insertions, 20 deletions
diff --git a/libs/libcurl/src/curl_setup.h b/libs/libcurl/src/curl_setup.h
index 1fd2b16c4e..88c3e12dcc 100644
--- a/libs/libcurl/src/curl_setup.h
+++ b/libs/libcurl/src/curl_setup.h
@@ -56,7 +56,7 @@
# endif
#endif
-#if defined(__APPLE__)
+#ifdef __APPLE__
#include <sys/types.h>
#include <TargetConditionals.h>
/* Fixup faulty target macro initialization in macOS SDK since v14.4 (as of
@@ -78,6 +78,12 @@
#endif
#endif
+/* Visual Studio 2008 is the minimum Visual Studio version we support.
+ Workarounds for older versions of Visual Studio have been removed. */
+#if defined(_MSC_VER) && (_MSC_VER < 1500)
+#error "Ancient versions of Visual Studio are no longer supported due to bugs."
+#endif
+
#ifdef _MSC_VER
/* Disable Visual Studio warnings: 4127 "conditional expression is constant" */
#pragma warning(disable:4127)
@@ -102,6 +108,24 @@
# ifndef NOGDI
# define NOGDI
# endif
+/* Detect Windows App environment which has a restricted access
+ * to the Win32 APIs. */
+# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
+ defined(WINAPI_FAMILY)
+# include <winapifamily.h>
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+# define CURL_WINDOWS_UWP
+# endif
+# endif
+#endif
+
+/* Avoid bogus format check warnings with mingw32ce gcc 4.4.0 in
+ C99 (-std=gnu99) mode */
+#if defined(__MINGW32CE__) && !defined(CURL_NO_FMT_CHECKS) && \
+ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) && \
+ (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4))
+#define CURL_NO_FMT_CHECKS
#endif
/* Compatibility */
@@ -151,6 +175,12 @@
/* system header files in our config files, avoid this at any cost. */
/* ================================================================ */
+#ifdef HAVE_LIBZ
+# ifndef ZLIB_CONST
+# define ZLIB_CONST /* Use z_const. Supported by v1.2.5.2 and upper. */
+# endif
+#endif
+
/*
* AIX 4.3 and newer needs _THREAD_SAFE defined to build
* proper reentrant code. Others may also need it.
@@ -252,7 +282,7 @@
* When HTTP is disabled, disable HTTP-only features
*/
-#if defined(CURL_DISABLE_HTTP)
+#ifdef CURL_DISABLE_HTTP
# define CURL_DISABLE_ALTSVC 1
# define CURL_DISABLE_COOKIES 1
# define CURL_DISABLE_BASIC_AUTH 1
@@ -439,9 +469,9 @@
#endif
#ifdef _WIN32
-#define Curl_getpid() GetCurrentProcessId()
+#define curlx_getpid() GetCurrentProcessId()
#else
-#define Curl_getpid() getpid()
+#define curlx_getpid() getpid()
#endif
/*
@@ -449,7 +479,9 @@
*/
#ifdef USE_WIN32_LARGE_FILES
+# ifdef HAVE_IO_H
# include <io.h>
+# endif
# include <sys/types.h>
# include <sys/stat.h>
# undef lseek
@@ -480,10 +512,12 @@
*/
#if defined(_WIN32) && !defined(USE_WIN32_LARGE_FILES)
+# ifdef HAVE_IO_H
# include <io.h>
+# endif
# include <sys/types.h>
# include <sys/stat.h>
-# ifndef _WIN32_WCE
+# ifndef UNDER_CE
# undef lseek
# define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
# define fstat(fdes,stp) _fstat(fdes, stp)
@@ -658,7 +692,6 @@
# ifdef __minix
/* Minix 3 versions up to at least 3.1.3 are missing these prototypes */
- extern char *strtok_r(char *s, const char *delim, char **last);
extern struct tm *gmtime_r(const time_t * const timep, struct tm *tmp);
# endif
@@ -672,16 +705,6 @@
/* ---------------------------------------------------------------- */
/*
- * MSVC threads support requires a multi-threaded runtime library.
- * _beginthreadex() is not available in single-threaded ones.
- * Single-threaded option was last available in VS2005: _MSC_VER <= 1400
- */
-#if defined(_MSC_VER) && !defined(_MT) /* available in _MSC_VER <= 1400 */
-# undef USE_THREADS_POSIX
-# undef USE_THREADS_WIN32
-#endif
-
-/*
* Mutually exclusive CURLRES_* definitions.
*/
@@ -754,7 +777,7 @@
#endif
/* Single point where USE_NTLM definition might be defined */
-#if !defined(CURL_DISABLE_NTLM)
+#ifndef CURL_DISABLE_NTLM
# if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
defined(USE_GNUTLS) || defined(USE_SECTRANSP) || \
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
@@ -794,7 +817,7 @@
/* noreturn attribute */
-#if !defined(CURL_NORETURN)
+#ifndef CURL_NORETURN
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) || \
defined(__IAR_SYSTEMS_ICC__)
# define CURL_NORETURN __attribute__((__noreturn__))
@@ -807,7 +830,7 @@
/* fallthrough attribute */
-#if !defined(FALLTHROUGH)
+#ifndef FALLTHROUGH
#if (defined(__GNUC__) && __GNUC__ >= 7) || \
(defined(__clang__) && __clang_major__ >= 10)
# define FALLTHROUGH() __attribute__((fallthrough))
@@ -824,6 +847,27 @@
#include "curl_setup_once.h"
#endif
+#ifdef UNDER_CE
+#define getenv curl_getenv /* Windows CE does not support getenv() */
+#define raise(s) ((void)(s))
+/* Terrible workarounds to make Windows CE compile */
+#define errno 0
+#define CURL_SETERRNO(x) ((void)(x))
+#define EINTR 4
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EEXIST 17
+#define EISDIR 21
+#define EINVAL 22
+#define ENOSPC 28
+#define strerror(x) "?"
+#undef STDIN_FILENO
+#define STDIN_FILENO 0
+#else
+#define CURL_SETERRNO(x) (errno = (x))
+#endif
+
/*
* Definition of our NOP statement Object-like macro
*/
@@ -868,6 +912,17 @@
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
+/* For MSVC (all versions as of VS2022) */
+#ifndef STDIN_FILENO
+#define STDIN_FILENO fileno(stdin)
+#endif
+#ifndef STDOUT_FILENO
+#define STDOUT_FILENO fileno(stdout)
+#endif
+#ifndef STDERR_FILENO
+#define STDERR_FILENO fileno(stderr)
+#endif
+
/* Since O_BINARY is used in bitmasks, setting it to zero makes it usable in
source code but yet it does not ruin anything */
#ifdef O_BINARY
@@ -925,6 +980,16 @@ endings either CRLF or LF so 't' is appropriate.
#define CURL_ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
+#ifdef CURLDEBUG
+#define CURL_GETADDRINFO(host,serv,hint,res) \
+ curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
+#define CURL_FREEADDRINFO(data) \
+ curl_dbg_freeaddrinfo(data, __LINE__, __FILE__)
+#else
+#define CURL_GETADDRINFO getaddrinfo
+#define CURL_FREEADDRINFO freeaddrinfo
+#endif
+
/* Some versions of the Android NDK is missing the declaration */
#if defined(HAVE_GETPWUID_R) && \
defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
@@ -987,7 +1052,7 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
# endif
#endif
-#if defined(CURL_INLINE)
+#ifdef CURL_INLINE
/* 'CURL_INLINE' defined, use as-is */
#elif defined(inline)
# define CURL_INLINE inline /* 'inline' defined, assumed correct */