Fixed warnings

This commit is contained in:
Armin Novak 2021-06-16 17:38:33 +02:00 committed by akallabeth
parent d9a8083ddf
commit 299c962b28
6 changed files with 46 additions and 17 deletions

View File

@ -28,7 +28,7 @@
#include "wlf_disp.h"
#include "wlfreerdp.h"
BOOL encomsp_toggle_control(EncomspClientContext* encomsp, BOOL control)
static BOOL encomsp_toggle_control(EncomspClientContext* encomsp, BOOL control)
{
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU pdu;

View File

@ -34,7 +34,7 @@
static proxyServer* server = NULL;
static void cleanup_handler(int signum)
static WINPR_NORETURN(void cleanup_handler(int signum))
{
printf("\n");
WLog_INFO(TAG, "[%s]: caught signal %d, starting cleanup...", __FUNCTION__, signum);

View File

@ -262,7 +262,7 @@ static BOOL x11_shadow_input_mouse_event(rdpShadowSubsystem* subsystem, rdpShado
{
#ifdef WITH_XTEST
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
int button = 0;
unsigned int button = 0;
BOOL down = FALSE;
rdpShadowServer* server;
rdpShadowSurface* surface;
@ -737,7 +737,7 @@ static int x11_shadow_error_handler_for_capture(Display* display, XErrorEvent* e
static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
{
int rc = 0;
int count;
size_t count;
int status;
int x, y;
int width, height;

View File

@ -62,10 +62,15 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server)
width = invalidRect.right - invalidRect.left;
height = invalidRect.bottom - invalidRect.top;
rdtk_surface_fill(surface, invalidRect.left, invalidRect.top, width, height, 0x3BB9FF);
WINPR_ASSERT(width <= UINT16_MAX);
WINPR_ASSERT(width >= 0);
WINPR_ASSERT(height <= UINT16_MAX);
WINPR_ASSERT(height >= 0);
rdtk_surface_fill(surface, invalidRect.left, invalidRect.top, (UINT16)width, (UINT16)height,
0x3BB9FF);
rdtk_label_draw(surface, invalidRect.left, invalidRect.top, width, height, NULL, "Welcome", 0,
0);
rdtk_label_draw(surface, invalidRect.left, invalidRect.top, (UINT16)width, (UINT16)height, NULL,
"Welcome", 0, 0);
// rdtk_button_draw(surface, 16, 64, 128, 32, NULL, "button");
// rdtk_text_field_draw(surface, 16, 128, 128, 32, NULL, "text field");

View File

@ -20,6 +20,8 @@
#include "config.h"
#endif
#include <winpr/assert.h>
#include "shadow_surface.h"
#include "shadow_screen.h"
@ -33,6 +35,9 @@ rdpShadowScreen* shadow_screen_new(rdpShadowServer* server)
rdpShadowSubsystem* subsystem;
MONITOR_DEF* primary;
WINPR_ASSERT(server);
WINPR_ASSERT(server->subsystem);
screen = (rdpShadowScreen*)calloc(1, sizeof(rdpShadowScreen));
if (!screen)
@ -53,17 +58,27 @@ rdpShadowScreen* shadow_screen_new(rdpShadowServer* server)
width = primary->right - primary->left;
height = primary->bottom - primary->top;
screen->width = width;
screen->height = height;
WINPR_ASSERT(x >= 0);
WINPR_ASSERT(x <= UINT16_MAX);
WINPR_ASSERT(y >= 0);
WINPR_ASSERT(y <= UINT16_MAX);
WINPR_ASSERT(width >= 0);
WINPR_ASSERT(width <= UINT16_MAX);
WINPR_ASSERT(height >= 0);
WINPR_ASSERT(height <= UINT16_MAX);
screen->primary = shadow_surface_new(server, x, y, width, height);
screen->width = (UINT16)width;
screen->height = (UINT16)height;
screen->primary =
shadow_surface_new(server, (UINT16)x, (UINT16)y, (UINT16)width, (UINT16)height);
if (!screen->primary)
goto out_free_region;
server->surface = screen->primary;
screen->lobby = shadow_surface_new(server, x, y, width, height);
screen->lobby = shadow_surface_new(server, (UINT16)x, (UINT16)y, (UINT16)width, (UINT16)height);
if (!screen->lobby)
goto out_free_primary;
@ -128,14 +143,23 @@ BOOL shadow_screen_resize(rdpShadowScreen* screen)
width = primary->right - primary->left;
height = primary->bottom - primary->top;
if (shadow_surface_resize(screen->primary, x, y, width, height) &&
shadow_surface_resize(screen->lobby, x, y, width, height))
WINPR_ASSERT(x >= 0);
WINPR_ASSERT(x <= UINT16_MAX);
WINPR_ASSERT(y >= 0);
WINPR_ASSERT(y <= UINT16_MAX);
WINPR_ASSERT(width >= 0);
WINPR_ASSERT(width <= UINT16_MAX);
WINPR_ASSERT(height >= 0);
WINPR_ASSERT(height <= UINT16_MAX);
if (shadow_surface_resize(screen->primary, (UINT16)x, (UINT16)y, (UINT16)width,
(UINT16)height) &&
shadow_surface_resize(screen->lobby, (UINT16)x, (UINT16)y, (UINT16)width, (UINT16)height))
{
if ((width != screen->width) || (height != screen->height))
if (((UINT32)width != screen->width) || ((UINT32)height != screen->height))
{
/* screen size is changed. Store new size and reinit lobby */
screen->width = width;
screen->height = height;
screen->width = (UINT32)width;
screen->height = (UINT32)height;
shadow_client_init_lobby(screen->server);
}
return TRUE;

View File

@ -54,7 +54,7 @@
#elif defined(__GNUC__)
#define WINPR_DEPRECATED(obj) obj __attribute__((deprecated))
#define WINPR_DEPRECATED_VAR(text, obj) obj __attribute__((deprecated(text)))
#define WINPR_NORETURN(obj) obj __attribute__((__noreturn__))
#define WINPR_NORETURN(obj) __attribute__((__noreturn__)) obj
#else
#define WINPR_DEPRECATED(obj) obj
#define WINPR_DEPRECATED_VAR(text, obj) obj