[clang,tidy] fix sign warnings

This commit is contained in:
akallabeth
2025-02-10 13:00:48 +01:00
parent 0f8d54d566
commit 4013b3132b
8 changed files with 23 additions and 20 deletions

View File

@@ -132,7 +132,8 @@ static size_t demux_uvcH264(const BYTE* srcData, size_t srcSize, BYTE* h264_data
if (spl[0] != 0xFF || spl[1] != 0xE4)
{
WLog_ERR(TAG, "Expected 2nd+ APP4 marker but none found");
return ph264 - h264_data;
const intptr_t diff = ph264 - h264_data;
return WINPR_ASSERTING_INT_CAST(size_t, diff);
}
/* 2nd+ segment length in big endian */
@@ -153,7 +154,8 @@ static size_t demux_uvcH264(const BYTE* srcData, size_t srcSize, BYTE* h264_data
spl += length;
}
return ph264 - h264_data;
const intptr_t diff = ph264 - h264_data;
return WINPR_ASSERTING_INT_CAST(size_t, diff);
}
#endif

View File

@@ -321,7 +321,7 @@ static BOOL get_devpath_from_device(libusb_device* device, char* path, size_t si
if ((nChars <= 0) || ((size_t)nChars >= size))
return FALSE;
size -= nChars;
size -= (size_t)nChars;
path += nChars;
if (i < nPorts - 1)
@@ -382,11 +382,11 @@ static uint8_t get_guid_unit_id_from_device(libusb_device* device, const uint8_t
desc->bDescriptorSubType == USB_VIDEO_CONTROL_XU_TYPE &&
memcmp(desc->guidExtensionCode, guid, 16) == 0)
{
uint8_t unit_id = desc->bUnitID;
int8_t unit_id = desc->bUnitID;
WLog_DBG(TAG,
"For camera %04" PRIx16 ":%04" PRIx16
" found UVCX H264 UnitID %" PRIu8,
" found UVCX H264 UnitID %" PRId8,
ddesc.idVendor, ddesc.idProduct, unit_id);
return unit_id;
}

View File

@@ -94,8 +94,11 @@ int SdlSelectList::run()
{
auto s = _list.size();
CurrentActiveTextInput++;
CurrentActiveTextInput =
CurrentActiveTextInput % WINPR_ASSERTING_INT_CAST(ssize_t, s);
if (s > 0)
{
CurrentActiveTextInput = CurrentActiveTextInput %
WINPR_ASSERTING_INT_CAST(ssize_t, s);
}
}
break;
case SDLK_RETURN:

View File

@@ -574,9 +574,9 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (freerdp_settings_get_bool(settings, FreeRDP_Workarea))
{
INT64 b = xfc->workArea.height + xfc->workArea.y - 1;
vscreen->area.top = WINPR_ASSERTING_INT_CAST(UINT16, xfc->workArea.y);
vscreen->area.bottom =
WINPR_ASSERTING_INT_CAST(UINT16, xfc->workArea.height + xfc->workArea.y - 1);
vscreen->area.bottom = WINPR_ASSERTING_INT_CAST(UINT16, b);
}
if (!primaryMonitorFound)

View File

@@ -88,7 +88,6 @@ static int freerdp_connect_begin(freerdp* instance)
rdpRdp* rdp = NULL;
BOOL status = TRUE;
rdpSettings* settings = NULL;
UINT32 KeyboardLayout = 0;
if (!instance)
return -1;
@@ -131,7 +130,7 @@ static int freerdp_connect_begin(freerdp* instance)
status = utils_reload_channels(instance->context);
const UINT32 cp = freerdp_settings_get_uint32(settings, FreeRDP_KeyboardCodePage);
KeyboardLayout = freerdp_get_keyboard_default_layout_for_locale(cp);
int64_t KeyboardLayout = freerdp_get_keyboard_default_layout_for_locale(cp);
if (KeyboardLayout == 0)
KeyboardLayout = freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout);

View File

@@ -866,7 +866,7 @@ static INLINE BOOL update_read_delta(wStream* s, INT32* value)
Stream_Read_UINT8(s, byte);
if (byte & 0x40)
uvalue = (byte | ~0x3F);
uvalue = (byte | ~0x3F) & UINT32_MAX;
else
uvalue = (byte & 0x3F);

View File

@@ -32,13 +32,13 @@
typedef struct
{
const char* variant; /* XKB Keyboard layout variant */
UINT32 keyboardLayoutID; /* Keyboard Layout ID */
INT64 keyboardLayoutID; /* Keyboard Layout ID */
} XKB_VARIANT;
typedef struct
{
const char* layout; /* XKB Keyboard layout */
UINT32 keyboardLayoutID; /* Keyboard Layout ID */
INT64 keyboardLayoutID; /* Keyboard Layout ID */
const XKB_VARIANT* variants;
} XKB_LAYOUT;

View File

@@ -1031,9 +1031,7 @@ static int32_t file_get_size(const struct synthetic_file* file, UINT64* size)
static UINT delegate_file_request_size(wClipboardDelegate* delegate,
const wClipboardFileSizeRequest* request)
{
UINT error = NO_ERROR;
UINT64 size = 0;
struct synthetic_file* file = NULL;
if (!delegate || !delegate->clipboard || !request)
return ERROR_BAD_ARGUMENTS;
@@ -1041,15 +1039,16 @@ static UINT delegate_file_request_size(wClipboardDelegate* delegate,
if (delegate->clipboard->sequenceNumber != delegate->clipboard->fileListSequenceNumber)
return ERROR_INVALID_STATE;
file = ArrayList_GetItem(delegate->clipboard->localFiles, request->listIndex);
struct synthetic_file* file =
ArrayList_GetItem(delegate->clipboard->localFiles, request->listIndex);
if (!file)
return ERROR_INDEX_ABSENT;
error = file_get_size(file, &size);
const int32_t s = file_get_size(file, &size);
uint32_t error = 0;
if (error)
error = delegate->ClipboardFileSizeFailure(delegate, request, error);
error = delegate->ClipboardFileSizeFailure(delegate, request, (UINT)s);
else
error = delegate->ClipboardFileSizeSuccess(delegate, request, size);