Fixed sign-compare warnings

This commit is contained in:
Armin Novak 2019-02-07 14:21:04 +01:00
parent 1a46ef2a82
commit de69dd3942
4 changed files with 17 additions and 14 deletions

View File

@ -35,12 +35,12 @@
#include "uwac-os.h"
#include "wayland-cursor.h"
#define TARGET_COMPOSITOR_INTERFACE 3
#define TARGET_SHM_INTERFACE 1
#define TARGET_SHELL_INTERFACE 1
#define TARGET_DDM_INTERFACE 1
#define TARGET_SEAT_INTERFACE 5
#define TARGET_XDG_VERSION 5 /* The version of xdg-shell that we implement */
#define TARGET_COMPOSITOR_INTERFACE 3U
#define TARGET_SHM_INTERFACE 1U
#define TARGET_SHELL_INTERFACE 1U
#define TARGET_DDM_INTERFACE 1U
#define TARGET_SEAT_INTERFACE 5U
#define TARGET_XDG_VERSION 5U /* The version of xdg-shell that we implement */
static const char* event_names[] =
{
@ -683,7 +683,7 @@ UwacReturnCode UwacDisplayQueryShmFormats(const UwacDisplay* display, enum wl_sh
if (!display)
return UWAC_ERROR_INVALID_DISPLAY;
*filled = min(display->shm_formats_nb, formats_size);
*filled = min((int64_t)display->shm_formats_nb, formats_size);
memcpy(formats, (const void*)display->shm_formats, *filled * sizeof(enum wl_shm_format));
return UWAC_SUCCESS;
}

View File

@ -235,7 +235,7 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint
{
uint32_t *key, *pressedKey;
UwacSeat *input = (UwacSeat *)data;
int i, found;
size_t i, found;
UwacKeyboardEnterLeaveEvent *event;
event = (UwacKeyboardEnterLeaveEvent *)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEYBOARD_ENTER);
@ -309,7 +309,7 @@ static int update_key_pressed(UwacSeat *seat, uint32_t key) {
static int update_key_released(UwacSeat *seat, uint32_t key) {
uint32_t *keyPtr;
int i, toMove;
size_t i, toMove;
bool found = false;
for (i = 0, keyPtr = seat->pressed_keys.data; i < seat->pressed_keys.size; i++, keyPtr++) {

View File

@ -27,7 +27,7 @@
#include <string.h>
#include <assert.h>
#define TARGET_OUTPUT_INTERFACE 2
#define TARGET_OUTPUT_INTERFACE 2U
static void output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
int physical_width, int physical_height, int subpixel,

View File

@ -47,10 +47,10 @@ bool UwacTouchAutomataInjectEvent(UwacTouchAutomata *automata, UwacEvent *event)
case UWAC_EVENT_TOUCH_UP: {
UwacTouchUp *touchUp = &event->touchUp;
int toMove = automata->tp.size - sizeof(UwacTouchPoint);
size_t toMove = automata->tp.size - sizeof(UwacTouchPoint);
wl_array_for_each(tp, &automata->tp) {
if (tp->id == touchUp->id) {
if ((int64_t)tp->id == touchUp->id) {
if (toMove)
memmove(tp, tp+1, toMove);
return true;
@ -65,7 +65,7 @@ bool UwacTouchAutomataInjectEvent(UwacTouchAutomata *automata, UwacEvent *event)
UwacTouchDown *touchDown = &event->touchDown;
wl_array_for_each(tp, &automata->tp) {
if (tp->id == touchDown->id) {
if ((int64_t)tp->id == touchDown->id) {
tp->x = touchDown->x;
tp->y = touchDown->y;
return true;
@ -76,7 +76,10 @@ bool UwacTouchAutomataInjectEvent(UwacTouchAutomata *automata, UwacEvent *event)
if (!tp)
return false;
tp->id = touchDown->id;
if (touchDown->id < 0)
return false;
tp->id = (uint32_t)touchDown->id;
tp->x = touchDown->x;
tp->y = touchDown->y;
break;