From 57254ca23c23063c815b3ed48472131119badb15 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 9 Feb 2024 15:51:04 +0100 Subject: [PATCH] xnest: Display: fix xallocarray() compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compiler warning: [7/29] Compiling C object hw/xnest/Xnest.p/Display.c.o In file included from ../include/misc.h:119, from ../include/screenint.h:50, from ../hw/xnest/Display.c:24: ../hw/xnest/Display.c: In function ‘xnestOpenDisplay’: ../include/os.h:81:32: warning: argument 2 range [2147483648, 4294967295] exceeds maximum object size 2147483647 [-Walloc-size-larger-than=] 81 | #define xallocarray(num, size) reallocarray(NULL, (num), (size)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../hw/xnest/Display.c:124:29: note: in expansion of macro ‘xallocarray’ 124 | xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps, | ^~~~~~~~~~~ In file included from ../include/os.h:54: /usr/include/stdlib.h:582:14: note: in a call to allocation function ‘reallocarray’ declared here 582 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) | ^~~~~~~~~~~~ Since we really don't need more than 2^16 colormaps, using uint16_t here to silence this warning. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- hw/xnest/Display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index e6fa4ba30..a014aa40d 100644 --- a/hw/xnest/Display.c +++ b/hw/xnest/Display.c @@ -41,7 +41,7 @@ XVisualInfo *xnestVisuals; int xnestNumVisuals; int xnestDefaultVisualIndex; Colormap *xnestDefaultColormaps; -static unsigned int xnestNumDefaultColormaps; +static uint16_t xnestNumDefaultColormaps; int *xnestDepths; int xnestNumDepths; XPixmapFormatValues *xnestPixmapFormats;