xnest: Display: fix xallocarray() compiler warning
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 <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1392>
This commit is contained in:
parent
eac10cf1fa
commit
57254ca23c
|
@ -41,7 +41,7 @@ XVisualInfo *xnestVisuals;
|
||||||
int xnestNumVisuals;
|
int xnestNumVisuals;
|
||||||
int xnestDefaultVisualIndex;
|
int xnestDefaultVisualIndex;
|
||||||
Colormap *xnestDefaultColormaps;
|
Colormap *xnestDefaultColormaps;
|
||||||
static unsigned int xnestNumDefaultColormaps;
|
static uint16_t xnestNumDefaultColormaps;
|
||||||
int *xnestDepths;
|
int *xnestDepths;
|
||||||
int xnestNumDepths;
|
int xnestNumDepths;
|
||||||
XPixmapFormatValues *xnestPixmapFormats;
|
XPixmapFormatValues *xnestPixmapFormats;
|
||||||
|
|
Loading…
Reference in New Issue