#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[] =
{
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;
}
{
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);
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++) {
#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,
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;
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;
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;