From 4fadd12047f8b5f005d54f226a3c8a601cfc8631 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 20 Aug 2025 11:28:09 +0200 Subject: [PATCH] fix clang-tidy warnings --- client/common/test/TestClientRdpFile.c | 2 +- winpr/libwinpr/crt/unicode_builtin.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/client/common/test/TestClientRdpFile.c b/client/common/test/TestClientRdpFile.c index 0ddf3aa6b..ff4eb143e 100644 --- a/client/common/test/TestClientRdpFile.c +++ b/client/common/test/TestClientRdpFile.c @@ -288,7 +288,7 @@ static void* read_rdp_data(const char* name, size_t* plen) if (fseek(fp, 0, SEEK_SET) != 0) goto fail; - json = calloc(pos + 1, sizeof(char)); + json = calloc(pos + 1ULL, sizeof(char)); if (!json) goto fail; if (fread(json, 1, pos, fp) != pos) diff --git a/winpr/libwinpr/crt/unicode_builtin.c b/winpr/libwinpr/crt/unicode_builtin.c index 3526d84c5..bbb65f427 100644 --- a/winpr/libwinpr/crt/unicode_builtin.c +++ b/winpr/libwinpr/crt/unicode_builtin.c @@ -158,7 +158,8 @@ static WCHAR setWcharFrom(WCHAR w) static ConversionResult winpr_ConvertUTF16toUTF8_Internal(const uint16_t** sourceStart, const uint16_t* sourceEnd, - uint8_t** targetStart, uint8_t* targetEnd, + uint8_t** targetStart, + const uint8_t* targetEnd, ConversionFlags flags) { bool computeLength = (!targetEnd) ? true : false; @@ -276,6 +277,9 @@ static ConversionResult winpr_ConvertUTF16toUTF8_Internal(const uint16_t** sourc case 1: *--target = (uint8_t)(ch | firstByteMark[bytesToWrite]); + break; + default: + return sourceIllegal; } } else @@ -300,6 +304,9 @@ static ConversionResult winpr_ConvertUTF16toUTF8_Internal(const uint16_t** sourc case 1: --target; + break; + default: + return sourceIllegal; } } @@ -402,7 +409,7 @@ static bool isLegalUTF8(const uint8_t* source, int length) static ConversionResult winpr_ConvertUTF8toUTF16_Internal(const uint8_t** sourceStart, const uint8_t* sourceEnd, uint16_t** targetStart, - uint16_t* targetEnd, + const uint16_t* targetEnd, ConversionFlags flags) { bool computeLength = (!targetEnd) ? true : false; @@ -466,6 +473,9 @@ static ConversionResult winpr_ConvertUTF8toUTF16_Internal(const uint8_t** source case 0: ch += *source++; + break; + default: + return sourceIllegal; } ch -= offsetsFromUTF8[extraBytesToRead];