diff --git a/client/SDL/SDL2/sdl_monitor.cpp b/client/SDL/SDL2/sdl_monitor.cpp index ab6f2ca38..23c08e264 100644 --- a/client/SDL/SDL2/sdl_monitor.cpp +++ b/client/SDL/SDL2/sdl_monitor.cpp @@ -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(numDisplays))) return FALSE; - for (size_t x = 0; x < numDisplays; x++) + for (size_t x = 0; x < static_cast(numDisplays); x++) { if (!freerdp_settings_set_pointer_array(settings, FreeRDP_MonitorIds, x, &x)) return FALSE; diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 2f43f1d2d..9e0171839 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -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; diff --git a/client/common/client_cliprdr_file.c b/client/common/client_cliprdr_file.c index 79cdd4f64..738bfeaac 100644 --- a/client/common/client_cliprdr_file.c +++ b/client/common/client_cliprdr_file.c @@ -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); diff --git a/server/proxy/pf_config.c b/server/proxy/pf_config.c index f2645d037..b1661f214 100644 --- a/server/proxy/pf_config.c +++ b/server/proxy/pf_config.c @@ -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); } diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c index aa95ab092..c30215ae5 100644 --- a/server/shadow/X11/x11_shadow.c +++ b/server/shadow/X11/x11_shadow.c @@ -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++; diff --git a/uwac/libuwac/uwac-priv.h b/uwac/libuwac/uwac-priv.h index 04ae658d1..98636e19f 100644 --- a/uwac/libuwac/uwac-priv.h +++ b/uwac/libuwac/uwac-priv.h @@ -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; diff --git a/uwac/libuwac/uwac-window.c b/uwac/libuwac/uwac-window.c index a4b0f0753..c43953d28 100644 --- a/uwac/libuwac/uwac-window.c +++ b/uwac/libuwac/uwac-window.c @@ -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; diff --git a/winpr/libwinpr/library/library.c b/winpr/libwinpr/library/library.c index 476c178b8..c20df191d 100644 --- a/winpr/libwinpr/library/library.c +++ b/winpr/libwinpr/library/library.c @@ -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; diff --git a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c index e17968211..bd4544826 100644 --- a/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c +++ b/winpr/libwinpr/timezone/TimeZoneIanaAbbrevMap.c @@ -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: diff --git a/winpr/libwinpr/utils/ini.c b/winpr/libwinpr/utils/ini.c index 17beef264..6918a44f9 100644 --- a/winpr/libwinpr/utils/ini.c +++ b/winpr/libwinpr/utils/ini.c @@ -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))