mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
build: enable -Wcast-qual, fix or silence compiler warnings
The issues found fell into these categories, with the applied fixes:
- const was accidentally stripped.
Adjust code to not cast or cast with const.
- const/volatile missing from arguments, local variables.
Constify arguments or variables, adjust/delete casts. Small code
changes in a few places.
- const must be stripped because an API dependency requires it.
Strip `const` with `CURL_UNCONST()` macro to silence the warning out
of our control. These happen at API boundaries. Sometimes they depend
on dependency version, which this patch handles as necessary. Also
enable const support for the zlib API, using `ZLIB_CONST`. Supported
by zlib 1.2.5.2 and newer.
- const must be stripped because a curl API requires it.
Strip `const` with `CURL_UNCONST()` macro to silence the warning out
of our immediate control. For example we promise to send a non-const
argument to a callback, though the data is const internally.
- other cases where we may avoid const stripping by code changes.
Also silenced with `CURL_UNCONST()`.
- there are 3 places where `CURL_UNCONST()` is cast again to const.
To silence this type of warning:
```
lib/vquic/curl_osslq.c:1015:29: error: to be safe all intermediate
pointers in cast from 'unsigned char **' to 'const unsigned char **'
must be 'const' qualified [-Werror=cast-qual]
lib/cf-socket.c:734:32: error: to be safe all intermediate pointers in
cast from 'char **' to 'const char **' must be 'const' qualified
[-Werror=cast-qual]
```
There may be a better solution, but I couldn't find it.
These cases are handled in separate subcommits, but without further
markup.
If you see a `-Wcast-qual` warning in curl, we appreciate your report
about it.
Closes #16142
This commit is contained in:
parent
8b1b5cd4d2
commit
f4e23950c7
@ -102,6 +102,7 @@ if(PICKY_COMPILER)
|
||||
-Waddress # clang 2.7 gcc 4.3
|
||||
-Wattributes # clang 2.7 gcc 4.1
|
||||
-Wcast-align # clang 1.0 gcc 4.2
|
||||
-Wcast-qual # clang 3.0 gcc 3.4.6
|
||||
-Wdeclaration-after-statement # clang 1.0 gcc 3.4
|
||||
-Wdiv-by-zero # clang 2.7 gcc 4.1
|
||||
-Wempty-body # clang 2.7 gcc 4.3
|
||||
|
||||
@ -191,7 +191,7 @@ static CURLcode base64_encode(const char *table64,
|
||||
{
|
||||
char *output;
|
||||
char *base64data;
|
||||
const unsigned char *in = (unsigned char *)inputbuff;
|
||||
const unsigned char *in = (const unsigned char *)inputbuff;
|
||||
const char *padstr = &table64[64]; /* Point to padding string. */
|
||||
|
||||
*outptr = NULL;
|
||||
|
||||
@ -61,7 +61,7 @@ void Curl_bufref_free(struct bufref *br)
|
||||
DEBUGASSERT(br->ptr || !br->len);
|
||||
|
||||
if(br->ptr && br->dtor)
|
||||
br->dtor((void *) br->ptr);
|
||||
br->dtor(CURL_UNCONST(br->ptr));
|
||||
|
||||
br->dtor = NULL;
|
||||
br->ptr = NULL;
|
||||
|
||||
@ -731,7 +731,8 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
||||
IDs and the former returns none at all. So the scope ID, if
|
||||
present, is known to be numeric */
|
||||
curl_off_t scope_id;
|
||||
if(Curl_str_number((const char **)&scope_ptr, &scope_id, UINT_MAX))
|
||||
if(Curl_str_number((const char **)CURL_UNCONST(&scope_ptr),
|
||||
&scope_id, UINT_MAX))
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
si6->sin6_scope_id = (unsigned int)scope_id;
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ struct cf_call_data {
|
||||
(save) = CF_CTX_CALL_DATA(cf); \
|
||||
DEBUGASSERT((save).data == NULL || (save).depth > 0); \
|
||||
CF_CTX_CALL_DATA(cf).depth++; \
|
||||
CF_CTX_CALL_DATA(cf).data = (struct Curl_easy *)data; \
|
||||
CF_CTX_CALL_DATA(cf).data = (struct Curl_easy *)CURL_UNCONST(data); \
|
||||
} while(0)
|
||||
|
||||
#define CF_DATA_RESTORE(cf, save) \
|
||||
@ -671,7 +671,7 @@ struct cf_call_data {
|
||||
#define CF_DATA_SAVE(save, cf, data) \
|
||||
do { \
|
||||
(save) = CF_CTX_CALL_DATA(cf); \
|
||||
CF_CTX_CALL_DATA(cf).data = (struct Curl_easy *)data; \
|
||||
CF_CTX_CALL_DATA(cf).data = (struct Curl_easy *)CURL_UNCONST(data); \
|
||||
} while(0)
|
||||
|
||||
#define CF_DATA_RESTORE(cf, save) \
|
||||
|
||||
@ -566,7 +566,8 @@ bool Curl_cpool_find(struct Curl_easy *data,
|
||||
return FALSE;
|
||||
|
||||
CPOOL_LOCK(cpool, data);
|
||||
bundle = Curl_hash_pick(&cpool->dest2bundle, (void *)destination, dest_len);
|
||||
bundle = Curl_hash_pick(&cpool->dest2bundle,
|
||||
CURL_UNCONST(destination), dest_len);
|
||||
if(bundle) {
|
||||
struct Curl_llist_node *curr = Curl_llist_head(&bundle->conns);
|
||||
while(curr) {
|
||||
|
||||
@ -166,7 +166,7 @@ static CURLcode inflate_stream(struct Curl_easy *data,
|
||||
struct zlib_writer *zp = (struct zlib_writer *) writer;
|
||||
z_stream *z = &zp->z; /* zlib state structure */
|
||||
uInt nread = z->avail_in;
|
||||
Bytef *orig_in = z->next_in;
|
||||
z_const Bytef *orig_in = z->next_in;
|
||||
bool done = FALSE;
|
||||
CURLcode result = CURLE_OK; /* Curl_client_write status */
|
||||
|
||||
@ -273,8 +273,8 @@ static CURLcode deflate_do_write(struct Curl_easy *data,
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
|
||||
/* Set the compressed input when this function is called */
|
||||
z->next_in = (Bytef *) buf;
|
||||
z->avail_in = (uInt) nbytes;
|
||||
z->next_in = (z_const Bytef *)buf;
|
||||
z->avail_in = (uInt)nbytes;
|
||||
|
||||
if(zp->zlib_init == ZLIB_EXTERNAL_TRAILER)
|
||||
return process_trailer(data, zp);
|
||||
@ -332,8 +332,8 @@ static CURLcode gzip_do_write(struct Curl_easy *data,
|
||||
|
||||
if(zp->zlib_init == ZLIB_INIT_GZIP) {
|
||||
/* Let zlib handle the gzip decompression entirely */
|
||||
z->next_in = (Bytef *) buf;
|
||||
z->avail_in = (uInt) nbytes;
|
||||
z->next_in = (z_const Bytef *)buf;
|
||||
z->avail_in = (uInt)nbytes;
|
||||
/* Now uncompress the data */
|
||||
return inflate_stream(data, writer, type, ZLIB_INIT_GZIP);
|
||||
}
|
||||
|
||||
@ -1249,8 +1249,8 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
|
||||
*/
|
||||
static int cookie_sort(const void *p1, const void *p2)
|
||||
{
|
||||
struct Cookie *c1 = *(struct Cookie **)p1;
|
||||
struct Cookie *c2 = *(struct Cookie **)p2;
|
||||
const struct Cookie *c1 = *(const struct Cookie * const *)p1;
|
||||
const struct Cookie *c2 = *(const struct Cookie * const *)p2;
|
||||
size_t l1, l2;
|
||||
|
||||
/* 1 - compare cookie path lengths */
|
||||
@ -1285,8 +1285,8 @@ static int cookie_sort(const void *p1, const void *p2)
|
||||
*/
|
||||
static int cookie_sort_ct(const void *p1, const void *p2)
|
||||
{
|
||||
struct Cookie *c1 = *(struct Cookie **)p1;
|
||||
struct Cookie *c2 = *(struct Cookie **)p2;
|
||||
const struct Cookie *c1 = *(const struct Cookie * const *)p1;
|
||||
const struct Cookie *c2 = *(const struct Cookie * const *)p2;
|
||||
|
||||
return (c2->creationtime > c1->creationtime) ? 1 : -1;
|
||||
}
|
||||
|
||||
@ -71,13 +71,13 @@ typedef enum {
|
||||
#define SETCHARSET_OK 1
|
||||
#define SETCHARSET_FAIL 0
|
||||
|
||||
static int parsekeyword(unsigned char **pattern, unsigned char *charset)
|
||||
static int parsekeyword(const unsigned char **pattern, unsigned char *charset)
|
||||
{
|
||||
parsekey_state state = CURLFNM_PKW_INIT;
|
||||
#define KEYLEN 10
|
||||
char keyword[KEYLEN] = { 0 };
|
||||
int i;
|
||||
unsigned char *p = *pattern;
|
||||
const unsigned char *p = *pattern;
|
||||
bool found = FALSE;
|
||||
for(i = 0; !found; i++) {
|
||||
char c = (char)*p++;
|
||||
@ -140,9 +140,9 @@ static char_class charclass(unsigned char c)
|
||||
}
|
||||
|
||||
/* Include a character or a range in set. */
|
||||
static void setcharorrange(unsigned char **pp, unsigned char *charset)
|
||||
static void setcharorrange(const unsigned char **pp, unsigned char *charset)
|
||||
{
|
||||
unsigned char *p = (*pp)++;
|
||||
const unsigned char *p = (*pp)++;
|
||||
unsigned char c = *p++;
|
||||
|
||||
charset[c] = 1;
|
||||
@ -162,7 +162,7 @@ static void setcharorrange(unsigned char **pp, unsigned char *charset)
|
||||
}
|
||||
|
||||
/* returns 1 (TRUE) if pattern is OK, 0 if is bad ("p" is pattern pointer) */
|
||||
static int setcharset(unsigned char **p, unsigned char *charset)
|
||||
static int setcharset(const unsigned char **p, unsigned char *charset)
|
||||
{
|
||||
setcharset_state state = CURLFNM_SCHS_DEFAULT;
|
||||
bool something_found = FALSE;
|
||||
@ -185,7 +185,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
|
||||
(*p)++;
|
||||
}
|
||||
else if(c == '[') {
|
||||
unsigned char *pp = *p + 1;
|
||||
const unsigned char *pp = *p + 1;
|
||||
|
||||
if(*pp++ == ':' && parsekeyword(&pp, charset))
|
||||
*p = pp;
|
||||
@ -257,12 +257,12 @@ fail:
|
||||
static int loop(const unsigned char *pattern, const unsigned char *string,
|
||||
int maxstars)
|
||||
{
|
||||
unsigned char *p = (unsigned char *)pattern;
|
||||
unsigned char *s = (unsigned char *)string;
|
||||
const unsigned char *p = (const unsigned char *)pattern;
|
||||
const unsigned char *s = (const unsigned char *)string;
|
||||
unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 };
|
||||
|
||||
for(;;) {
|
||||
unsigned char *pp;
|
||||
const unsigned char *pp;
|
||||
|
||||
switch(*p) {
|
||||
case '*':
|
||||
@ -359,7 +359,8 @@ int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
|
||||
if(!pattern || !string) {
|
||||
return CURL_FNMATCH_FAIL;
|
||||
}
|
||||
return loop((unsigned char *)pattern, (unsigned char *)string, 2);
|
||||
return loop((const unsigned char *)pattern,
|
||||
(const unsigned char *)string, 2);
|
||||
}
|
||||
#else
|
||||
#include <fnmatch.h>
|
||||
|
||||
@ -46,10 +46,10 @@
|
||||
#endif
|
||||
|
||||
gss_OID_desc Curl_spnego_mech_oid CURL_ALIGN8 = {
|
||||
6, (char *)"\x2b\x06\x01\x05\x05\x02"
|
||||
6, CURL_UNCONST("\x2b\x06\x01\x05\x05\x02")
|
||||
};
|
||||
gss_OID_desc Curl_krb5_mech_oid CURL_ALIGN8 = {
|
||||
9, (char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"
|
||||
9, CURL_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02")
|
||||
};
|
||||
|
||||
OM_uint32 Curl_gss_init_sec_context(
|
||||
|
||||
@ -57,7 +57,7 @@ Curl_memrchr(const void *s, int c, size_t n)
|
||||
|
||||
while(p >= q) {
|
||||
if(*p == (unsigned char)c)
|
||||
return (void *)p;
|
||||
return CURL_UNCONST(p);
|
||||
p--;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ typedef union {
|
||||
#define curlx_unicodefree(ptr) \
|
||||
do { \
|
||||
if(ptr) { \
|
||||
(free)((char *)ptr); \
|
||||
(free)(CURL_UNCONST(ptr)); \
|
||||
(ptr) = NULL; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
@ -321,16 +321,16 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
|
||||
DES_key_schedule ks;
|
||||
|
||||
setup_des_key(keys, DESKEY(ks));
|
||||
DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) results,
|
||||
DESKEY(ks), DES_ENCRYPT);
|
||||
DES_ecb_encrypt((DES_cblock*)CURL_UNCONST(plaintext),
|
||||
(DES_cblock*)results, DESKEY(ks), DES_ENCRYPT);
|
||||
|
||||
setup_des_key(keys + 7, DESKEY(ks));
|
||||
DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 8),
|
||||
DESKEY(ks), DES_ENCRYPT);
|
||||
DES_ecb_encrypt((DES_cblock*)CURL_UNCONST(plaintext),
|
||||
(DES_cblock*)(results + 8), DESKEY(ks), DES_ENCRYPT);
|
||||
|
||||
setup_des_key(keys + 14, DESKEY(ks));
|
||||
DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 16),
|
||||
DESKEY(ks), DES_ENCRYPT);
|
||||
DES_ecb_encrypt((DES_cblock*)CURL_UNCONST(plaintext),
|
||||
(DES_cblock*)(results + 16), DESKEY(ks), DES_ENCRYPT);
|
||||
#elif defined(USE_GNUTLS)
|
||||
struct des_ctx des;
|
||||
setup_des_key(keys, &des);
|
||||
@ -375,12 +375,12 @@ CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
|
||||
DES_key_schedule ks;
|
||||
|
||||
setup_des_key(pw, DESKEY(ks));
|
||||
DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)lmbuffer,
|
||||
DESKEY(ks), DES_ENCRYPT);
|
||||
DES_ecb_encrypt((DES_cblock *)CURL_UNCONST(magic),
|
||||
(DES_cblock *)lmbuffer, DESKEY(ks), DES_ENCRYPT);
|
||||
|
||||
setup_des_key(pw + 7, DESKEY(ks));
|
||||
DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)(lmbuffer + 8),
|
||||
DESKEY(ks), DES_ENCRYPT);
|
||||
DES_ecb_encrypt((DES_cblock *)CURL_UNCONST(magic),
|
||||
(DES_cblock *)(lmbuffer + 8), DESKEY(ks), DES_ENCRYPT);
|
||||
#elif defined(USE_GNUTLS)
|
||||
struct des_ctx des;
|
||||
setup_des_key(pw, &des);
|
||||
|
||||
@ -344,7 +344,7 @@ static ssize_t rtmp_send(struct Curl_easy *data, int sockindex,
|
||||
(void)sockindex; /* unused */
|
||||
(void)eos; /* unused */
|
||||
|
||||
num = RTMP_Write(r, (char *)buf, curlx_uztosi(len));
|
||||
num = RTMP_Write(r, (const char *)buf, curlx_uztosi(len));
|
||||
if(num < 0)
|
||||
*err = CURLE_SEND_ERROR;
|
||||
|
||||
|
||||
@ -175,6 +175,12 @@
|
||||
/* system header files in our config files, avoid this at any cost. */
|
||||
/* ================================================================ */
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
# ifndef ZLIB_CONST
|
||||
# define ZLIB_CONST /* Use z_const. Supported by v1.2.5.2 and upper. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* AIX 4.3 and newer needs _THREAD_SAFE defined to build
|
||||
* proper reentrant code. Others may also need it.
|
||||
|
||||
@ -65,10 +65,20 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_WOLFSSL
|
||||
#if defined(HAVE_STDINT_H) || defined(USE_WOLFSSL)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Macro to strip 'const' without triggering a compiler warning.
|
||||
Use it for APIs that do not or cannot support the const qualifier. */
|
||||
#ifdef HAVE_STDINT_H
|
||||
# define CURL_UNCONST(p) ((void *)(uintptr_t)(const void *)(p))
|
||||
#elif defined(_WIN32) /* for VS2008 */
|
||||
# define CURL_UNCONST(p) ((void *)(ULONG_PTR)(const void *)(p))
|
||||
#else
|
||||
# define CURL_UNCONST(p) ((void *)(p)) /* Fall back to simple cast */
|
||||
#endif
|
||||
|
||||
#ifdef USE_SCHANNEL
|
||||
/* Must set this before <schannel.h> is included directly or indirectly by
|
||||
another Windows header. */
|
||||
@ -168,11 +178,11 @@ struct timeval {
|
||||
#ifdef __minix
|
||||
/* Minix does not support send on TCP sockets */
|
||||
#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG2)CURL_UNCONST(y), \
|
||||
(SEND_TYPE_ARG3)(z))
|
||||
#elif defined(HAVE_SEND)
|
||||
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \
|
||||
(SEND_QUAL_ARG2 SEND_TYPE_ARG2)CURL_UNCONST(y), \
|
||||
(SEND_TYPE_ARG3)(z), \
|
||||
(SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#else /* HAVE_SEND */
|
||||
|
||||
@ -154,7 +154,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
|
||||
/* Initialize the identity */
|
||||
memset(identity, 0, sizeof(*identity));
|
||||
|
||||
useranddomain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)userp);
|
||||
useranddomain.tchar_ptr = curlx_convert_UTF8_to_tchar(userp);
|
||||
if(!useranddomain.tchar_ptr)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -198,7 +198,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
|
||||
curlx_unicodefree(useranddomain.tchar_ptr);
|
||||
|
||||
/* Setup the identity's password and length */
|
||||
passwd.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)passwdp);
|
||||
passwd.tchar_ptr = curlx_convert_UTF8_to_tchar(passwdp);
|
||||
if(!passwd.tchar_ptr)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
dup_passwd.tchar_ptr = _tcsdup(passwd.tchar_ptr);
|
||||
|
||||
@ -53,13 +53,14 @@
|
||||
#include "memdebug.h"
|
||||
|
||||
static void trc_write(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size)
|
||||
const char *ptr, size_t size)
|
||||
{
|
||||
if(data->set.verbose) {
|
||||
if(data->set.fdebug) {
|
||||
bool inCallback = Curl_is_in_callback(data);
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
(void)(*data->set.fdebug)(data, type, ptr, size, data->set.debugdata);
|
||||
(void)(*data->set.fdebug)(data, type, CURL_UNCONST(ptr), size,
|
||||
data->set.debugdata);
|
||||
Curl_set_in_callback(data, inCallback);
|
||||
}
|
||||
else {
|
||||
@ -130,7 +131,7 @@ static size_t trc_end_buf(char *buf, size_t len, size_t maxlen, bool addnl)
|
||||
}
|
||||
|
||||
void Curl_debug(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size)
|
||||
const char *ptr, size_t size)
|
||||
{
|
||||
if(data->set.verbose) {
|
||||
static const char s_infotype[CURLINFO_END][3] = {
|
||||
@ -151,7 +152,8 @@ void Curl_debug(struct Curl_easy *data, curl_infotype type,
|
||||
}
|
||||
else {
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
(void)(*data->set.fdebug)(data, type, ptr, size, data->set.debugdata);
|
||||
(void)(*data->set.fdebug)(data, type, CURL_UNCONST(ptr),
|
||||
size, data->set.debugdata);
|
||||
Curl_set_in_callback(data, inCallback);
|
||||
}
|
||||
}
|
||||
@ -241,7 +243,7 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
|
||||
void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
DEBUGASSERT(cf);
|
||||
@ -592,8 +594,7 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
|
||||
(void)data; (void)fmt;
|
||||
}
|
||||
|
||||
void Curl_trc_cf_infof(struct Curl_easy *data,
|
||||
struct Curl_cfilter *cf,
|
||||
void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
(void)data; (void)cf; (void)fmt;
|
||||
|
||||
@ -52,7 +52,7 @@ CURLcode Curl_trc_opt(const char *config);
|
||||
|
||||
/* the function used to output verbose information */
|
||||
void Curl_debug(struct Curl_easy *data, curl_infotype type,
|
||||
char *ptr, size_t size);
|
||||
const char *ptr, size_t size);
|
||||
|
||||
/**
|
||||
* Output a failure message on registered callbacks for transfer.
|
||||
@ -80,7 +80,7 @@ void Curl_infof(struct Curl_easy *data,
|
||||
* Output an informational message when both transfer's verbose logging
|
||||
* and connection filters verbose logging are enabled.
|
||||
*/
|
||||
void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
|
||||
void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf,
|
||||
const char *fmt, ...) CURL_PRINTF(3, 4);
|
||||
void Curl_trc_multi(struct Curl_easy *data,
|
||||
const char *fmt, ...) CURL_PRINTF(2, 3);
|
||||
|
||||
@ -221,7 +221,7 @@ static CURLcode cw_out_ptr_flush(struct cw_out_ctx *ctx,
|
||||
break;
|
||||
wlen = max_write ? CURLMIN(blen, max_write) : blen;
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
nwritten = wcb((char *)buf, 1, wlen, wcb_data);
|
||||
nwritten = wcb((char *)CURL_UNCONST(buf), 1, wlen, wcb_data);
|
||||
Curl_set_in_callback(data, FALSE);
|
||||
CURL_TRC_WRITE(data, "[OUT] wrote %zu %s bytes -> %zu",
|
||||
wlen, (otype == CW_OUT_BODY) ? "body" : "header",
|
||||
|
||||
23
lib/dict.c
23
lib/dict.c
@ -212,16 +212,8 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
||||
|
||||
if(!word || (*word == (char)0)) {
|
||||
infof(data, "lookup word is missing");
|
||||
word = (char *)"default";
|
||||
}
|
||||
if(!database || (*database == (char)0)) {
|
||||
database = (char *)"!";
|
||||
}
|
||||
if(!strategy || (*strategy == (char)0)) {
|
||||
strategy = (char *)".";
|
||||
}
|
||||
|
||||
eword = unescape_word(word);
|
||||
eword = unescape_word((!word || (*word == (char)0)) ? "default" : word);
|
||||
if(!eword) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto error;
|
||||
@ -234,8 +226,8 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
||||
"%s " /* strategy */
|
||||
"%s\r\n" /* word */
|
||||
"QUIT\r\n",
|
||||
database,
|
||||
strategy,
|
||||
(!database || (*database == (char)0)) ? "!" : database,
|
||||
(!strategy || (*strategy == (char)0)) ? "." : strategy,
|
||||
eword);
|
||||
|
||||
if(result) {
|
||||
@ -263,13 +255,8 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
||||
|
||||
if(!word || (*word == (char)0)) {
|
||||
infof(data, "lookup word is missing");
|
||||
word = (char *)"default";
|
||||
}
|
||||
if(!database || (*database == (char)0)) {
|
||||
database = (char *)"!";
|
||||
}
|
||||
|
||||
eword = unescape_word(word);
|
||||
eword = unescape_word((!word || (*word == (char)0)) ? "default" : word);
|
||||
if(!eword) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto error;
|
||||
@ -281,7 +268,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
||||
"%s " /* database */
|
||||
"%s\r\n" /* word */
|
||||
"QUIT\r\n",
|
||||
database,
|
||||
(!database || (*database == (char)0)) ? "!" : database,
|
||||
eword);
|
||||
|
||||
if(result) {
|
||||
|
||||
@ -183,7 +183,7 @@ CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
|
||||
DEBUGASSERT(s->init == DYNINIT);
|
||||
DEBUGASSERT(!s->leng || s->bufr);
|
||||
n = strlen(str);
|
||||
return dyn_nappend(s, (unsigned char *)str, n);
|
||||
return dyn_nappend(s, (const unsigned char *)str, n);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -209,7 +209,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
|
||||
str = vaprintf(fmt, ap); /* this allocs a new string to append */
|
||||
|
||||
if(str) {
|
||||
CURLcode result = dyn_nappend(s, (unsigned char *)str, strlen(str));
|
||||
CURLcode result = dyn_nappend(s, (const unsigned char *)str, strlen(str));
|
||||
free(str);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if(array_state && forms) {
|
||||
/* get the upcoming option from the given array */
|
||||
option = forms->option;
|
||||
array_value = (char *)forms->value;
|
||||
array_value = (char *)CURL_UNCONST(forms->value);
|
||||
|
||||
forms++; /* advance this to next entry */
|
||||
if(CURLFORM_END == option) {
|
||||
|
||||
@ -98,7 +98,7 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
|
||||
{
|
||||
switch(info) {
|
||||
case CURLINFO_EFFECTIVE_URL:
|
||||
*param_charp = data->state.url ? data->state.url : (char *)"";
|
||||
*param_charp = data->state.url ? data->state.url : "";
|
||||
break;
|
||||
case CURLINFO_EFFECTIVE_METHOD: {
|
||||
const char *m = data->set.str[STRING_CUSTOMREQUEST];
|
||||
|
||||
@ -162,7 +162,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
|
||||
|
||||
/* Create selector. Degenerate cases: / and /1 => convert to "" */
|
||||
if(strlen(gopherpath) <= 2) {
|
||||
sel = (char *)"";
|
||||
sel = (char *)CURL_UNCONST("");
|
||||
len = strlen(sel);
|
||||
free(gopherpath);
|
||||
}
|
||||
@ -236,7 +236,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
|
||||
failf(data, "Failed sending Gopher request");
|
||||
return result;
|
||||
}
|
||||
result = Curl_client_write(data, CLIENTWRITE_HEADER, (char *)"\r\n", 2);
|
||||
result = Curl_client_write(data, CLIENTWRITE_HEADER, "\r\n", 2);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ hash_elem_create(const void *key, size_t key_len, const void *p,
|
||||
/* copy the key */
|
||||
memcpy(he->key, key, key_len);
|
||||
he->key_len = key_len;
|
||||
he->ptr = (void *) p;
|
||||
he->ptr = CURL_UNCONST(p);
|
||||
he->dtor = dtor;
|
||||
}
|
||||
return he;
|
||||
|
||||
@ -210,7 +210,8 @@ static CURLcode namevalue(char *header, size_t hlen, unsigned int type,
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
/* skip all leading blank letters */
|
||||
Curl_str_passblanks((const char **)&header);
|
||||
while(ISBLANK(*header))
|
||||
header++;
|
||||
|
||||
*value = header;
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
||||
* getaddrinfo() nor gethostbyname_r() function or for which
|
||||
* gethostbyname() is the preferred one.
|
||||
*/
|
||||
h = gethostbyname((void *)hostname);
|
||||
h = gethostbyname(CURL_UNCONST(hostname));
|
||||
#endif /* (HAVE_GETADDRINFO && HAVE_GETADDRINFO_THREADSAFE) ||
|
||||
HAVE_GETHOSTBYNAME_R */
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ struct hsts *Curl_hsts_init(void)
|
||||
|
||||
static void hsts_free(struct stsentry *e)
|
||||
{
|
||||
free((char *)e->host);
|
||||
free(CURL_UNCONST(e->host));
|
||||
free(e);
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ static CURLcode hsts_push(struct Curl_easy *data,
|
||||
struct tm stamp;
|
||||
CURLcode result;
|
||||
|
||||
e.name = (char *)sts->host;
|
||||
e.name = (char *)CURL_UNCONST(sts->host);
|
||||
e.namelen = strlen(sts->host);
|
||||
e.includeSubDomains = sts->includeSubDomains;
|
||||
|
||||
|
||||
@ -3541,7 +3541,7 @@ static CURLcode http_write_header(struct Curl_easy *data,
|
||||
|
||||
/* now, only output this if the header AND body are requested:
|
||||
*/
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)hd, hdlen);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, hd, hdlen);
|
||||
|
||||
writetype = CLIENTWRITE_HEADER |
|
||||
((data->req.httpcode/100 == 1) ? CLIENTWRITE_1XX : 0);
|
||||
@ -3997,7 +3997,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
|
||||
/*
|
||||
* Taken in one (more) header. Write it to the client.
|
||||
*/
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)hd, hdlen);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, hd, hdlen);
|
||||
|
||||
if(k->httpcode/100 == 1)
|
||||
writetype |= CLIENTWRITE_1XX;
|
||||
@ -4198,7 +4198,7 @@ CURLcode Curl_http_write_resp(struct Curl_easy *data,
|
||||
flags = CLIENTWRITE_BODY;
|
||||
if(is_eos)
|
||||
flags |= CLIENTWRITE_EOS;
|
||||
result = Curl_client_write(data, flags, (char *)buf, blen);
|
||||
result = Curl_client_write(data, flags, buf, blen);
|
||||
}
|
||||
out:
|
||||
return result;
|
||||
|
||||
@ -1454,7 +1454,7 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
||||
if(!stream)
|
||||
return NGHTTP2_ERR_CALLBACK_FAILURE;
|
||||
|
||||
h2_xfer_write_resp(cf, data_s, stream, (char *)mem, len, FALSE);
|
||||
h2_xfer_write_resp(cf, data_s, stream, (const char *)mem, len, FALSE);
|
||||
|
||||
nghttp2_session_consume(ctx->h2, stream_id, len);
|
||||
stream->nrcvd_data += (curl_off_t)len;
|
||||
|
||||
@ -46,16 +46,16 @@
|
||||
|
||||
#include "slist.h"
|
||||
|
||||
#define HMAC_SHA256(k, kl, d, dl, o) \
|
||||
do { \
|
||||
result = Curl_hmacit(&Curl_HMAC_SHA256, \
|
||||
(unsigned char *)k, \
|
||||
kl, \
|
||||
(unsigned char *)d, \
|
||||
dl, o); \
|
||||
if(result) { \
|
||||
goto fail; \
|
||||
} \
|
||||
#define HMAC_SHA256(k, kl, d, dl, o) \
|
||||
do { \
|
||||
result = Curl_hmacit(&Curl_HMAC_SHA256, \
|
||||
(const unsigned char *)k, \
|
||||
kl, \
|
||||
(const unsigned char *)d, \
|
||||
dl, o); \
|
||||
if(result) { \
|
||||
goto fail; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define TIMESTAMP_SIZE 17
|
||||
@ -92,7 +92,7 @@ static void trim_headers(struct curl_slist *head)
|
||||
if(!*value)
|
||||
continue;
|
||||
++value;
|
||||
store = (char *)value;
|
||||
store = (char *)CURL_UNCONST(value);
|
||||
|
||||
/* skip leading whitespace */
|
||||
Curl_str_passblanks(&value);
|
||||
@ -624,7 +624,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
|
||||
* are still using aws:amz as a prefix.
|
||||
*/
|
||||
line = data->set.str[STRING_AWS_SIGV4] ?
|
||||
data->set.str[STRING_AWS_SIGV4] : (char *)"aws:amz";
|
||||
data->set.str[STRING_AWS_SIGV4] : "aws:amz";
|
||||
|
||||
/* provider0[:provider1[:region[:service]]]
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
||||
if(cw_next)
|
||||
result = Curl_cwriter_write(data, cw_next, CLIENTWRITE_BODY, buf, blen);
|
||||
else
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)buf, blen);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, buf, blen);
|
||||
if(result) {
|
||||
ch->state = CHUNK_FAILED;
|
||||
ch->last_code = CHUNKE_PASSTHRU_ERROR;
|
||||
@ -213,8 +213,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
||||
result = Curl_cwriter_write(data, cw_next, CLIENTWRITE_BODY,
|
||||
buf, piece);
|
||||
else
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY,
|
||||
(char *)buf, piece);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, buf, piece);
|
||||
if(result) {
|
||||
ch->state = CHUNK_FAILED;
|
||||
ch->last_code = CHUNKE_PASSTHRU_ERROR;
|
||||
@ -258,7 +257,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
||||
|
||||
if(tr) {
|
||||
size_t trlen;
|
||||
result = Curl_dyn_addn(&ch->trailer, (char *)STRCONST("\x0d\x0a"));
|
||||
result = Curl_dyn_addn(&ch->trailer, STRCONST("\x0d\x0a"));
|
||||
if(result) {
|
||||
ch->state = CHUNK_FAILED;
|
||||
ch->last_code = CHUNKE_OUT_OF_MEMORY;
|
||||
|
||||
@ -145,15 +145,15 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
|
||||
*/
|
||||
|
||||
if(authp->iestyle) {
|
||||
tmp = strchr((char *)uripath, '?');
|
||||
tmp = strchr((const char *)uripath, '?');
|
||||
if(tmp) {
|
||||
size_t urilen = tmp - (char *)uripath;
|
||||
size_t urilen = tmp - (const char *)uripath;
|
||||
/* typecast is fine here since the value is always less than 32 bits */
|
||||
path = (unsigned char *) aprintf("%.*s", (int)urilen, uripath);
|
||||
}
|
||||
}
|
||||
if(!tmp)
|
||||
path = (unsigned char *) strdup((char *) uripath);
|
||||
path = (unsigned char *) strdup((const char *) uripath);
|
||||
|
||||
if(!path)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -64,7 +64,7 @@ static CURLcode iconv_to_utf8(const char *in, size_t inlen,
|
||||
iconv_t cd = iconv_open("UTF-8", nl_langinfo(CODESET));
|
||||
if(cd != (iconv_t)-1) {
|
||||
size_t iconv_outlen = *outlen;
|
||||
char *iconv_in = (char *)in;
|
||||
char *iconv_in = (char *)CURL_UNCONST(in);
|
||||
size_t iconv_inlen = inlen;
|
||||
size_t iconv_result = iconv(cd, &iconv_in, &iconv_inlen,
|
||||
out, &iconv_outlen);
|
||||
|
||||
@ -67,7 +67,8 @@
|
||||
unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
|
||||
{
|
||||
if(sa->sa_family == AF_INET6) {
|
||||
const struct sockaddr_in6 * sa6 = (const struct sockaddr_in6 *)(void *) sa;
|
||||
const struct sockaddr_in6 * sa6 =
|
||||
(const struct sockaddr_in6 *)(const void *) sa;
|
||||
const unsigned char *b = sa6->sin6_addr.s6_addr;
|
||||
unsigned short w = (unsigned short) ((b[0] << 8) | b[1]);
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
|
||||
#endif
|
||||
#ifdef __AMIGA__
|
||||
#define Curl_inet_ntop(af,addr,buf,size) \
|
||||
(char *)inet_ntop(af, (void *)addr, (unsigned char *)buf, \
|
||||
(char *)inet_ntop(af, CURL_UNCONST(addr), (unsigned char *)buf, \
|
||||
(curl_socklen_t)(size))
|
||||
#else
|
||||
#define Curl_inet_ntop(af,addr,buf,size) \
|
||||
|
||||
@ -39,7 +39,7 @@ int Curl_inet_pton(int, const char *, void *);
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef __AMIGA__
|
||||
#define Curl_inet_pton(x,y,z) inet_pton(x,(unsigned char *)y,z)
|
||||
#define Curl_inet_pton(x,y,z) inet_pton(x,(unsigned char *)CURL_UNCONST(y),z)
|
||||
#else
|
||||
#define Curl_inet_pton(x,y,z) inet_pton(x,y,z)
|
||||
#endif
|
||||
|
||||
@ -173,7 +173,7 @@ krb5_encode(void *app_data, const void *from, int length, int level, void **to)
|
||||
/* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal
|
||||
* libraries modify the input buffer in gss_wrap()
|
||||
*/
|
||||
dec.value = (void *)from;
|
||||
dec.value = CURL_UNCONST(from);
|
||||
dec.length = (size_t)length;
|
||||
maj = gss_wrap(&min, *context,
|
||||
level == PROT_PRIVATE,
|
||||
@ -215,7 +215,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
|
||||
struct gss_channel_bindings_struct chan;
|
||||
size_t base64_sz = 0;
|
||||
struct sockaddr_in *remote_addr =
|
||||
(struct sockaddr_in *)(void *)&conn->remote_addr->curl_sa_addr;
|
||||
(struct sockaddr_in *)CURL_UNCONST(&conn->remote_addr->curl_sa_addr);
|
||||
char *stringp;
|
||||
|
||||
if(getsockname(conn->sock[FIRSTSOCKET],
|
||||
|
||||
16
lib/ldap.c
16
lib/ldap.c
@ -285,8 +285,8 @@ static int ldap_win_bind(struct Curl_easy *data, LDAP *server,
|
||||
PTCHAR inpass = NULL;
|
||||
|
||||
if(user && passwd && (data->set.httpauth & CURLAUTH_BASIC)) {
|
||||
inuser = curlx_convert_UTF8_to_tchar((char *) user);
|
||||
inpass = curlx_convert_UTF8_to_tchar((char *) passwd);
|
||||
inuser = curlx_convert_UTF8_to_tchar(user);
|
||||
inpass = curlx_convert_UTF8_to_tchar(passwd);
|
||||
|
||||
rc = (int)ldap_simple_bind_s(server, inuser, inpass);
|
||||
|
||||
@ -543,7 +543,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
||||
#endif
|
||||
name_len = strlen(name);
|
||||
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"DN: ", 4);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, "DN: ", 4);
|
||||
if(result) {
|
||||
FREE_ON_WINLDAP(name);
|
||||
ldap_memfree(dn);
|
||||
@ -557,7 +557,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
||||
goto quit;
|
||||
}
|
||||
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\n", 1);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, "\n", 1);
|
||||
if(result) {
|
||||
FREE_ON_WINLDAP(name);
|
||||
ldap_memfree(dn);
|
||||
@ -593,7 +593,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
||||
vals = ldap_get_values_len(server, entryIterator, attribute);
|
||||
if(vals) {
|
||||
for(i = 0; (vals[i] != NULL); i++) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\t", 1);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, "\t", 1);
|
||||
if(result) {
|
||||
ldap_value_free_len(vals);
|
||||
FREE_ON_WINLDAP(attr);
|
||||
@ -615,7 +615,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
||||
goto quit;
|
||||
}
|
||||
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)": ", 2);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, ": ", 2);
|
||||
if(result) {
|
||||
ldap_value_free_len(vals);
|
||||
FREE_ON_WINLDAP(attr);
|
||||
@ -670,7 +670,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
||||
}
|
||||
}
|
||||
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\n", 1);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, "\n", 1);
|
||||
if(result) {
|
||||
ldap_value_free_len(vals);
|
||||
FREE_ON_WINLDAP(attr);
|
||||
@ -690,7 +690,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
||||
FREE_ON_WINLDAP(attr);
|
||||
ldap_memfree(attribute);
|
||||
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\n", 1);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, "\n", 1);
|
||||
if(result)
|
||||
goto quit;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ Curl_llist_insert_next(struct Curl_llist *list,
|
||||
#ifdef DEBUGBUILD
|
||||
ne->_init = NODEINIT;
|
||||
#endif
|
||||
ne->_ptr = (void *) p;
|
||||
ne->_ptr = CURL_UNCONST(p);
|
||||
ne->_list = list;
|
||||
if(list->_size == 0) {
|
||||
list->_head = ne;
|
||||
|
||||
@ -170,7 +170,12 @@ static int MD4_Init(MD4_CTX *ctx)
|
||||
|
||||
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
|
||||
{
|
||||
CryptHashData(ctx->hHash, (BYTE *)data, (unsigned int) size, 0);
|
||||
#ifdef __MINGW32CE__
|
||||
CryptHashData(ctx->hHash, (BYTE *)CURL_UNCONST(data),
|
||||
(unsigned int) size, 0);
|
||||
#else
|
||||
CryptHashData(ctx->hHash, (const BYTE *)data, (unsigned int) size, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
|
||||
@ -308,7 +313,7 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx);
|
||||
*/
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
|
||||
#define MD4_SET(n) \
|
||||
(*(MD4_u32plus *)(void *)&ptr[(n) * 4])
|
||||
(*(const MD4_u32plus *)(const void *)&ptr[(n) * 4])
|
||||
#define MD4_GET(n) \
|
||||
MD4_SET(n)
|
||||
#else
|
||||
|
||||
@ -252,7 +252,11 @@ static void my_md5_update(void *in,
|
||||
unsigned int inputLen)
|
||||
{
|
||||
my_md5_ctx *ctx = in;
|
||||
CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);
|
||||
#ifdef __MINGW32CE__
|
||||
CryptHashData(ctx->hHash, (BYTE *)CURL_UNCONST(input), inputLen, 0);
|
||||
#else
|
||||
CryptHashData(ctx->hHash, (const BYTE *)input, inputLen, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void my_md5_final(unsigned char *digest, void *in)
|
||||
@ -356,7 +360,7 @@ static void my_md5_final(unsigned char *result, void *ctx);
|
||||
*/
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
|
||||
#define MD5_SET(n) \
|
||||
(*(MD5_u32plus *)(void *)&ptr[(n) * 4])
|
||||
(*(const MD5_u32plus *)(const void *)&ptr[(n) * 4])
|
||||
#define MD5_GET(n) \
|
||||
MD5_SET(n)
|
||||
#else
|
||||
|
||||
@ -229,7 +229,7 @@ ALLOC_FUNC wchar_t *curl_dbg_wcsdup(const wchar_t *str,
|
||||
|
||||
if(source)
|
||||
curl_dbg_log("MEM %s:%d wcsdup(%p) (%zu) = %p\n",
|
||||
source, line, (void *)str, bsiz, (void *)mem);
|
||||
source, line, (const void *)str, bsiz, (void *)mem);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
12
lib/mqtt.c
12
lib/mqtt.c
@ -117,7 +117,7 @@ static CURLcode mqtt_setup_conn(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
static CURLcode mqtt_send(struct Curl_easy *data,
|
||||
char *buf, size_t len)
|
||||
const char *buf, size_t len)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct MQTT *mq = data->req.p.mqtt;
|
||||
@ -351,7 +351,7 @@ static CURLcode mqtt_disconnect(struct Curl_easy *data)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct MQTT *mq = data->req.p.mqtt;
|
||||
result = mqtt_send(data, (char *)"\xe0\x00", 2);
|
||||
result = mqtt_send(data, "\xe0\x00", 2);
|
||||
Curl_safefree(mq->sendleftovers);
|
||||
Curl_dyn_free(&mq->recvbuf);
|
||||
return result;
|
||||
@ -471,7 +471,7 @@ static CURLcode mqtt_subscribe(struct Curl_easy *data)
|
||||
memcpy(&packet[5 + n], topic, topiclen);
|
||||
packet[5 + n + topiclen] = 0; /* QoS zero */
|
||||
|
||||
result = mqtt_send(data, (char *)packet, packetlen);
|
||||
result = mqtt_send(data, (const char *)packet, packetlen);
|
||||
|
||||
fail:
|
||||
free(topic);
|
||||
@ -558,7 +558,7 @@ static CURLcode mqtt_publish(struct Curl_easy *data)
|
||||
i += topiclen;
|
||||
memcpy(&pkt[i], payload, payloadlen);
|
||||
i += payloadlen;
|
||||
result = mqtt_send(data, (char *)pkt, i);
|
||||
result = mqtt_send(data, (const char *)pkt, i);
|
||||
|
||||
fail:
|
||||
free(pkt);
|
||||
@ -770,7 +770,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
|
||||
result = CURLE_RECV_ERROR;
|
||||
break;
|
||||
}
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (const char *)&mq->firstbyte, 1);
|
||||
/* remember the first byte */
|
||||
mq->npacket = 0;
|
||||
mqstate(data, MQTT_REMAINING_LENGTH, MQTT_NOSTATE);
|
||||
@ -780,7 +780,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
|
||||
result = Curl_xfer_recv(data, (char *)&recvbyte, 1, &nread);
|
||||
if(result || !nread)
|
||||
break;
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&recvbyte, 1);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (const char *)&recvbyte, 1);
|
||||
mq->pkt_hd[mq->npacket++] = recvbyte;
|
||||
} while((recvbyte & 0x80) && (mq->npacket < 4));
|
||||
if(!result && nread && (recvbyte & 0x80))
|
||||
|
||||
@ -548,7 +548,8 @@ void Curl_multi_ev_expire_xfers(struct Curl_multi *multi,
|
||||
asked to get removed, so thus we better survive stray socket actions
|
||||
and just move on. */
|
||||
if(entry) {
|
||||
Curl_hash_offt_visit(&entry->xfers, mev_xfer_expire_cb, (void *)nowp);
|
||||
Curl_hash_offt_visit(&entry->xfers, mev_xfer_expire_cb,
|
||||
CURL_UNCONST(nowp));
|
||||
|
||||
if(Curl_hash_offt_count(&entry->conns))
|
||||
*run_cpool = TRUE;
|
||||
|
||||
@ -354,7 +354,7 @@ static CURLcode oldap_perform_auth(struct Curl_easy *data, const char *mech,
|
||||
struct berval *pcred = &cred;
|
||||
int rc;
|
||||
|
||||
cred.bv_val = (char *) Curl_bufref_ptr(initresp);
|
||||
cred.bv_val = (char *)CURL_UNCONST(Curl_bufref_ptr(initresp));
|
||||
cred.bv_len = Curl_bufref_len(initresp);
|
||||
if(!cred.bv_val)
|
||||
pcred = NULL;
|
||||
@ -376,7 +376,7 @@ static CURLcode oldap_continue_auth(struct Curl_easy *data, const char *mech,
|
||||
struct berval *pcred = &cred;
|
||||
int rc;
|
||||
|
||||
cred.bv_val = (char *) Curl_bufref_ptr(resp);
|
||||
cred.bv_val = (char *)CURL_UNCONST(Curl_bufref_ptr(resp));
|
||||
cred.bv_len = Curl_bufref_len(resp);
|
||||
if(!cred.bv_val)
|
||||
pcred = NULL;
|
||||
@ -440,7 +440,7 @@ static CURLcode oldap_perform_mechs(struct Curl_easy *data)
|
||||
};
|
||||
|
||||
rc = ldap_search_ext(li->ld, "", LDAP_SCOPE_BASE, "(objectclass=*)",
|
||||
(char **) supportedSASLMechanisms, 0,
|
||||
(char **)CURL_UNCONST(supportedSASLMechanisms), 0,
|
||||
NULL, NULL, NULL, 0, &li->msgid);
|
||||
if(rc != LDAP_SUCCESS)
|
||||
return oldap_map_error(rc, CURLE_LOGIN_DENIED);
|
||||
@ -950,13 +950,13 @@ static CURLcode client_write(struct Curl_easy *data,
|
||||
separator, drop the latter. */
|
||||
if(!len && plen && prefix[plen - 1] == ' ')
|
||||
plen--;
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *) prefix, plen);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, prefix, plen);
|
||||
}
|
||||
if(!result && value) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *) value, len);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, value, len);
|
||||
}
|
||||
if(!result && suffix) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *) suffix, slen);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, suffix, slen);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ match:
|
||||
*h = hh;
|
||||
*m = mm;
|
||||
*s = ss;
|
||||
*endp = (char *)p;
|
||||
*endp = (char *)CURL_UNCONST(p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -1580,11 +1580,11 @@ static CURLcode pop3_write(struct Curl_easy *data, const char *str,
|
||||
/* If the partial match was the CRLF and dot then only write the CRLF
|
||||
as the server would have inserted the dot */
|
||||
if(strip_dot && prev - 1 > 0) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)POP3_EOB,
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, POP3_EOB,
|
||||
prev - 1);
|
||||
}
|
||||
else if(!strip_dot) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)POP3_EOB,
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, POP3_EOB,
|
||||
prev);
|
||||
}
|
||||
else {
|
||||
@ -1604,7 +1604,7 @@ static CURLcode pop3_write(struct Curl_easy *data, const char *str,
|
||||
/* We have a full match so the transfer is done, however we must transfer
|
||||
the CRLF at the start of the EOB as this is considered to be part of the
|
||||
message as per RFC-1939, sect. 3 */
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)POP3_EOB, 2);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, POP3_EOB, 2);
|
||||
|
||||
k->keepon &= ~KEEP_RECV;
|
||||
pop3c->eob = 0;
|
||||
|
||||
@ -40,7 +40,7 @@ void Curl_psl_destroy(struct PslCache *pslcache)
|
||||
{
|
||||
if(pslcache->psl) {
|
||||
if(pslcache->dynamic)
|
||||
psl_free((psl_ctx_t *) pslcache->psl);
|
||||
psl_free((psl_ctx_t *)CURL_UNCONST(pslcache->psl));
|
||||
pslcache->psl = NULL;
|
||||
pslcache->dynamic = FALSE;
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ int Curl_rename(const char *oldpath, const char *newpath)
|
||||
when there are open handles to the file. */
|
||||
const int max_wait_ms = 1000;
|
||||
struct curltime start = Curl_now();
|
||||
TCHAR *tchar_oldpath = curlx_convert_UTF8_to_tchar((char *)oldpath);
|
||||
TCHAR *tchar_newpath = curlx_convert_UTF8_to_tchar((char *)newpath);
|
||||
TCHAR *tchar_oldpath = curlx_convert_UTF8_to_tchar(oldpath);
|
||||
TCHAR *tchar_newpath = curlx_convert_UTF8_to_tchar(newpath);
|
||||
for(;;) {
|
||||
timediff_t diff;
|
||||
if(MoveFileEx(tchar_oldpath, tchar_newpath, MOVEFILE_REPLACE_EXISTING)) {
|
||||
|
||||
@ -228,11 +228,11 @@ static CURLcode xfer_send(struct Curl_easy *data,
|
||||
data->req.eos_sent = TRUE;
|
||||
if(*pnwritten) {
|
||||
if(hds_len)
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *)buf,
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, buf,
|
||||
CURLMIN(hds_len, *pnwritten));
|
||||
if(*pnwritten > hds_len) {
|
||||
size_t body_len = *pnwritten - hds_len;
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, (char *)buf + hds_len, body_len);
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, buf + hds_len, body_len);
|
||||
data->req.writebytecount += body_len;
|
||||
Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
|
||||
}
|
||||
|
||||
12
lib/rtsp.c
12
lib/rtsp.c
@ -627,7 +627,7 @@ static CURLcode rtp_write_body_junk(struct Curl_easy *data,
|
||||
if(body_remain) {
|
||||
if((curl_off_t)blen > body_remain)
|
||||
blen = (size_t)body_remain;
|
||||
return Curl_client_write(data, CLIENTWRITE_BODY, (char *)buf, blen);
|
||||
return Curl_client_write(data, CLIENTWRITE_BODY, buf, blen);
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
@ -674,8 +674,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
|
||||
/* possible start of an RTP message, buffer */
|
||||
if(skip_len) {
|
||||
/* end of junk/BODY bytes, flush */
|
||||
result = rtp_write_body_junk(data,
|
||||
(char *)(buf - skip_len), skip_len);
|
||||
result = rtp_write_body_junk(data, buf - skip_len, skip_len);
|
||||
skip_len = 0;
|
||||
if(result)
|
||||
goto out;
|
||||
@ -791,7 +790,7 @@ static CURLcode rtsp_filter_rtp(struct Curl_easy *data,
|
||||
}
|
||||
out:
|
||||
if(!result && skip_len)
|
||||
result = rtp_write_body_junk(data, (char *)(buf - skip_len), skip_len);
|
||||
result = rtp_write_body_junk(data, buf - skip_len, skip_len);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -865,8 +864,7 @@ static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
|
||||
data->req.size));
|
||||
if(!result && (is_eos || blen)) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY|
|
||||
(is_eos ? CLIENTWRITE_EOS : 0),
|
||||
(char *)buf, blen);
|
||||
(is_eos ? CLIENTWRITE_EOS : 0), buf, blen);
|
||||
}
|
||||
|
||||
out:
|
||||
@ -906,7 +904,7 @@ CURLcode rtp_client_write(struct Curl_easy *data, const char *ptr, size_t len)
|
||||
}
|
||||
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
wrote = writeit((char *)ptr, 1, len, user_ptr);
|
||||
wrote = writeit((char *)CURL_UNCONST(ptr), 1, len, user_ptr);
|
||||
Curl_set_in_callback(data, FALSE);
|
||||
|
||||
if(CURL_WRITEFUNC_PAUSE == wrote) {
|
||||
|
||||
@ -360,7 +360,7 @@ static CURLcode cw_raw_write(struct Curl_easy *data,
|
||||
const char *buf, size_t nbytes)
|
||||
{
|
||||
if(type & CLIENTWRITE_BODY && data->set.verbose && !data->req.ignorebody) {
|
||||
Curl_debug(data, CURLINFO_DATA_IN, (char *)buf, nbytes);
|
||||
Curl_debug(data, CURLINFO_DATA_IN, buf, nbytes);
|
||||
}
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
}
|
||||
|
||||
10
lib/sha256.c
10
lib/sha256.c
@ -216,7 +216,11 @@ static void my_sha256_update(void *in,
|
||||
unsigned int length)
|
||||
{
|
||||
my_sha256_ctx *ctx = (my_sha256_ctx *)in;
|
||||
CryptHashData(ctx->hHash, (unsigned char *) data, length, 0);
|
||||
#ifdef __MINGW32CE__
|
||||
CryptHashData(ctx->hHash, (BYTE *)CURL_UNCONST(data), length, 0);
|
||||
#else
|
||||
CryptHashData(ctx->hHash, (const BYTE *)data, length, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void my_sha256_final(unsigned char *digest, void *in)
|
||||
@ -323,7 +327,7 @@ static const unsigned long K[64] = {
|
||||
|
||||
/* Compress 512-bits */
|
||||
static int sha256_compress(struct sha256_state *md,
|
||||
unsigned char *buf)
|
||||
const unsigned char *buf)
|
||||
{
|
||||
unsigned long S[8], W[64];
|
||||
int i;
|
||||
@ -401,7 +405,7 @@ static void my_sha256_update(void *ctx,
|
||||
return;
|
||||
while(inlen > 0) {
|
||||
if(md->curlen == 0 && inlen >= CURL_SHA256_BLOCK_SIZE) {
|
||||
if(sha256_compress(md, (unsigned char *)in) < 0)
|
||||
if(sha256_compress(md, in) < 0)
|
||||
return;
|
||||
md->length += CURL_SHA256_BLOCK_SIZE * 8;
|
||||
in += CURL_SHA256_BLOCK_SIZE;
|
||||
|
||||
@ -140,14 +140,14 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
||||
cred_handle.dwUpper = 0;
|
||||
|
||||
status = Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *) TEXT("Kerberos"),
|
||||
SECPKG_CRED_OUTBOUND,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&cred_handle,
|
||||
&expiry);
|
||||
(TCHAR *)CURL_UNCONST(TEXT("Kerberos")),
|
||||
SECPKG_CRED_OUTBOUND,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&cred_handle,
|
||||
&expiry);
|
||||
|
||||
if(check_sspi_err(data, status, "AcquireCredentialsHandle")) {
|
||||
failf(data, "Failed to acquire credentials.");
|
||||
|
||||
18
lib/telnet.c
18
lib/telnet.c
@ -1066,15 +1066,15 @@ CURLcode telrcv(struct Curl_easy *data,
|
||||
int startwrite = -1;
|
||||
struct TELNET *tn = data->req.p.telnet;
|
||||
|
||||
#define startskipping() \
|
||||
if(startwrite >= 0) { \
|
||||
result = Curl_client_write(data, \
|
||||
CLIENTWRITE_BODY, \
|
||||
(char *)&inbuf[startwrite], \
|
||||
in-startwrite); \
|
||||
if(result) \
|
||||
return result; \
|
||||
} \
|
||||
#define startskipping() \
|
||||
if(startwrite >= 0) { \
|
||||
result = Curl_client_write(data, \
|
||||
CLIENTWRITE_BODY, \
|
||||
(const char *)&inbuf[startwrite], \
|
||||
in-startwrite); \
|
||||
if(result) \
|
||||
return result; \
|
||||
} \
|
||||
startwrite = -1
|
||||
|
||||
#define writebyte() \
|
||||
|
||||
@ -520,9 +520,14 @@ static CURLcode tftp_send_first(struct tftp_state_data *state,
|
||||
|
||||
/* the typecase for the 3rd argument is mostly for systems that do
|
||||
not have a size_t argument, like older unixes that want an 'int' */
|
||||
#ifdef __AMIGA__
|
||||
#define CURL_SENDTO_ARG5(x) CURL_UNCONST(x)
|
||||
#else
|
||||
#define CURL_SENDTO_ARG5(x) (x)
|
||||
#endif
|
||||
senddata = sendto(state->sockfd, (void *)state->spacket.data,
|
||||
(SEND_TYPE_ARG3)sbytes, 0,
|
||||
(struct sockaddr *)&data->conn->remote_addr->curl_sa_addr,
|
||||
CURL_SENDTO_ARG5(&data->conn->remote_addr->curl_sa_addr),
|
||||
(curl_socklen_t)data->conn->remote_addr->addrlen);
|
||||
if(senddata != (ssize_t)sbytes) {
|
||||
char buffer[STRERROR_LEN];
|
||||
|
||||
@ -2101,7 +2101,7 @@ static char *detect_proxy(struct Curl_easy *data,
|
||||
* checked if the lowercase versions do not exist.
|
||||
*/
|
||||
char proxy_env[20];
|
||||
char *envp = proxy_env;
|
||||
const char *envp = proxy_env;
|
||||
#ifdef CURL_DISABLE_VERBOSE_STRINGS
|
||||
(void)data;
|
||||
#endif
|
||||
@ -2142,10 +2142,10 @@ static char *detect_proxy(struct Curl_easy *data,
|
||||
}
|
||||
if(!proxy) {
|
||||
#endif
|
||||
envp = (char *)"all_proxy";
|
||||
envp = "all_proxy";
|
||||
proxy = curl_getenv(envp); /* default proxy to use */
|
||||
if(!proxy) {
|
||||
envp = (char *)"ALL_PROXY";
|
||||
envp = "ALL_PROXY";
|
||||
proxy = curl_getenv(envp);
|
||||
}
|
||||
#ifndef CURL_DISABLE_WEBSOCKETS
|
||||
|
||||
12
lib/urlapi.c
12
lib/urlapi.c
@ -923,7 +923,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
|
||||
}
|
||||
|
||||
/* path has been allocated large enough to hold this */
|
||||
path = (char *)&url[5];
|
||||
path = &url[5];
|
||||
pathlen = urllen - 5;
|
||||
|
||||
u->scheme = strdup("file");
|
||||
@ -1221,7 +1221,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
|
||||
if(!(flags & CURLU_PATH_AS_IS)) {
|
||||
/* remove ../ and ./ sequences according to RFC3986 */
|
||||
char *dedot;
|
||||
int err = dedotdotify((char *)path, pathlen, &dedot);
|
||||
int err = dedotdotify(path, pathlen, &dedot);
|
||||
if(err) {
|
||||
result = CURLUE_OUT_OF_MEMORY;
|
||||
goto fail;
|
||||
@ -1399,7 +1399,7 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
|
||||
break;
|
||||
case CURLUPART_URL: {
|
||||
char *url;
|
||||
char *scheme;
|
||||
const char *scheme;
|
||||
char *options = u->options;
|
||||
char *port = u->port;
|
||||
char *allochost = NULL;
|
||||
@ -1426,7 +1426,7 @@ CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
|
||||
if(u->scheme)
|
||||
scheme = u->scheme;
|
||||
else if(flags & CURLU_DEFAULT_SCHEME)
|
||||
scheme = (char *) DEFAULT_SCHEME;
|
||||
scheme = DEFAULT_SCHEME;
|
||||
else
|
||||
return CURLUE_NO_SCHEME;
|
||||
|
||||
@ -1887,7 +1887,7 @@ nomem:
|
||||
bad = TRUE;
|
||||
free(decoded);
|
||||
}
|
||||
else if(hostname_check(u, (char *)newp, n))
|
||||
else if(hostname_check(u, (char *)CURL_UNCONST(newp), n))
|
||||
bad = TRUE;
|
||||
if(bad) {
|
||||
Curl_dyn_free(&enc);
|
||||
@ -1897,7 +1897,7 @@ nomem:
|
||||
}
|
||||
|
||||
free(*storep);
|
||||
*storep = (char *)newp;
|
||||
*storep = (char *)CURL_UNCONST(newp);
|
||||
}
|
||||
return CURLUE_OK;
|
||||
}
|
||||
|
||||
@ -61,8 +61,9 @@ bool Curl_auth_is_digest_supported(void)
|
||||
|
||||
/* Query the security package for Digest */
|
||||
status =
|
||||
Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
|
||||
&SecurityPackage);
|
||||
Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_DIGEST)),
|
||||
&SecurityPackage);
|
||||
|
||||
/* Release the package buffer as it is not required anymore */
|
||||
if(status == SEC_E_OK) {
|
||||
@ -121,8 +122,9 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
|
||||
|
||||
/* Query the security package for DigestSSP */
|
||||
status =
|
||||
Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
|
||||
&SecurityPackage);
|
||||
Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_DIGEST)),
|
||||
&SecurityPackage);
|
||||
if(status != SEC_E_OK) {
|
||||
failf(data, "SSPI: could not get auth info");
|
||||
return CURLE_AUTH_ERROR;
|
||||
@ -163,10 +165,10 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
|
||||
|
||||
/* Acquire our credentials handle */
|
||||
status = Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *) TEXT(SP_NAME_DIGEST),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
p_identity, NULL, NULL,
|
||||
&credentials, &expiry);
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_DIGEST)),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
p_identity, NULL, NULL,
|
||||
&credentials, &expiry);
|
||||
|
||||
if(status != SEC_E_OK) {
|
||||
Curl_sspi_free_identity(p_identity);
|
||||
@ -180,7 +182,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
|
||||
chlg_desc.cBuffers = 1;
|
||||
chlg_desc.pBuffers = &chlg_buf;
|
||||
chlg_buf.BufferType = SECBUFFER_TOKEN;
|
||||
chlg_buf.pvBuffer = (void *) Curl_bufref_ptr(chlg);
|
||||
chlg_buf.pvBuffer = CURL_UNCONST(Curl_bufref_ptr(chlg));
|
||||
chlg_buf.cbBuffer = curlx_uztoul(Curl_bufref_len(chlg));
|
||||
|
||||
/* Setup the response "output" security buffer */
|
||||
@ -271,7 +273,7 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg,
|
||||
if(strcasecompare(value, "realm")) {
|
||||
|
||||
/* Setup identity's domain and length */
|
||||
domain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *) content);
|
||||
domain.tchar_ptr = curlx_convert_UTF8_to_tchar(content);
|
||||
if(!domain.tchar_ptr)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -413,8 +415,9 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
|
||||
/* Query the security package for DigestSSP */
|
||||
status =
|
||||
Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
|
||||
&SecurityPackage);
|
||||
Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_DIGEST)),
|
||||
&SecurityPackage);
|
||||
if(status != SEC_E_OK) {
|
||||
failf(data, "SSPI: could not get auth info");
|
||||
return CURLE_AUTH_ERROR;
|
||||
@ -454,10 +457,10 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
chlg_buf[0].pvBuffer = NULL;
|
||||
chlg_buf[0].cbBuffer = 0;
|
||||
chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[1].pvBuffer = (void *) request;
|
||||
chlg_buf[1].pvBuffer = CURL_UNCONST(request);
|
||||
chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
|
||||
chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[2].pvBuffer = (void *) uripath;
|
||||
chlg_buf[2].pvBuffer = CURL_UNCONST(uripath);
|
||||
chlg_buf[2].cbBuffer = curlx_uztoul(strlen((const char *) uripath));
|
||||
chlg_buf[3].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[3].pvBuffer = NULL;
|
||||
@ -534,10 +537,10 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
|
||||
/* Acquire our credentials handle */
|
||||
status = Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *) TEXT(SP_NAME_DIGEST),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
p_identity, NULL, NULL,
|
||||
&credentials, &expiry);
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_DIGEST)),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
p_identity, NULL, NULL,
|
||||
&credentials, &expiry);
|
||||
if(status != SEC_E_OK) {
|
||||
Curl_sspi_free_identity(p_identity);
|
||||
free(output_token);
|
||||
@ -553,7 +556,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
chlg_buf[0].pvBuffer = digest->input_token;
|
||||
chlg_buf[0].cbBuffer = curlx_uztoul(digest->input_token_len);
|
||||
chlg_buf[1].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[1].pvBuffer = (void *) request;
|
||||
chlg_buf[1].pvBuffer = CURL_UNCONST(request);
|
||||
chlg_buf[1].cbBuffer = curlx_uztoul(strlen((const char *) request));
|
||||
chlg_buf[2].BufferType = SECBUFFER_PKG_PARAMS;
|
||||
chlg_buf[2].pvBuffer = NULL;
|
||||
@ -567,7 +570,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
||||
resp_buf.pvBuffer = output_token;
|
||||
resp_buf.cbBuffer = curlx_uztoul(token_max);
|
||||
|
||||
spn = curlx_convert_UTF8_to_tchar((char *) uripath);
|
||||
spn = curlx_convert_UTF8_to_tchar((const char *) uripath);
|
||||
if(!spn) {
|
||||
Curl_pSecFn->FreeCredentialsHandle(&credentials);
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
||||
infof(data, "GSSAPI handshake failure (empty challenge message)");
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
input_token.value = (void *) Curl_bufref_ptr(chlg);
|
||||
input_token.value = CURL_UNCONST(Curl_bufref_ptr(chlg));
|
||||
input_token.length = Curl_bufref_len(chlg);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
/* Setup the challenge "input" security buffer */
|
||||
input_token.value = (void *) Curl_bufref_ptr(chlg);
|
||||
input_token.value = CURL_UNCONST(Curl_bufref_ptr(chlg));
|
||||
input_token.length = Curl_bufref_len(chlg);
|
||||
|
||||
/* Decrypt the inbound challenge and obtain the qop */
|
||||
|
||||
@ -55,9 +55,9 @@ bool Curl_auth_is_gssapi_supported(void)
|
||||
SECURITY_STATUS status;
|
||||
|
||||
/* Query the security package for Kerberos */
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *)
|
||||
TEXT(SP_NAME_KERBEROS),
|
||||
&SecurityPackage);
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_KERBEROS)),
|
||||
&SecurityPackage);
|
||||
|
||||
/* Release the package buffer as it is not required anymore */
|
||||
if(status == SEC_E_OK) {
|
||||
@ -118,9 +118,9 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
||||
|
||||
if(!krb5->output_token) {
|
||||
/* Query the security package for Kerberos */
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *)
|
||||
TEXT(SP_NAME_KERBEROS),
|
||||
&SecurityPackage);
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_KERBEROS)),
|
||||
&SecurityPackage);
|
||||
if(status != SEC_E_OK) {
|
||||
failf(data, "SSPI: could not get auth info");
|
||||
return CURLE_AUTH_ERROR;
|
||||
@ -159,11 +159,10 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
||||
|
||||
/* Acquire our credentials handle */
|
||||
status = Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *)
|
||||
TEXT(SP_NAME_KERBEROS),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
krb5->p_identity, NULL, NULL,
|
||||
krb5->credentials, &expiry);
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_KERBEROS)),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
krb5->p_identity, NULL, NULL,
|
||||
krb5->credentials, &expiry);
|
||||
if(status != SEC_E_OK)
|
||||
return CURLE_LOGIN_DENIED;
|
||||
|
||||
@ -184,7 +183,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
||||
chlg_desc.cBuffers = 1;
|
||||
chlg_desc.pBuffers = &chlg_buf;
|
||||
chlg_buf.BufferType = SECBUFFER_TOKEN;
|
||||
chlg_buf.pvBuffer = (void *) Curl_bufref_ptr(chlg);
|
||||
chlg_buf.pvBuffer = CURL_UNCONST(Curl_bufref_ptr(chlg));
|
||||
chlg_buf.cbBuffer = curlx_uztoul(Curl_bufref_len(chlg));
|
||||
}
|
||||
|
||||
@ -297,7 +296,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
|
||||
input_desc.cBuffers = 2;
|
||||
input_desc.pBuffers = input_buf;
|
||||
input_buf[0].BufferType = SECBUFFER_STREAM;
|
||||
input_buf[0].pvBuffer = (void *) Curl_bufref_ptr(chlg);
|
||||
input_buf[0].pvBuffer = CURL_UNCONST(Curl_bufref_ptr(chlg));
|
||||
input_buf[0].cbBuffer = curlx_uztoul(Curl_bufref_len(chlg));
|
||||
input_buf[1].BufferType = SECBUFFER_DATA;
|
||||
input_buf[1].pvBuffer = NULL;
|
||||
|
||||
@ -55,8 +55,9 @@ bool Curl_auth_is_ntlm_supported(void)
|
||||
SECURITY_STATUS status;
|
||||
|
||||
/* Query the security package for NTLM */
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_NTLM),
|
||||
&SecurityPackage);
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_NTLM)),
|
||||
&SecurityPackage);
|
||||
|
||||
/* Release the package buffer as it is not required anymore */
|
||||
if(status == SEC_E_OK) {
|
||||
@ -103,8 +104,9 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
||||
Curl_auth_cleanup_ntlm(ntlm);
|
||||
|
||||
/* Query the security package for NTLM */
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_NTLM),
|
||||
&SecurityPackage);
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_NTLM)),
|
||||
&SecurityPackage);
|
||||
if(status != SEC_E_OK) {
|
||||
failf(data, "SSPI: could not get auth info");
|
||||
return CURLE_AUTH_ERROR;
|
||||
@ -142,10 +144,10 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
||||
|
||||
/* Acquire our credentials handle */
|
||||
status = Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *) TEXT(SP_NAME_NTLM),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
ntlm->p_identity, NULL, NULL,
|
||||
ntlm->credentials, &expiry);
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_NTLM)),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
ntlm->p_identity, NULL, NULL,
|
||||
ntlm->credentials, &expiry);
|
||||
if(status != SEC_E_OK)
|
||||
return CURLE_LOGIN_DENIED;
|
||||
|
||||
|
||||
@ -57,9 +57,9 @@ bool Curl_auth_is_spnego_supported(void)
|
||||
SECURITY_STATUS status;
|
||||
|
||||
/* Query the security package for Negotiate */
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *)
|
||||
TEXT(SP_NAME_NEGOTIATE),
|
||||
&SecurityPackage);
|
||||
status = Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_NEGOTIATE)),
|
||||
&SecurityPackage);
|
||||
|
||||
/* Release the package buffer as it is not required anymore */
|
||||
if(status == SEC_E_OK) {
|
||||
@ -128,9 +128,9 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
|
||||
|
||||
if(!nego->output_token) {
|
||||
/* Query the security package for Negotiate */
|
||||
nego->status = (DWORD)Curl_pSecFn->QuerySecurityPackageInfo((TCHAR *)
|
||||
TEXT(SP_NAME_NEGOTIATE),
|
||||
&SecurityPackage);
|
||||
nego->status = (DWORD)Curl_pSecFn->QuerySecurityPackageInfo(
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_NEGOTIATE)),
|
||||
&SecurityPackage);
|
||||
if(nego->status != SEC_E_OK) {
|
||||
failf(data, "SSPI: could not get auth info");
|
||||
return CURLE_AUTH_ERROR;
|
||||
@ -170,10 +170,10 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
|
||||
/* Acquire our credentials handle */
|
||||
nego->status = (DWORD)
|
||||
Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *)TEXT(SP_NAME_NEGOTIATE),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
nego->p_identity, NULL, NULL,
|
||||
nego->credentials, &expiry);
|
||||
(TCHAR *)CURL_UNCONST(TEXT(SP_NAME_NEGOTIATE)),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
nego->p_identity, NULL, NULL,
|
||||
nego->credentials, &expiry);
|
||||
if(nego->status != SEC_E_OK)
|
||||
return CURLE_AUTH_ERROR;
|
||||
|
||||
|
||||
@ -400,7 +400,7 @@ static void MSH3_CALL msh3_header_received(MSH3_REQUEST *Request,
|
||||
msh3_lock_acquire(&stream->recv_lock);
|
||||
|
||||
if((hd->NameLength == 7) &&
|
||||
!strncmp(HTTP_PSEUDO_STATUS, (char *)hd->Name, 7)) {
|
||||
!strncmp(HTTP_PSEUDO_STATUS, (const char *)hd->Name, 7)) {
|
||||
char line[14]; /* status line is always 13 characters long */
|
||||
size_t ncopy;
|
||||
|
||||
@ -754,12 +754,13 @@ static bool cf_msh3_data_pending(struct Curl_cfilter *cf,
|
||||
(void)cf;
|
||||
if(stream && stream->req) {
|
||||
msh3_lock_acquire(&stream->recv_lock);
|
||||
CURL_TRC_CF((struct Curl_easy *)data, cf, "data pending = %zu",
|
||||
CURL_TRC_CF((struct Curl_easy *)CURL_UNCONST(data), cf,
|
||||
"data pending = %zu",
|
||||
Curl_bufq_len(&stream->recvbuf));
|
||||
pending = !Curl_bufq_is_empty(&stream->recvbuf);
|
||||
msh3_lock_release(&stream->recv_lock);
|
||||
if(pending)
|
||||
h3_drain_stream(cf, (struct Curl_easy *)data);
|
||||
h3_drain_stream(cf, (struct Curl_easy *)CURL_UNCONST(data));
|
||||
}
|
||||
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
|
||||
@ -977,7 +977,7 @@ static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream3_id,
|
||||
if(!stream)
|
||||
return NGHTTP3_ERR_CALLBACK_FAILURE;
|
||||
|
||||
h3_xfer_write_resp(cf, data, stream, (char *)buf, blen, FALSE);
|
||||
h3_xfer_write_resp(cf, data, stream, (const char *)buf, blen, FALSE);
|
||||
if(blen) {
|
||||
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] ACK %zu bytes of DATA",
|
||||
stream->id, blen);
|
||||
@ -1381,7 +1381,7 @@ cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id,
|
||||
while(nvecs < veccnt &&
|
||||
Curl_bufq_peek_at(&stream->sendbuf,
|
||||
stream->sendbuf_len_in_flight,
|
||||
(const unsigned char **)&vec[nvecs].base,
|
||||
CURL_UNCONST(&vec[nvecs].base),
|
||||
&vec[nvecs].len)) {
|
||||
stream->sendbuf_len_in_flight += vec[nvecs].len;
|
||||
nwritten += vec[nvecs].len;
|
||||
@ -2370,7 +2370,7 @@ static CURLcode cf_ngtcp2_on_session_reuse(struct Curl_cfilter *cf,
|
||||
else {
|
||||
int rv;
|
||||
rv = ngtcp2_conn_decode_and_set_0rtt_transport_params(
|
||||
ctx->qconn, (uint8_t *)scs->quic_tp, scs->quic_tp_len);
|
||||
ctx->qconn, (const uint8_t *)scs->quic_tp, scs->quic_tp_len);
|
||||
if(rv)
|
||||
CURL_TRC_CF(data, cf, "no early data, failed to set 0RTT transport "
|
||||
"parameters: %s", ngtcp2_strerror(rv));
|
||||
|
||||
@ -171,7 +171,7 @@ static CURLcode make_bio_addr(BIO_ADDR **pbio_addr,
|
||||
switch(addr->family) {
|
||||
case AF_INET: {
|
||||
struct sockaddr_in * const sin =
|
||||
(struct sockaddr_in * const)(void *)&addr->curl_sa_addr;
|
||||
(struct sockaddr_in * const)CURL_UNCONST(&addr->curl_sa_addr);
|
||||
if(!BIO_ADDR_rawmake(ba, AF_INET, &sin->sin_addr,
|
||||
sizeof(sin->sin_addr), sin->sin_port)) {
|
||||
goto out;
|
||||
@ -182,7 +182,7 @@ static CURLcode make_bio_addr(BIO_ADDR **pbio_addr,
|
||||
#ifdef USE_IPV6
|
||||
case AF_INET6: {
|
||||
struct sockaddr_in6 * const sin =
|
||||
(struct sockaddr_in6 * const)(void *)&addr->curl_sa_addr;
|
||||
(struct sockaddr_in6 * const)CURL_UNCONST(&addr->curl_sa_addr);
|
||||
if(!BIO_ADDR_rawmake(ba, AF_INET6, &sin->sin6_addr,
|
||||
sizeof(sin->sin6_addr), sin->sin6_port)) {
|
||||
}
|
||||
@ -1025,7 +1025,7 @@ cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id,
|
||||
while(nvecs < veccnt &&
|
||||
Curl_bufq_peek_at(&stream->sendbuf,
|
||||
stream->sendbuf_len_in_flight,
|
||||
(const unsigned char **)&vec[nvecs].base,
|
||||
CURL_UNCONST(&vec[nvecs].base),
|
||||
&vec[nvecs].len)) {
|
||||
stream->sendbuf_len_in_flight += vec[nvecs].len;
|
||||
nwritten += vec[nvecs].len;
|
||||
|
||||
@ -662,7 +662,8 @@ static CURLcode recv_pkt(const unsigned char *pkt, size_t pktlen,
|
||||
recv_info.from = (struct sockaddr *)remote_addr;
|
||||
recv_info.from_len = remote_addrlen;
|
||||
|
||||
nread = quiche_conn_recv(ctx->qconn, (unsigned char *)pkt, pktlen,
|
||||
nread = quiche_conn_recv(ctx->qconn,
|
||||
(unsigned char *)CURL_UNCONST(pkt), pktlen,
|
||||
&recv_info);
|
||||
if(nread < 0) {
|
||||
if(QUICHE_ERR_DONE == nread) {
|
||||
@ -960,7 +961,7 @@ static ssize_t cf_quiche_send_body(struct Curl_cfilter *cf,
|
||||
ssize_t nwritten;
|
||||
|
||||
nwritten = quiche_h3_send_body(ctx->h3c, ctx->qconn, stream->id,
|
||||
(uint8_t *)buf, len, eos);
|
||||
(uint8_t *)CURL_UNCONST(buf), len, eos);
|
||||
if(nwritten == QUICHE_H3_ERR_DONE || (nwritten == 0 && len > 0)) {
|
||||
/* Blocked on flow control and should HOLD sending. But when do we open
|
||||
* again? */
|
||||
@ -1337,8 +1338,7 @@ static const struct alpn_spec ALPN_SPEC_H3 = {
|
||||
10 * QUIC_MAX_STREAMS * H3_STREAM_WINDOW_SIZE);
|
||||
quiche_config_set_max_stream_window(ctx->cfg, 10 * H3_STREAM_WINDOW_SIZE);
|
||||
quiche_config_set_application_protos(ctx->cfg,
|
||||
(uint8_t *)
|
||||
QUICHE_H3_APPLICATION_PROTOCOL,
|
||||
(uint8_t *)CURL_UNCONST(QUICHE_H3_APPLICATION_PROTOCOL),
|
||||
sizeof(QUICHE_H3_APPLICATION_PROTOCOL)
|
||||
- 1);
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf,
|
||||
#endif
|
||||
|
||||
*psent = 0;
|
||||
msg_iov.iov_base = (uint8_t *)pkt;
|
||||
msg_iov.iov_base = (uint8_t *)CURL_UNCONST(pkt);
|
||||
msg_iov.iov_len = pktlen;
|
||||
msg.msg_iov = &msg_iov;
|
||||
msg.msg_iovlen = 1;
|
||||
|
||||
@ -2687,7 +2687,7 @@ static void sftp_quote(struct Curl_easy *data)
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
return;
|
||||
}
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *) "PWD\n", 4);
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, "PWD\n", 4);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
|
||||
|
||||
/* this sends an FTP-like "header" to the header callback so that the
|
||||
|
||||
@ -930,7 +930,7 @@ static CURLcode sftp_quote(struct Curl_easy *data,
|
||||
char *tmp = aprintf("257 \"%s\" is current directory.\n", sshp->path);
|
||||
if(!tmp)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4);
|
||||
Curl_debug(data, CURLINFO_HEADER_OUT, "PWD\n", 4);
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
|
||||
|
||||
/* this sends an FTP-like "header" to the header callback so that the
|
||||
@ -1591,8 +1591,7 @@ static CURLcode sftp_readdir(struct Curl_easy *data,
|
||||
sshp->readdir_filename,
|
||||
readdir_len);
|
||||
if(!result)
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY,
|
||||
(char *)"\n", 1);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, "\n", 1);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
@ -3110,7 +3109,7 @@ static ssize_t ssh_tls_recv(libssh2_socket_t sock, void *buffer,
|
||||
return -EAGAIN; /* magic return code for libssh2 */
|
||||
else if(result)
|
||||
return -1; /* generic error */
|
||||
Curl_debug(data, CURLINFO_DATA_IN, (char *)buffer, (size_t)nread);
|
||||
Curl_debug(data, CURLINFO_DATA_IN, (const char *)buffer, (size_t)nread);
|
||||
return nread;
|
||||
}
|
||||
|
||||
@ -3135,7 +3134,7 @@ static ssize_t ssh_tls_send(libssh2_socket_t sock, const void *buffer,
|
||||
return -EAGAIN; /* magic return code for libssh2 */
|
||||
else if(result)
|
||||
return -1; /* error */
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, (char *)buffer, nwrite);
|
||||
Curl_debug(data, CURLINFO_DATA_OUT, (const char *)buffer, nwrite);
|
||||
return (ssize_t)nwrite;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -263,7 +263,7 @@ static ssize_t wsftp_send(struct Curl_easy *data, int sockindex,
|
||||
rc = wolfSSH_SFTP_SendWritePacket(sshc->ssh_session, sshc->handle,
|
||||
sshc->handleSz,
|
||||
&offset[0],
|
||||
(byte *)mem, (word32)len);
|
||||
(byte *)CURL_UNCONST(mem), (word32)len);
|
||||
|
||||
if(rc == WS_FATAL_ERROR)
|
||||
rc = wolfSSH_get_error(sshc->ssh_session);
|
||||
@ -504,7 +504,8 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
|
||||
}
|
||||
break;
|
||||
case SSH_SFTP_REALPATH:
|
||||
name = wolfSSH_SFTP_RealPath(sshc->ssh_session, (char *)".");
|
||||
name = wolfSSH_SFTP_RealPath(sshc->ssh_session,
|
||||
(char *)CURL_UNCONST("."));
|
||||
rc = wolfSSH_get_error(sshc->ssh_session);
|
||||
if(rc == WS_WANT_READ) {
|
||||
*block = TRUE;
|
||||
|
||||
@ -153,7 +153,7 @@ static CURLcode load_cafile(struct cafile_source *source,
|
||||
}
|
||||
else if(source->type == CAFILE_SOURCE_BLOB) {
|
||||
n = source->len;
|
||||
p = (unsigned char *) source->data;
|
||||
p = (const unsigned char *) source->data;
|
||||
}
|
||||
while(n) {
|
||||
pushed = br_pem_decoder_push(&pc, p, n);
|
||||
@ -338,7 +338,7 @@ static unsigned x509_end_chain(const br_x509_class **ctx)
|
||||
static const br_x509_pkey *x509_get_pkey(const br_x509_class *const *ctx,
|
||||
unsigned *usages)
|
||||
{
|
||||
struct x509_context *x509 = (struct x509_context *)ctx;
|
||||
struct x509_context *x509 = (struct x509_context *)CURL_UNCONST(ctx);
|
||||
|
||||
if(!x509->verifypeer) {
|
||||
/* Nothing in the chain is verified, just return the public key of the
|
||||
@ -611,12 +611,12 @@ static CURLcode bearssl_connect_step1(struct Curl_cfilter *cf,
|
||||
|
||||
if(ssl_config->primary.cache_session) {
|
||||
struct Curl_ssl_session *sc_session = NULL;
|
||||
const br_ssl_session_parameters *session;
|
||||
|
||||
ret = Curl_ssl_scache_take(cf, data, connssl->peer.scache_key,
|
||||
&sc_session);
|
||||
if(!ret && sc_session && sc_session->sdata && sc_session->sdata_len) {
|
||||
session = (br_ssl_session_parameters *)(void *)sc_session->sdata;
|
||||
const br_ssl_session_parameters *session;
|
||||
session = (const br_ssl_session_parameters *)sc_session->sdata;
|
||||
br_ssl_engine_set_session_parameters(&backend->ctx.eng, session);
|
||||
session_set = 1;
|
||||
infof(data, "BearSSL: reusing session ID");
|
||||
@ -729,7 +729,7 @@ static CURLcode bearssl_run_until(struct Curl_cfilter *cf,
|
||||
return CURLE_OK;
|
||||
if(state & BR_SSL_SENDREC) {
|
||||
buf = br_ssl_engine_sendrec_buf(&backend->ctx.eng, &len);
|
||||
ret = Curl_conn_cf_send(cf->next, data, (char *)buf, len, FALSE,
|
||||
ret = Curl_conn_cf_send(cf->next, data, (const char *)buf, len, FALSE,
|
||||
&result);
|
||||
CURL_TRC_CF(data, cf, "ssl_send(len=%zu) -> %zd, %d", len, ret, result);
|
||||
if(ret <= 0) {
|
||||
|
||||
@ -564,7 +564,7 @@ gtls_get_cached_creds(struct Curl_cfilter *cf, struct Curl_easy *data)
|
||||
|
||||
if(data->multi) {
|
||||
shared_creds = Curl_hash_pick(&data->multi->proto_hash,
|
||||
(void *)MPROTO_GTLS_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_GTLS_X509_KEY),
|
||||
sizeof(MPROTO_GTLS_X509_KEY)-1);
|
||||
if(shared_creds && shared_creds->creds &&
|
||||
!gtls_shared_creds_expired(data, shared_creds) &&
|
||||
@ -608,7 +608,7 @@ static void gtls_set_cached_creds(struct Curl_cfilter *cf,
|
||||
return;
|
||||
|
||||
if(!Curl_hash_add2(&data->multi->proto_hash,
|
||||
(void *)MPROTO_GTLS_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_GTLS_X509_KEY),
|
||||
sizeof(MPROTO_GTLS_X509_KEY)-1,
|
||||
sc, gtls_shared_creds_hash_free)) {
|
||||
Curl_gtls_shared_creds_free(&sc); /* down reference again */
|
||||
@ -1980,7 +1980,7 @@ static ssize_t gtls_send(struct Curl_cfilter *cf,
|
||||
nwritten = (size_t)rc;
|
||||
total_written += nwritten;
|
||||
DEBUGASSERT(nwritten <= blen);
|
||||
buf = (char *)buf + nwritten;
|
||||
buf = (char *)CURL_UNCONST(buf) + nwritten;
|
||||
blen -= nwritten;
|
||||
}
|
||||
rc = total_written;
|
||||
|
||||
@ -198,7 +198,7 @@ static int mbedtls_bio_cf_write(void *bio,
|
||||
if(!data)
|
||||
return 0;
|
||||
|
||||
nwritten = Curl_conn_cf_send(cf->next, data, (char *)buf, blen, FALSE,
|
||||
nwritten = Curl_conn_cf_send(cf->next, data, (const char *)buf, blen, FALSE,
|
||||
&result);
|
||||
CURL_TRC_CF(data, cf, "mbedtls_bio_cf_out_write(len=%zu) -> %zd, err=%d",
|
||||
blen, nwritten, result);
|
||||
@ -1211,7 +1211,7 @@ static ssize_t mbed_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
len = backend->send_blocked_len;
|
||||
}
|
||||
|
||||
ret = mbedtls_ssl_write(&backend->ssl, (unsigned char *)mem, len);
|
||||
ret = mbedtls_ssl_write(&backend->ssl, (const unsigned char *)mem, len);
|
||||
|
||||
if(ret < 0) {
|
||||
CURL_TRC_CF(data, cf, "mbedtls_ssl_write(len=%zu) -> -0x%04X",
|
||||
|
||||
@ -140,19 +140,22 @@
|
||||
#include <openssl/ui.h>
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
#define OSSL_UI_METHOD_CAST(x) (x)
|
||||
#else
|
||||
#define OSSL_UI_METHOD_CAST(x) CURL_UNCONST(x)
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* OpenSSL 1.1.0+ and LibreSSL */
|
||||
#define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */
|
||||
#define HAVE_OPAQUE_EVP_PKEY 1 /* since 1.1.0 -pre3 */
|
||||
#define HAVE_OPAQUE_RSA_DSA_DH 1 /* since 1.1.0 -pre5 */
|
||||
#define CONST_EXTS const
|
||||
#define HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED 1
|
||||
|
||||
#else
|
||||
/* For OpenSSL before 1.1.0 */
|
||||
#define ASN1_STRING_get0_data(x) ASN1_STRING_data(x)
|
||||
#define X509_get0_notBefore(x) X509_get_notBefore(x)
|
||||
#define X509_get0_notAfter(x) X509_get_notAfter(x)
|
||||
#define CONST_EXTS /* nope */
|
||||
#define OpenSSL_version_num() SSLeay()
|
||||
#endif
|
||||
|
||||
@ -317,10 +320,16 @@ static int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len)
|
||||
|
||||
static CURLcode X509V3_ext(struct Curl_easy *data,
|
||||
int certnum,
|
||||
CONST_EXTS STACK_OF(X509_EXTENSION) *exts)
|
||||
const STACK_OF(X509_EXTENSION) *extsarg)
|
||||
{
|
||||
int i;
|
||||
CURLcode result = CURLE_OK;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \
|
||||
!defined(LIBRESSL_VERSION_NUMBER)
|
||||
const STACK_OF(X509_EXTENSION) *exts = extsarg;
|
||||
#else
|
||||
STACK_OF(X509_EXTENSION) *exts = CURL_UNCONST(extsarg);
|
||||
#endif
|
||||
|
||||
if((int)sk_X509_EXTENSION_num(exts) <= 0)
|
||||
/* no extensions, bail out */
|
||||
@ -1113,7 +1122,7 @@ static int use_certificate_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
||||
else if(type == SSL_FILETYPE_PEM) {
|
||||
/* ERR_R_PEM_LIB; */
|
||||
x = PEM_read_bio_X509(in, NULL,
|
||||
passwd_callback, (void *)key_passwd);
|
||||
passwd_callback, CURL_UNCONST(key_passwd));
|
||||
}
|
||||
else {
|
||||
ret = 0;
|
||||
@ -1143,7 +1152,7 @@ static int use_privatekey_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
||||
|
||||
if(type == SSL_FILETYPE_PEM)
|
||||
pkey = PEM_read_bio_PrivateKey(in, NULL, passwd_callback,
|
||||
(void *)key_passwd);
|
||||
CURL_UNCONST(key_passwd));
|
||||
else if(type == SSL_FILETYPE_ASN1)
|
||||
pkey = d2i_PrivateKey_bio(in, NULL);
|
||||
else
|
||||
@ -1165,7 +1174,6 @@ use_certificate_chain_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
||||
{
|
||||
int ret = 0;
|
||||
X509 *x = NULL;
|
||||
void *passwd_callback_userdata = (void *)key_passwd;
|
||||
BIO *in = BIO_new_mem_buf(blob->data, (int)(blob->len));
|
||||
if(!in)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@ -1173,7 +1181,7 @@ use_certificate_chain_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
||||
ERR_clear_error();
|
||||
|
||||
x = PEM_read_bio_X509_AUX(in, NULL,
|
||||
passwd_callback, (void *)key_passwd);
|
||||
passwd_callback, CURL_UNCONST(key_passwd));
|
||||
if(!x)
|
||||
goto end;
|
||||
|
||||
@ -1192,7 +1200,7 @@ use_certificate_chain_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
||||
}
|
||||
|
||||
while((ca = PEM_read_bio_X509(in, NULL, passwd_callback,
|
||||
passwd_callback_userdata))
|
||||
CURL_UNCONST(key_passwd)))
|
||||
!= NULL) {
|
||||
|
||||
if(!SSL_CTX_add0_chain_cert(ctx, ca)) {
|
||||
@ -1309,7 +1317,7 @@ int cert_stuff(struct Curl_easy *data,
|
||||
|
||||
/* Does the engine supports LOAD_CERT_CTRL ? */
|
||||
if(!ENGINE_ctrl(data->state.engine, ENGINE_CTRL_GET_CMD_FROM_NAME,
|
||||
0, (void *)cmd_name, NULL)) {
|
||||
0, CURL_UNCONST(cmd_name), NULL)) {
|
||||
failf(data, "ssl engine does not support loading certificates");
|
||||
return 0;
|
||||
}
|
||||
@ -1576,7 +1584,7 @@ fail:
|
||||
|
||||
if(data->state.engine) {
|
||||
UI_METHOD *ui_method =
|
||||
UI_create_method((char *)"curl user interface");
|
||||
UI_create_method(OSSL_UI_METHOD_CAST("curl user interface"));
|
||||
if(!ui_method) {
|
||||
failf(data, "unable do create " OSSL_PACKAGE
|
||||
" user-interface method");
|
||||
@ -1627,7 +1635,7 @@ fail:
|
||||
OSSL_STORE_CTX *store = NULL;
|
||||
OSSL_STORE_INFO *info = NULL;
|
||||
UI_METHOD *ui_method =
|
||||
UI_create_method((char *)"curl user interface");
|
||||
UI_create_method(OSSL_UI_METHOD_CAST("curl user interface"));
|
||||
if(!ui_method) {
|
||||
failf(data, "unable do create " OSSL_PACKAGE
|
||||
" user-interface method");
|
||||
@ -2263,7 +2271,7 @@ static CURLcode ossl_verifyhost(struct Curl_easy *data,
|
||||
/* only check alternatives of the same type the target is */
|
||||
if(check->type == target) {
|
||||
/* get data and length */
|
||||
const char *altptr = (char *)ASN1_STRING_get0_data(check->d.ia5);
|
||||
const char *altptr = (const char *)ASN1_STRING_get0_data(check->d.ia5);
|
||||
size_t altlen = (size_t) ASN1_STRING_length(check->d.ia5);
|
||||
|
||||
switch(target) {
|
||||
@ -2349,7 +2357,7 @@ static CURLcode ossl_verifyhost(struct Curl_easy *data,
|
||||
if(tmp) {
|
||||
if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) {
|
||||
cnlen = ASN1_STRING_length(tmp);
|
||||
cn = (unsigned char *) ASN1_STRING_get0_data(tmp);
|
||||
cn = (unsigned char *)CURL_UNCONST(ASN1_STRING_get0_data(tmp));
|
||||
}
|
||||
else { /* not a UTF8 name */
|
||||
cnlen = ASN1_STRING_to_UTF8(&cn, tmp);
|
||||
@ -2727,15 +2735,15 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
|
||||
tls_rt_name = "";
|
||||
|
||||
if(content_type == SSL3_RT_CHANGE_CIPHER_SPEC) {
|
||||
msg_type = *(char *)buf;
|
||||
msg_type = *(const char *)buf;
|
||||
msg_name = "Change cipher spec";
|
||||
}
|
||||
else if(content_type == SSL3_RT_ALERT) {
|
||||
msg_type = (((char *)buf)[0] << 8) + ((char *)buf)[1];
|
||||
msg_type = (((const char *)buf)[0] << 8) + ((const char *)buf)[1];
|
||||
msg_name = SSL_alert_desc_string_long(msg_type);
|
||||
}
|
||||
else {
|
||||
msg_type = *(char *)buf;
|
||||
msg_type = *(const char *)buf;
|
||||
msg_name = ssl_msg_type(ssl_ver, msg_type);
|
||||
}
|
||||
|
||||
@ -2747,7 +2755,7 @@ static void ossl_trace(int direction, int ssl_ver, int content_type,
|
||||
}
|
||||
|
||||
Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT :
|
||||
CURLINFO_SSL_DATA_IN, (char *)buf, len);
|
||||
CURLINFO_SSL_DATA_IN, (const char *)buf, len);
|
||||
(void) ssl;
|
||||
}
|
||||
#endif
|
||||
@ -3434,7 +3442,7 @@ static X509_STORE *ossl_get_cached_x509_store(struct Curl_cfilter *cf,
|
||||
|
||||
DEBUGASSERT(multi);
|
||||
share = multi ? Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_OSSL_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_OSSL_X509_KEY),
|
||||
sizeof(MPROTO_OSSL_X509_KEY)-1) : NULL;
|
||||
if(share && share->store &&
|
||||
!ossl_cached_x509_store_expired(data, share) &&
|
||||
@ -3457,7 +3465,7 @@ static void ossl_set_cached_x509_store(struct Curl_cfilter *cf,
|
||||
if(!multi)
|
||||
return;
|
||||
share = Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_OSSL_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_OSSL_X509_KEY),
|
||||
sizeof(MPROTO_OSSL_X509_KEY)-1);
|
||||
|
||||
if(!share) {
|
||||
@ -3465,7 +3473,7 @@ static void ossl_set_cached_x509_store(struct Curl_cfilter *cf,
|
||||
if(!share)
|
||||
return;
|
||||
if(!Curl_hash_add2(&multi->proto_hash,
|
||||
(void *)MPROTO_OSSL_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_OSSL_X509_KEY),
|
||||
sizeof(MPROTO_OSSL_X509_KEY)-1,
|
||||
share, oss_x509_share_free)) {
|
||||
free(share);
|
||||
@ -3789,7 +3797,12 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx,
|
||||
{
|
||||
const char *curves = conn_config->curves;
|
||||
if(curves) {
|
||||
if(!SSL_CTX_set1_curves_list(octx->ssl_ctx, curves)) {
|
||||
#if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC)
|
||||
#define OSSL_CURVE_CAST(x) (x)
|
||||
#else
|
||||
#define OSSL_CURVE_CAST(x) (char *)CURL_UNCONST(x)
|
||||
#endif
|
||||
if(!SSL_CTX_set1_curves_list(octx->ssl_ctx, OSSL_CURVE_CAST(curves))) {
|
||||
failf(data, "failed setting curves list: '%s'", curves);
|
||||
return CURLE_SSL_CIPHER;
|
||||
}
|
||||
@ -4677,15 +4690,16 @@ CURLcode Curl_oss_check_peer_cert(struct Curl_cfilter *cf,
|
||||
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
{
|
||||
char *buf;
|
||||
long len;
|
||||
ASN1_TIME_print(mem, X509_get0_notBefore(octx->server_cert));
|
||||
len = BIO_get_mem_data(mem, (char **) &ptr);
|
||||
infof(data, " start date: %.*s", (int)len, ptr);
|
||||
len = BIO_get_mem_data(mem, (char **) &buf);
|
||||
infof(data, " start date: %.*s", (int)len, buf);
|
||||
(void)BIO_reset(mem);
|
||||
|
||||
ASN1_TIME_print(mem, X509_get0_notAfter(octx->server_cert));
|
||||
len = BIO_get_mem_data(mem, (char **) &ptr);
|
||||
infof(data, " expire date: %.*s", (int)len, ptr);
|
||||
len = BIO_get_mem_data(mem, (char **) &buf);
|
||||
infof(data, " expire date: %.*s", (int)len, buf);
|
||||
(void)BIO_reset(mem);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -806,11 +806,12 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
|
||||
#endif
|
||||
|
||||
sspi_status =
|
||||
Curl_pSecFn->AcquireCredentialsHandle(NULL, (TCHAR*)UNISP_NAME,
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
&credentials, NULL, NULL,
|
||||
&backend->cred->cred_handle,
|
||||
&backend->cred->time_stamp);
|
||||
Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *)CURL_UNCONST(UNISP_NAME),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
&credentials, NULL, NULL,
|
||||
&backend->cred->cred_handle,
|
||||
&backend->cred->time_stamp);
|
||||
}
|
||||
else {
|
||||
/* Pre-Windows 10 1809 or the user set a legacy algorithm list.
|
||||
@ -846,11 +847,12 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
|
||||
#endif
|
||||
|
||||
sspi_status =
|
||||
Curl_pSecFn->AcquireCredentialsHandle(NULL, (TCHAR*)UNISP_NAME,
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
&schannel_cred, NULL, NULL,
|
||||
&backend->cred->cred_handle,
|
||||
&backend->cred->time_stamp);
|
||||
Curl_pSecFn->AcquireCredentialsHandle(NULL,
|
||||
(TCHAR *)CURL_UNCONST(UNISP_NAME),
|
||||
SECPKG_CRED_OUTBOUND, NULL,
|
||||
&schannel_cred, NULL, NULL,
|
||||
&backend->cred->cred_handle,
|
||||
&backend->cred->time_stamp);
|
||||
}
|
||||
|
||||
#ifdef HAS_CLIENT_CERT_PATH
|
||||
@ -2534,7 +2536,7 @@ static void schannel_checksum(const unsigned char *input,
|
||||
|
||||
#ifdef __MINGW32CE__
|
||||
/* workaround for CeGCC, should be (const BYTE*) */
|
||||
if(!CryptHashData(hHash, (BYTE*)input, (DWORD)inputlen, 0))
|
||||
if(!CryptHashData(hHash, (BYTE*)CURL_UNCONST(input), (DWORD)inputlen, 0))
|
||||
#else
|
||||
if(!CryptHashData(hHash, input, (DWORD)inputlen, 0))
|
||||
#endif
|
||||
@ -2601,7 +2603,7 @@ HCERTSTORE Curl_schannel_get_cached_cert_store(struct Curl_cfilter *cf,
|
||||
}
|
||||
|
||||
share = Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_SCHANNEL_CERT_SHARE_KEY,
|
||||
CURL_UNCONST(MPROTO_SCHANNEL_CERT_SHARE_KEY),
|
||||
sizeof(MPROTO_SCHANNEL_CERT_SHARE_KEY)-1);
|
||||
if(!share || !share->cert_store) {
|
||||
return NULL;
|
||||
@ -2679,7 +2681,7 @@ bool Curl_schannel_set_cached_cert_store(struct Curl_cfilter *cf,
|
||||
}
|
||||
|
||||
share = Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_SCHANNEL_CERT_SHARE_KEY,
|
||||
CURL_UNCONST(MPROTO_SCHANNEL_CERT_SHARE_KEY),
|
||||
sizeof(MPROTO_SCHANNEL_CERT_SHARE_KEY)-1);
|
||||
if(!share) {
|
||||
share = calloc(1, sizeof(*share));
|
||||
@ -2687,7 +2689,7 @@ bool Curl_schannel_set_cached_cert_store(struct Curl_cfilter *cf,
|
||||
return FALSE;
|
||||
}
|
||||
if(!Curl_hash_add2(&multi->proto_hash,
|
||||
(void *)MPROTO_SCHANNEL_CERT_SHARE_KEY,
|
||||
CURL_UNCONST(MPROTO_SCHANNEL_CERT_SHARE_KEY),
|
||||
sizeof(MPROTO_SCHANNEL_CERT_SHARE_KEY)-1,
|
||||
share, schannel_cert_share_free)) {
|
||||
free(share);
|
||||
|
||||
@ -155,13 +155,13 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
|
||||
}
|
||||
else {
|
||||
CERT_BLOB cert_blob;
|
||||
CERT_CONTEXT *cert_context = NULL;
|
||||
const CERT_CONTEXT *cert_context = NULL;
|
||||
BOOL add_cert_result = FALSE;
|
||||
DWORD actual_content_type = 0;
|
||||
DWORD cert_size = (DWORD)
|
||||
((end_cert_ptr + end_cert_len) - begin_cert_ptr);
|
||||
|
||||
cert_blob.pbData = (BYTE *)begin_cert_ptr;
|
||||
cert_blob.pbData = (BYTE *)CURL_UNCONST(begin_cert_ptr);
|
||||
cert_blob.cbData = cert_size;
|
||||
if(!CryptQueryObject(CERT_QUERY_OBJECT_BLOB,
|
||||
&cert_blob,
|
||||
@ -249,7 +249,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store,
|
||||
size_t ca_file_bufsize = 0;
|
||||
DWORD total_bytes_read = 0;
|
||||
|
||||
ca_file_tstr = curlx_convert_UTF8_to_tchar((char *)ca_file);
|
||||
ca_file_tstr = curlx_convert_UTF8_to_tchar(ca_file);
|
||||
if(!ca_file_tstr) {
|
||||
char buffer[STRERROR_LEN];
|
||||
failf(data,
|
||||
|
||||
@ -263,7 +263,7 @@ static OSStatus sectransp_bio_cf_in_read(SSLConnectionRef connection,
|
||||
void *buf,
|
||||
size_t *dataLength) /* IN/OUT */
|
||||
{
|
||||
struct Curl_cfilter *cf = (struct Curl_cfilter *)connection;
|
||||
const struct Curl_cfilter *cf = (const struct Curl_cfilter *)connection;
|
||||
struct ssl_connect_data *connssl = cf->ctx;
|
||||
struct st_ssl_backend_data *backend =
|
||||
(struct st_ssl_backend_data *)connssl->backend;
|
||||
@ -303,7 +303,7 @@ static OSStatus sectransp_bio_cf_out_write(SSLConnectionRef connection,
|
||||
const void *buf,
|
||||
size_t *dataLength) /* IN/OUT */
|
||||
{
|
||||
struct Curl_cfilter *cf = (struct Curl_cfilter *)connection;
|
||||
const struct Curl_cfilter *cf = (const struct Curl_cfilter *)connection;
|
||||
struct ssl_connect_data *connssl = cf->ctx;
|
||||
struct st_ssl_backend_data *backend =
|
||||
(struct st_ssl_backend_data *)connssl->backend;
|
||||
@ -536,8 +536,8 @@ static OSStatus CopyIdentityWithLabel(char *label,
|
||||
for(i = 0; i < keys_list_count; i++) {
|
||||
OSStatus err = noErr;
|
||||
SecCertificateRef cert = NULL;
|
||||
SecIdentityRef identity =
|
||||
(SecIdentityRef) CFArrayGetValueAtIndex(keys_list, i);
|
||||
const void *item = CFArrayGetValueAtIndex(keys_list, i);
|
||||
SecIdentityRef identity = (SecIdentityRef)CURL_UNCONST(item);
|
||||
err = SecIdentityCopyCertificate(identity, &cert);
|
||||
if(err == noErr) {
|
||||
CFStringRef common_name = NULL;
|
||||
@ -666,22 +666,22 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath,
|
||||
count = CFArrayGetCount(items);
|
||||
|
||||
for(i = 0; i < count; i++) {
|
||||
CFTypeRef item = (CFTypeRef) CFArrayGetValueAtIndex(items, i);
|
||||
CFTypeID itemID = CFGetTypeID(item);
|
||||
const CFTypeRef item = CFArrayGetValueAtIndex(items, i);
|
||||
CFTypeID itemID = CFGetTypeID(item);
|
||||
|
||||
if(itemID == CFDictionaryGetTypeID()) {
|
||||
CFTypeRef identity = (CFTypeRef) CFDictionaryGetValue(
|
||||
(CFDictionaryRef) item,
|
||||
kSecImportItemIdentity);
|
||||
const CFTypeRef identity = CFDictionaryGetValue(
|
||||
(CFDictionaryRef)item,
|
||||
kSecImportItemIdentity);
|
||||
CFRetain(identity);
|
||||
*out_cert_and_key = (SecIdentityRef) identity;
|
||||
*out_cert_and_key = (SecIdentityRef)CURL_UNCONST(identity);
|
||||
break;
|
||||
}
|
||||
#if CURL_BUILD_MAC_10_7
|
||||
else if(itemID == SecCertificateGetTypeID()) {
|
||||
status = SecIdentityCreateWithCertificate(NULL,
|
||||
(SecCertificateRef) item,
|
||||
out_cert_and_key);
|
||||
(SecCertificateRef)CURL_UNCONST(item),
|
||||
out_cert_and_key);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -1694,7 +1694,8 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
|
||||
const char *pinnedpubkey)
|
||||
{ /* Scratch */
|
||||
size_t pubkeylen, realpubkeylen, spkiHeaderLength = 24;
|
||||
unsigned char *pubkey = NULL, *realpubkey = NULL;
|
||||
const unsigned char *pubkey = NULL;
|
||||
unsigned char *realpubkey = NULL;
|
||||
const unsigned char *spkiHeader = NULL;
|
||||
CFDataRef publicKeyBits = NULL;
|
||||
|
||||
@ -1744,7 +1745,7 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
|
||||
#endif /* SECTRANSP_PINNEDPUBKEY_V2 */
|
||||
|
||||
pubkeylen = (size_t)CFDataGetLength(publicKeyBits);
|
||||
pubkey = (unsigned char *)CFDataGetBytePtr(publicKeyBits);
|
||||
pubkey = (const unsigned char *)CFDataGetBytePtr(publicKeyBits);
|
||||
|
||||
switch(pubkeylen) {
|
||||
case 526:
|
||||
@ -2131,7 +2132,7 @@ check_handshake:
|
||||
|
||||
static CURLcode
|
||||
add_cert_to_certinfo(struct Curl_easy *data,
|
||||
SecCertificateRef server_cert,
|
||||
const SecCertificateRef server_cert,
|
||||
int idx)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
@ -2151,7 +2152,7 @@ add_cert_to_certinfo(struct Curl_easy *data,
|
||||
|
||||
static CURLcode
|
||||
collect_server_cert_single(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
SecCertificateRef server_cert,
|
||||
const SecCertificateRef server_cert,
|
||||
CFIndex idx)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
@ -2248,8 +2249,8 @@ static CURLcode collect_server_cert(struct Curl_cfilter *cf,
|
||||
if(ssl_config->certinfo)
|
||||
result = Curl_ssl_init_certinfo(data, (int)count);
|
||||
for(i = 0L ; !result && (i < count) ; i++) {
|
||||
server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs,
|
||||
i);
|
||||
const void *item = CFArrayGetValueAtIndex(server_certs, i);
|
||||
server_cert = (SecCertificateRef)CURL_UNCONST(item);
|
||||
result = collect_server_cert_single(cf, data, server_cert, i);
|
||||
}
|
||||
CFRelease(server_certs);
|
||||
@ -2265,7 +2266,8 @@ static CURLcode collect_server_cert(struct Curl_cfilter *cf,
|
||||
if(ssl_config->certinfo)
|
||||
result = Curl_ssl_init_certinfo(data, (int)count);
|
||||
for(i = 0L ; !result && (i < count) ; i++) {
|
||||
server_cert = (SecCertificateRef)CFArrayGetValueAtIndex(server_certs, i);
|
||||
const void *item = CFArrayGetValueAtIndex(server_certs, i);
|
||||
server_cert = (SecCertificateRef)CURL_UNCONST(item);
|
||||
result = collect_server_cert_single(cf, data, server_cert, i);
|
||||
}
|
||||
CFRelease(server_certs);
|
||||
@ -2465,7 +2467,7 @@ static bool sectransp_data_pending(struct Curl_cfilter *cf,
|
||||
DEBUGASSERT(backend);
|
||||
|
||||
if(backend->ssl_ctx) { /* SSL is in use */
|
||||
CURL_TRC_CF((struct Curl_easy *)data, cf, "data_pending");
|
||||
CURL_TRC_CF((struct Curl_easy *)CURL_UNCONST(data), cf, "data_pending");
|
||||
err = SSLGetBufferedReadSize(backend->ssl_ctx, &buffer);
|
||||
if(err == noErr)
|
||||
return buffer > 0UL;
|
||||
|
||||
@ -112,14 +112,14 @@ static void cf_ssl_scache_sesssion_ldestroy(void *udata, void *obj)
|
||||
{
|
||||
struct Curl_ssl_session *s = obj;
|
||||
(void)udata;
|
||||
free((void *)s->sdata);
|
||||
free((void *)s->quic_tp);
|
||||
free(CURL_UNCONST(s->sdata));
|
||||
free(CURL_UNCONST(s->quic_tp));
|
||||
free((void *)s->alpn);
|
||||
free(s);
|
||||
}
|
||||
|
||||
CURLcode
|
||||
Curl_ssl_session_create(unsigned char *sdata, size_t sdata_len,
|
||||
Curl_ssl_session_create(void *sdata, size_t sdata_len,
|
||||
int ietf_tls_id, const char *alpn,
|
||||
curl_off_t valid_until, size_t earlydata_max,
|
||||
struct Curl_ssl_session **psession)
|
||||
@ -130,7 +130,7 @@ Curl_ssl_session_create(unsigned char *sdata, size_t sdata_len,
|
||||
}
|
||||
|
||||
CURLcode
|
||||
Curl_ssl_session_create2(unsigned char *sdata, size_t sdata_len,
|
||||
Curl_ssl_session_create2(void *sdata, size_t sdata_len,
|
||||
int ietf_tls_id, const char *alpn,
|
||||
curl_off_t valid_until, size_t earlydata_max,
|
||||
unsigned char *quic_tp, size_t quic_tp_len,
|
||||
@ -1089,7 +1089,7 @@ out:
|
||||
CURLcode Curl_ssl_session_import(struct Curl_easy *data,
|
||||
const char *ssl_peer_key,
|
||||
const unsigned char *shmac, size_t shmac_len,
|
||||
const unsigned char *sdata, size_t sdata_len)
|
||||
const void *sdata, size_t sdata_len)
|
||||
{
|
||||
struct Curl_ssl_scache *scache = cf_ssl_scache_get(data);
|
||||
struct Curl_ssl_scache_peer *peer = NULL;
|
||||
|
||||
@ -115,7 +115,7 @@ CURLcode Curl_ssl_scache_add_obj(struct Curl_cfilter *cf,
|
||||
|
||||
/* All about a SSL session ticket */
|
||||
struct Curl_ssl_session {
|
||||
const unsigned char *sdata; /* session ticket data, plain bytes */
|
||||
const void *sdata; /* session ticket data, plain bytes */
|
||||
size_t sdata_len; /* number of bytes in sdata */
|
||||
curl_off_t valid_until; /* seconds since EPOCH until ticket expires */
|
||||
int ietf_tls_id; /* TLS protocol identifier negotiated */
|
||||
@ -137,7 +137,7 @@ struct Curl_ssl_session {
|
||||
* @param psession on return the scached session instance created
|
||||
*/
|
||||
CURLcode
|
||||
Curl_ssl_session_create(unsigned char *sdata, size_t sdata_len,
|
||||
Curl_ssl_session_create(void *sdata, size_t sdata_len,
|
||||
int ietf_tls_id, const char *alpn,
|
||||
curl_off_t valid_until,
|
||||
size_t earlydata_max,
|
||||
@ -146,7 +146,7 @@ Curl_ssl_session_create(unsigned char *sdata, size_t sdata_len,
|
||||
/* Variation of session creation with quic transport parameter bytes,
|
||||
* Takes ownership of `quic_tp` regardless of return code. */
|
||||
CURLcode
|
||||
Curl_ssl_session_create2(unsigned char *sdata, size_t sdata_len,
|
||||
Curl_ssl_session_create2(void *sdata, size_t sdata_len,
|
||||
int ietf_tls_id, const char *alpn,
|
||||
curl_off_t valid_until,
|
||||
size_t earlydata_max,
|
||||
@ -199,7 +199,7 @@ void Curl_ssl_scache_remove_all(struct Curl_cfilter *cf,
|
||||
CURLcode Curl_ssl_session_import(struct Curl_easy *data,
|
||||
const char *ssl_peer_key,
|
||||
const unsigned char *shmac, size_t shmac_len,
|
||||
const unsigned char *sdata, size_t sdata_len);
|
||||
const void *sdata, size_t sdata_len);
|
||||
|
||||
CURLcode Curl_ssl_session_export(struct Curl_easy *data,
|
||||
curl_ssls_export_cb *export_fn,
|
||||
|
||||
@ -254,10 +254,11 @@ CURLcode Curl_ssl_session_pack(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
CURLcode Curl_ssl_session_unpack(struct Curl_easy *data,
|
||||
const unsigned char *buf, size_t buflen,
|
||||
const void *bufv, size_t buflen,
|
||||
struct Curl_ssl_session **ps)
|
||||
{
|
||||
struct Curl_ssl_session *s = NULL;
|
||||
const unsigned char *buf = (const unsigned char *)bufv;
|
||||
const unsigned char *end = buf + buflen;
|
||||
uint8_t val8, *pval8;
|
||||
uint16_t val16;
|
||||
|
||||
@ -35,7 +35,7 @@ CURLcode Curl_ssl_session_pack(struct Curl_easy *data,
|
||||
struct dynbuf *buf);
|
||||
|
||||
CURLcode Curl_ssl_session_unpack(struct Curl_easy *data,
|
||||
const unsigned char *buf, size_t buflen,
|
||||
const void *bufv, size_t buflen,
|
||||
struct Curl_ssl_session **ps);
|
||||
|
||||
#endif /* USE_SSLS_EXPORT */
|
||||
|
||||
@ -744,7 +744,7 @@ static WOLFSSL_X509_STORE *wssl_get_cached_x509_store(struct Curl_cfilter *cf,
|
||||
|
||||
DEBUGASSERT(multi);
|
||||
share = multi ? Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_WSSL_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_WSSL_X509_KEY),
|
||||
sizeof(MPROTO_WSSL_X509_KEY)-1) : NULL;
|
||||
if(share && share->store &&
|
||||
!wssl_cached_x509_store_expired(data, share) &&
|
||||
@ -767,7 +767,7 @@ static void wssl_set_cached_x509_store(struct Curl_cfilter *cf,
|
||||
if(!multi)
|
||||
return;
|
||||
share = Curl_hash_pick(&multi->proto_hash,
|
||||
(void *)MPROTO_WSSL_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_WSSL_X509_KEY),
|
||||
sizeof(MPROTO_WSSL_X509_KEY)-1);
|
||||
|
||||
if(!share) {
|
||||
@ -775,7 +775,7 @@ static void wssl_set_cached_x509_store(struct Curl_cfilter *cf,
|
||||
if(!share)
|
||||
return;
|
||||
if(!Curl_hash_add2(&multi->proto_hash,
|
||||
(void *)MPROTO_WSSL_X509_KEY,
|
||||
CURL_UNCONST(MPROTO_WSSL_X509_KEY),
|
||||
sizeof(MPROTO_WSSL_X509_KEY)-1,
|
||||
share, wssl_x509_share_free)) {
|
||||
free(share);
|
||||
@ -1100,7 +1100,7 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
|
||||
|
||||
curves = conn_config->curves;
|
||||
if(!curves && cf->conn->transport == TRNSPRT_QUIC)
|
||||
curves = (char *)QUIC_GROUPS;
|
||||
curves = (char *)CURL_UNCONST(QUIC_GROUPS);
|
||||
|
||||
if(curves) {
|
||||
#ifdef WOLFSSL_HAVE_KYBER
|
||||
|
||||
@ -1026,7 +1026,7 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
|
||||
len = ((elem.end - q) * 8);
|
||||
if(len) {
|
||||
unsigned int i;
|
||||
for(i = *(unsigned char *) q; !(i & 0x80); i <<= 1)
|
||||
for(i = *(const unsigned char *) q; !(i & 0x80); i <<= 1)
|
||||
len--;
|
||||
}
|
||||
if(len > 32)
|
||||
|
||||
4
lib/ws.c
4
lib/ws.c
@ -866,7 +866,7 @@ CURLcode Curl_ws_accept(struct Curl_easy *data,
|
||||
else { /* !connect_only */
|
||||
/* And pass any additional data to the writers */
|
||||
if(nread) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)mem, nread);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, mem, nread);
|
||||
}
|
||||
}
|
||||
k->upgr101 = UPGR101_RECEIVED;
|
||||
@ -1062,7 +1062,7 @@ static CURLcode ws_flush(struct Curl_easy *data, struct websocket *ws,
|
||||
}
|
||||
#endif
|
||||
if(blocking) {
|
||||
result = ws_send_raw_blocking(data, ws, (char *)out, outlen);
|
||||
result = ws_send_raw_blocking(data, ws, (const char *)out, outlen);
|
||||
n = result ? 0 : outlen;
|
||||
}
|
||||
else if(data->set.connect_only || Curl_is_in_callback(data))
|
||||
|
||||
@ -851,6 +851,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
||||
#
|
||||
dnl Only clang 3.0 or later
|
||||
if test "$compiler_num" -ge "300"; then
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [language-extension-token])
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wformat=2"
|
||||
fi
|
||||
@ -996,6 +997,7 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
||||
#
|
||||
dnl Only gcc 4.0 or later
|
||||
if test "$compiler_num" -ge "400"; then
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-qual])
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
|
||||
fi
|
||||
#
|
||||
|
||||
@ -122,8 +122,8 @@ void hugehelp(void)
|
||||
memset(&z, 0, sizeof(z_stream));
|
||||
z.zalloc = (alloc_func)zalloc_func;
|
||||
z.zfree = (free_func)zfree_func;
|
||||
z.avail_in = (unsigned int)(sizeof(hugehelpgz) - HEADERLEN);
|
||||
z.next_in = (unsigned char *)hugehelpgz + HEADERLEN;
|
||||
z.avail_in = (uInt)(sizeof(hugehelpgz) - HEADERLEN);
|
||||
z.next_in = (z_const Bytef *)hugehelpgz + HEADERLEN;
|
||||
|
||||
if(inflateInit2(&z, -MAX_WBITS) != Z_OK)
|
||||
return;
|
||||
@ -162,8 +162,8 @@ void showhelp(const char *trigger, const char *arg, const char *endarg)
|
||||
memset(&z, 0, sizeof(z_stream));
|
||||
z.zalloc = (alloc_func)zalloc_func;
|
||||
z.zfree = (free_func)zfree_func;
|
||||
z.avail_in = (unsigned int)(sizeof(hugehelpgz) - HEADERLEN);
|
||||
z.next_in = (unsigned char *)hugehelpgz + HEADERLEN;
|
||||
z.avail_in = (uInt)(sizeof(hugehelpgz) - HEADERLEN);
|
||||
z.next_in = (z_const Bytef *)hugehelpgz + HEADERLEN;
|
||||
|
||||
if(inflateInit2(&z, -MAX_WBITS) != Z_OK)
|
||||
return;
|
||||
@ -235,8 +235,8 @@ void showhelp(const char *trigger, const char *arg, const char *endarg)
|
||||
inithelpscan(&ctx, trigger, arg, endarg);
|
||||
while(curlman[i]) {
|
||||
size_t len = strlen(curlman[i]);
|
||||
if(!helpscan((unsigned char *)curlman[i], len, &ctx) ||
|
||||
!helpscan((unsigned char *)"\\n", 1, &ctx))
|
||||
if(!helpscan((const unsigned char *)curlman[i], len, &ctx) ||
|
||||
!helpscan((const unsigned char *)"\\n", 1, &ctx))
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
||||
hdrcbdata->config->show_headers) {
|
||||
/* still awaiting the Content-Disposition header, store the header in
|
||||
memory. Since it is not zero terminated, we need an extra dance. */
|
||||
char *clone = aprintf("%.*s", (int)cb, (char *)str);
|
||||
char *clone = aprintf("%.*s", (int)cb, str);
|
||||
if(clone) {
|
||||
struct curl_slist *old = hdrcbdata->headlist;
|
||||
hdrcbdata->headlist = curl_slist_append(old, clone);
|
||||
|
||||
@ -43,7 +43,7 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
|
||||
access to a 64-bit type we can bypass stat and get the times directly. */
|
||||
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
|
||||
HANDLE hfile;
|
||||
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename);
|
||||
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar(filename);
|
||||
|
||||
hfile = CreateFile(tchar_filename, FILE_READ_ATTRIBUTES,
|
||||
(FILE_SHARE_READ | FILE_SHARE_WRITE |
|
||||
@ -97,7 +97,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
|
||||
access to a 64-bit type we can bypass utime and set the times directly. */
|
||||
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
|
||||
HANDLE hfile;
|
||||
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename);
|
||||
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar(filename);
|
||||
|
||||
/* 910670515199 is the maximum Unix filetime that can be used as a
|
||||
Windows FILETIME without overflow: 30827-12-31T23:59:59. */
|
||||
|
||||
@ -1789,7 +1789,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
if(ARGTYPE(a->desc) >= ARG_STRG) {
|
||||
/* this option requires an extra parameter */
|
||||
if(!longopt && parse[1]) {
|
||||
nextarg = (char *)&parse[1]; /* this is the actual extra parameter */
|
||||
nextarg = &parse[1]; /* this is the actual extra parameter */
|
||||
singleopt = TRUE; /* do not loop anymore after this */
|
||||
#ifdef HAVE_WRITABLE_ARGV
|
||||
clearthis = &cleararg1[parse + 2 - flag];
|
||||
@ -1832,7 +1832,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
that use nextarg should be marked as such and they will check that
|
||||
nextarg is set before continuing, but code analyzers are not always
|
||||
that aware of that state */
|
||||
nextarg = (char *)"";
|
||||
nextarg = "";
|
||||
|
||||
switch(cmd) {
|
||||
case C_RANDOM_FILE: /* --random-file */
|
||||
@ -2985,7 +2985,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
|
||||
error:
|
||||
if(nextalloc)
|
||||
free((char *)nextarg);
|
||||
free(CURL_UNCONST(nextarg));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ void inithelpscan(struct scan_ctx *ctx,
|
||||
memset(ctx->rbuf, 0, sizeof(ctx->rbuf));
|
||||
}
|
||||
|
||||
bool helpscan(unsigned char *buf, size_t len, struct scan_ctx *ctx)
|
||||
bool helpscan(const unsigned char *buf, size_t len, struct scan_ctx *ctx)
|
||||
{
|
||||
size_t i;
|
||||
for(i = 0; i < len; i++) {
|
||||
|
||||
@ -45,7 +45,7 @@ struct scan_ctx {
|
||||
};
|
||||
void inithelpscan(struct scan_ctx *ctx, const char *trigger,
|
||||
const char *arg, const char *endarg);
|
||||
bool helpscan(unsigned char *buf, size_t len, struct scan_ctx *ctx);
|
||||
bool helpscan(const unsigned char *buf, size_t len, struct scan_ctx *ctx);
|
||||
|
||||
struct helptxt {
|
||||
const char *opt;
|
||||
|
||||
@ -1214,7 +1214,7 @@ static CURLcode config2setopts(struct GlobalConfig *global,
|
||||
#ifdef CURL_CA_EMBED
|
||||
if(!config->cacert && !config->capath) {
|
||||
struct curl_blob blob;
|
||||
blob.data = (void *)curl_ca_embed;
|
||||
blob.data = CURL_UNCONST(curl_ca_embed);
|
||||
blob.len = strlen((const char *)curl_ca_embed);
|
||||
blob.flags = CURL_BLOB_NOCOPY;
|
||||
notef(config->global,
|
||||
@ -1228,7 +1228,7 @@ static CURLcode config2setopts(struct GlobalConfig *global,
|
||||
}
|
||||
if(!config->proxy_cacert && !config->proxy_capath) {
|
||||
struct curl_blob blob;
|
||||
blob.data = (void *)curl_ca_embed;
|
||||
blob.data = CURL_UNCONST(curl_ca_embed);
|
||||
blob.len = strlen((const char *)curl_ca_embed);
|
||||
blob.flags = CURL_BLOB_NOCOPY;
|
||||
notef(config->global,
|
||||
|
||||
@ -210,16 +210,16 @@ CURLcode get_url_file_name(struct GlobalConfig *global,
|
||||
}
|
||||
}
|
||||
|
||||
if(pc)
|
||||
if(pc) {
|
||||
/* duplicate the string beyond the slash */
|
||||
pc++;
|
||||
*filename = strdup(pc + 1);
|
||||
}
|
||||
else {
|
||||
/* no slash => empty string, use default */
|
||||
pc = (char *)"curl_response";
|
||||
warnf(global, "No remote file name, uses \"%s\"", pc);
|
||||
*filename = strdup("curl_response");
|
||||
warnf(global, "No remote file name, uses \"%s\"", *filename);
|
||||
}
|
||||
|
||||
*filename = strdup(pc);
|
||||
curl_free(path);
|
||||
if(!*filename)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
@ -252,7 +252,7 @@ static char *c_escape(const char *str, curl_off_t len)
|
||||
/* Octal escape to avoid >2 digit hex. */
|
||||
(len > 1 && ISXDIGIT(s[1])) ?
|
||||
"\\%03o" : "\\x%02x",
|
||||
(unsigned int) *(unsigned char *) s);
|
||||
(unsigned int) *(const unsigned char *) s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ CURLcode glob_match_url(char **result, const char *filename,
|
||||
struct URLGlob *glob)
|
||||
{
|
||||
char numbuf[18];
|
||||
const char *appendthis = (char *)"";
|
||||
const char *appendthis = "";
|
||||
size_t appendlen = 0;
|
||||
struct curlx_dynbuf dyn;
|
||||
|
||||
|
||||
@ -427,7 +427,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":null", wovar->name);
|
||||
}
|
||||
curl_free((char *)freestr);
|
||||
curl_free((char *)CURL_UNCONST(freestr));
|
||||
|
||||
curlx_dyn_free(&buf);
|
||||
return 1; /* return 1 if anything was written */
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
int jsonquoted(const char *in, size_t len,
|
||||
struct curlx_dynbuf *out, bool lowercase)
|
||||
{
|
||||
const unsigned char *i = (unsigned char *)in;
|
||||
const unsigned char *i = (const unsigned char *)in;
|
||||
const unsigned char *in_end = &i[len];
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user