Commit cb508b26 authored by Ulrich Sibiller's avatar Ulrich Sibiller

various scope improvements

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