xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 15 18:56:45 UTC 2024


 hw/xnest/Display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 57254ca23c23063c815b3ed48472131119badb15
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Fri Feb 9 15:51:04 2024 +0100

    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 at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1392>

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;


More information about the xorg-commit mailing list