From a501acd291e819d00ef744ac6cd8b25500b07c3c Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Mon, 14 Oct 2024 22:26:56 +0100 Subject: [PATCH] libweston/matrix: Fix narrow conversion with C++ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following C++ narrow conversion: /include/libweston-14/libweston/matrix.h: In function ‘weston_coord weston_coord_truncate(weston_coord)’: /include/libweston-14/libweston/matrix.h:212:39: error: narrowing conversion of ‘(int)in.weston_coord::x’ from ‘int’ to ‘double’ [-Werror=narrowing] 212 | return (struct weston_coord){ (int)in.x, (int)in.y }; | ^~~~~~~~~ /home/mvlad/install-new/include/libweston-14/libweston/matrix.h:212:50: error: narrowing conversion of ‘(int)in.weston_coord::y’ from ‘int’ to ‘double’ [-Werror=narrowing] 212 | return (struct weston_coord){ (int)in.x, (int)in.y }; Signed-off-by: Marius Vlad Signed-off-by: Derek Foreman --- include/libweston/matrix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libweston/matrix.h b/include/libweston/matrix.h index fa2aac825..c309db48d 100644 --- a/include/libweston/matrix.h +++ b/include/libweston/matrix.h @@ -209,7 +209,7 @@ weston_coord_surface_sub(struct weston_coord_surface a, static inline struct weston_coord __attribute__ ((warn_unused_result)) weston_coord_truncate(struct weston_coord in) { - return (struct weston_coord){ (int)in.x, (int)in.y }; + return (struct weston_coord){ (double)(int) in.x, (double)(int) in.y }; } static inline struct weston_coord_surface __attribute__ ((warn_unused_result))