diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2019-07-25 23:53:57 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2019-09-29 17:10:05 +0200 |
commit | f8a1f79b30f5996109646d890b39d9453342a7b9 (patch) | |
tree | 51f090233bbc9b71fbb7eb67dc398b599806d1c9 | |
parent | 8f609404caa511a464207507129de586d325b3d9 (diff) | |
download | nx-libs-f8a1f79b30f5996109646d890b39d9453342a7b9.tar.gz nx-libs-f8a1f79b30f5996109646d890b39d9453342a7b9.tar.bz2 nx-libs-f8a1f79b30f5996109646d890b39d9453342a7b9.zip |
Colormap.c: scope improvements
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 33b0738ec..7fa006539 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -187,9 +187,7 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr) { nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *) ptr; - int i; - - for (i = 0; i < icws->numCmapIDs; i++) + for (int i = 0; i < icws->numCmapIDs; i++) if (SEARCH_PREDICATE) { icws->numWindows++; return WT_DONTWALKCHILDREN; @@ -201,9 +199,8 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr) static int nxagentGetInstalledColormapWindows(WindowPtr pWin, void * ptr) { nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *)ptr; - int i; - for (i = 0; i < icws->numCmapIDs; i++) + for (int i = 0; i < icws->numCmapIDs; i++) if (SEARCH_PREDICATE) { icws->windows[icws->index++] = nxagentWindow(pWin); return WT_DONTWALKCHILDREN; @@ -262,10 +259,9 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) #ifdef _XSERVER64 { - int i; Window64 *windows = (Window64 *)malloc(numWindows * sizeof(Window64)); - for(i = 0; i < numWindows; ++i) + for(int i = 0; i < numWindows; ++i) windows[i] = icws.windows[i]; XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], windows, numWindows); @@ -347,17 +343,14 @@ void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen) void nxagentDirectInstallColormaps(ScreenPtr pScreen) { - int i, n; Colormap pCmapIDs[MAXCMAPS]; if (!nxagentDoDirectColormaps) return; - n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); - - for (i = 0; i < n; i++) { - ColormapPtr pCmap; + int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); - pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); + for (int i = 0; i < n; i++) { + ColormapPtr pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); if (pCmap) XInstallColormap(nxagentDisplay, nxagentColormap(pCmap)); } @@ -365,14 +358,13 @@ void nxagentDirectInstallColormaps(ScreenPtr pScreen) void nxagentDirectUninstallColormaps(ScreenPtr pScreen) { - int i, n; Colormap pCmapIDs[MAXCMAPS]; if (!nxagentDoDirectColormaps) return; - n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); + int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); - for (i = 0; i < n; i++) { + for (int i = 0; i < n; i++) { ColormapPtr pCmap; pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); @@ -429,7 +421,6 @@ int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds) if (nxagentInstalledDefaultColormap) { *pCmapIds = InstalledMaps[pScreen->myNum]->mid; - return 1; } else @@ -443,10 +434,9 @@ void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors) if (pCmap->pVisual->class & DynamicClass) #ifdef _XSERVER64 { - int i; XColor *pColors64 = (XColor *)malloc(nColors * sizeof(XColor) ); - for(i = 0; i < nColors; ++i) + for(int i = 0; i < nColors; ++i) { pColors64[i].pixel = pColors[i].pixel; pColors64[i].red = pColors[i].red; |