tidy-up: use CURL_CSTRLEN() macro on more static strings

Follow-up to e1450d8fda #22406

Closes #22424
This commit is contained in:
Viktor Szakats 2026-07-28 22:36:11 +02:00
parent 8186edf85d
commit 59dc2bbe07
No known key found for this signature in database
6 changed files with 11 additions and 11 deletions

View file

@ -433,7 +433,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
return result;
result = Curl_client_write(data, CLIENTWRITE_HEADER,
accept_ranges, sizeof(accept_ranges) - 1);
accept_ranges, CURL_CSTRLEN(accept_ranges));
if(result != CURLE_OK)
return result;
}

View file

@ -878,9 +878,9 @@ static bool out_string(void *userp,
if(!str) {
/* Write null string if there is space. */
if(prec == -1 || prec >= (int)sizeof(nilstr) - 1) {
if(prec == -1 || prec >= (int)CURL_CSTRLEN(nilstr)) {
str = nilstr;
len = sizeof(nilstr) - 1;
len = CURL_CSTRLEN(nilstr);
/* Disable quotes around (nil) */
flags &= ~(unsigned int)FLAGS_ALT;
}
@ -939,7 +939,7 @@ static bool out_pointer(void *userp,
int width = p->width;
int flags = p->flags;
width -= (int)(sizeof(nilstr) - 1);
width -= (int)CURL_CSTRLEN(nilstr);
if(flags & FLAGS_LEFT)
while(width-- > 0)
OUTCHAR(' ');

View file

@ -208,7 +208,7 @@ CURLcode Curl_rand_alnum(struct Curl_easy *data, unsigned char *rnd,
size_t num)
{
CURLcode result = CURLE_OK;
const unsigned int alnumspace = sizeof(alnum) - 1;
const unsigned int alnumspace = CURL_CSTRLEN(alnum);
unsigned int r;
DEBUGASSERT(num > 1);

View file

@ -268,7 +268,7 @@ static uint16_t mbed_cipher_suite_walk_str(const char **str, const char **end)
static const char ecjpake_suite[] = "TLS_ECJPAKE_WITH_AES_128_CCM_8";
if(!id) {
if((len == sizeof(ecjpake_suite) - 1) &&
if((len == CURL_CSTRLEN(ecjpake_suite)) &&
curl_strnequal(ecjpake_suite, *str, len))
id = MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8;
}