addBetterWinLibSupp

This commit is contained in:
Your Name 2022-03-25 21:50:29 +01:00
parent febfbdcb8b
commit cd0b5a361c
25 changed files with 5378 additions and 4944 deletions

3
.gitignore vendored
View File

@ -72,9 +72,6 @@ Thumbs.db
*.exe *.exe


#Own adds: #Own adds:
g++/
build* build*
src/lib/

Makefile Makefile
S_New4 S_New4

1030
src/curl/curl.h → include/curl/curl.h Executable file → Normal file

File diff suppressed because it is too large Load Diff

24
src/curl/curlver.h → include/curl/curlver.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_CURLVER_H #ifndef CURLINC_CURLVER_H
#define __CURL_CURLVER_H #define CURLINC_CURLVER_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -26,20 +26,20 @@
a script at release-time. This was made its own header file in 7.11.2 */ a script at release-time. This was made its own header file in 7.11.2 */


/* This is the global package copyright */ /* This is the global package copyright */
#define LIBCURL_COPYRIGHT "1996 - 2019 Daniel Stenberg, <daniel@haxx.se>." #define LIBCURL_COPYRIGHT "1996 - 2022 Daniel Stenberg, <daniel@haxx.se>."


/* This is the version number of the libcurl package from which this header /* This is the version number of the libcurl package from which this header
file origins: */ file origins: */
#define LIBCURL_VERSION "7.65.2-DEV" #define LIBCURL_VERSION "7.82.0"


/* The numeric version number is also available "in parts" by using these /* The numeric version number is also available "in parts" by using these
defines: */ defines: */
#define LIBCURL_VERSION_MAJOR 7 #define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 65 #define LIBCURL_VERSION_MINOR 82
#define LIBCURL_VERSION_PATCH 2 #define LIBCURL_VERSION_PATCH 0


/* This is the numeric version of the libcurl version number, meant for easier /* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax: always follow this syntax:


0xXXYYZZ 0xXXYYZZ
@ -57,7 +57,7 @@
CURL_VERSION_BITS() macro since curl's own configure script greps for it CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number. and needs it to contain the full number.
*/ */
#define LIBCURL_VERSION_NUM 0x074102 #define LIBCURL_VERSION_NUM 0x075200


/* /*
* This is the date and time when the full source package was created. The * This is the date and time when the full source package was created. The
@ -68,10 +68,10 @@
* *
* "2007-11-23" * "2007-11-23"
*/ */
#define LIBCURL_TIMESTAMP "[unreleased]" #define LIBCURL_TIMESTAMP "2022-03-05"


#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
#define CURL_AT_LEAST_VERSION(x,y,z) \ #define CURL_AT_LEAST_VERSION(x,y,z) \
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))


#endif /* __CURL_CURLVER_H */ #endif /* CURLINC_CURLVER_H */

19
src/curl/easy.h → include/curl/easy.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_EASY_H #ifndef CURLINC_EASY_H
#define __CURL_EASY_H #define CURLINC_EASY_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -25,6 +25,17 @@
extern "C" { extern "C" {
#endif #endif


/* Flag bits in the curl_blob struct: */
#define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */
#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */

struct curl_blob {
void *data;
size_t len;
unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
left zeroes */
};

CURL_EXTERN CURL *curl_easy_init(void); CURL_EXTERN CURL *curl_easy_init(void);
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);

10
src/curl/mprintf.h → include/curl/mprintf.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_MPRINTF_H #ifndef CURLINC_MPRINTF_H
#define __CURL_MPRINTF_H #define CURLINC_MPRINTF_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -47,4 +47,4 @@ CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
} }
#endif #endif


#endif /* __CURL_MPRINTF_H */ #endif /* CURLINC_MPRINTF_H */

98
src/curl/multi.h → include/curl/multi.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_MULTI_H #ifndef CURLINC_MULTI_H
#define __CURL_MULTI_H #define CURLINC_MULTI_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -72,6 +72,9 @@ typedef enum {
attempted to get added - again */ attempted to get added - again */
CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
callback */ callback */
CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */
CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */
CURLM_ABORTED_BY_CALLBACK,
CURLM_LAST CURLM_LAST
} CURLMcode; } CURLMcode;


@ -173,6 +176,29 @@ CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
int timeout_ms, int timeout_ms,
int *ret); int *ret);


/*
* Name: curl_multi_poll()
*
* Desc: Poll on all fds within a CURLM set as well as any
* additional fds passed to the function.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
int timeout_ms,
int *ret);

/*
* Name: curl_multi_wakeup()
*
* Desc: wakes up a sleeping curl_multi_poll call.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);

/* /*
* Name: curl_multi_perform() * Name: curl_multi_perform()
* *
@ -242,7 +268,7 @@ CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
* value into the equivalent human readable error string. This is * value into the equivalent human readable error string. This is
* useful for printing meaningful error messages. * useful for printing meaningful error messages.
* *
* Returns: A pointer to a zero-terminated error message. * Returns: A pointer to a null-terminated error message.
*/ */
CURL_EXTERN const char *curl_multi_strerror(CURLMcode); CURL_EXTERN const char *curl_multi_strerror(CURLMcode);


@ -319,68 +345,56 @@ CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
long *milliseconds); long *milliseconds);


#undef CINIT /* re-using the same name as in curl.h */

#ifdef CURL_ISOCPP
#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
#else
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
#define LONG CURLOPTTYPE_LONG
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
#define OFF_T CURLOPTTYPE_OFF_T
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
#endif

typedef enum { typedef enum {
/* This is the socket callback function pointer */ /* This is the socket callback function pointer */
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),


/* This is the argument passed to the socket callback */ /* This is the argument passed to the socket callback */
CINIT(SOCKETDATA, OBJECTPOINT, 2), CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),


/* set to 1 to enable pipelining for this multi handle */ /* set to 1 to enable pipelining for this multi handle */
CINIT(PIPELINING, LONG, 3), CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),


/* This is the timer callback function pointer */ /* This is the timer callback function pointer */
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),


/* This is the argument passed to the timer callback */ /* This is the argument passed to the timer callback */
CINIT(TIMERDATA, OBJECTPOINT, 5), CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),


/* maximum number of entries in the connection cache */ /* maximum number of entries in the connection cache */
CINIT(MAXCONNECTS, LONG, 6), CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),


/* maximum number of (pipelining) connections to one host */ /* maximum number of (pipelining) connections to one host */
CINIT(MAX_HOST_CONNECTIONS, LONG, 7), CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),


/* maximum number of requests in a pipeline */ /* maximum number of requests in a pipeline */
CINIT(MAX_PIPELINE_LENGTH, LONG, 8), CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),


/* a connection with a content-length longer than this /* a connection with a content-length longer than this
will not be considered for pipelining */ will not be considered for pipelining */
CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9), CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),


/* a connection with a chunk length longer than this /* a connection with a chunk length longer than this
will not be considered for pipelining */ will not be considered for pipelining */
CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10), CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),


/* a list of site names(+port) that are blacklisted from /* a list of site names(+port) that are blocked from pipelining */
pipelining */ CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),


/* a list of server types that are blacklisted from /* a list of server types that are blocked from pipelining */
pipelining */ CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),


/* maximum number of open connections in total */ /* maximum number of open connections in total */
CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13), CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),


/* This is the server push callback function pointer */ /* This is the server push callback function pointer */
CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14), CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),


/* This is the argument passed to the server push callback */ /* This is the argument passed to the server push callback */
CINIT(PUSHDATA, OBJECTPOINT, 15), CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),

/* maximum number of concurrent streams to support on a connection */
CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),


CURLMOPT_LASTENTRY /* the last unused */ CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption; } CURLMoption;
@ -414,12 +428,14 @@ CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
* Name: curl_push_callback * Name: curl_push_callback
* *
* Desc: This callback gets called when a new stream is being pushed by the * Desc: This callback gets called when a new stream is being pushed by the
* server. It approves or denies the new stream. * server. It approves or denies the new stream. It can also decide
* to completely fail the connection.
* *
* Returns: CURL_PUSH_OK or CURL_PUSH_DENY. * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
*/ */
#define CURL_PUSH_OK 0 #define CURL_PUSH_OK 0
#define CURL_PUSH_DENY 1 #define CURL_PUSH_DENY 1
#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */


struct curl_pushheaders; /* forward declaration only */ struct curl_pushheaders; /* forward declaration only */


68
include/curl/options.h Normal file
View File

@ -0,0 +1,68 @@
#ifndef CURLINC_OPTIONS_H
#define CURLINC_OPTIONS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
CURLOT_LONG, /* long (a range of values) */
CURLOT_VALUES, /* (a defined set or bitmask) */
CURLOT_OFF_T, /* curl_off_t (a range of values) */
CURLOT_OBJECT, /* pointer (void *) */
CURLOT_STRING, /* (char * to zero terminated buffer) */
CURLOT_SLIST, /* (struct curl_slist *) */
CURLOT_CBPTR, /* (void * passed as-is to a callback) */
CURLOT_BLOB, /* blob (struct curl_blob *) */
CURLOT_FUNCTION /* function pointer */
} curl_easytype;

/* Flag bits */

/* "alias" means it is provided for old programs to remain functional,
we prefer another name */
#define CURLOT_FLAG_ALIAS (1<<0)

/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
to use for curl_easy_setopt() for the given id */
struct curl_easyoption {
const char *name;
CURLoption id;
curl_easytype type;
unsigned int flags;
};

CURL_EXTERN const struct curl_easyoption *
curl_easy_option_by_name(const char *name);

CURL_EXTERN const struct curl_easyoption *
curl_easy_option_by_id (CURLoption id);

CURL_EXTERN const struct curl_easyoption *
curl_easy_option_next(const struct curl_easyoption *prev);

#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* CURLINC_OPTIONS_H */

10
src/curl/stdcheaders.h → include/curl/stdcheaders.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __STDC_HEADERS_H #ifndef CURLINC_STDCHEADERS_H
#define __STDC_HEADERS_H #define CURLINC_STDCHEADERS_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -30,4 +30,4 @@ size_t fwrite(const void *, size_t, size_t, FILE *);
int strcasecmp(const char *, const char *); int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t); int strncasecmp(const char *, const char *, size_t);


#endif /* __STDC_HEADERS_H */ #endif /* CURLINC_STDCHEADERS_H */

75
src/curl/system.h → include/curl/system.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_SYSTEM_H #ifndef CURLINC_SYSTEM_H
#define __CURL_SYSTEM_H #define CURLINC_SYSTEM_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -98,22 +98,6 @@
# define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int # define CURL_TYPEOF_CURL_SOCKLEN_T int


#elif defined(__WATCOMC__)
# if defined(__386__)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int

#elif defined(__POCC__) #elif defined(__POCC__)
# if (__POCC__ < 280) # if (__POCC__ < 280)
# define CURL_TYPEOF_CURL_OFF_T long # define CURL_TYPEOF_CURL_OFF_T long
@ -137,15 +121,26 @@
# define CURL_TYPEOF_CURL_SOCKLEN_T int # define CURL_TYPEOF_CURL_SOCKLEN_T int


#elif defined(__LCC__) #elif defined(__LCC__)
# define CURL_TYPEOF_CURL_OFF_T long # if defined(__e2k__) /* MCST eLbrus C Compiler */
# define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_TU "lu" # define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_SUFFIX_CURL_OFF_T L # define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_SUFFIX_CURL_OFF_T L
# define CURL_TYPEOF_CURL_SOCKLEN_T int # define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# else /* Local (or Little) C Compiler */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# endif


#elif defined(__SYMBIAN32__) #elif defined(__SYMBIAN32__)
# if defined(__EABI__) /* Treat all ARM compilers equally */ # if defined(__EABI__) /* Treat all ARM compilers equally */
# define CURL_TYPEOF_CURL_OFF_T long long # define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu" # define CURL_FORMAT_CURL_OFF_TU "llu"
@ -288,7 +283,6 @@
# define CURL_TYPEOF_CURL_SOCKLEN_T int # define CURL_TYPEOF_CURL_SOCKLEN_T int


#elif defined(__TINYC__) /* also known as tcc */ #elif defined(__TINYC__) /* also known as tcc */

# define CURL_TYPEOF_CURL_OFF_T long long # define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu" # define CURL_FORMAT_CURL_OFF_TU "llu"
@ -377,6 +371,7 @@
# define CURL_SUFFIX_CURL_OFF_TU ULL # define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64__) || \ # elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
defined(__e2k__) || \
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
# define CURL_TYPEOF_CURL_OFF_T long # define CURL_TYPEOF_CURL_OFF_T long
@ -473,21 +468,21 @@
*/ */


#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
# define __CURL_OFF_T_C_HLPR2(x) x # define CURLINC_OFF_T_C_HLPR2(x) x
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) # define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x)
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
#else #else
# ifdef CURL_ISOCPP # ifdef CURL_ISOCPP
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
# else # else
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix # define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
# endif # endif
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) # define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix)
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) # define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) # define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
#endif #endif


#endif /* __CURL_SYSTEM_H */ #endif /* CURLINC_SYSTEM_H */

575
src/curl/typecheck-gcc.h → include/curl/typecheck-gcc.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_TYPECHECK_GCC_H #ifndef CURLINC_TYPECHECK_GCC_H
#define __CURL_TYPECHECK_GCC_H #define CURLINC_TYPECHECK_GCC_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -25,10 +25,10 @@
/* wraps curl_easy_setopt() with typechecking */ /* wraps curl_easy_setopt() with typechecking */


/* To add a new kind of warning, add an /* To add a new kind of warning, add an
* if(_curl_is_sometype_option(_curl_opt)) * if(curlcheck_sometype_option(_curl_opt))
* if(!_curl_is_sometype(value)) * if(!curlcheck_sometype(value))
* _curl_easy_setopt_err_sometype(); * _curl_easy_setopt_err_sometype();
* block and define _curl_is_sometype_option, _curl_is_sometype and * block and define curlcheck_sometype_option, curlcheck_sometype and
* _curl_easy_setopt_err_sometype below * _curl_easy_setopt_err_sometype below
* *
* NOTE: We use two nested 'if' statements here instead of the && operator, in * NOTE: We use two nested 'if' statements here instead of the && operator, in
@ -38,112 +38,112 @@
* To add an option that uses the same type as an existing option, you'll just * To add an option that uses the same type as an existing option, you'll just
* need to extend the appropriate _curl_*_option macro * need to extend the appropriate _curl_*_option macro
*/ */
#define curl_easy_setopt(handle, option, value) \ #define curl_easy_setopt(handle, option, value) \
__extension__ ({ \ __extension__({ \
__typeof__(option) _curl_opt = option; \ __typeof__(option) _curl_opt = option; \
if(__builtin_constant_p(_curl_opt)) { \ if(__builtin_constant_p(_curl_opt)) { \
if(_curl_is_long_option(_curl_opt)) \ if(curlcheck_long_option(_curl_opt)) \
if(!_curl_is_long(value)) \ if(!curlcheck_long(value)) \
_curl_easy_setopt_err_long(); \ _curl_easy_setopt_err_long(); \
if(_curl_is_off_t_option(_curl_opt)) \ if(curlcheck_off_t_option(_curl_opt)) \
if(!_curl_is_off_t(value)) \ if(!curlcheck_off_t(value)) \
_curl_easy_setopt_err_curl_off_t(); \ _curl_easy_setopt_err_curl_off_t(); \
if(_curl_is_string_option(_curl_opt)) \ if(curlcheck_string_option(_curl_opt)) \
if(!_curl_is_string(value)) \ if(!curlcheck_string(value)) \
_curl_easy_setopt_err_string(); \ _curl_easy_setopt_err_string(); \
if(_curl_is_write_cb_option(_curl_opt)) \ if(curlcheck_write_cb_option(_curl_opt)) \
if(!_curl_is_write_cb(value)) \ if(!curlcheck_write_cb(value)) \
_curl_easy_setopt_err_write_callback(); \ _curl_easy_setopt_err_write_callback(); \
if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \ if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \
if(!_curl_is_resolver_start_callback(value)) \ if(!curlcheck_resolver_start_callback(value)) \
_curl_easy_setopt_err_resolver_start_callback(); \ _curl_easy_setopt_err_resolver_start_callback(); \
if((_curl_opt) == CURLOPT_READFUNCTION) \ if((_curl_opt) == CURLOPT_READFUNCTION) \
if(!_curl_is_read_cb(value)) \ if(!curlcheck_read_cb(value)) \
_curl_easy_setopt_err_read_cb(); \ _curl_easy_setopt_err_read_cb(); \
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
if(!_curl_is_ioctl_cb(value)) \ if(!curlcheck_ioctl_cb(value)) \
_curl_easy_setopt_err_ioctl_cb(); \ _curl_easy_setopt_err_ioctl_cb(); \
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
if(!_curl_is_sockopt_cb(value)) \ if(!curlcheck_sockopt_cb(value)) \
_curl_easy_setopt_err_sockopt_cb(); \ _curl_easy_setopt_err_sockopt_cb(); \
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
if(!_curl_is_opensocket_cb(value)) \ if(!curlcheck_opensocket_cb(value)) \
_curl_easy_setopt_err_opensocket_cb(); \ _curl_easy_setopt_err_opensocket_cb(); \
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
if(!_curl_is_progress_cb(value)) \ if(!curlcheck_progress_cb(value)) \
_curl_easy_setopt_err_progress_cb(); \ _curl_easy_setopt_err_progress_cb(); \
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
if(!_curl_is_debug_cb(value)) \ if(!curlcheck_debug_cb(value)) \
_curl_easy_setopt_err_debug_cb(); \ _curl_easy_setopt_err_debug_cb(); \
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
if(!_curl_is_ssl_ctx_cb(value)) \ if(!curlcheck_ssl_ctx_cb(value)) \
_curl_easy_setopt_err_ssl_ctx_cb(); \ _curl_easy_setopt_err_ssl_ctx_cb(); \
if(_curl_is_conv_cb_option(_curl_opt)) \ if(curlcheck_conv_cb_option(_curl_opt)) \
if(!_curl_is_conv_cb(value)) \ if(!curlcheck_conv_cb(value)) \
_curl_easy_setopt_err_conv_cb(); \ _curl_easy_setopt_err_conv_cb(); \
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
if(!_curl_is_seek_cb(value)) \ if(!curlcheck_seek_cb(value)) \
_curl_easy_setopt_err_seek_cb(); \ _curl_easy_setopt_err_seek_cb(); \
if(_curl_is_cb_data_option(_curl_opt)) \ if(curlcheck_cb_data_option(_curl_opt)) \
if(!_curl_is_cb_data(value)) \ if(!curlcheck_cb_data(value)) \
_curl_easy_setopt_err_cb_data(); \ _curl_easy_setopt_err_cb_data(); \
if((_curl_opt) == CURLOPT_ERRORBUFFER) \ if((_curl_opt) == CURLOPT_ERRORBUFFER) \
if(!_curl_is_error_buffer(value)) \ if(!curlcheck_error_buffer(value)) \
_curl_easy_setopt_err_error_buffer(); \ _curl_easy_setopt_err_error_buffer(); \
if((_curl_opt) == CURLOPT_STDERR) \ if((_curl_opt) == CURLOPT_STDERR) \
if(!_curl_is_FILE(value)) \ if(!curlcheck_FILE(value)) \
_curl_easy_setopt_err_FILE(); \ _curl_easy_setopt_err_FILE(); \
if(_curl_is_postfields_option(_curl_opt)) \ if(curlcheck_postfields_option(_curl_opt)) \
if(!_curl_is_postfields(value)) \ if(!curlcheck_postfields(value)) \
_curl_easy_setopt_err_postfields(); \ _curl_easy_setopt_err_postfields(); \
if((_curl_opt) == CURLOPT_HTTPPOST) \ if((_curl_opt) == CURLOPT_HTTPPOST) \
if(!_curl_is_arr((value), struct curl_httppost)) \ if(!curlcheck_arr((value), struct curl_httppost)) \
_curl_easy_setopt_err_curl_httpost(); \ _curl_easy_setopt_err_curl_httpost(); \
if((_curl_opt) == CURLOPT_MIMEPOST) \ if((_curl_opt) == CURLOPT_MIMEPOST) \
if(!_curl_is_ptr((value), curl_mime)) \ if(!curlcheck_ptr((value), curl_mime)) \
_curl_easy_setopt_err_curl_mimepost(); \ _curl_easy_setopt_err_curl_mimepost(); \
if(_curl_is_slist_option(_curl_opt)) \ if(curlcheck_slist_option(_curl_opt)) \
if(!_curl_is_arr((value), struct curl_slist)) \ if(!curlcheck_arr((value), struct curl_slist)) \
_curl_easy_setopt_err_curl_slist(); \ _curl_easy_setopt_err_curl_slist(); \
if((_curl_opt) == CURLOPT_SHARE) \ if((_curl_opt) == CURLOPT_SHARE) \
if(!_curl_is_ptr((value), CURLSH)) \ if(!curlcheck_ptr((value), CURLSH)) \
_curl_easy_setopt_err_CURLSH(); \ _curl_easy_setopt_err_CURLSH(); \
} \ } \
curl_easy_setopt(handle, _curl_opt, value); \ curl_easy_setopt(handle, _curl_opt, value); \
}) })


/* wraps curl_easy_getinfo() with typechecking */ /* wraps curl_easy_getinfo() with typechecking */
#define curl_easy_getinfo(handle, info, arg) \ #define curl_easy_getinfo(handle, info, arg) \
__extension__ ({ \ __extension__({ \
__typeof__(info) _curl_info = info; \ __typeof__(info) _curl_info = info; \
if(__builtin_constant_p(_curl_info)) { \ if(__builtin_constant_p(_curl_info)) { \
if(_curl_is_string_info(_curl_info)) \ if(curlcheck_string_info(_curl_info)) \
if(!_curl_is_arr((arg), char *)) \ if(!curlcheck_arr((arg), char *)) \
_curl_easy_getinfo_err_string(); \ _curl_easy_getinfo_err_string(); \
if(_curl_is_long_info(_curl_info)) \ if(curlcheck_long_info(_curl_info)) \
if(!_curl_is_arr((arg), long)) \ if(!curlcheck_arr((arg), long)) \
_curl_easy_getinfo_err_long(); \ _curl_easy_getinfo_err_long(); \
if(_curl_is_double_info(_curl_info)) \ if(curlcheck_double_info(_curl_info)) \
if(!_curl_is_arr((arg), double)) \ if(!curlcheck_arr((arg), double)) \
_curl_easy_getinfo_err_double(); \ _curl_easy_getinfo_err_double(); \
if(_curl_is_slist_info(_curl_info)) \ if(curlcheck_slist_info(_curl_info)) \
if(!_curl_is_arr((arg), struct curl_slist *)) \ if(!curlcheck_arr((arg), struct curl_slist *)) \
_curl_easy_getinfo_err_curl_slist(); \ _curl_easy_getinfo_err_curl_slist(); \
if(_curl_is_tlssessioninfo_info(_curl_info)) \ if(curlcheck_tlssessioninfo_info(_curl_info)) \
if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \ if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
_curl_easy_getinfo_err_curl_tlssesssioninfo(); \ _curl_easy_getinfo_err_curl_tlssesssioninfo(); \
if(_curl_is_certinfo_info(_curl_info)) \ if(curlcheck_certinfo_info(_curl_info)) \
if(!_curl_is_arr((arg), struct curl_certinfo *)) \ if(!curlcheck_arr((arg), struct curl_certinfo *)) \
_curl_easy_getinfo_err_curl_certinfo(); \ _curl_easy_getinfo_err_curl_certinfo(); \
if(_curl_is_socket_info(_curl_info)) \ if(curlcheck_socket_info(_curl_info)) \
if(!_curl_is_arr((arg), curl_socket_t)) \ if(!curlcheck_arr((arg), curl_socket_t)) \
_curl_easy_getinfo_err_curl_socket(); \ _curl_easy_getinfo_err_curl_socket(); \
if(_curl_is_off_t_info(_curl_info)) \ if(curlcheck_off_t_info(_curl_info)) \
if(!_curl_is_arr((arg), curl_off_t)) \ if(!curlcheck_arr((arg), curl_off_t)) \
_curl_easy_getinfo_err_curl_off_t(); \ _curl_easy_getinfo_err_curl_off_t(); \
} \ } \
curl_easy_getinfo(handle, _curl_info, arg); \ curl_easy_getinfo(handle, _curl_info, arg); \
}) })


/* /*
* For now, just make sure that the functions are called with three arguments * For now, just make sure that the functions are called with three arguments
@ -156,83 +156,83 @@ __extension__ ({ \
* functions */ * functions */


/* To define a new warning, use _CURL_WARNING(identifier, "message") */ /* To define a new warning, use _CURL_WARNING(identifier, "message") */
#define _CURL_WARNING(id, message) \ #define CURLWARNING(id, message) \
static void __attribute__((__warning__(message))) \ static void __attribute__((__warning__(message))) \
__attribute__((__unused__)) __attribute__((__noinline__)) \ __attribute__((__unused__)) __attribute__((__noinline__)) \
id(void) { __asm__(""); } id(void) { __asm__(""); }


_CURL_WARNING(_curl_easy_setopt_err_long, CURLWARNING(_curl_easy_setopt_err_long,
"curl_easy_setopt expects a long argument for this option") "curl_easy_setopt expects a long argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_off_t, CURLWARNING(_curl_easy_setopt_err_curl_off_t,
"curl_easy_setopt expects a curl_off_t argument for this option") "curl_easy_setopt expects a curl_off_t argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_string, CURLWARNING(_curl_easy_setopt_err_string,
"curl_easy_setopt expects a " "curl_easy_setopt expects a "
"string ('char *' or char[]) argument for this option" "string ('char *' or char[]) argument for this option"
) )
_CURL_WARNING(_curl_easy_setopt_err_write_callback, CURLWARNING(_curl_easy_setopt_err_write_callback,
"curl_easy_setopt expects a curl_write_callback argument for this option") "curl_easy_setopt expects a curl_write_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_resolver_start_callback, CURLWARNING(_curl_easy_setopt_err_resolver_start_callback,
"curl_easy_setopt expects a " "curl_easy_setopt expects a "
"curl_resolver_start_callback argument for this option" "curl_resolver_start_callback argument for this option"
) )
_CURL_WARNING(_curl_easy_setopt_err_read_cb, CURLWARNING(_curl_easy_setopt_err_read_cb,
"curl_easy_setopt expects a curl_read_callback argument for this option") "curl_easy_setopt expects a curl_read_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, CURLWARNING(_curl_easy_setopt_err_ioctl_cb,
"curl_easy_setopt expects a curl_ioctl_callback argument for this option") "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, CURLWARNING(_curl_easy_setopt_err_sockopt_cb,
"curl_easy_setopt expects a curl_sockopt_callback argument for this option") "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, CURLWARNING(_curl_easy_setopt_err_opensocket_cb,
"curl_easy_setopt expects a " "curl_easy_setopt expects a "
"curl_opensocket_callback argument for this option" "curl_opensocket_callback argument for this option"
) )
_CURL_WARNING(_curl_easy_setopt_err_progress_cb, CURLWARNING(_curl_easy_setopt_err_progress_cb,
"curl_easy_setopt expects a curl_progress_callback argument for this option") "curl_easy_setopt expects a curl_progress_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_debug_cb, CURLWARNING(_curl_easy_setopt_err_debug_cb,
"curl_easy_setopt expects a curl_debug_callback argument for this option") "curl_easy_setopt expects a curl_debug_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb, CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb,
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_conv_cb, CURLWARNING(_curl_easy_setopt_err_conv_cb,
"curl_easy_setopt expects a curl_conv_callback argument for this option") "curl_easy_setopt expects a curl_conv_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_seek_cb, CURLWARNING(_curl_easy_setopt_err_seek_cb,
"curl_easy_setopt expects a curl_seek_callback argument for this option") "curl_easy_setopt expects a curl_seek_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_cb_data, CURLWARNING(_curl_easy_setopt_err_cb_data,
"curl_easy_setopt expects a " "curl_easy_setopt expects a "
"private data pointer as argument for this option") "private data pointer as argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_error_buffer, CURLWARNING(_curl_easy_setopt_err_error_buffer,
"curl_easy_setopt expects a " "curl_easy_setopt expects a "
"char buffer of CURL_ERROR_SIZE as argument for this option") "char buffer of CURL_ERROR_SIZE as argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_FILE, CURLWARNING(_curl_easy_setopt_err_FILE,
"curl_easy_setopt expects a 'FILE *' argument for this option") "curl_easy_setopt expects a 'FILE *' argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_postfields, CURLWARNING(_curl_easy_setopt_err_postfields,
"curl_easy_setopt expects a 'void *' or 'char *' argument for this option") "curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_httpost, CURLWARNING(_curl_easy_setopt_err_curl_httpost,
"curl_easy_setopt expects a 'struct curl_httppost *' " "curl_easy_setopt expects a 'struct curl_httppost *' "
"argument for this option") "argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_mimepost, CURLWARNING(_curl_easy_setopt_err_curl_mimepost,
"curl_easy_setopt expects a 'curl_mime *' " "curl_easy_setopt expects a 'curl_mime *' "
"argument for this option") "argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_slist, CURLWARNING(_curl_easy_setopt_err_curl_slist,
"curl_easy_setopt expects a 'struct curl_slist *' argument for this option") "curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_CURLSH, CURLWARNING(_curl_easy_setopt_err_CURLSH,
"curl_easy_setopt expects a CURLSH* argument for this option") "curl_easy_setopt expects a CURLSH* argument for this option")


_CURL_WARNING(_curl_easy_getinfo_err_string, CURLWARNING(_curl_easy_getinfo_err_string,
"curl_easy_getinfo expects a pointer to 'char *' for this info") "curl_easy_getinfo expects a pointer to 'char *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_long, CURLWARNING(_curl_easy_getinfo_err_long,
"curl_easy_getinfo expects a pointer to long for this info") "curl_easy_getinfo expects a pointer to long for this info")
_CURL_WARNING(_curl_easy_getinfo_err_double, CURLWARNING(_curl_easy_getinfo_err_double,
"curl_easy_getinfo expects a pointer to double for this info") "curl_easy_getinfo expects a pointer to double for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_slist, CURLWARNING(_curl_easy_getinfo_err_curl_slist,
"curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info") "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo, CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
"curl_easy_getinfo expects a pointer to " "curl_easy_getinfo expects a pointer to "
"'struct curl_tlssessioninfo *' for this info") "'struct curl_tlssessioninfo *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo, CURLWARNING(_curl_easy_getinfo_err_curl_certinfo,
"curl_easy_getinfo expects a pointer to " "curl_easy_getinfo expects a pointer to "
"'struct curl_certinfo *' for this info") "'struct curl_certinfo *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_socket, CURLWARNING(_curl_easy_getinfo_err_curl_socket,
"curl_easy_getinfo expects a pointer to curl_socket_t for this info") "curl_easy_getinfo expects a pointer to curl_socket_t for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_off_t, CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
"curl_easy_getinfo expects a pointer to curl_off_t for this info") "curl_easy_getinfo expects a pointer to curl_off_t for this info")


/* groups of curl_easy_setops options that take the same type of argument */ /* groups of curl_easy_setops options that take the same type of argument */
@ -244,14 +244,14 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
*/ */


/* evaluates to true if option takes a long argument */ /* evaluates to true if option takes a long argument */
#define _curl_is_long_option(option) \ #define curlcheck_long_option(option) \
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)


#define _curl_is_off_t_option(option) \ #define curlcheck_off_t_option(option) \
((option) > CURLOPTTYPE_OFF_T) (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))


/* evaluates to true if option takes a char* argument */ /* evaluates to true if option takes a char* argument */
#define _curl_is_string_option(option) \ #define curlcheck_string_option(option) \
((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \ ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
(option) == CURLOPT_ACCEPT_ENCODING || \ (option) == CURLOPT_ACCEPT_ENCODING || \
(option) == CURLOPT_ALTSVC || \ (option) == CURLOPT_ALTSVC || \
@ -273,6 +273,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_FTPPORT || \ (option) == CURLOPT_FTPPORT || \
(option) == CURLOPT_FTP_ACCOUNT || \ (option) == CURLOPT_FTP_ACCOUNT || \
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
(option) == CURLOPT_HSTS || \
(option) == CURLOPT_INTERFACE || \ (option) == CURLOPT_INTERFACE || \
(option) == CURLOPT_ISSUERCERT || \ (option) == CURLOPT_ISSUERCERT || \
(option) == CURLOPT_KEYPASSWD || \ (option) == CURLOPT_KEYPASSWD || \
@ -292,6 +293,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_PROXY_CAINFO || \ (option) == CURLOPT_PROXY_CAINFO || \
(option) == CURLOPT_PROXY_CAPATH || \ (option) == CURLOPT_PROXY_CAPATH || \
(option) == CURLOPT_PROXY_CRLFILE || \ (option) == CURLOPT_PROXY_CRLFILE || \
(option) == CURLOPT_PROXY_ISSUERCERT || \
(option) == CURLOPT_PROXY_KEYPASSWD || \ (option) == CURLOPT_PROXY_KEYPASSWD || \
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \ (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
(option) == CURLOPT_PROXY_SERVICE_NAME || \ (option) == CURLOPT_PROXY_SERVICE_NAME || \
@ -311,9 +313,11 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_RTSP_SESSION_ID || \ (option) == CURLOPT_RTSP_SESSION_ID || \
(option) == CURLOPT_RTSP_STREAM_URI || \ (option) == CURLOPT_RTSP_STREAM_URI || \
(option) == CURLOPT_RTSP_TRANSPORT || \ (option) == CURLOPT_RTSP_TRANSPORT || \
(option) == CURLOPT_SASL_AUTHZID || \
(option) == CURLOPT_SERVICE_NAME || \ (option) == CURLOPT_SERVICE_NAME || \
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 || \
(option) == CURLOPT_SSH_KNOWNHOSTS || \ (option) == CURLOPT_SSH_KNOWNHOSTS || \
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
@ -331,32 +335,36 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_URL || \ (option) == CURLOPT_URL || \
(option) == CURLOPT_USERAGENT || \ (option) == CURLOPT_USERAGENT || \
(option) == CURLOPT_USERNAME || \ (option) == CURLOPT_USERNAME || \
(option) == CURLOPT_AWS_SIGV4 || \
(option) == CURLOPT_USERPWD || \ (option) == CURLOPT_USERPWD || \
(option) == CURLOPT_XOAUTH2_BEARER || \ (option) == CURLOPT_XOAUTH2_BEARER || \
(option) == CURLOPT_SSL_EC_CURVES || \
0) 0)


/* evaluates to true if option takes a curl_write_callback argument */ /* evaluates to true if option takes a curl_write_callback argument */
#define _curl_is_write_cb_option(option) \ #define curlcheck_write_cb_option(option) \
((option) == CURLOPT_HEADERFUNCTION || \ ((option) == CURLOPT_HEADERFUNCTION || \
(option) == CURLOPT_WRITEFUNCTION) (option) == CURLOPT_WRITEFUNCTION)


/* evaluates to true if option takes a curl_conv_callback argument */ /* evaluates to true if option takes a curl_conv_callback argument */
#define _curl_is_conv_cb_option(option) \ #define curlcheck_conv_cb_option(option) \
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)


/* evaluates to true if option takes a data argument to pass to a callback */ /* evaluates to true if option takes a data argument to pass to a callback */
#define _curl_is_cb_data_option(option) \ #define curlcheck_cb_data_option(option) \
((option) == CURLOPT_CHUNK_DATA || \ ((option) == CURLOPT_CHUNK_DATA || \
(option) == CURLOPT_CLOSESOCKETDATA || \ (option) == CURLOPT_CLOSESOCKETDATA || \
(option) == CURLOPT_DEBUGDATA || \ (option) == CURLOPT_DEBUGDATA || \
(option) == CURLOPT_FNMATCH_DATA || \ (option) == CURLOPT_FNMATCH_DATA || \
(option) == CURLOPT_HEADERDATA || \ (option) == CURLOPT_HEADERDATA || \
(option) == CURLOPT_HSTSREADDATA || \
(option) == CURLOPT_HSTSWRITEDATA || \
(option) == CURLOPT_INTERLEAVEDATA || \ (option) == CURLOPT_INTERLEAVEDATA || \
(option) == CURLOPT_IOCTLDATA || \ (option) == CURLOPT_IOCTLDATA || \
(option) == CURLOPT_OPENSOCKETDATA || \ (option) == CURLOPT_OPENSOCKETDATA || \
(option) == CURLOPT_PRIVATE || \ (option) == CURLOPT_PREREQDATA || \
(option) == CURLOPT_PROGRESSDATA || \ (option) == CURLOPT_PROGRESSDATA || \
(option) == CURLOPT_READDATA || \ (option) == CURLOPT_READDATA || \
(option) == CURLOPT_SEEKDATA || \ (option) == CURLOPT_SEEKDATA || \
@ -369,13 +377,13 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
0) 0)


/* evaluates to true if option takes a POST data argument (void* or char*) */ /* evaluates to true if option takes a POST data argument (void* or char*) */
#define _curl_is_postfields_option(option) \ #define curlcheck_postfields_option(option) \
((option) == CURLOPT_POSTFIELDS || \ ((option) == CURLOPT_POSTFIELDS || \
(option) == CURLOPT_COPYPOSTFIELDS || \ (option) == CURLOPT_COPYPOSTFIELDS || \
0) 0)


/* evaluates to true if option takes a struct curl_slist * argument */ /* evaluates to true if option takes a struct curl_slist * argument */
#define _curl_is_slist_option(option) \ #define curlcheck_slist_option(option) \
((option) == CURLOPT_HTTP200ALIASES || \ ((option) == CURLOPT_HTTP200ALIASES || \
(option) == CURLOPT_HTTPHEADER || \ (option) == CURLOPT_HTTPHEADER || \
(option) == CURLOPT_MAIL_RCPT || \ (option) == CURLOPT_MAIL_RCPT || \
@ -391,40 +399,41 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
/* groups of curl_easy_getinfo infos that take the same type of argument */ /* groups of curl_easy_getinfo infos that take the same type of argument */


/* evaluates to true if info expects a pointer to char * argument */ /* evaluates to true if info expects a pointer to char * argument */
#define _curl_is_string_info(info) \ #define curlcheck_string_info(info) \
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG) (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
(info) != CURLINFO_PRIVATE)


/* evaluates to true if info expects a pointer to long argument */ /* evaluates to true if info expects a pointer to long argument */
#define _curl_is_long_info(info) \ #define curlcheck_long_info(info) \
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)


/* evaluates to true if info expects a pointer to double argument */ /* evaluates to true if info expects a pointer to double argument */
#define _curl_is_double_info(info) \ #define curlcheck_double_info(info) \
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)


/* true if info expects a pointer to struct curl_slist * argument */ /* true if info expects a pointer to struct curl_slist * argument */
#define _curl_is_slist_info(info) \ #define curlcheck_slist_info(info) \
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST)) (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))


/* true if info expects a pointer to struct curl_tlssessioninfo * argument */ /* true if info expects a pointer to struct curl_tlssessioninfo * argument */
#define _curl_is_tlssessioninfo_info(info) \ #define curlcheck_tlssessioninfo_info(info) \
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION)) (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))


/* true if info expects a pointer to struct curl_certinfo * argument */ /* true if info expects a pointer to struct curl_certinfo * argument */
#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO) #define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)


/* true if info expects a pointer to struct curl_socket_t argument */ /* true if info expects a pointer to struct curl_socket_t argument */
#define _curl_is_socket_info(info) \ #define curlcheck_socket_info(info) \
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T) (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)


/* true if info expects a pointer to curl_off_t argument */ /* true if info expects a pointer to curl_off_t argument */
#define _curl_is_off_t_info(info) \ #define curlcheck_off_t_info(info) \
(CURLINFO_OFF_T < (info)) (CURLINFO_OFF_T < (info))




/* typecheck helpers -- check whether given expression has requested type*/ /* typecheck helpers -- check whether given expression has requested type*/


/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros, /* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros,
* otherwise define a new macro. Search for __builtin_types_compatible_p * otherwise define a new macro. Search for __builtin_types_compatible_p
* in the GCC manual. * in the GCC manual.
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
@ -434,35 +443,35 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
*/ */


/* XXX: should evaluate to true if expr is a pointer */ /* XXX: should evaluate to true if expr is a pointer */
#define _curl_is_any_ptr(expr) \ #define curlcheck_any_ptr(expr) \
(sizeof(expr) == sizeof(void *)) (sizeof(expr) == sizeof(void *))


/* evaluates to true if expr is NULL */ /* evaluates to true if expr is NULL */
/* XXX: must not evaluate expr, so this check is not accurate */ /* XXX: must not evaluate expr, so this check is not accurate */
#define _curl_is_NULL(expr) \ #define curlcheck_NULL(expr) \
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))


/* evaluates to true if expr is type*, const type* or NULL */ /* evaluates to true if expr is type*, const type* or NULL */
#define _curl_is_ptr(expr, type) \ #define curlcheck_ptr(expr, type) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), type *) || \ __builtin_types_compatible_p(__typeof__(expr), type *) || \
__builtin_types_compatible_p(__typeof__(expr), const type *)) __builtin_types_compatible_p(__typeof__(expr), const type *))


/* evaluates to true if expr is one of type[], type*, NULL or const type* */ /* evaluates to true if expr is one of type[], type*, NULL or const type* */
#define _curl_is_arr(expr, type) \ #define curlcheck_arr(expr, type) \
(_curl_is_ptr((expr), type) || \ (curlcheck_ptr((expr), type) || \
__builtin_types_compatible_p(__typeof__(expr), type [])) __builtin_types_compatible_p(__typeof__(expr), type []))


/* evaluates to true if expr is a string */ /* evaluates to true if expr is a string */
#define _curl_is_string(expr) \ #define curlcheck_string(expr) \
(_curl_is_arr((expr), char) || \ (curlcheck_arr((expr), char) || \
_curl_is_arr((expr), signed char) || \ curlcheck_arr((expr), signed char) || \
_curl_is_arr((expr), unsigned char)) curlcheck_arr((expr), unsigned char))


/* evaluates to true if expr is a long (no matter the signedness) /* evaluates to true if expr is a long (no matter the signedness)
* XXX: for now, int is also accepted (and therefore short and char, which * XXX: for now, int is also accepted (and therefore short and char, which
* are promoted to int when passed to a variadic function) */ * are promoted to int when passed to a variadic function) */
#define _curl_is_long(expr) \ #define curlcheck_long(expr) \
(__builtin_types_compatible_p(__typeof__(expr), long) || \ (__builtin_types_compatible_p(__typeof__(expr), long) || \
__builtin_types_compatible_p(__typeof__(expr), signed long) || \ __builtin_types_compatible_p(__typeof__(expr), signed long) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
@ -477,59 +486,59 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
__builtin_types_compatible_p(__typeof__(expr), unsigned char)) __builtin_types_compatible_p(__typeof__(expr), unsigned char))


/* evaluates to true if expr is of type curl_off_t */ /* evaluates to true if expr is of type curl_off_t */
#define _curl_is_off_t(expr) \ #define curlcheck_off_t(expr) \
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))


/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
/* XXX: also check size of an char[] array? */ /* XXX: also check size of an char[] array? */
#define _curl_is_error_buffer(expr) \ #define curlcheck_error_buffer(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), char *) || \ __builtin_types_compatible_p(__typeof__(expr), char *) || \
__builtin_types_compatible_p(__typeof__(expr), char[])) __builtin_types_compatible_p(__typeof__(expr), char[]))


/* evaluates to true if expr is of type (const) void* or (const) FILE* */ /* evaluates to true if expr is of type (const) void* or (const) FILE* */
#if 0 #if 0
#define _curl_is_cb_data(expr) \ #define curlcheck_cb_data(expr) \
(_curl_is_ptr((expr), void) || \ (curlcheck_ptr((expr), void) || \
_curl_is_ptr((expr), FILE)) curlcheck_ptr((expr), FILE))
#else /* be less strict */ #else /* be less strict */
#define _curl_is_cb_data(expr) \ #define curlcheck_cb_data(expr) \
_curl_is_any_ptr(expr) curlcheck_any_ptr(expr)
#endif #endif


/* evaluates to true if expr is of type FILE* */ /* evaluates to true if expr is of type FILE* */
#define _curl_is_FILE(expr) \ #define curlcheck_FILE(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
(__builtin_types_compatible_p(__typeof__(expr), FILE *))) (__builtin_types_compatible_p(__typeof__(expr), FILE *)))


/* evaluates to true if expr can be passed as POST data (void* or char*) */ /* evaluates to true if expr can be passed as POST data (void* or char*) */
#define _curl_is_postfields(expr) \ #define curlcheck_postfields(expr) \
(_curl_is_ptr((expr), void) || \ (curlcheck_ptr((expr), void) || \
_curl_is_arr((expr), char) || \ curlcheck_arr((expr), char) || \
_curl_is_arr((expr), unsigned char)) curlcheck_arr((expr), unsigned char))


/* helper: __builtin_types_compatible_p distinguishes between functions and /* helper: __builtin_types_compatible_p distinguishes between functions and
* function pointers, hide it */ * function pointers, hide it */
#define _curl_callback_compatible(func, type) \ #define curlcheck_cb_compatible(func, type) \
(__builtin_types_compatible_p(__typeof__(func), type) || \ (__builtin_types_compatible_p(__typeof__(func), type) || \
__builtin_types_compatible_p(__typeof__(func) *, type)) __builtin_types_compatible_p(__typeof__(func) *, type))


/* evaluates to true if expr is of type curl_resolver_start_callback */ /* evaluates to true if expr is of type curl_resolver_start_callback */
#define _curl_is_resolver_start_callback(expr) \ #define curlcheck_resolver_start_callback(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_resolver_start_callback)) curlcheck_cb_compatible((expr), curl_resolver_start_callback))


/* evaluates to true if expr is of type curl_read_callback or "similar" */ /* evaluates to true if expr is of type curl_read_callback or "similar" */
#define _curl_is_read_cb(expr) \ #define curlcheck_read_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), __typeof__(fread) *) || \ curlcheck_cb_compatible((expr), __typeof__(fread) *) || \
_curl_callback_compatible((expr), curl_read_callback) || \ curlcheck_cb_compatible((expr), curl_read_callback) || \
_curl_callback_compatible((expr), _curl_read_callback1) || \ curlcheck_cb_compatible((expr), _curl_read_callback1) || \
_curl_callback_compatible((expr), _curl_read_callback2) || \ curlcheck_cb_compatible((expr), _curl_read_callback2) || \
_curl_callback_compatible((expr), _curl_read_callback3) || \ curlcheck_cb_compatible((expr), _curl_read_callback3) || \
_curl_callback_compatible((expr), _curl_read_callback4) || \ curlcheck_cb_compatible((expr), _curl_read_callback4) || \
_curl_callback_compatible((expr), _curl_read_callback5) || \ curlcheck_cb_compatible((expr), _curl_read_callback5) || \
_curl_callback_compatible((expr), _curl_read_callback6)) curlcheck_cb_compatible((expr), _curl_read_callback6))
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *); typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *); typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *); typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
@ -538,16 +547,16 @@ typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *); typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);


/* evaluates to true if expr is of type curl_write_callback or "similar" */ /* evaluates to true if expr is of type curl_write_callback or "similar" */
#define _curl_is_write_cb(expr) \ #define curlcheck_write_cb(expr) \
(_curl_is_read_cb(expr) || \ (curlcheck_read_cb(expr) || \
_curl_callback_compatible((expr), __typeof__(fwrite) *) || \ curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \
_curl_callback_compatible((expr), curl_write_callback) || \ curlcheck_cb_compatible((expr), curl_write_callback) || \
_curl_callback_compatible((expr), _curl_write_callback1) || \ curlcheck_cb_compatible((expr), _curl_write_callback1) || \
_curl_callback_compatible((expr), _curl_write_callback2) || \ curlcheck_cb_compatible((expr), _curl_write_callback2) || \
_curl_callback_compatible((expr), _curl_write_callback3) || \ curlcheck_cb_compatible((expr), _curl_write_callback3) || \
_curl_callback_compatible((expr), _curl_write_callback4) || \ curlcheck_cb_compatible((expr), _curl_write_callback4) || \
_curl_callback_compatible((expr), _curl_write_callback5) || \ curlcheck_cb_compatible((expr), _curl_write_callback5) || \
_curl_callback_compatible((expr), _curl_write_callback6)) curlcheck_cb_compatible((expr), _curl_write_callback6))
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *); typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t, typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
const void *); const void *);
@ -558,37 +567,37 @@ typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *); typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);


/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
#define _curl_is_ioctl_cb(expr) \ #define curlcheck_ioctl_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_ioctl_callback) || \ curlcheck_cb_compatible((expr), curl_ioctl_callback) || \
_curl_callback_compatible((expr), _curl_ioctl_callback1) || \ curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \
_curl_callback_compatible((expr), _curl_ioctl_callback2) || \ curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \
_curl_callback_compatible((expr), _curl_ioctl_callback3) || \ curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \
_curl_callback_compatible((expr), _curl_ioctl_callback4)) curlcheck_cb_compatible((expr), _curl_ioctl_callback4))
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *); typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *); typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *); typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *); typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);


/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
#define _curl_is_sockopt_cb(expr) \ #define curlcheck_sockopt_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_sockopt_callback) || \ curlcheck_cb_compatible((expr), curl_sockopt_callback) || \
_curl_callback_compatible((expr), _curl_sockopt_callback1) || \ curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \
_curl_callback_compatible((expr), _curl_sockopt_callback2)) curlcheck_cb_compatible((expr), _curl_sockopt_callback2))
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t, typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
curlsocktype); curlsocktype);


/* evaluates to true if expr is of type curl_opensocket_callback or /* evaluates to true if expr is of type curl_opensocket_callback or
"similar" */ "similar" */
#define _curl_is_opensocket_cb(expr) \ #define curlcheck_opensocket_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_opensocket_callback) || \ curlcheck_cb_compatible((expr), curl_opensocket_callback) || \
_curl_callback_compatible((expr), _curl_opensocket_callback1) || \ curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \
_curl_callback_compatible((expr), _curl_opensocket_callback2) || \ curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \
_curl_callback_compatible((expr), _curl_opensocket_callback3) || \ curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \
_curl_callback_compatible((expr), _curl_opensocket_callback4)) curlcheck_cb_compatible((expr), _curl_opensocket_callback4))
typedef curl_socket_t (*_curl_opensocket_callback1) typedef curl_socket_t (*_curl_opensocket_callback1)
(void *, curlsocktype, struct curl_sockaddr *); (void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback2) typedef curl_socket_t (*_curl_opensocket_callback2)
@ -599,28 +608,28 @@ typedef curl_socket_t (*_curl_opensocket_callback4)
(const void *, curlsocktype, const struct curl_sockaddr *); (const void *, curlsocktype, const struct curl_sockaddr *);


/* evaluates to true if expr is of type curl_progress_callback or "similar" */ /* evaluates to true if expr is of type curl_progress_callback or "similar" */
#define _curl_is_progress_cb(expr) \ #define curlcheck_progress_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_progress_callback) || \ curlcheck_cb_compatible((expr), curl_progress_callback) || \
_curl_callback_compatible((expr), _curl_progress_callback1) || \ curlcheck_cb_compatible((expr), _curl_progress_callback1) || \
_curl_callback_compatible((expr), _curl_progress_callback2)) curlcheck_cb_compatible((expr), _curl_progress_callback2))
typedef int (*_curl_progress_callback1)(void *, typedef int (*_curl_progress_callback1)(void *,
double, double, double, double); double, double, double, double);
typedef int (*_curl_progress_callback2)(const void *, typedef int (*_curl_progress_callback2)(const void *,
double, double, double, double); double, double, double, double);


/* evaluates to true if expr is of type curl_debug_callback or "similar" */ /* evaluates to true if expr is of type curl_debug_callback or "similar" */
#define _curl_is_debug_cb(expr) \ #define curlcheck_debug_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_debug_callback) || \ curlcheck_cb_compatible((expr), curl_debug_callback) || \
_curl_callback_compatible((expr), _curl_debug_callback1) || \ curlcheck_cb_compatible((expr), _curl_debug_callback1) || \
_curl_callback_compatible((expr), _curl_debug_callback2) || \ curlcheck_cb_compatible((expr), _curl_debug_callback2) || \
_curl_callback_compatible((expr), _curl_debug_callback3) || \ curlcheck_cb_compatible((expr), _curl_debug_callback3) || \
_curl_callback_compatible((expr), _curl_debug_callback4) || \ curlcheck_cb_compatible((expr), _curl_debug_callback4) || \
_curl_callback_compatible((expr), _curl_debug_callback5) || \ curlcheck_cb_compatible((expr), _curl_debug_callback5) || \
_curl_callback_compatible((expr), _curl_debug_callback6) || \ curlcheck_cb_compatible((expr), _curl_debug_callback6) || \
_curl_callback_compatible((expr), _curl_debug_callback7) || \ curlcheck_cb_compatible((expr), _curl_debug_callback7) || \
_curl_callback_compatible((expr), _curl_debug_callback8)) curlcheck_cb_compatible((expr), _curl_debug_callback8))
typedef int (*_curl_debug_callback1) (CURL *, typedef int (*_curl_debug_callback1) (CURL *,
curl_infotype, char *, size_t, void *); curl_infotype, char *, size_t, void *);
typedef int (*_curl_debug_callback2) (CURL *, typedef int (*_curl_debug_callback2) (CURL *,
@ -640,17 +649,17 @@ typedef int (*_curl_debug_callback8) (CURL *,


/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
/* this is getting even messier... */ /* this is getting even messier... */
#define _curl_is_ssl_ctx_cb(expr) \ #define curlcheck_ssl_ctx_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_ssl_ctx_callback) || \ curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \ curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback8)) curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8))
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *); typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *); typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *); typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
@ -660,11 +669,11 @@ typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
* this will of course break if we're included before OpenSSL headers... * this will of course break if we're included before OpenSSL headers...
*/ */
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
const void *); const void *);
#else #else
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
@ -673,26 +682,26 @@ typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
#endif #endif


/* evaluates to true if expr is of type curl_conv_callback or "similar" */ /* evaluates to true if expr is of type curl_conv_callback or "similar" */
#define _curl_is_conv_cb(expr) \ #define curlcheck_conv_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_conv_callback) || \ curlcheck_cb_compatible((expr), curl_conv_callback) || \
_curl_callback_compatible((expr), _curl_conv_callback1) || \ curlcheck_cb_compatible((expr), _curl_conv_callback1) || \
_curl_callback_compatible((expr), _curl_conv_callback2) || \ curlcheck_cb_compatible((expr), _curl_conv_callback2) || \
_curl_callback_compatible((expr), _curl_conv_callback3) || \ curlcheck_cb_compatible((expr), _curl_conv_callback3) || \
_curl_callback_compatible((expr), _curl_conv_callback4)) curlcheck_cb_compatible((expr), _curl_conv_callback4))
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);


/* evaluates to true if expr is of type curl_seek_callback or "similar" */ /* evaluates to true if expr is of type curl_seek_callback or "similar" */
#define _curl_is_seek_cb(expr) \ #define curlcheck_seek_cb(expr) \
(_curl_is_NULL(expr) || \ (curlcheck_NULL(expr) || \
_curl_callback_compatible((expr), curl_seek_callback) || \ curlcheck_cb_compatible((expr), curl_seek_callback) || \
_curl_callback_compatible((expr), _curl_seek_callback1) || \ curlcheck_cb_compatible((expr), _curl_seek_callback1) || \
_curl_callback_compatible((expr), _curl_seek_callback2)) curlcheck_cb_compatible((expr), _curl_seek_callback2))
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);




#endif /* __CURL_TYPECHECK_GCC_H */ #endif /* CURLINC_TYPECHECK_GCC_H */

34
src/curl/urlapi.h → include/curl/urlapi.h Executable file → Normal file
View File

@ -1,5 +1,5 @@
#ifndef __CURL_URLAPI_H #ifndef CURLINC_URLAPI_H
#define __CURL_URLAPI_H #define CURLINC_URLAPI_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2018 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2018 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html. * are also available at https://curl.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is * copies of the Software, and permit persons to whom the Software is
@ -47,7 +47,20 @@ typedef enum {
CURLUE_NO_HOST, /* 14 */ CURLUE_NO_HOST, /* 14 */
CURLUE_NO_PORT, /* 15 */ CURLUE_NO_PORT, /* 15 */
CURLUE_NO_QUERY, /* 16 */ CURLUE_NO_QUERY, /* 16 */
CURLUE_NO_FRAGMENT /* 17 */ CURLUE_NO_FRAGMENT, /* 17 */
CURLUE_NO_ZONEID, /* 18 */
CURLUE_BAD_FILE_URL, /* 19 */
CURLUE_BAD_FRAGMENT, /* 20 */
CURLUE_BAD_HOSTNAME, /* 21 */
CURLUE_BAD_IPV6, /* 22 */
CURLUE_BAD_LOGIN, /* 23 */
CURLUE_BAD_PASSWORD, /* 24 */
CURLUE_BAD_PATH, /* 25 */
CURLUE_BAD_QUERY, /* 26 */
CURLUE_BAD_SCHEME, /* 27 */
CURLUE_BAD_SLASHES, /* 28 */
CURLUE_BAD_USER, /* 29 */
CURLUE_LAST
} CURLUcode; } CURLUcode;


typedef enum { typedef enum {
@ -77,6 +90,9 @@ typedef enum {
#define CURLU_URLENCODE (1<<7) /* URL encode on set */ #define CURLU_URLENCODE (1<<7) /* URL encode on set */
#define CURLU_APPENDQUERY (1<<8) /* append a form style part */ #define CURLU_APPENDQUERY (1<<8) /* append a form style part */
#define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
scheme is unknown. */
#define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */


typedef struct Curl_URL CURLU; typedef struct Curl_URL CURLU;


@ -115,9 +131,15 @@ CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
const char *part, unsigned int flags); const char *part, unsigned int flags);


/*
* curl_url_strerror() turns a CURLUcode value into the equivalent human
* readable error string. This is useful for printing meaningful error
* messages.
*/
CURL_EXTERN const char *curl_url_strerror(CURLUcode);


#ifdef __cplusplus #ifdef __cplusplus
} /* end of extern "C" */ } /* end of extern "C" */
#endif #endif


#endif #endif /* CURLINC_URLAPI_H */

View File

@ -1,21 +1,15 @@
QT -= gui QT -= gui

CONFIG += -static -libstdc++ -static-libgcc #-static

#INCLUDEPATH += -L$${_PRO_FILE_PWD_}\openssl-android-arm64-v8a\include

#LIBS += -L$${_PRO_FILE_PWD_}\lib -lssl
#LIBS += -L$${_PRO_FILE_PWD_}\lib -lcrypto
#LIBS += -L$${_PRO_FILE_PWD_}\lib -lcurl



#Linux: #Linux:
unix: LIBS += -lcurl unix: LIBS += -lcurl


#Windows #Windows
win32: LIBS += -L$${_PRO_FILE_PWD_}\curl -lcurl win32: LIBS += -L$${_PRO_FILE_PWD_}\..\lib\ -lcurl # 7.82.0
#win32: LIBS += -L$${_PRO_FILE_PWD_}\..\alt\curl -lcurl # 7.64.1




CONFIG += c++14 console CONFIG += c++17 console
CONFIG -= app_bundle CONFIG -= app_bundle


# The following define makes your compiler emit warnings if you use # The following define makes your compiler emit warnings if you use

View File

@ -10,7 +10,7 @@ AccountManager::AccountManager(std::string pathToFil, std::string pathToAccountN
exit(12); exit(12);
ifs.open(pathToAccountsFile); ifs.open(pathToAccountsFile);
if(!ifs.is_open()) { if(!ifs.is_open()) {
std::cout << " => Error: Konnte Account File nicht öffnen" << std::endl; std::cout << " => Error: Konnte Account File nicht aufmachen" << std::endl;
exit(13); exit(13);
} }
} }
@ -61,7 +61,7 @@ int AccountManager::writeDefault(std::string path)
{ {
std::ofstream ofs(path); std::ofstream ofs(path);
if(!ofs.is_open()) { if(!ofs.is_open()) {
perror((std::string(" => Error: Konnte Account Datei nicht öffnen: ") + path).c_str()); perror((std::string(" => Error: Konnte Account Datei nicht aufmachen: ") + path).c_str());
return -1; return -1;
} }
std::cout << " => Erstelle Datei mit Accounts unter: " << path << "..." <<std::endl; std::cout << " => Erstelle Datei mit Accounts unter: " << path << "..." <<std::endl;
@ -253,7 +253,7 @@ int AccountManager::setLastAccountNumber(size_t number)
std::ofstream ofs; std::ofstream ofs;
ofs.open(pathToAccountNumberFile, std::ios::trunc); ofs.open(pathToAccountNumberFile, std::ios::trunc);
if(!ofs.is_open()) { if(!ofs.is_open()) {
std::cout << " => Error: Account Number Datei ist nicht geöffnet." << std::endl; std::cout << " => Error: Account Number Datei ist nicht aufgemacht." << std::endl;
return 110; return 110;
} }
//fStream.clear(); //fStream.clear();

View File

@ -1,22 +1,21 @@
#ifndef ACCOUNTMANAGER_H #ifndef ACCOUNTMANAGER_H
#define ACCOUNTMANAGER_H #define ACCOUNTMANAGER_H




#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <fstream> #include <fstream>




#include "parameterManager.h"



struct Account { struct Account {
std::string Email, std::string Email,
Password; Password;
}; };




//wichtig vor Account declaration!!!!
#include "parameterManager.h"

class AccountManager class AccountManager
{ {
public: public:

3
src/curl/.gitignore vendored
View File

@ -1,3 +0,0 @@
curlver.h.dist
stamp-h2
stamp-h3

Binary file not shown.

View File

@ -77,7 +77,7 @@ int Logger::openFile(std::string path)
} }
file.open(path); file.open(path);
if(!file.is_open()) { if(!file.is_open()) {
perror((" => Error: Konnte LogDatei nicht öffnen: '" + path + "'").c_str()); perror((" => Error: Konnte LogDatei nicht aufmachen: '" + path + "'").c_str());
return (5657); return (5657);
} }
} }

View File

@ -1,6 +1,8 @@
#ifndef LOGGER_H #ifndef LOGGER_H
#define LOGGER_H #define LOGGER_H




#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <string> #include <string>

View File

@ -87,7 +87,7 @@ Reply PageManager::getServerRequest(std::string Url, bool useCookies, std::strin
std::string returnUrl; std::string returnUrl;




int width; int width = 0;
get_terminal_size(width); get_terminal_size(width);
if(width < 1) if(width < 1)
width = 999999; width = 999999;
@ -559,7 +559,7 @@ int PageManager::writeToFile(std::vector<std::string> paths, std::string text)
for(const auto &path : paths) { for(const auto &path : paths) {
of.open(path, std::ios::out | std::ios::app); of.open(path, std::ios::out | std::ios::app);
if(!of.is_open()) { if(!of.is_open()) {
perror((" => Error: Konnte Output: '" + path + "' Datei nicht öffnen").c_str()); perror((" => Error: Konnte Output: '" + path + "' Datei nicht aufmachen").c_str());
return -1; return -1;
} }
of << text << std::endl; of << text << std::endl;
@ -569,6 +569,13 @@ int PageManager::writeToFile(std::vector<std::string> paths, std::string text)
return 0; return 0;
} }


std::string PageManager::getCurlVersion()
{
auto data = curl_version_info(CURLVERSION_NOW);
return data->version;
}


std::string PageManager::chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg) std::string PageManager::chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg)
{ {
std::istringstream SListLang ( replace( languages_with_highst_priority_at_first, ",", "\n") + "\n" ); std::istringstream SListLang ( replace( languages_with_highst_priority_at_first, ",", "\n") + "\n" );

View File

@ -3,13 +3,13 @@




#include "accountManager.h" #include "accountManager.h"
#include "curl/curl.h"


#include "parameterManager.h" // for isNumber #include "parameterManager.h" // for isNumber


#ifdef _WIN32 #ifdef _WIN32
#include "./../include/curl/curl.h"
#include <windows.h> #include <windows.h>
#else
#include "curl/curl.h"
#endif #endif


#include <sstream> #include <sstream>
@ -67,6 +67,8 @@ public:


int writeToFile(std::vector<std::string> paths, std::string text); int writeToFile(std::vector<std::string> paths, std::string text);


static std::string getCurlVersion();

std::string sock5Proxy; std::string sock5Proxy;
private: private:
bool debugMode = false; bool debugMode = false;

View File

@ -153,23 +153,26 @@ int manageParameter(Settings &settings, int argc, char **argv)


void unterOption_printVersion(Settings &settings) void unterOption_printVersion(Settings &settings)
{ {
std::cout << "Programinfos:" << std::endl std::cout << "Programminformationen:" << std::endl
<< " > Build-Datum: " << __DATE__ << std::endl << " > Build-Datum: \t\t" << __DATE__ << std::endl
<< " > Build-Uhrzeit: " << __TIME__ << std::endl << " > Build-Uhrzeit: \t\t" << __TIME__ << std::endl
<< " > Program Version: " << settings.version << std::endl << " > Program Version: \t" << settings.version << std::endl
<< " > Defaults Datei Version: " << settings.defaultFileVersion << std::endl << " > Defaults Datei Version: \t" << settings.defaultFileVersion << std::endl

#ifdef __MINGW_GCC_VERSION #ifdef __MINGW_GCC_VERSION
<< " > MINGW GCC Version: " <<__GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__ << std::endl << " > MINGW GCC Version: \t" <<__GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__ << std::endl
#endif #endif


<< " > C++ Standart: "; << " > Curl Version: \t\t" << PageManager::getCurlVersion() << std::endl

<< " > C++ Standart: \t\t";
if(__cplusplus == 1) std::cout << "C++_Pre_C++98" << std::endl; if(__cplusplus == 1) std::cout << "C++_Pre_C++98" << std::endl;
else if (__cplusplus == 199711) std::cout << "C++98" << std::endl; else if (__cplusplus == 199711) std::cout << "C++98" << std::endl;
else if (__cplusplus == 201103) std::cout << "C++11" << std::endl; else if (__cplusplus == 201103) std::cout << "C++11" << std::endl;
else if (__cplusplus == 201402) std::cout << "C++14" << std::endl; else if (__cplusplus == 201402) std::cout << "C++14" << std::endl;
else if (__cplusplus == 201703) std::cout << "C++17" << std::endl; else if (__cplusplus == 201703) std::cout << "C++17" << std::endl;
else std::cout << "C++_Newer_C++17" << std::endl; else std::cout << "C++_Newer_C++17" << std::endl;
std::cout << " > " << sizeof (void *) * 8 << " Bit Version" << std::endl; std::cout << " > Bit Version: \t\tx" << sizeof (void *) * 8 << "" << std::endl;
} }


int loadDefaulOptions(Settings &settings) int loadDefaulOptions(Settings &settings)
@ -178,7 +181,7 @@ int loadDefaulOptions(Settings &settings)
if(!ifs.is_open()) { if(!ifs.is_open()) {
std::ofstream ofs(settings.defaultsFilePath); std::ofstream ofs(settings.defaultsFilePath);
if(!ofs.is_open()) { if(!ofs.is_open()) {
perror((" => Error: Konnte Defaults-Datei nicht öffnen: " + settings.defaultsFilePath).c_str()); perror((" => Error: Konnte Defaults-Datei nicht aufmachen: " + settings.defaultsFilePath).c_str());
return 89; return 89;
} else { } else {
std::cout << " => Erstelle Defaults-Datei: " << settings.defaultsFilePath << std::endl; std::cout << " => Erstelle Defaults-Datei: " << settings.defaultsFilePath << std::endl;
@ -257,7 +260,7 @@ int loadDefaulOptions(Settings &settings)
} }
ifs.open(settings.defaultsFilePath); ifs.open(settings.defaultsFilePath);
if(!ifs.is_open()) { if(!ifs.is_open()) {
perror((" => Error: Konnte Defaults-Datei nach dem erstellen nicht öffnen: " + settings.defaultsFilePath).c_str()); perror((" => Error: Konnte Defaults-Datei nach dem erstellen nicht aufmachen: " + settings.defaultsFilePath).c_str());
return 97; return 97;
} }
} }
@ -1593,7 +1596,7 @@ bool removeDirIsOk(std::string path, Settings *settings, bool askForDelete)


DIR* dirp = nullptr; DIR* dirp = nullptr;
if( (dirp = opendir( path.c_str() )) == nullptr ) { if( (dirp = opendir( path.c_str() )) == nullptr ) {
perror(std::string(" => Error: Konnte Verzeichnis nicht öffnen: '" + path + "'").c_str()); perror(std::string(" => Error: Konnte Verzeichnis nicht aufmachen: '" + path + "'").c_str());
return false; return false;
} }



View File

@ -1,6 +1,9 @@
#ifndef PARAMETERMANAGER_H #ifndef PARAMETERMANAGER_H
#define PARAMETERMANAGER_H #define PARAMETERMANAGER_H





#ifndef __linux__ #ifndef __linux__
#ifndef _WIN32 #ifndef _WIN32
#error "Error Invalid System: Only for Linux and Windows systems!" #error "Error Invalid System: Only for Linux and Windows systems!"
@ -60,6 +63,9 @@ struct PAGE {
}; };




//Wichtig nach MODUS UND PAGE DECLARATION
#include "pageManager.h"



struct Settings { struct Settings {



View File

@ -2,9 +2,11 @@
#define MANAGEPROGRAM_H #define MANAGEPROGRAM_H




#include "pageManager.h"

//#include "pageManager.h"
#include "parameterManager.h" #include "parameterManager.h"
#include "accountManager.h" //#include "accountManager.h"


#include <sys/types.h> #include <sys/types.h>
#include <pthread.h> #include <pthread.h>

View File

@ -1 +0,0 @@
../src/curl/

View File

@ -0,0 +1,87 @@
EXPORTS
curl_easy_cleanup @1
curl_easy_duphandle @2
curl_easy_escape @3
curl_easy_getinfo @4
curl_easy_init @5
curl_easy_option_by_id @6
curl_easy_option_by_name @7
curl_easy_option_next @8
curl_easy_pause @9
curl_easy_perform @10
curl_easy_recv @11
curl_easy_reset @12
curl_easy_send @13
curl_easy_setopt @14
curl_easy_strerror @15
curl_easy_unescape @16
curl_easy_upkeep @17
curl_escape @18
curl_formadd @19
curl_formfree @20
curl_formget @21
curl_free @22
curl_getdate @23
curl_getenv @24
curl_global_cleanup @25
curl_global_init @26
curl_global_init_mem @27
curl_global_sslset @28
curl_maprintf @29
curl_mfprintf @30
curl_mime_addpart @31
curl_mime_data @32
curl_mime_data_cb @33
curl_mime_encoder @34
curl_mime_filedata @35
curl_mime_filename @36
curl_mime_free @37
curl_mime_headers @38
curl_mime_init @39
curl_mime_name @40
curl_mime_subparts @41
curl_mime_type @42
curl_mprintf @43
curl_msnprintf @44
curl_msprintf @45
curl_multi_add_handle @46
curl_multi_assign @47
curl_multi_cleanup @48
curl_multi_fdset @49
curl_multi_info_read @50
curl_multi_init @51
curl_multi_perform @52
curl_multi_poll @53
curl_multi_remove_handle @54
curl_multi_setopt @55
curl_multi_socket @56
curl_multi_socket_action @57
curl_multi_socket_all @58
curl_multi_strerror @59
curl_multi_timeout @60
curl_multi_wait @61
curl_multi_wakeup @62
curl_mvaprintf @63
curl_mvfprintf @64
curl_mvprintf @65
curl_mvsnprintf @66
curl_mvsprintf @67
curl_pushheader_byname @68
curl_pushheader_bynum @69
curl_share_cleanup @70
curl_share_init @71
curl_share_setopt @72
curl_share_strerror @73
curl_slist_append @74
curl_slist_free_all @75
curl_strequal @76
curl_strnequal @77
curl_unescape @78
curl_url @79
curl_url_cleanup @80
curl_url_dup @81
curl_url_get @82
curl_url_set @83
curl_url_strerror @84
curl_version @85
curl_version_info @86