krb5: fix "implicit conversion loses integer precision" warnings

conversions to/from enum and unsigned chars

Closes #11814
This commit is contained in:
Daniel Stenberg 2023-09-07 13:52:30 +02:00
parent 3b30cc1a0d
commit 25907fd5ba
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -72,7 +72,7 @@ static CURLcode ftpsend(struct Curl_easy *data, struct connectdata *conn,
char *sptr = s;
CURLcode result = CURLE_OK;
#ifdef HAVE_GSSAPI
enum protection_level data_sec = conn->data_prot;
unsigned char data_sec = conn->data_prot;
#endif
if(!cmd)
@ -385,7 +385,7 @@ static const struct Curl_sec_client_mech Curl_krb5_client_mech = {
};
static const struct {
enum protection_level level;
unsigned char level;
const char *name;
} level_names[] = {
{ PROT_CLEAR, "clear" },
@ -394,8 +394,7 @@ static const struct {
{ PROT_PRIVATE, "private" }
};
static enum protection_level
name_to_level(const char *name)
static unsigned char name_to_level(const char *name)
{
int i;
for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
@ -734,7 +733,7 @@ static int sec_set_protection_level(struct Curl_easy *data)
{
int code;
struct connectdata *conn = data->conn;
enum protection_level level = conn->request_data_prot;
unsigned char level = conn->request_data_prot;
DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
@ -793,7 +792,7 @@ static int sec_set_protection_level(struct Curl_easy *data)
int
Curl_sec_request_prot(struct connectdata *conn, const char *level)
{
enum protection_level l = name_to_level(level);
unsigned char l = name_to_level(level);
if(l == PROT_NONE)
return -1;
DEBUGASSERT(l > PROT_NONE && l < PROT_LAST);