Commit 1eb56035 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Window.c: save some lines by declaring loop variables in the loop

parent c8383b83
...@@ -232,13 +232,12 @@ static int nxagentFindWindowMatch(WindowPtr pWin, void * ptr) ...@@ -232,13 +232,12 @@ static int nxagentFindWindowMatch(WindowPtr pWin, void * ptr)
WindowPtr nxagentWindowPtr(Window window) WindowPtr nxagentWindowPtr(Window window)
{ {
int i;
WindowMatchRec match; WindowMatchRec match;
match.pWin = NullWindow; match.pWin = NullWindow;
match.id = window; match.id = window;
for (i = 0; i < nxagentNumScreens; i++) for (int i = 0; i < nxagentNumScreens; i++)
{ {
WalkTree(screenInfo.screens[i], nxagentFindWindowMatch, (void *) &match); WalkTree(screenInfo.screens[i], nxagentFindWindowMatch, (void *) &match);
...@@ -559,8 +558,6 @@ Bool nxagentSomeWindowsAreMapped(void) ...@@ -559,8 +558,6 @@ Bool nxagentSomeWindowsAreMapped(void)
Bool nxagentDestroyWindow(WindowPtr pWin) Bool nxagentDestroyWindow(WindowPtr pWin)
{ {
int j;
nxagentPrivWindowPtr pWindowPriv; nxagentPrivWindowPtr pWindowPriv;
if (nxagentScreenTrap == 1) if (nxagentScreenTrap == 1)
...@@ -570,7 +567,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin) ...@@ -570,7 +567,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin)
nxagentClearClipboard(NULL, pWin); nxagentClearClipboard(NULL, pWin);
for (j = 0; j < nxagentExposeQueue.length; j++) for (int j = 0; j < nxagentExposeQueue.length; j++)
{ {
int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
...@@ -1234,7 +1231,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1234,7 +1231,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
{ {
unsigned int valuemask; unsigned int valuemask;
XWindowChanges values; XWindowChanges values;
int j;
int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x;
int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y;
...@@ -1333,7 +1329,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ...@@ -1333,7 +1329,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY); nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY);
for (j = 0; j < nxagentExposeQueue.length; j++) for (int j = 0; j < nxagentExposeQueue.length; j++)
{ {
int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
...@@ -1966,10 +1962,9 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) ...@@ -1966,10 +1962,9 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what)
if (pWin -> realized) if (pWin -> realized)
{ {
int i;
BoxPtr pBox = RegionRects(pRegion); BoxPtr pBox = RegionRects(pRegion);
for (i = 0; i < RegionNumRects(pRegion); i++) for (int i = 0; i < RegionNumRects(pRegion); i++)
{ {
XClearArea(nxagentDisplay, nxagentWindow(pWin), XClearArea(nxagentDisplay, nxagentWindow(pWin),
pBox[i].x1 - pWin->drawable.x, pBox[i].x1 - pWin->drawable.x,
...@@ -2082,13 +2077,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo ...@@ -2082,13 +2077,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
{ {
if (nxagentExposeArrayIsInitialized == 0) if (nxagentExposeArrayIsInitialized == 0)
{ {
int i;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentWindowExposures: Initializing expose queue.\n"); fprintf(stderr, "nxagentWindowExposures: Initializing expose queue.\n");
#endif #endif
for (i = 0; i < EXPOSED_SIZE; i++) for (int i = 0; i < EXPOSED_SIZE; i++)
{ {
nxagentExposeQueue.exposures[i].pWindow = NULL; nxagentExposeQueue.exposures[i].pWindow = NULL;
nxagentExposeQueue.exposures[i].localRegion = NullRegion; nxagentExposeQueue.exposures[i].localRegion = NullRegion;
...@@ -2271,7 +2264,6 @@ void nxagentShapeWindow(WindowPtr pWin) ...@@ -2271,7 +2264,6 @@ void nxagentShapeWindow(WindowPtr pWin)
Region reg; Region reg;
BoxPtr pBox; BoxPtr pBox;
XRectangle rect; XRectangle rect;
int i;
if (NXDisplayError(nxagentDisplay) == 1) if (NXDisplayError(nxagentDisplay) == 1)
{ {
...@@ -2308,7 +2300,7 @@ void nxagentShapeWindow(WindowPtr pWin) ...@@ -2308,7 +2300,7 @@ void nxagentShapeWindow(WindowPtr pWin)
reg = XCreateRegion(); reg = XCreateRegion();
pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape); pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape);
for (i = 0; for (int i = 0;
i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape); i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape);
i++) i++)
{ {
...@@ -2365,7 +2357,7 @@ void nxagentShapeWindow(WindowPtr pWin) ...@@ -2365,7 +2357,7 @@ void nxagentShapeWindow(WindowPtr pWin)
reg = XCreateRegion(); reg = XCreateRegion();
pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape); pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape);
for (i = 0; for (int i = 0;
i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape); i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape);
i++) i++)
{ {
...@@ -2438,9 +2430,7 @@ void nxagentUnmapWindows(void) ...@@ -2438,9 +2430,7 @@ void nxagentUnmapWindows(void)
{ {
if (nxagentOption(Fullscreen) == 1) if (nxagentOption(Fullscreen) == 1)
{ {
int i; for (int i = 0; i < screenInfo.numScreens; i++)
for (i = 0; i < screenInfo.numScreens; i++)
{ {
if (nxagentDefaultWindows[i]) if (nxagentDefaultWindows[i])
{ {
...@@ -2454,9 +2444,7 @@ void nxagentUnmapWindows(void) ...@@ -2454,9 +2444,7 @@ void nxagentUnmapWindows(void)
void nxagentMapDefaultWindows(void) void nxagentMapDefaultWindows(void)
{ {
int i; for (int i = 0; i < screenInfo.numScreens; i++)
for (i = 0; i < screenInfo.numScreens; i++)
{ {
WindowPtr pWin = screenInfo.screens[i]->root; WindowPtr pWin = screenInfo.screens[i]->root;
ScreenPtr pScreen = pWin -> drawable.pScreen; ScreenPtr pScreen = pWin -> drawable.pScreen;
...@@ -2563,13 +2551,12 @@ void nxagentMapDefaultWindows(void) ...@@ -2563,13 +2551,12 @@ void nxagentMapDefaultWindows(void)
Bool nxagentDisconnectAllWindows(void) Bool nxagentDisconnectAllWindows(void)
{ {
Bool succeeded = True; Bool succeeded = True;
int i;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG)
fprintf(stderr, "nxagentDisconnectAllWindows\n"); fprintf(stderr, "nxagentDisconnectAllWindows\n");
#endif #endif
for (i = 0; i < screenInfo.numScreens; i++) for (int i = 0; i < screenInfo.numScreens; i++)
{ {
WindowPtr pWin = screenInfo.screens[i]->root; WindowPtr pWin = screenInfo.screens[i]->root;
nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded); nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded);
...@@ -2709,9 +2696,7 @@ Bool nxagentReconnectAllWindows(void *p0) ...@@ -2709,9 +2696,7 @@ Bool nxagentReconnectAllWindows(void *p0)
if (nxagentOption(Rootless) == 0) if (nxagentOption(Rootless) == 0)
{ {
int i; for (int i = 0; i < screenInfo.numScreens; i++)
for (i = 0; i < screenInfo.numScreens; i++)
{ {
XRaiseWindow(nxagentDisplay, nxagentInputWindows[i]); XRaiseWindow(nxagentDisplay, nxagentInputWindows[i]);
} }
...@@ -2817,10 +2802,9 @@ static void nxagentTraverseWindow( ...@@ -2817,10 +2802,9 @@ static void nxagentTraverseWindow(
static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *)) static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *))
{ {
int i;
Bool windowSuccess = True; Bool windowSuccess = True;
for (i = 0; i < screenInfo.numScreens; i++) for (int i = 0; i < screenInfo.numScreens; i++)
{ {
nxagentTraverseWindow(screenInfo.screens[i]->root, pF, &windowSuccess); nxagentTraverseWindow(screenInfo.screens[i]->root, pF, &windowSuccess);
} }
...@@ -3004,7 +2988,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3004,7 +2988,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
unsigned char *data = NULL; unsigned char *data = NULL;
#ifdef _XSERVER64 #ifdef _XSERVER64
unsigned char *data64 = NULL; unsigned char *data64 = NULL;
unsigned int i;
#endif #endif
ret = GetWindowProperty(pWin, ret = GetWindowProperty(pWin,
...@@ -3032,14 +3015,14 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer ...@@ -3032,14 +3015,14 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer
#ifdef _XSERVER64 #ifdef _XSERVER64
data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4); data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4);
for (i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
*(data64 + i) = *(data + i); *(data64 + i) = *(data + i);
} }
*(((int *) data64) + 1) = 0; *(((int *) data64) + 1) = 0;
for (i = 8; i < sizeof(XSizeHints) + 4; i++) for (int i = 8; i < sizeof(XSizeHints) + 4; i++)
{ {
*(data64 + i) = *(data + i - 4); *(data64 + i) = *(data + i - 4);
} }
...@@ -3276,15 +3259,12 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) ...@@ -3276,15 +3259,12 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin)
if (image && memcmp(image->data, data, length) != 0) if (image && memcmp(image->data, data, length) != 0)
{ {
#ifdef TEST
int i;
char *p, *q;
#endif
integrity = False; integrity = False;
#ifdef TEST #ifdef TEST
for (i = 0, p = image->data, q = data; i < length; i++) char *p = image->data, *q = data;
for (int i = 0; i < length; i++)
{ {
if (p[i] != q[i]) if (p[i] != q[i])
{ {
...@@ -3395,7 +3375,6 @@ void nxagentFlushConfigureWindow(void) ...@@ -3395,7 +3375,6 @@ void nxagentFlushConfigureWindow(void)
{ {
ConfiguredWindowStruct *index; ConfiguredWindowStruct *index;
XWindowChanges changes; XWindowChanges changes;
int j;
index = nxagentConfiguredWindowList; index = nxagentConfiguredWindowList;
...@@ -3434,7 +3413,7 @@ void nxagentFlushConfigureWindow(void) ...@@ -3434,7 +3413,7 @@ void nxagentFlushConfigureWindow(void)
nxagentConfiguredWindowList = NULL; nxagentConfiguredWindowList = NULL;
for (j = 0; j < nxagentExposeQueue.length; j++) for (int j = 0; j < nxagentExposeQueue.length; j++)
{ {
int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
...@@ -3729,9 +3708,7 @@ void nxagentInitBSPixmapList(void) ...@@ -3729,9 +3708,7 @@ void nxagentInitBSPixmapList(void)
int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pWin, int bsx, int bsy) int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pWin, int bsx, int bsy)
{ {
int i; for (int i = 0; i < BSPIXMAPLIMIT; i++)
for (i = 0; i < BSPIXMAPLIMIT; i++)
{ {
if (nxagentBSPixmapList[i] == NULL) if (nxagentBSPixmapList[i] == NULL)
{ {
...@@ -3779,14 +3756,12 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW ...@@ -3779,14 +3756,12 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW
int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) int nxagentRemoveItemBSPixmapList(unsigned long pixmapId)
{ {
int i;
if (pixmapId == 0 || nxagentBSPixmapList[0] == NULL) if (pixmapId == 0 || nxagentBSPixmapList[0] == NULL)
{ {
return 0; return 0;
} }
for (i = 0; i < BSPIXMAPLIMIT; i++) for (int i = 0; i < BSPIXMAPLIMIT; i++)
{ {
if ((nxagentBSPixmapList[i] != NULL) && if ((nxagentBSPixmapList[i] != NULL) &&
(nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId))
...@@ -3828,9 +3803,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) ...@@ -3828,9 +3803,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId)
int nxagentEmptyBSPixmapList(void) int nxagentEmptyBSPixmapList(void)
{ {
int i; for (int i = 0; i < BSPIXMAPLIMIT; i++)
for (i = 0; i < BSPIXMAPLIMIT; i++)
{ {
free(nxagentBSPixmapList[i]); free(nxagentBSPixmapList[i]);
nxagentBSPixmapList[i] = NULL; nxagentBSPixmapList[i] = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment