mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 17:05:42 +01:00
Fix integer conversion warnings in psa_constant_names
This commit is contained in:
parent
a3678224b3
commit
1824696681
@ -83,9 +83,9 @@ static int psa_snprint_status(char *buffer, size_t buffer_size,
|
|||||||
size_t length = strlen(name);
|
size_t length = strlen(name);
|
||||||
if (length < buffer_size) {
|
if (length < buffer_size) {
|
||||||
memcpy(buffer, name, length + 1);
|
memcpy(buffer, name, length + 1);
|
||||||
return length;
|
return (int) length;
|
||||||
} else {
|
} else {
|
||||||
return buffer_size;
|
return (int) buffer_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,9 +100,9 @@ static int psa_snprint_ecc_curve(char *buffer, size_t buffer_size,
|
|||||||
size_t length = strlen(name);
|
size_t length = strlen(name);
|
||||||
if (length < buffer_size) {
|
if (length < buffer_size) {
|
||||||
memcpy(buffer, name, length + 1);
|
memcpy(buffer, name, length + 1);
|
||||||
return length;
|
return (int) length;
|
||||||
} else {
|
} else {
|
||||||
return buffer_size;
|
return (int) buffer_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,15 +144,15 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[1], "error") || !strcmp(argv[1], "status"))
|
if (!strcmp(argv[1], "error") || !strcmp(argv[1], "status"))
|
||||||
psa_snprint_status(buffer, sizeof(buffer), value);
|
psa_snprint_status(buffer, sizeof(buffer), (psa_status_t) value);
|
||||||
else if (!strcmp(argv[1], "alg") || !strcmp(argv[1], "algorithm"))
|
else if (!strcmp(argv[1], "alg") || !strcmp(argv[1], "algorithm"))
|
||||||
psa_snprint_algorithm(buffer, sizeof(buffer), value);
|
psa_snprint_algorithm(buffer, sizeof(buffer), (psa_algorithm_t) value);
|
||||||
else if (!strcmp(argv[1], "curve") || !strcmp(argv[1], "ecc_curve"))
|
else if (!strcmp(argv[1], "curve") || !strcmp(argv[1], "ecc_curve"))
|
||||||
psa_snprint_ecc_curve(buffer, sizeof(buffer), value);
|
psa_snprint_ecc_curve(buffer, sizeof(buffer), (psa_ecc_curve_t) value);
|
||||||
else if (!strcmp(argv[1], "type") || !strcmp(argv[1], "key_type"))
|
else if (!strcmp(argv[1], "type") || !strcmp(argv[1], "key_type"))
|
||||||
psa_snprint_key_type(buffer, sizeof(buffer), value);
|
psa_snprint_key_type(buffer, sizeof(buffer), (psa_key_type_t) value);
|
||||||
else if (!strcmp(argv[1], "usage") || !strcmp(argv[1], "key_usage"))
|
else if (!strcmp(argv[1], "usage") || !strcmp(argv[1], "key_usage"))
|
||||||
psa_snprint_key_usage(buffer, sizeof(buffer), value);
|
psa_snprint_key_usage(buffer, sizeof(buffer), (psa_key_usage_t) value);
|
||||||
else {
|
else {
|
||||||
printf("Unknown type: %s\n", argv[1]);
|
printf("Unknown type: %s\n", argv[1]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -44,7 +44,7 @@ static int psa_snprint_key_type(char *buffer, size_t buffer_size,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
return required_size;
|
return (int) required_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int psa_snprint_algorithm(char *buffer, size_t buffer_size,
|
static int psa_snprint_algorithm(char *buffer, size_t buffer_size,
|
||||||
@ -84,7 +84,7 @@ static int psa_snprint_algorithm(char *buffer, size_t buffer_size,
|
|||||||
append(&buffer, buffer_size, &required_size, ")", 1);
|
append(&buffer, buffer_size, &required_size, ")", 1);
|
||||||
}
|
}
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
return required_size;
|
return (int) required_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int psa_snprint_key_usage(char *buffer, size_t buffer_size,
|
static int psa_snprint_key_usage(char *buffer, size_t buffer_size,
|
||||||
@ -110,7 +110,7 @@ static int psa_snprint_key_usage(char *buffer, size_t buffer_size,
|
|||||||
} else {
|
} else {
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
}
|
}
|
||||||
return required_size;
|
return (int) required_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of automatically generated file. */
|
/* End of automatically generated file. */
|
||||||
|
Loading…
Reference in New Issue
Block a user