[warnings] fixed sign-compare

This commit is contained in:
akallabeth 2024-09-04 09:55:55 +02:00
parent 2fc791fe9b
commit 5e123735fa
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
10 changed files with 16 additions and 15 deletions

View File

@ -334,7 +334,7 @@ BOOL sdl_detect_monitors(SdlContext* sdl, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, nullptr,
static_cast<size_t>(numDisplays)))
return FALSE;
for (size_t x = 0; x < numDisplays; x++)
for (size_t x = 0; x < static_cast<size_t>(numDisplays); x++)
{
if (!freerdp_settings_set_pointer_array(settings, FreeRDP_MonitorIds, x, &x))
return FALSE;

View File

@ -147,7 +147,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
int mouse_y = 0;
int _dummy_i = 0;
Window _dummy_w = 0;
int current_monitor = 0;
UINT32 current_monitor = 0;
Screen* screen = NULL;
#if defined WITH_XINERAMA || defined WITH_XRANDR
int major = 0;

View File

@ -973,7 +973,7 @@ static void cliprdr_file_fuse_read(fuse_req_t fuse_req, fuse_ino_t fuse_ino, siz
fuse_reply_err(fuse_req, EISDIR);
return;
}
if (!fuse_file->has_size || (offset < 0) || (offset > fuse_file->size))
if (!fuse_file->has_size || (offset < 0) || ((size_t)offset > fuse_file->size))
{
HashTable_Unlock(file_context->inode_table);
fuse_reply_err(fuse_req, EINVAL);

View File

@ -409,7 +409,7 @@ static char* pf_config_decode_base64(const char* data, const char* name, size_t*
while (*end == '-')
end++;
const size_t s = MIN(ARRAYSIZE(hdr) - 1, end - data);
const size_t s = MIN(ARRAYSIZE(hdr) - 1ULL, (size_t)(end - data));
memcpy(hdr, data, s);
}

View File

@ -676,12 +676,12 @@ static int x11_shadow_blend_cursor(x11ShadowSubsystem* subsystem)
pDstData = surface->data;
nDstStep = surface->scanline;
for (int y = 0; y < nHeight; y++)
for (size_t y = 0; y < nHeight; y++)
{
const BYTE* pSrcPixel = &pSrcData[((nYSrc + y) * nSrcStep) + (nXSrc * 4)];
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) + (nXDst * 4)];
for (int x = 0; x < nWidth; x++)
for (size_t x = 0; x < nWidth; x++)
{
B = *pSrcPixel++;
G = *pSrcPixel++;

View File

@ -242,7 +242,7 @@ struct uwac_window
int surfaceStates;
enum wl_shm_format format;
int nbuffers;
size_t nbuffers;
UwacBuffer* buffers;
struct wl_region* opaque_region;

View File

@ -58,7 +58,7 @@ static const struct wl_buffer_listener buffer_listener = { buffer_release };
static void UwacWindowDestroyBuffers(UwacWindow* w)
{
for (int i = 0; i < w->nbuffers; i++)
for (size_t i = 0; i < w->nbuffers; i++)
{
UwacBuffer* buffer = &w->buffers[i];
#ifdef UWAC_HAVE_PIXMAN_REGION
@ -370,19 +370,20 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, int64_t nbuffers, int64_t allocSize
goto error_mmap;
}
for (int i = 0; i < nbuffers; i++)
for (int64_t i = 0; i < nbuffers; i++)
{
int bufferIdx = w->nbuffers + i;
const size_t idx = (size_t)i;
size_t bufferIdx = w->nbuffers + idx;
UwacBuffer* buffer = &w->buffers[bufferIdx];
#ifdef UWAC_HAVE_PIXMAN_REGION
pixman_region32_init(&buffer->damage);
#else
region16_init(&buffer->damage);
#endif
buffer->data = &((char*)data)[allocSize * i];
buffer->data = &((char*)data)[allocSize * idx];
buffer->size = allocSize;
buffer->wayland_buffer =
wl_shm_pool_create_buffer(pool, allocSize * i, width, height, w->stride, format);
wl_shm_pool_create_buffer(pool, allocSize * idx, width, height, w->stride, format);
UwacBufferReleaseData* listener_data = xmalloc(sizeof(UwacBufferReleaseData));
listener_data->window = w;
listener_data->bufferIdx = bufferIdx;

View File

@ -278,7 +278,7 @@ DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
(void)sprintf_s(path, ARRAYSIZE(path), "/proc/%d/exe", getpid());
status = readlink(path, buffer, ARRAYSIZE(buffer) - 1);
if ((status < 0) || (status >= ARRAYSIZE(buffer)))
if ((status < 0) || ((size_t)status >= ARRAYSIZE(buffer)))
{
SetLastError(ERROR_INTERNAL_ERROR);
return 0;

View File

@ -184,7 +184,7 @@ static char* get_link_target(const char* base, const char* dir, const char* name
rc = readlink(path, target, size);
if (rc < 0)
goto fail;
} while (rc >= size);
} while ((size_t)rc >= size);
apath = topath(base, dir, target);
fail:

View File

@ -175,7 +175,7 @@ static BOOL IniFile_Load_File(wIniFile* ini, const char* filename)
if (fileSize < 1)
goto out_file;
if (fileSize > SIZE_MAX)
if (fileSize > INT64_MAX)
goto out_file;
if (!IniFile_BufferResize(ini, (size_t)fileSize + 2))