From 4b8194e1eafb9fd788b814921f9e2518a2079344 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 9 Jan 2020 23:06:08 +0100 Subject: mi: fix shadow warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the following commit. But for mispans.c I think the first contained fix is wrong (nested loop with variable i) so I took another approach. commit f02e27e4fcc34413b2051e5a01edc92172fa8612 Author: Yaakov Selkowitz Date: Tue Oct 16 02:16:17 2012 -0500 mi: fix shadow warnings mibitblt.c: In function 'miGetImage': mibitblt.c:617:20: warning: declaration of 'pt' shadows a previous local mibitblt.c:609:17: warning: shadowed declaration is here mispans.c: In function 'miFillUniqueSpanGroup': mispans.c:456:33: warning: declaration of 'i' shadows a previous local mispans.c:382:9: warning: shadowed declaration is here mispans.c:488:17: warning: declaration of 'i' shadows a previous local mispans.c:382:9: warning: shadowed declaration is here Signed-off-by: Yaakov Selkowitz Reviewed-by: Peter Hutterer Fixes these warnings: mi/mispans.c: fix shadowed vars mispans.c: In function ‘miFillUniqueSpanGroup’: mispans.c:465:12: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local] int i; ^ mispans.c:387:21: note: shadowed declaration is here register int i; ^ mispans.c:497:10: warning: declaration of ‘i’ shadows a previous local [-Wshadow=compatible-local] int i; ^ mispans.c:387:21: note: shadowed declaration is here register int i; ^ mibitblt.c: In function ‘miGetImage’: mibitblt.c:669:13: warning: declaration of ‘pt’ shadows a previous local [-Wshadow=compatible-local] xPoint pt; ^~ mibitblt.c:659:18: note: shadowed declaration is here DDXPointRec pt = {0, 0}; ^~ --- nx-X11/programs/Xserver/mi/mibitblt.c | 6 +++--- nx-X11/programs/Xserver/mi/mispans.c | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/mi/mibitblt.c b/nx-X11/programs/Xserver/mi/mibitblt.c index 67d36a742..7b1aca794 100644 --- a/nx-X11/programs/Xserver/mi/mibitblt.c +++ b/nx-X11/programs/Xserver/mi/mibitblt.c @@ -666,7 +666,7 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) { if ( (((1<pScreen); if (!pGC) @@ -683,9 +683,9 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) * Clear the pixmap before doing anything else */ ValidateGC((DrawablePtr)pPixmap, pGC); - pt.x = pt.y = 0; + xpt.x = xpt.y = 0; width = w; - (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &pt, &width, + (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &xpt, &width, TRUE); /* alu is already GXCopy */ diff --git a/nx-X11/programs/Xserver/mi/mispans.c b/nx-X11/programs/Xserver/mi/mispans.c index a8762d323..c731f2a03 100644 --- a/nx-X11/programs/Xserver/mi/mispans.c +++ b/nx-X11/programs/Xserver/mi/mispans.c @@ -462,12 +462,12 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) ysizes[index] * sizeof(int)); if (!newpoints || !newwidths) { - int i; + int k; - for (i = 0; i < ylength; i++) + for (k = 0; k < ylength; k++) { - free (yspans[i].points); - free (yspans[i].widths); + free (yspans[k].points); + free (yspans[k].widths); } free (yspans); free (ysizes); @@ -494,8 +494,6 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) widths = (int *) malloc(count * sizeof(int)); if (!points || !widths) { - int i; - for (i = 0; i < ylength; i++) { free (yspans[i].points); -- cgit v1.2.3