Fixed some issues reported on new Ubuntu 14.04 buildbots.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 2590b49..74a9f9b 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -106,6 +106,7 @@ create_buffer_from_shm(Wayland_CursorData *d,
{
SDL_VideoDevice *vd = SDL_GetVideoDevice();
SDL_VideoData *data = (SDL_VideoData *) vd->driverdata;
+ struct wl_shm_pool *shm_pool;
int stride = width * 4;
int size = stride * height;
@@ -131,9 +132,7 @@ create_buffer_from_shm(Wayland_CursorData *d,
close (shm_fd);
}
- struct wl_shm_pool *shm_pool = wl_shm_create_pool(data->shm,
- shm_fd,
- size);
+ shm_pool = wl_shm_create_pool(data->shm, shm_fd, size);
d->buffer = wl_shm_pool_create_buffer(shm_pool,
0,
width,
@@ -280,18 +279,18 @@ Wayland_CreateSystemCursor(SDL_SystemCursor id)
break;
}
- SDL_Cursor *sdl_cursor = CreateCursorFromWlCursor (d, cursor);
-
- return sdl_cursor;
+ return CreateCursorFromWlCursor(d, cursor);
}
static void
Wayland_FreeCursor(SDL_Cursor *cursor)
{
+ Wayland_CursorData *d;
+
if (!cursor)
return;
- Wayland_CursorData *d = cursor->driverdata;
+ d = cursor->driverdata;
/* Probably not a cursor we own */
if (!d)
diff --git a/src/video/wayland/SDL_waylandtouch.c b/src/video/wayland/SDL_waylandtouch.c
index 683c702..0daec4d 100644
--- a/src/video/wayland/SDL_waylandtouch.c
+++ b/src/video/wayland/SDL_waylandtouch.c
@@ -236,13 +236,16 @@ WL_EXPORT const struct wl_interface qt_extended_surface_interface = {
void
Wayland_touch_create(SDL_VideoData *data, uint32_t id)
{
+ struct SDL_WaylandTouch *touch;
+
if (data->touch) {
Wayland_touch_destroy(data);
}
- data->touch = malloc(sizeof(struct SDL_WaylandTouch));
+ /* !!! FIXME: check for failure, call SDL_OutOfMemory() */
+ data->touch = SDL_malloc(sizeof(struct SDL_WaylandTouch));
- struct SDL_WaylandTouch *touch = data->touch;
+ touch = data->touch;
touch->touch_extension = wl_registry_bind(data->registry, id, &qt_touch_extension_interface, 1);
qt_touch_extension_add_listener(touch->touch_extension, &touch_listener, data);
}
@@ -256,7 +259,7 @@ Wayland_touch_destroy(SDL_VideoData *data)
qt_touch_extension_destroy(touch->touch_extension);
}
- free(data->touch);
+ SDL_free(data->touch);
data->touch = NULL;
}
}