aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-01-08 23:43:15 +0100
committerUlrich Sibiller <uli42@gmx.de>2020-01-10 00:25:31 +0100
commitfbfef7e62afa32f95c6d8e97aba6f13ab3493332 (patch)
treeaeb000bc142c1c21f5d1005d7137fdae610b798f
parent32b64d7d78a7986d3887c6892dd36be205897d80 (diff)
downloadnx-libs-fbfef7e62afa32f95c6d8e97aba6f13ab3493332.tar.gz
nx-libs-fbfef7e62afa32f95c6d8e97aba6f13ab3493332.tar.bz2
nx-libs-fbfef7e62afa32f95c6d8e97aba6f13ab3493332.zip
Drawable.c: fix logic broken by scope cleanup
xp must be declared outside the while loop! xp was reset in each interation despite being increased at the iteration's end! To protect against this happening again replace the while loop by a for loop that references xp. Bug introduced by d94f472744355c71987d145727aecace1e8455b6
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Drawable.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
index 199f01cd8..7f1d2dec5 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c
@@ -2261,11 +2261,11 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
{
RegionPtr pRegion = RegionCreate(NullBox, 1);
- int np = nPoints;
- while (np--)
+ xPoint *xp = pPoints;
+
+ for (int np = nPoints; np--; xp++)
{
BoxRec box;
- xPoint *xp = pPoints;
if (CoordModePrevious)
{
@@ -2294,8 +2294,6 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
RegionUnion(pRegion, pRegion, &tmpRegion);
RegionUninit(&tmpRegion);
-
- xp++;
}
BoxRec extents = *RegionExtents(pRegion);