[warnings] fix issues from ci builder

This commit is contained in:
Armin Novak 2025-03-12 11:43:34 +01:00
parent 9aecba9357
commit 3e6707c443
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
16 changed files with 38 additions and 32 deletions

View File

@ -28,6 +28,7 @@ Checks: >
-cert-dcl16-c,
-cert-env33-c,
-cert-dcl50-cpp,
-clang-analyzer-webkit.NoUncountedMemberChecker,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-clang-analyzer-valist.Uninitialized,

View File

@ -21,5 +21,5 @@
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, argv);
return NSApplicationMain(argc, (const char *const *)argv);
}

View File

@ -718,7 +718,7 @@ static DWORD wf_is_x509_certificate_trusted(const char* common_name, const char*
CERT_CHAIN_POLICY_STATUS PolicyStatus = { 0 };
CERT_CHAIN_ENGINE_CONFIG EngineConfig = { 0 };
DWORD derPubKeyLen = strlen(fingerprint);
DWORD derPubKeyLen = WINPR_ASSERTING_INT_CAST(uint32_t, strlen(fingerprint));
char* derPubKey = calloc(derPubKeyLen, sizeof(char));
if (NULL == derPubKey)
{

View File

@ -232,13 +232,14 @@ int TestClientCmdLine(int argc, char* argv[])
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
for (size_t i = 0; i < ARRAYSIZE(tests); i++)
{
const test* current = &tests[i];
int failure = 0;
char** command_line = string_list_copy(current->command_line);
if (!testcase(__func__, command_line, string_list_length((const char* const*)command_line),
const int len = string_list_length((const char* const*)command_line);
if (!testcase(__func__, command_line, WINPR_ASSERTING_INT_CAST(size_t, len),
current->expected_status, current->validate_settings))
{
TEST_FAILURE("parsing arguments.\n");

View File

@ -1386,7 +1386,7 @@ static int test_dump(int argc, char* argv[])
const RECTANGLE_16* rects = region16_rects(&invalid, &nbRects);
for (size_t x = 0; x < nbRects; x++)
{
RECTANGLE_16* rect = &rects[x];
const RECTANGLE_16* rect = &rects[x];
const UINT32 w = rect->right - rect->left;
const UINT32 h = rect->bottom - rect->top;
if (!freerdp_image_copy_no_overlap(output, DstFormat, stride, rect->left,

View File

@ -5,11 +5,11 @@
#include "cursor_dump_00000000.h"
static const uint8_t andmask[] = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x80, 0xe3, 0x80, 0xe3,
0x80, 0xe3, 0x80, 0xe3, 0x80, 0xe3, 0x80, 0xe3, 0x80, 0xe3, 0x80,
0xe3, 0x80, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00 };
static uint8_t andmask[] = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x80, 0xe3, 0x80, 0xe3,
0x80, 0xe3, 0x80, 0xe3, 0x80, 0xe3, 0x80, 0xe3, 0x80, 0xe3, 0x80,
0xe3, 0x80, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00 };
static const uint8_t xormask[] = {
static uint8_t xormask[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -5,7 +5,7 @@
#include "cursor_dump_00000001.h"
static const uint8_t andmask[] = {
static uint8_t andmask[] = {
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, 0xff, 0xc0, 0xff, 0x00,
0xff, 0xc0, 0xff, 0x00, 0xff, 0xc0, 0xff, 0x00, 0xff, 0xc0, 0xff, 0x00, 0xff, 0xc0, 0xff, 0x00,
0xff, 0xc0, 0xff, 0x00, 0xff, 0xc0, 0xff, 0x00, 0xfc, 0x00, 0x07, 0x00, 0xf8, 0x00, 0x07, 0x00,
@ -14,7 +14,7 @@ static const uint8_t andmask[] = {
0xf0, 0x00, 0x07, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00
};
static const uint8_t xormask[] = {
static uint8_t xormask[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -5,7 +5,7 @@
#include "cursor_dump_00000002.h"
static const uint8_t andmask[] = {
static uint8_t andmask[] = {
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x8f, 0xff, 0x00, 0xef, 0x87, 0xff, 0x00,
0xe3, 0x07, 0xff, 0x00, 0xe0, 0x07, 0xff, 0x00, 0xe0, 0x0f, 0xff, 0x00, 0xe0, 0x0f, 0xff, 0x00,
0xe0, 0x01, 0xff, 0x00, 0xe0, 0x00, 0xff, 0x00, 0xe0, 0x01, 0xff, 0x00, 0xe0, 0x03, 0xff, 0x00,
@ -14,7 +14,7 @@ static const uint8_t andmask[] = {
0xe7, 0xff, 0xff, 0x00, 0xef, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00
};
static const uint8_t xormask[] = {
static uint8_t xormask[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -5,7 +5,7 @@
#include "cursor_dump_00000003.h"
static const uint8_t andmask[] = {
static uint8_t andmask[] = {
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xc7, 0xff, 0x00,
0xff, 0x83, 0xff, 0x00, 0xff, 0x01, 0xff, 0x00, 0xfe, 0x00, 0xff, 0x00, 0xfc, 0x00, 0x7f, 0x00,
0xf8, 0x00, 0x3f, 0x00, 0xf0, 0xc2, 0x1f, 0x00, 0xe0, 0x82, 0x0f, 0x00, 0xc0, 0x00, 0x07, 0x00,
@ -14,7 +14,7 @@ static const uint8_t andmask[] = {
0xff, 0x03, 0xff, 0x00, 0xff, 0x87, 0xff, 0x00, 0xff, 0xcf, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00
};
static const uint8_t xormask[] = {
static uint8_t xormask[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -5,7 +5,7 @@
#include "cursor_dump_00000004.h"
static const uint8_t andmask[] = {
static uint8_t andmask[] = {
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xc7, 0xff, 0x00,
0xff, 0x83, 0xff, 0x00, 0xff, 0x01, 0xff, 0x00, 0xfe, 0x00, 0xff, 0x00, 0xfc, 0x00, 0x7f, 0x00,
0xf8, 0x00, 0x3f, 0x00, 0xf0, 0xc2, 0x1f, 0x00, 0xe0, 0x82, 0x0f, 0x00, 0xc0, 0x00, 0x07, 0x00,
@ -14,7 +14,7 @@ static const uint8_t andmask[] = {
0xff, 0x03, 0xff, 0x00, 0xff, 0x87, 0xff, 0x00, 0xff, 0xcf, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00
};
static const uint8_t xormask[] = {
static uint8_t xormask[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -5,7 +5,7 @@
#include "cursor_dump_00000005.h"
static const uint8_t andmask[] = {
static uint8_t andmask[] = {
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x8f, 0xff, 0x00, 0xef, 0x87, 0xff, 0x00,
0xe3, 0x07, 0xff, 0x00, 0xe0, 0x07, 0xff, 0x00, 0xe0, 0x0f, 0xff, 0x00, 0xe0, 0x0f, 0xff, 0x00,
0xe0, 0x01, 0xff, 0x00, 0xe0, 0x00, 0xff, 0x00, 0xe0, 0x01, 0xff, 0x00, 0xe0, 0x03, 0xff, 0x00,
@ -14,7 +14,7 @@ static const uint8_t andmask[] = {
0xe7, 0xff, 0xff, 0x00, 0xef, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00
};
static const uint8_t xormask[] = {
static uint8_t xormask[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -1036,9 +1036,11 @@ static BOOL compare_yuv444_to_rgb(prim_size_t roi, DWORD type)
if (!allocate_yuv(yuv, roi) || !rgb1 || !rgb2)
goto fail;
if (soft->YUV444ToRGB_8u_P3AC4R(yuv, yuvStep, rgb1, stride, format, &roi) != PRIMITIVES_SUCCESS)
const BYTE* cyuv[] = { yuv[0], yuv[1], yuv[2] };
if (soft->YUV444ToRGB_8u_P3AC4R(cyuv, yuvStep, rgb1, stride, format, &roi) !=
PRIMITIVES_SUCCESS)
goto fail;
if (prims->YUV444ToRGB_8u_P3AC4R(yuv, yuvStep, rgb2, stride, format, &roi) !=
if (prims->YUV444ToRGB_8u_P3AC4R(cyuv, yuvStep, rgb2, stride, format, &roi) !=
PRIMITIVES_SUCCESS)
goto fail;
@ -1207,9 +1209,11 @@ static BOOL compare_yuv420_to_rgb(prim_size_t roi, DWORD type)
if (!allocate_yuv(yuv, roi) || !rgb1 || !rgb2)
goto fail;
if (soft->YUV420ToRGB_8u_P3AC4R(yuv, yuvStep, rgb1, stride, format, &roi) != PRIMITIVES_SUCCESS)
const BYTE* cyuv[3] = { yuv[0], yuv[1], yuv[2] };
if (soft->YUV420ToRGB_8u_P3AC4R(cyuv, yuvStep, rgb1, stride, format, &roi) !=
PRIMITIVES_SUCCESS)
goto fail;
if (prims->YUV420ToRGB_8u_P3AC4R(yuv, yuvStep, rgb2, stride, format, &roi) !=
if (prims->YUV420ToRGB_8u_P3AC4R(cyuv, yuvStep, rgb2, stride, format, &roi) !=
PRIMITIVES_SUCCESS)
goto fail;

View File

@ -30,9 +30,9 @@ extern "C"
#endif
WINPR_API void string_list_free(char** string_list);
WINPR_API int string_list_length(const char** string_list);
WINPR_API char** string_list_copy(const char** string_list);
WINPR_API void string_list_print(FILE* out, const char** string_list);
WINPR_API int string_list_length(const char* const* string_list);
WINPR_API char** string_list_copy(const char* const* string_list);
WINPR_API void string_list_print(FILE* out, const char* const* string_list);
#ifdef __cplusplus
}

View File

@ -554,7 +554,7 @@ fail:
BOOL ntlm_construct_authenticate_target_info(NTLM_CONTEXT* context)
{
ULONG AvPairsCount = 0;
ULONG AvPairsValueLength = 0;
size_t AvPairsValueLength = 0;
NTLM_AV_PAIR* AvTimestamp = NULL;
NTLM_AV_PAIR* AvNbDomainName = NULL;
NTLM_AV_PAIR* AvNbComputerName = NULL;
@ -575,7 +575,6 @@ BOOL ntlm_construct_authenticate_target_info(NTLM_CONTEXT* context)
WINPR_ASSERT(context);
AvPairsCount = 1;
AvPairsValueLength = 0;
ChallengeTargetInfo = (NTLM_AV_PAIR*)context->ChallengeTargetInfo.pvBuffer;
cbChallengeTargetInfo = context->ChallengeTargetInfo.cbBuffer;
AvNbDomainName = ntlm_av_pair_get(ChallengeTargetInfo, cbChallengeTargetInfo, MsvAvNbDomainName,

View File

@ -35,7 +35,7 @@ void string_list_free(char** string_list)
free((void*)string_list);
}
int string_list_length(const char** string_list)
int string_list_length(const char* const* string_list)
{
int i = 0;
for (; string_list[i]; i++)
@ -44,7 +44,7 @@ int string_list_length(const char** string_list)
return i;
}
char** string_list_copy(const char** string_list)
char** string_list_copy(const char* const* string_list)
{
int length = string_list_length(string_list);
char** copy = (char**)calloc(WINPR_ASSERTING_INT_CAST(size_t, length) + 1, sizeof(char*));
@ -63,7 +63,7 @@ char** string_list_copy(const char** string_list)
return copy;
}
void string_list_print(FILE* out, const char** string_list)
void string_list_print(FILE* out, const char* const* string_list)
{
for (int j = 0; string_list[j]; j++)
{

View File

@ -147,7 +147,8 @@ char* winpr_win_strerror(DWORD dw, char* dmsg, size_t size)
if (rc > 0)
{
#if defined(UNICODE)
WideCharToMultiByte(CP_ACP, 0, msg, (int)rc, dmsg, (int)MIN(size - 1, INT_MAX), NULL, NULL);
(void)WideCharToMultiByte(CP_ACP, 0, msg, (int)rc, dmsg, (int)MIN(size - 1, INT_MAX), NULL,
NULL);
#else /* defined(UNICODE) */
memcpy(dmsg, msg, MIN(rc, size - 1));
#endif /* defined(UNICODE) */