From 81fa6c4b96d598f98bb9eaa99863835c83ebde5c Mon Sep 17 00:00:00 2001 From: xurui Date: Wed, 23 Oct 2024 18:18:28 +0800 Subject: [PATCH] wlr_linux_dmabuf_v1: use enum_is_valid functions Signed-off-by: xurui --- types/wlr_linux_dmabuf_v1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c index 77fe76ce9..7809a29d8 100644 --- a/types/wlr_linux_dmabuf_v1.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -266,10 +266,8 @@ static void params_create_common(struct wl_resource *params_resource, } /* reject unknown flags */ - uint32_t all_flags = ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT | - ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED | - ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST; - if (flags & ~all_flags) { + uint32_t version = wl_resource_get_version(params_resource); + if (!zwp_linux_buffer_params_v1_flags_is_valid(flags, version)) { wl_resource_post_error(params_resource, ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT, "Unknown dmabuf flags %"PRIu32, flags);