Merge pull request #10554 from akallabeth/tidy-silence

Tidy silence
This commit is contained in:
akallabeth 2024-09-04 10:35:22 +02:00 committed by GitHub
commit 5aff241096
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 35 additions and 18 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

@ -139,7 +139,6 @@ static BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
{
BOOL rc = FALSE;
int nmonitors = 0;
UINT32 monitor_index = 0;
BOOL primaryMonitorFound = FALSE;
VIRTUAL_SCREEN* vscreen = NULL;
@ -148,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;
@ -384,6 +383,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
/* Create array of all active monitors by taking into account monitors requested on the
* command-line */
int nmonitors = 0;
{
UINT32 nr = 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

@ -309,8 +309,22 @@ static long bio_rdp_tls_ctrl(BIO* bio, int cmd, long num, void* ptr)
break;
case BIO_CTRL_GET_CALLBACK:
*((ULONG_PTR*)ptr) = (ULONG_PTR)SSL_get_info_callback(tls->ssl);
status = 1;
/* The OpenSSL API is horrible here:
* we get a function pointer returned and have to cast it to ULONG_PTR
* to return the value to the caller.
*
* This, of course, is something compilers warn about. So silence it by casting
* by the means of a union */
{
union
{
void (*fkt)(const SSL*, int, int);
ULONG_PTR uptr;
} cnv;
cnv.fkt = SSL_get_info_callback(tls->ssl);
*((ULONG_PTR*)ptr) = cnv.uptr;
status = 1;
}
break;
case BIO_C_SSL_MODE:

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

@ -25,6 +25,8 @@
#include <winpr/collections.h>
#include <winpr/file.h>
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#if defined __linux__ && !defined ANDROID

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))