Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package xcompmgr for openSUSE:Factory 
checked in at 2024-11-13 15:29:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xcompmgr (Old)
 and      /work/SRC/openSUSE:Factory/.xcompmgr.new.2017 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xcompmgr"

Wed Nov 13 15:29:05 2024 rev:9 rq:1223829 version:1.1.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/xcompmgr/xcompmgr.changes        2022-11-14 
14:28:55.654951409 +0100
+++ /work/SRC/openSUSE:Factory/.xcompmgr.new.2017/xcompmgr.changes      
2024-11-13 15:29:36.532589422 +0100
@@ -1,0 +2,12 @@
+Wed Nov 13 04:15:06 UTC 2024 - Stefan Dirsch <sndir...@suse.com>
+
+- Update to version 1.1.10
+  * find_fade: declare argument as const
+  * Handle realloc() failure
+  * Use reallocarray() if it is available
+  * Convert sprintf calls to snprintf
+  * Use C99 struct initializers
+  * Add {} around for loops containing multiple lines of code
+  * More variable scope reductions
+
+-------------------------------------------------------------------

Old:
----
  xcompmgr-1.1.9.tar.xz

New:
----
  xcompmgr-1.1.10.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xcompmgr.spec ++++++
--- /var/tmp/diff_new_pack.BraLGQ/_old  2024-11-13 15:29:37.100613148 +0100
+++ /var/tmp/diff_new_pack.BraLGQ/_new  2024-11-13 15:29:37.100613148 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package xcompmgr
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           xcompmgr
-Version:        1.1.9
+Version:        1.1.10
 Release:        0
 Summary:        Compositing manager for X servers
 License:        MIT

++++++ xcompmgr-1.1.9.tar.xz -> xcompmgr-1.1.10.tar.xz ++++++
++++ 5618 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xcompmgr-1.1.9/ChangeLog new/xcompmgr-1.1.10/ChangeLog
--- old/xcompmgr-1.1.9/ChangeLog        2022-11-12 20:58:08.000000000 +0100
+++ new/xcompmgr-1.1.10/ChangeLog       2024-11-13 02:06:54.000000000 +0100
@@ -1,3 +1,88 @@
+commit 5244f3a61beb61702f6dcaca64aa99b63b78e3b9
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Tue Nov 12 16:51:40 2024 -0800
+
+    xcompmgr 1.1.10
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+
+commit ebc2a566d68bdfc86e94ae5e37d2ad2124095f5c
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 11:37:48 2024 -0700
+
+    More variable scope reductions
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
+commit 1972797736a5aa25a69c5b0ba53a33592fe1640e
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 11:22:16 2024 -0700
+
+    Add {} around for loops containing multiple lines of code
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
+commit 7175619585083d6378229e5f86b900472c7d7c01
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 11:11:42 2024 -0700
+
+    Use C99 struct initializers
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
+commit 4c4bc9a67fbefb63e9dc1355a686622eac7a5da3
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 10:23:12 2024 -0700
+
+    Convert sprintf calls to snprintf
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
+commit fb596ae3eb7a4732319391c0274c29cc5499cb23
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 09:38:53 2024 -0700
+
+    Use reallocarray() if it is available
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
+commit e455e9eb8091fa7bbcfde9fbe2920ff053f1ee9c
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 09:30:32 2024 -0700
+
+    Handle realloc() failure
+    
+    Flagged by cppcheck:
+    
+    xcompmgr.c:2290:8: error: Common realloc mistake: 'expose_rects' nulled
+     but not freed upon failure [memleakOnRealloc]
+           expose_rects = realloc (expose_rects,
+           ^
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
+commit 062ba6bd66ac4998047467490d608d15c0f6caae
+Author: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date:   Sat Aug 3 09:11:17 2024 -0700
+
+    find_fade: declare argument as const
+    
+    Suggested by cppcheck:
+    
+    xcompmgr.c:211:17: style: Parameter 'w' can be declared with const
+     [constParameter]
+    find_fade (win *w)
+                    ^
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+    Part-of: 
<https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/merge_requests/6>
+
 commit 052a0d39908a33e62f4d77b4d9e395f2f3583925
 Author: Alan Coopersmith <alan.coopersm...@oracle.com>
 Date:   Sat Nov 12 11:55:23 2022 -0800
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xcompmgr-1.1.9/compile new/xcompmgr-1.1.10/compile
--- old/xcompmgr-1.1.9/compile  2022-11-12 20:58:03.000000000 +0100
+++ new/xcompmgr-1.1.10/compile 2024-11-13 02:06:47.000000000 +0100
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2021 Free Software Foundation, Inc.
+# Copyright (C) 1999-2020 Free Software Foundation, Inc.
 # Written by Tom Tromey <tro...@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xcompmgr-1.1.9/config.h.in new/xcompmgr-1.1.10/config.h.in
--- old/xcompmgr-1.1.9/config.h.in      2022-11-12 20:58:03.000000000 +0100
+++ new/xcompmgr-1.1.10/config.h.in     2024-11-13 02:06:46.000000000 +0100
@@ -3,6 +3,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `reallocarray' function. */
+#undef HAVE_REALLOCARRAY
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xcompmgr-1.1.9/configure.ac new/xcompmgr-1.1.10/configure.ac
--- old/xcompmgr-1.1.9/configure.ac     2022-11-12 20:57:59.000000000 +0100
+++ new/xcompmgr-1.1.10/configure.ac    2024-11-13 02:06:41.000000000 +0100
@@ -3,7 +3,7 @@
 
 # Initialize Autoconf
 AC_PREREQ(2.60)
-AC_INIT([xcompmgr], [1.1.9],
+AC_INIT([xcompmgr], [1.1.10],
         [https://gitlab.freedesktop.org/xorg/app/xcompmgr/-/issues])
 AC_CONFIG_SRCDIR([xcompmgr.c])
 AC_CONFIG_HEADERS([config.h])
@@ -17,6 +17,9 @@
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
+# Checks for library functions.
+AC_CHECK_FUNCS([reallocarray])
+
 PKG_CHECK_MODULES(XCOMPMGR,
         [xcomposite xfixes xdamage xrender xext xproto >= 7.0.25])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xcompmgr-1.1.9/missing new/xcompmgr-1.1.10/missing
--- old/xcompmgr-1.1.9/missing  2022-11-12 20:58:03.000000000 +0100
+++ new/xcompmgr-1.1.10/missing 2024-11-13 02:06:47.000000000 +0100
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996-2021 Free Software Foundation, Inc.
+# Copyright (C) 1996-2020 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pin...@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/xcompmgr-1.1.9/xcompmgr.c new/xcompmgr-1.1.10/xcompmgr.c
--- old/xcompmgr-1.1.9/xcompmgr.c       2022-11-12 20:57:59.000000000 +0100
+++ new/xcompmgr-1.1.10/xcompmgr.c      2024-11-13 02:06:41.000000000 +0100
@@ -46,6 +46,10 @@
 #include <X11/extensions/Xrender.h>
 #include <X11/extensions/shape.h>
 
+#ifndef HAVE_REALLOCARRAY
+#define reallocarray(old, num, size) realloc(old, (num) * (size))
+#endif
+
 #if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2
 #define HAS_NAME_WINDOW_PIXMAP 1
 #endif
@@ -208,11 +212,9 @@
 }
 
 static fade *
-find_fade (win *w)
+find_fade (const win *w)
 {
-    fade    *f;
-
-    for (f = fades; f; f = f->next)
+    for (fade *f = fades; f; f = f->next)
     {
        if (f->w == w)
            return f;
@@ -223,9 +225,8 @@
 static void
 dequeue_fade (Display *dpy, fade *f)
 {
-    fade    **prev;
-
-    for (prev = &fades; *prev; prev = &(*prev)->next)
+    for (fade **prev = &fades; *prev; prev = &(*prev)->next)
+    {
        if (*prev == f)
        {
            *prev = f->next;
@@ -234,6 +235,7 @@
            free (f);
            break;
        }
+    }
 }
 
 static void
@@ -264,9 +266,11 @@
     if (!f)
     {
        f = malloc (sizeof (fade));
-       f->next = NULL;
-       f->w = w;
-       f->cur = start;
+       *f = (fade) {
+           .next = NULL,
+           .w = w,
+           .cur = start
+       };
        enqueue_fade (dpy, f);
     }
     else if(!override)
@@ -391,27 +395,32 @@
     conv           *c;
     int                    size = ((int) ceil ((r * 3)) + 1) & ~1;
     int                    center = size / 2;
-    int                    x, y;
     double         t;
-    double         g;
 
     c = malloc (sizeof (conv) + size * size * sizeof (double));
-    c->size = size;
-    c->data = (double *) (c + 1);
+    *c = (conv) {
+       .size = size,
+       .data = (double *) (c + 1)
+    };
     t = 0.0;
-    for (y = 0; y < size; y++)
-       for (x = 0; x < size; x++)
+    for (int y = 0; y < size; y++)
+    {
+       for (int x = 0; x < size; x++)
        {
-           g = gaussian (r, (double) (x - center), (double) (y - center));
+           double g =
+               gaussian (r, (double) (x - center), (double) (y - center));
            t += g;
            c->data[y * size + x] = g;
        }
+    }
 /*    printf ("gaussian total %f\n", t); */
-    for (y = 0; y < size; y++)
-       for (x = 0; x < size; x++)
+    for (int y = 0; y < size; y++)
+    {
+       for (int x = 0; x < size; x++)
        {
            c->data[y*size + x] /= t;
        }
+    }
     return c;
 }
 
@@ -435,7 +444,6 @@
 static unsigned char
 sum_gaussian (conv *map, double opacity, int x, int y, int width, int height)
 {
-    int            fx, fy;
     double  *g_line = map->data;
     int            g_size = map->size;
     int            center = g_size / 2;
@@ -470,12 +478,12 @@
     g_line = g_line + fy_start * g_size + fx_start;
 
     v = 0;
-    for (fy = fy_start; fy < fy_end; fy++)
+    for (int fy = fy_start; fy < fy_end; fy++)
     {
        double  *g_data = g_line;
        g_line += g_size;
 
-       for (fx = fx_start; fx < fx_end; fx++)
+       for (int fx = fx_start; fx < fx_end; fx++)
            v += *g_data++;
     }
     if (v > 1)
@@ -489,7 +497,6 @@
 presum_gaussian (conv *map)
 {
     int center = map->size/2;
-    int opacity, x, y;
 
     Gsize = map->size;
 
@@ -501,21 +508,23 @@
     shadowCorner = malloc ((Gsize + 1) * (Gsize + 1) * 26);
     shadowTop = malloc ((Gsize + 1) * 26);
 
-    for (x = 0; x <= Gsize; x++)
+    for (int x = 0; x <= Gsize; x++)
     {
        shadowTop[25 * (Gsize + 1) + x] = sum_gaussian (map, 1, x - center, 
center, Gsize * 2, Gsize * 2);
-       for(opacity = 0; opacity < 25; opacity++)
+       for (int opacity = 0; opacity < 25; opacity++)
            shadowTop[opacity * (Gsize + 1) + x] = shadowTop[25 * (Gsize + 1) + 
x] * opacity / 25;
-       for(y = 0; y <= x; y++)
+       for (int y = 0; y <= x; y++)
        {
            shadowCorner[25 * (Gsize + 1) * (Gsize + 1) + y * (Gsize + 1) + x]
                = sum_gaussian (map, 1, x - center, y - center, Gsize * 2, 
Gsize * 2);
            shadowCorner[25 * (Gsize + 1) * (Gsize + 1) + x * (Gsize + 1) + y]
                = shadowCorner[25 * (Gsize + 1) * (Gsize + 1) + y * (Gsize + 1) 
+ x];
-           for(opacity = 0; opacity < 25; opacity++)
+           for (int opacity = 0; opacity < 25; opacity++)
+           {
                shadowCorner[opacity * (Gsize + 1) * (Gsize + 1) + y * (Gsize + 
1) + x]
                    = shadowCorner[opacity * (Gsize + 1) * (Gsize + 1) + x * 
(Gsize + 1) + y]
                    = shadowCorner[25 * (Gsize + 1) * (Gsize + 1) + y * (Gsize 
+ 1) + x] * opacity / 25;
+           }
        }
     }
 }
@@ -530,7 +539,6 @@
     int                    swidth = width + gsize;
     int                    sheight = height + gsize;
     int                    center = gsize / 2;
-    int                    x, y;
     unsigned char   d;
     int                    x_diff;
     int             opacity_int = (int)(opacity * 25);
@@ -572,8 +580,9 @@
     if (xlimit > swidth / 2)
        xlimit = (swidth + 1) / 2;
 
-    for (y = 0; y < ylimit; y++)
-       for (x = 0; x < xlimit; x++)
+    for (int y = 0; y < ylimit; y++)
+    {
+       for (int x = 0; x < xlimit; x++)
        {
            if (xlimit == Gsize && ylimit == Gsize)
                d = shadowCorner[opacity_int * (Gsize + 1) * (Gsize + 1) + y * 
(Gsize + 1) + x];
@@ -584,6 +593,7 @@
            data[(sheight - y - 1) * swidth + (swidth - x - 1)] = d;
            data[y * swidth + (swidth - x - 1)] = d;
        }
+    }
 
     /*
      * top/bottom
@@ -591,7 +601,7 @@
     x_diff = swidth - (gsize * 2);
     if (x_diff > 0 && ylimit > 0)
     {
-       for (y = 0; y < ylimit; y++)
+       for (int y = 0; y < ylimit; y++)
        {
            if (ylimit == Gsize)
                d = shadowTop[opacity_int * (Gsize + 1) + y];
@@ -606,13 +616,13 @@
      * sides
      */
 
-    for (x = 0; x < xlimit; x++)
+    for (int x = 0; x < xlimit; x++)
     {
        if (xlimit == Gsize)
            d = shadowTop[opacity_int * (Gsize + 1) + x];
        else
            d = sum_gaussian (gaussianMap, opacity, x - center, center, width, 
height);
-       for (y = gsize; y < sheight - gsize; y++)
+       for (int y = gsize; y < sheight - gsize; y++)
        {
            data[y * swidth + x] = d;
            data[y * swidth + (swidth - x - 1)] = d;
@@ -696,10 +706,12 @@
        return None;
     }
 
-    c.alpha = a * 0xffff;
-    c.red = r * 0xffff;
-    c.green = g * 0xffff;
-    c.blue = b * 0xffff;
+    c = (XRenderColor) {
+       .alpha = a * 0xffff,
+       .red = r * 0xffff,
+       .green = g * 0xffff,
+       .blue = b * 0xffff
+    };
     XRenderFillRectangle (dpy, PictOpSrc, picture, &c, 0, 0, 1, 1);
     XFreePixmap (dpy, pixmap);
     return picture;
@@ -729,8 +741,10 @@
     ignore  *i = malloc (sizeof (ignore));
     if (!i)
        return;
-    i->sequence = sequence;
-    i->next = NULL;
+    *i = (ignore) {
+       .sequence = sequence,
+       .next = NULL
+    };
     *ignore_tail = i;
     ignore_tail = &i->next;
 }
@@ -745,11 +759,11 @@
 static win *
 find_win (Display *dpy, Window id)
 {
-    win        *w;
-
-    for (w = list; w; w = w->next)
+    for (win *w = list; w; w = w->next)
+    {
        if (w->id == id)
            return w;
+    }
     return NULL;
 }
 
@@ -771,10 +785,9 @@
     unsigned char   *prop;
     Bool           fill;
     XRenderPictureAttributes   pa;
-    int                    p;
 
     pixmap = None;
-    for (p = 0; backgroundProps[p]; p++)
+    for (int p = 0; backgroundProps[p]; p++)
     {
        if (XGetWindowProperty (dpy, root, XInternAtom (dpy, 
backgroundProps[p], False),
                                0, 4, False, AnyPropertyType,
@@ -799,10 +812,12 @@
                                    CPRepeat, &pa);
     if (fill)
     {
-       XRenderColor    c;
-
-       c.red = c.green = c.blue = 0x8080;
-       c.alpha = 0xffff;
+       XRenderColor    c = {
+           .red = 0x8080,
+           .green = 0x8080,
+           .blue = 0x8080,
+           .alpha = 0xffff
+       };
        XRenderFillRectangle (dpy, PictOpSrc, picture, &c,
                              0, 0, 1, 1);
     }
@@ -823,12 +838,13 @@
 static XserverRegion
 win_extents (Display *dpy, win *w)
 {
-    XRectangle     r;
+    XRectangle     r = {
+       .x = w->a.x,
+       .y = w->a.y,
+       .width = w->a.width + w->a.border_width * 2,
+       .height = w->a.height + w->a.border_width * 2
+    };
 
-    r.x = w->a.x;
-    r.y = w->a.y;
-    r.width = w->a.width + w->a.border_width * 2;
-    r.height = w->a.height + w->a.border_width * 2;
     if (compMode != CompSimple && !(w->windowType == winDockAtom && 
excludeDockShadows))
     {
        if (compMode == CompServerShadows || w->mode != WINDOW_ARGB)
@@ -857,10 +873,12 @@
                                                &w->shadow_width, 
&w->shadow_height);
                }
            }
-           sr.x = w->a.x + w->shadow_dx;
-           sr.y = w->a.y + w->shadow_dy;
-           sr.width = w->shadow_width;
-           sr.height = w->shadow_height;
+           sr = (XRectangle) {
+               .x = w->a.x + w->shadow_dx,
+               .y = w->a.y + w->shadow_dy,
+               .width = w->shadow_width,
+               .height = w->shadow_height
+           };
            if (sr.x < r.x)
            {
                r.width = (r.x + r.width) - sr.x;
@@ -909,11 +927,12 @@
 
     if (!region)
     {
-       XRectangle  r;
-       r.x = 0;
-       r.y = 0;
-       r.width = root_width;
-       r.height = root_height;
+       XRectangle  r = {
+           .x = 0,
+           .y = 0,
+           .width = root_width,
+           .height = root_height
+       };
        region = XFixesCreateRegion (dpy, &r, 1);
     }
 #if MONITOR_REPAINT
@@ -1504,8 +1523,10 @@
 
        /* unhook */
        for (prev = &list; *prev; prev = &(*prev)->next)
+       {
            if ((*prev) == w)
                break;
+       }
        *prev = w->next;
 
        /* rehook */
@@ -1617,6 +1638,7 @@
     win        **prev, *w;
 
     for (prev = &list; (w = *prev); prev = &w->next)
+    {
        if (w->id == id)
        {
            if (gone)
@@ -1653,6 +1675,7 @@
            free (w);
            break;
        }
+    }
 }
 
 #if HAS_NAME_WINDOW_PIXMAP
@@ -1769,7 +1792,7 @@
   case ShapeInput:
     return "ShapeInput";
   default:
-    sprintf (buf, "Shape %d", kind);
+    snprintf (buf, sizeof(buf), "Shape %d", kind);
     return buf;
   }
 }
@@ -1920,7 +1943,7 @@
        {
            return "Shape";
        }
-       sprintf (buf, "Event %d", ev->type);
+       snprintf (buf, sizeof(buf), "Event %d", ev->type);
        return buf;
     }
 }
@@ -2287,21 +2310,32 @@
                    {
                        if (expose_rects)
                        {
-                           expose_rects = realloc (expose_rects,
-                                                   (size_expose + more) *
-                                                   sizeof (XRectangle));
-                           size_expose += more;
+                           XRectangle *old = expose_rects;
+
+                           expose_rects = reallocarray (old,
+                                                        (size_expose + more),
+                                                        sizeof (XRectangle));
+                           if (expose_rects == NULL) {
+                               expose_rects = old;
+                               expose_root (dpy, root, expose_rects, n_expose);
+                               n_expose = 0;
+                           } else {
+                               size_expose += more;
+                           }
                        }
                        else
                        {
-                           expose_rects = malloc (more * sizeof (XRectangle));
+                           expose_rects = reallocarray (NULL, more,
+                                                        sizeof (XRectangle));
                            size_expose = more;
                        }
                    }
-                   expose_rects[n_expose].x = ev.xexpose.x;
-                   expose_rects[n_expose].y = ev.xexpose.y;
-                   expose_rects[n_expose].width = ev.xexpose.width;
-                   expose_rects[n_expose].height = ev.xexpose.height;
+                   expose_rects[n_expose] = (XRectangle) {
+                       .x = ev.xexpose.x,
+                       .y = ev.xexpose.y,
+                       .width = ev.xexpose.width,
+                       .height = ev.xexpose.height
+                   };
                    n_expose++;
                    if (ev.xexpose.count == 0)
                    {

Reply via email to