Merge branch 'build-errors' into 'master'

Fix build errors with -Werror and NDEBUG

See merge request wlroots/wlroots!4557
This commit is contained in:
John Lindgren 2024-12-08 12:39:03 +00:00
commit ccf98e44cd
9 changed files with 33 additions and 38 deletions

View file

@ -120,10 +120,8 @@ static void xwm_dnd_send_position(struct wlr_xwm *xwm, uint32_t time, int16_t x,
}
static void xwm_dnd_send_drop(struct wlr_xwm *xwm, uint32_t time) {
struct wlr_drag *drag = xwm->drag;
assert(drag != NULL);
struct wlr_xwayland_surface *dest = xwm->drag_focus;
assert(dest != NULL);
assert(xwm->drag != NULL);
assert(xwm->drag_focus != NULL);
xcb_client_message_data_t data = { 0 };
data.data32[0] = xwm->dnd_selection.window;
@ -133,10 +131,8 @@ static void xwm_dnd_send_drop(struct wlr_xwm *xwm, uint32_t time) {
}
static void xwm_dnd_send_leave(struct wlr_xwm *xwm) {
struct wlr_drag *drag = xwm->drag;
assert(drag != NULL);
struct wlr_xwayland_surface *dest = xwm->drag_focus;
assert(dest != NULL);
assert(xwm->drag != NULL);
assert(xwm->drag_focus != NULL);
xcb_client_message_data_t data = { 0 };
data.data32[0] = xwm->dnd_selection.window;

View file

@ -271,15 +271,14 @@ xcb_void_cookie_t xwm_send_event_with_size(xcb_connection_t *c,
uint8_t propagate, xcb_window_t destination,
uint32_t event_mask, const void *event, uint32_t length)
{
if (length == 32) {
assert(length <= 32);
if (length >= 32) {
return xcb_send_event(c, propagate, destination, event_mask, event);
} else if (length < 32) {
} else {
char buf[32];
memcpy(buf, event, length);
memset(buf + length, 0, 32 - length);
return xcb_send_event(c, propagate, destination, event_mask, buf);
} else {
assert(false && "Event too long");
}
}