aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-05-25 19:38:14 +0200
committerUlrich Sibiller <uli42@gmx.de>2019-06-19 01:12:02 +0200
commitcb508b2632f661e19b44f1375ddce3ffb415f4c5 (patch)
tree8e2221e23e48b4867d1a9b29547fb6b33a1624d5
parentbffdacc48a6bd49e4ac1b4ce5d2fcc8eecdb811c (diff)
downloadnx-libs-cb508b2632f661e19b44f1375ddce3ffb415f4c5.tar.gz
nx-libs-cb508b2632f661e19b44f1375ddce3ffb415f4c5.tar.bz2
nx-libs-cb508b2632f661e19b44f1375ddce3ffb415f4c5.zip
various scope improvements
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c24
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Font.c49
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXglyph.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXpicture.c12
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pixmap.c18
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Rootless.c38
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c4
8 files changed, 50 insertions, 107 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 8e976779d..9d9f5d204 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -1964,14 +1964,14 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
case UnmapNotify:
{
- WindowPtr pWin;
-
#ifdef TEST
fprintf(stderr, "nxagentDispatchEvents: Going to handle new UnmapNotify event.\n");
#endif
if (nxagentOption(Rootless) == 1)
{
+ WindowPtr pWin;
+
if ((pWin = nxagentRootlessTopLevelWindow(X.xunmap.window)) != NULL ||
((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1))
@@ -1995,22 +1995,19 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
case MapNotify:
{
- WindowPtr pWin;
- ClientPtr pClient;
-
#ifdef TEST
fprintf(stderr, "nxagentDispatchEvents: Going to handle new MapNotify event.\n");
#endif
if (nxagentOption(Rootless) == 1)
{
- Bool value = 1;
+ WindowPtr pWin;
if ((pWin = nxagentRootlessTopLevelWindow(X.xmap.window)) != NULL ||
((pWin = nxagentWindowPtr(X.xmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1))
{
- pClient = wClient(pWin);
+ ClientPtr pClient = wClient(pWin);
nxagentScreenTrap = 1;
@@ -2021,6 +2018,8 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (pWin != NULL)
{
+ Bool value = 1;
+
TraverseTree(pWin, nxagentChangeMapPrivate, &value);
}
}
@@ -2355,8 +2354,6 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
int nxagentHandlePropertyNotify(XEvent *X)
{
- int resource;
-
if (nxagentOption(Rootless) && !nxagentNotifyMatchChangeProperty((XPropertyEvent *) X))
{
#ifdef TEST
@@ -2366,7 +2363,7 @@ int nxagentHandlePropertyNotify(XEvent *X)
if (nxagentWindowPtr(X -> xproperty.window) != NULL)
{
- resource = NXGetCollectPropertyResource(nxagentDisplay);
+ int resource = NXGetCollectPropertyResource(nxagentDisplay);
if (resource == -1)
{
@@ -2643,8 +2640,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
{
- WindowPtr pWin;
-
*result = doNothing;
#ifdef TEST
@@ -2680,7 +2675,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
return 0;
}
- pWin = nxagentWindowPtr(X -> xclient.window);
+ WindowPtr pWin = nxagentWindowPtr(X -> xclient.window);
if (pWin == NULL)
{
@@ -2886,7 +2881,6 @@ int nxagentHandleXkbKeyboardStateEvent(XEvent *X)
int nxagentHandleXFixesSelectionNotify(XEvent *X)
{
- int i;
Atom local;
XFixesSelectionEvent *xfixesEvent = (XFixesSelectionEvent *) X;
@@ -2915,7 +2909,7 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
if (SelectionCallback)
{
- i = 0;
+ int i = 0;
while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != local)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c
index 8de50fdc3..c135adb72 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Font.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c
@@ -165,8 +165,6 @@ static struct _nxagentFailedToReconnectFonts
void nxagentFreeFontCache(void)
{
- int i;
-
#ifdef NXAGENT_FONTCACHE_DEBUG
fprintf(stderr, "Font: Freeing nxagent font cache\n");
#endif
@@ -178,7 +176,7 @@ void nxagentFreeFontCache(void)
fprintf(stderr, "Font: Freeing nxagent font cache, there are [%d] entries.\n", CACHE_INDEX);
#endif
- for (i = 0; i < CACHE_INDEX; i++)
+ for (int i = 0; i < CACHE_INDEX; i++)
{
#ifdef NXAGENT_FONTCACHE_DEBUG
fprintf(stderr, "Font: Freeing nxagent font cache entry [%d] entry pointer is [%p], name [%s]\n",
@@ -208,8 +206,6 @@ void nxagentFreeFontCache(void)
void nxagentListRemoteFonts(const char *searchPattern, const int maxNames)
{
- int i, q, p;
-
char **xList;
int xLen = 0;
@@ -241,7 +237,7 @@ void nxagentListRemoteFonts(const char *searchPattern, const int maxNames)
* other one will select the 'real' fonts.
*/
- for (p = 0; p < patternsQt; p++)
+ for (int p = 0; p < patternsQt; p++)
{
xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen);
@@ -256,11 +252,9 @@ void nxagentListRemoteFonts(const char *searchPattern, const int maxNames)
nxagentListRemoteAddName(searchPattern, maxNames);
- for (i = 0; i < xLen; i++)
+ for (int i = 0; i < xLen; i++)
{
- q = 1;
-
- nxagentListRemoteAddName(xList[i], q);
+ nxagentListRemoteAddName(xList[i], 1);
}
XFreeFontNames(xList);
@@ -270,7 +264,7 @@ void nxagentListRemoteFonts(const char *searchPattern, const int maxNames)
fprintf(stderr, "nxagentListRemoteFonts: Printing remote font list.\n");
- for (i = 0; i < nxagentRemoteFontList.length; i++)
+ for (int i = 0; i < nxagentRemoteFontList.length; i++)
{
fprintf(stderr, "Font# %d, \"%s\"\n", i, nxagentRemoteFontList.list[i]->name);
}
@@ -353,9 +347,7 @@ void nxagentListRemoteAddName(const char *name, int status)
static void nxagentFreeRemoteFontList(nxagentFontList *listRec)
{
- int l;
-
- for (l = 0; l < listRec -> length; l++)
+ for (int l = 0; l < listRec -> length; l++)
{
if (listRec -> list[l])
{
@@ -857,7 +849,6 @@ static void nxagentFontDisconnect(FontPtr pFont, XID param1, void * param2)
{
nxagentPrivFont *privFont;
Bool *pBool = (Bool*)param2;
- int i;
if (pFont == NULL || !*pBool)
return;
@@ -869,7 +860,7 @@ static void nxagentFontDisconnect(FontPtr pFont, XID param1, void * param2)
(void *) pFont, privFont -> font_struct ? nxagentFont(pFont) : 0);
#endif
- for (i = 0; i < CACHE_INDEX; i++)
+ for (int i = 0; i < CACHE_INDEX; i++)
{
if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0)
{
@@ -1043,13 +1034,11 @@ static void nxagentFontReconnect(FontPtr pFont, XID param1, void * param2)
static void nxagentFreeCacheBeforeReconnect(void)
{
- int i;
-
#ifdef NXAGENT_RECONNECT_FONT_DEBUG
printFontCacheDump("nxagentFreeCacheBeforeReconnect");
#endif
- for (i = 0; i < CACHE_INDEX; i++)
+ for (int i = 0; i < CACHE_INDEX; i++)
{
if (CACHE_FSTRUCT(i))
{
@@ -1061,15 +1050,13 @@ static void nxagentFreeCacheBeforeReconnect(void)
static void nxagentCleanCacheAfterReconnect(void)
{
- int i, j;
int real_size = CACHE_INDEX;
- nxCacheFontEntryRecPtr swapEntryPtr;
#ifdef NXAGENT_RECONNECT_FONT_DEBUG
printFontCacheDump("nxagentCleanCacheAfterReconnect");
#endif
- for (i = 0; i < CACHE_INDEX; i++)
+ for (int i = 0; i < CACHE_INDEX; i++)
{
if(CACHE_FSTRUCT(i) == NULL)
{
@@ -1078,8 +1065,11 @@ static void nxagentCleanCacheAfterReconnect(void)
}
}
- for (i = 0; i < real_size; i++)
+ for (int i = 0; i < real_size; i++)
{
+ int j;
+ nxCacheFontEntryRecPtr swapEntryPtr;
+
/* Find - first bad occurrence if exist. */
while ((i < real_size) && CACHE_FSTRUCT(i)) i++;
@@ -1108,11 +1098,9 @@ static void nxagentCleanCacheAfterReconnect(void)
#ifdef NXAGENT_RECONNECT_FONT_DEBUG
static void printFontCacheDump(char* msg)
{
- int i;
-
fprintf(stderr, "%s - begin -\n", msg);
- for (i = 0; i < CACHE_INDEX; i++)
+ for (int i = 0; i < CACHE_INDEX; i++)
{
if (CACHE_FSTRUCT(i))
{
@@ -1129,7 +1117,6 @@ static void printFontCacheDump(char* msg)
Bool nxagentReconnectAllFonts(void *p0)
{
- int cid;
Bool fontSuccess = True;
reconnectFlexibility = *((int *) p0);
@@ -1147,7 +1134,7 @@ Bool nxagentReconnectAllFonts(void *p0)
FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT,
(FindResType) nxagentFontReconnect, &fontSuccess);
- for (cid = 0; cid < MAXCLIENTS; cid++)
+ for (int cid = 0; cid < MAXCLIENTS; cid++)
{
if (clients[cid])
{
@@ -1258,7 +1245,6 @@ static void nxagentFreeFailedToReconnectFonts(void)
Bool nxagentReconnectFailedFonts(void *p0)
{
- int i;
int attempt = 1;
const int maxAttempt = 5;
@@ -1312,7 +1298,7 @@ Bool nxagentReconnectFailedFonts(void *p0)
nxagentFreeRemoteFontList(&nxagentRemoteFontList);
nxagentListRemoteFonts("*", nxagentMaxFontNames);
- for(i = 0; i < nxagentFailedToReconnectFonts.index; i++)
+ for(int i = 0; i < nxagentFailedToReconnectFonts.index; i++)
{
fontSuccess = True;
@@ -1365,7 +1351,6 @@ Bool nxagentReconnectFailedFonts(void *p0)
Bool nxagentDisconnectAllFonts(void)
{
- int cid;
Bool fontSuccess = True;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG)
@@ -1384,7 +1369,7 @@ Bool nxagentDisconnectAllFonts(void)
FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT,
(FindResType) nxagentFontDisconnect, &fontSuccess);
- for(cid = 0; cid < MAXCLIENTS; cid++)
+ for(int cid = 0; cid < MAXCLIENTS; cid++)
{
if( clients[cid] && fontSuccess )
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index c8038955b..cff92ec48 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -1299,8 +1299,6 @@ static int nxagentRestoreKeyboardDeviceData(DeviceIntPtr devBackup, DeviceIntPtr
static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
{
- KbdFeedbackPtr k, knext;
-
if (!dev)
{
#ifdef PANIC
@@ -1336,7 +1334,7 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
if (dev->kbdfeed)
{
- for (k = dev->kbdfeed; k; k = knext)
+ for (KbdFeedbackPtr k = dev->kbdfeed, knext; k; k = knext)
{
knext = k->next;
#ifdef XKB
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c
index 35dcbc132..1f82e73dc 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c
@@ -138,12 +138,6 @@ ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global)
int oldSize;
CARD32 s;
- #ifdef NXAGENT_SERVER
-
- CARD32 c;
-
- #endif
-
tableEntries = hash->tableEntries + change;
hashSet = FindGlyphHashSet (tableEntries);
if (hashSet == hash->hashSet)
@@ -164,7 +158,7 @@ ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global)
#ifdef NXAGENT_SERVER
- c = hash->table[i].corruptedGlyph;
+ CARD32 c = hash->table[i].corruptedGlyph;
#endif
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
index 4ea7d2d73..e35d1e9bc 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
@@ -309,12 +309,6 @@ static PicturePtr createSourcePicture(void)
unsigned int totalPictureSize;
- DevUnion *ppriv;
-
- char *privPictureRecAddr;
-
- int i;
-
/*
* Compute size of entire PictureRect, plus privates.
*/
@@ -327,9 +321,9 @@ static PicturePtr createSourcePicture(void)
if (pPicture != NULL)
{
- ppriv = (DevUnion *) (pPicture + 1);
+ DevUnion *ppriv = (DevUnion *) (pPicture + 1);
- for (i = 0; i < picturePrivateCount; ++i)
+ for (int i = 0; i < picturePrivateCount; ++i)
{
/*
* Other privates are inaccessible.
@@ -338,7 +332,7 @@ static PicturePtr createSourcePicture(void)
ppriv[i].ptr = NULL;
}
- privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
+ char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
index 676a0aebb..653426ebb 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
@@ -700,7 +700,6 @@ static void nxagentPixmapMatchID(void *p0, XID x1, void *p2)
PixmapPtr nxagentPixmapPtr(Pixmap pixmap)
{
- int i;
struct nxagentPixmapPair pair;
if (pixmap == None)
@@ -714,7 +713,7 @@ PixmapPtr nxagentPixmapPtr(Pixmap pixmap)
FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP,
nxagentPixmapMatchID, &pair);
- for (i = 0; (pair.pMap == NULL) && (i < MAXCLIENTS); i++)
+ for (int i = 0; (pair.pMap == NULL) && (i < MAXCLIENTS); i++)
{
if (clients[i])
{
@@ -790,8 +789,8 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2)
Bool nxagentDisconnectAllPixmaps(void)
{
- int r = 1;
int i;
+ int r = 1;
#ifdef TEST
fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to iterate through pixmap resources.\n");
@@ -958,8 +957,6 @@ Bool nxagentReconnectAllPixmaps(void *p0)
{
Bool result = 1;
- int i;
-
#ifdef TEST
fprintf(stderr, "nxagentReconnectAllPixmaps: Going to recreate all pixmaps.\n");
#endif
@@ -991,7 +988,7 @@ Bool nxagentReconnectAllPixmaps(void *p0)
#endif
- for (i = 0, result = 1; i < MAXCLIENTS; result = 1, i++)
+ for (int i = 0, result = 1; i < MAXCLIENTS; result = 1, i++)
{
if (clients[i] != NULL)
{
@@ -1138,10 +1135,9 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
if (!integrity)
{
- int i;
char *p, *q;
- for (i = 0, p = image -> data, q = data; i < length; i++)
+ for (int i = 0, p = image -> data, q = data; i < length; i++)
{
if (p[i] != q[i])
{
@@ -1187,7 +1183,6 @@ Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap)
Bool nxagentCheckAllPixmapIntegrity(void)
{
- int i;
Bool imageIsGood = True;
#ifdef TEST
@@ -1197,7 +1192,7 @@ Bool nxagentCheckAllPixmapIntegrity(void)
FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP,
nxagentCheckOnePixmapIntegrity, &imageIsGood);
- for (i = 0; (i < MAXCLIENTS) && (imageIsGood); i++)
+ for (int i = 0; (i < MAXCLIENTS) && (imageIsGood); i++)
{
if (clients[i])
{
@@ -1630,11 +1625,10 @@ void nxagentPrintResourcePredicate(void *value, XID id, XID type, void *cdata)
void nxagentPrintResources(void)
{
Bool result;
- int i;
nxagentPrintResourceTypes();
- for (i = 0; i < MAXCLIENTS; i++)
+ for (int i = 0; i < MAXCLIENTS; i++)
{
if (clients[i])
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
index f50cd1295..c2611c194 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
@@ -120,12 +120,10 @@ static void nxagentPrintRootlessTopLevelWindowMap(void);
void nxagentPrintRootlessTopLevelWindowMap(void)
{
- int i;
-
fprintf(stderr, "nxagentPrintRootlessTopLevelWindowMap: Map size is [%d] num of entry [%d].\n",
topLevelParentMap.size, topLevelParentMap.next);
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
fprintf(stderr, "nxagentPrintRootlessTopLevelWindowMap: [%d] pWin at [%p] XID at [%ld].\n",
i, (void *) topLevelParentMap.elt[i].pWin, (long int) topLevelParentMap.elt[i].xid);
@@ -136,9 +134,7 @@ void nxagentPrintRootlessTopLevelWindowMap(void)
void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w)
{
- int i;
-
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
if (topLevelParentMap.elt[i].pWin == pWin)
{
@@ -181,9 +177,7 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w)
WindowPtr nxagentRootlessTopLevelWindow(Window w)
{
- int i;
-
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
if (w == topLevelParentMap.elt[i].xid)
{
@@ -196,9 +190,7 @@ WindowPtr nxagentRootlessTopLevelWindow(Window w)
void nxagentRootlessDelTopLevelWindow(WindowPtr pWin)
{
- int i;
-
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
if (pWin == topLevelParentMap.elt[i].pWin)
{
@@ -506,7 +498,6 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
/* FIXME: is it okay here to ignore malloc fails? */
unsigned long *buffer = malloc(nUnits * sizeof(*buffer));
int *input = value;
- int i;
if (buffer)
{
@@ -514,7 +505,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
export = True;
output = (char*) buffer;
- for (i = 0; i < nUnits; i++)
+ for (int i = 0; i < nUnits; i++)
{
buffer[i] = input[i];
}
@@ -644,7 +635,6 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
XlibAtom *atoms = malloc(nUnits * sizeof(*atoms));
Atom *input = value;
const char *atomName = NULL;
- int i;
int j = 0;
if (!atoms)
@@ -659,7 +649,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
export = True;
output = (char *) atoms;
- for (i = 0; i < nUnits; i++)
+ for (int i = 0; i < nUnits; i++)
{
/*
* Exporting the _NET_WM_PING property could
@@ -703,7 +693,6 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
XlibWindow *wind = malloc(nUnits * sizeof(*wind));
ClientPtr pClient = wClient(pWin);
WindowPtr pWindow;
- int i;
if (!wind)
{
@@ -717,7 +706,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
export = True;
output = (char*) wind;
- for (i = 0; i < nUnits; i++)
+ for (int i = 0; i < nUnits; i++)
{
pWindow = (WindowPtr)SecurityLookupWindow(input[i], pClient,
DixDestroyAccess);
@@ -774,15 +763,14 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
}
else if (mode == PropModeReplace)
{
- int n;
- char *data;
+ char * data = (char *) output;
XDeleteProperty(nxagentDisplay, nxagentWindow(pWin), propertyX);
- data = (char *) output;
-
while (nUnits > 0)
{
+ int n;
+
if ((format >> 3) * nUnits + sizeof(xChangePropertyReq) <
(MAX_REQUEST_SIZE << 2))
{
@@ -1055,7 +1043,6 @@ void nxagentImportProperty(Window window,
{
Atom *atoms = malloc(nitems * sizeof(Atom));
Atom *input = (Atom*) buffer;
- int i;
if (atoms == NULL)
{
@@ -1070,7 +1057,7 @@ void nxagentImportProperty(Window window,
import = True;
output = (char *) atoms;
- for (i = 0; i < nitems; i++)
+ for (int i = 0; i < nitems; i++)
{
atoms[i] = nxagentRemoteToLocalAtom(input[i]);
@@ -1088,7 +1075,6 @@ void nxagentImportProperty(Window window,
Window *input = (Window*) buffer;
Window *wind = malloc(nitems * sizeof(Window));
WindowPtr pWindow;
- int i;
if (!wind)
{
@@ -1102,7 +1088,7 @@ void nxagentImportProperty(Window window,
import = True;
output = (char*) wind;
- for (i = 0; i < nitems; i++)
+ for (int i = 0; i < nitems; i++)
{
pWindow = nxagentWindowPtr(input[i]);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index b5d133b42..147a3108d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -2143,8 +2143,6 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
Bool nxagentCloseScreen(ScreenPtr pScreen)
{
- int i;
-
#ifdef DEBUG
fprintf(stderr, "running nxagentCloseScreen()\n");
#endif
@@ -2157,7 +2155,7 @@ Bool nxagentCloseScreen(ScreenPtr pScreen)
* them again.
*/
- for (i = 0; i < pScreen->numDepths; i++)
+ for (int i = 0; i < pScreen->numDepths; i++)
{
#ifdef DEBUG
fprintf(stderr, "%s: freeing depth [%d] index [%d] vids [%p]\n", __func__, pScreen->allowedDepths[i].depth, i, (void*) pScreen->allowedDepths[i].vids);