lib: fix -Wassign-enum warnings

configure --enable-debug now enables -Wassign-enum with clang,
identifying several enum "abuses" also fixed.

Reported-by: Gisle Vanem
Bug: 879007f811 (commitcomment-42087553)

Closes #5929
This commit is contained in:
Daniel Stenberg 2020-09-07 10:52:48 +02:00
parent ad425d3e3e
commit 17fcdf6a31
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
15 changed files with 53 additions and 48 deletions

View file

@ -332,7 +332,7 @@ struct curl_easyoption Curl_easyopts[] = {
{"XFERINFODATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, 0},
{"XFERINFOFUNCTION", CURLOPT_XFERINFOFUNCTION, CURLOT_FUNCTION, 0},
{"XOAUTH2_BEARER", CURLOPT_XOAUTH2_BEARER, CURLOT_STRING, 0},
{NULL, 0, 0, 0} /* end of table */
{NULL, CURLOPT_LASTENTRY, 0, 0} /* end of table */
};
#ifdef DEBUGBUILD

View file

@ -101,7 +101,7 @@ for my $name (sort @names) {
}
print <<FOOT
{NULL, 0, 0, 0} /* end of table */
{NULL, CURLOPT_LASTENTRY, 0, 0} /* end of table */
};
#ifdef DEBUGBUILD

View file

@ -7,10 +7,10 @@
* rewrite to work around the paragraph 2 in the BSD licenses as explained
* below.
*
* Copyright (c) 1998, 1999, 2017 Kungliga Tekniska Högskolan
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
*
* Copyright (C) 2001 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2001 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* All rights reserved.
*
@ -529,7 +529,7 @@ static CURLcode choose_mech(struct connectdata *conn)
if(ret != AUTH_CONTINUE) {
if(ret != AUTH_OK) {
/* Mechanism has dumped the error to stderr, don't error here. */
return -1;
return CURLE_USE_SSL_FAILED;
}
DEBUGASSERT(ret == AUTH_OK);

View file

@ -304,7 +304,7 @@ static gnutls_x509_crt_fmt_t do_file_type(const char *type)
return GNUTLS_X509_FMT_PEM;
if(strcasecompare(type, "DER"))
return GNUTLS_X509_FMT_DER;
return -1;
return GNUTLS_X509_FMT_PEM; /* default to PEM */
}
#define GNUTLS_CIPHERS "NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509"

View file

@ -1672,7 +1672,8 @@ static CURLcode nss_load_ca_certificates(struct connectdata *conn,
if(!dir)
return CURLE_SSL_CACERT_BADFILE;
while((entry = PR_ReadDir(dir, PR_SKIP_BOTH | PR_SKIP_HIDDEN))) {
while((entry =
PR_ReadDir(dir, (PRDirFlags)(PR_SKIP_BOTH | PR_SKIP_HIDDEN)))) {
char *fullpath = aprintf("%s/%s", capath, entry->name);
if(!fullpath) {
PR_CloseDir(dir);