clang-tidy: silence more minor issues found by v22

Also one found manually in lib/curl_sha512_256.c.

Follow-up to 7a08c5d820 #20762

Closes #20770
This commit is contained in:
Viktor Szakats 2026-02-28 11:29:16 +01:00
parent 006f561f6e
commit bcc8144b89
No known key found for this signature in database
5 changed files with 16 additions and 15 deletions

View File

@ -727,10 +727,10 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context)
/* Put in BE mode the leftmost part of the hash as the final digest.
See FIPS PUB 180-4 section 6.7. */
CURL_PUT_64BIT_BE(digest + 0 * SHA512_256_BYTES_IN_WORD, ctx->H[0]);
CURL_PUT_64BIT_BE(digest + 1 * SHA512_256_BYTES_IN_WORD, ctx->H[1]);
CURL_PUT_64BIT_BE(digest + 2 * SHA512_256_BYTES_IN_WORD, ctx->H[2]);
CURL_PUT_64BIT_BE(digest + 3 * SHA512_256_BYTES_IN_WORD, ctx->H[3]);
CURL_PUT_64BIT_BE(digest + (0 * SHA512_256_BYTES_IN_WORD), ctx->H[0]);
CURL_PUT_64BIT_BE(digest + (1 * SHA512_256_BYTES_IN_WORD), ctx->H[1]);
CURL_PUT_64BIT_BE(digest + (2 * SHA512_256_BYTES_IN_WORD), ctx->H[2]);
CURL_PUT_64BIT_BE(digest + (3 * SHA512_256_BYTES_IN_WORD), ctx->H[3]);
/* Erase potentially sensitive data. */
memset(ctx, 0, sizeof(struct Curl_sha512_256ctx));

View File

@ -1247,7 +1247,7 @@ void Curl_ldap_version(char *buf, size_t bufsz)
unsigned int patch = (unsigned int)(api.ldapai_vendor_version % 100);
unsigned int major = (unsigned int)(api.ldapai_vendor_version / 10000);
unsigned int minor =
(((unsigned int)api.ldapai_vendor_version - major * 10000)
(((unsigned int)api.ldapai_vendor_version - (major * 10000))
- patch) / 100;
curl_msnprintf(buf, bufsz, "%s/%u.%u.%u",
api.ldapai_vendor_name, major, minor, patch);

View File

@ -1000,10 +1000,11 @@ static int myssh_in_UPLOAD_INIT(struct Curl_easy *data,
if(!sshc->sftp_file) {
int err = sftp_get_error(sshc->sftp_session);
if(((err == SSH_FX_NO_SUCH_FILE || err == SSH_FX_FAILURE ||
err == SSH_FX_NO_SUCH_PATH)) &&
(data->set.ftp_create_missing_dirs &&
(strlen(sshp->path) > 1))) {
if((err == SSH_FX_NO_SUCH_FILE ||
err == SSH_FX_FAILURE ||
err == SSH_FX_NO_SUCH_PATH) &&
data->set.ftp_create_missing_dirs &&
(strlen(sshp->path) > 1)) {
/* try to create the path remotely */
rc = 0;
sshc->secondCreateDirs = 1;

View File

@ -967,11 +967,11 @@ static CURLcode sftp_upload_init(struct Curl_easy *data,
sftp_libssh2_strerror(sftperr));
return sftp_libssh2_error_to_CURLE(sftperr);
}
if(((sftperr == LIBSSH2_FX_NO_SUCH_FILE) ||
(sftperr == LIBSSH2_FX_FAILURE) ||
(sftperr == LIBSSH2_FX_NO_SUCH_PATH)) &&
(data->set.ftp_create_missing_dirs &&
(strlen(sshp->path) > 1))) {
if((sftperr == LIBSSH2_FX_NO_SUCH_FILE ||
sftperr == LIBSSH2_FX_FAILURE ||
sftperr == LIBSSH2_FX_NO_SUCH_PATH) &&
data->set.ftp_create_missing_dirs &&
(strlen(sshp->path) > 1)) {
/* try to create the path remotely */
sshc->secondCreateDirs = 1;
myssh_to(data, sshc, SSH_SFTP_CREATE_DIRS_INIT);

View File

@ -577,7 +577,7 @@ init_config_builder(struct Curl_easy *data,
}
#endif /* USE_ECH */
cipher_suites = curlx_malloc(sizeof(*cipher_suites) * (cipher_suites_len));
cipher_suites = curlx_malloc(sizeof(*cipher_suites) * cipher_suites_len);
if(!cipher_suites) {
result = CURLE_OUT_OF_MEMORY;
goto cleanup;