diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-05-26 00:53:32 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-10-17 22:38:05 +0200 |
commit | 42fb683315d1472e7aeec6cc98d453d6663803f4 (patch) | |
tree | 60047f9e5a81b8eab64411e489993656ac2d99a8 /nx-X11 | |
parent | f534a48601a2b239db48ebb8b984f2951c57dc3e (diff) | |
download | nx-libs-42fb683315d1472e7aeec6cc98d453d6663803f4.tar.gz nx-libs-42fb683315d1472e7aeec6cc98d453d6663803f4.tar.bz2 nx-libs-42fb683315d1472e7aeec6cc98d453d6663803f4.zip |
Screen.c: scope improvements
Diffstat (limited to 'nx-X11')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Screen.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 5c543da19..98add8add 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -837,24 +837,10 @@ void freeDepths(DepthPtr depths, int num) SAFE_free(depths); } -Bool nxagentOpenScreen(ScreenPtr pScreen, - int argc, char *argv[]) +Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) { - VisualPtr visuals; - DepthPtr depths; - int numVisuals, numDepths; - int depthIndex; Bool resetAgentPosition = False; - VisualID defaultVisual; - int rootDepth; - - void * pFrameBufferBits; - int bitsPerPixel; - int sizeInBytes; - - int defaultVisualIndex = 0; - #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Called for screen index [%d].\n", pScreen->myNum); @@ -1161,7 +1147,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, * Initialize the depths. */ - depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec)); + DepthPtr depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec)); for (int i = 0; i < nxagentNumDepths; i++) { @@ -1179,10 +1165,12 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, "[%d].\n", nxagentNumVisuals); #endif - numVisuals = 0; - numDepths = nxagentNumDepths; + int numVisuals = 0; + int numDepths = nxagentNumDepths; - visuals = (VisualPtr) malloc(nxagentNumVisuals * sizeof(VisualRec)); + VisualPtr visuals = (VisualPtr) malloc(nxagentNumVisuals * sizeof(VisualRec)); + + int defaultVisualIndex = 0; for (int i = 0; i < nxagentNumVisuals; i++) { @@ -1231,10 +1219,9 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, if (j < numVisuals) continue; - } - depthIndex = UNDEFINED; + int depthIndex = UNDEFINED; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Added visual [%lu].\n" , @@ -1292,12 +1279,13 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, visuals[defaultVisualIndex].nplanes); #endif - defaultVisual = visuals[defaultVisualIndex].vid; - rootDepth = visuals[defaultVisualIndex].nplanes; + VisualID defaultVisual = visuals[defaultVisualIndex].vid; + int rootDepth = visuals[defaultVisualIndex].nplanes; nxagentInitAlphaVisual(); - bitsPerPixel = nxagentBitsPerPixel(rootDepth); + int bitsPerPixel = nxagentBitsPerPixel(rootDepth); + int sizeInBytes; if (bitsPerPixel == 1) { @@ -1313,7 +1301,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, "[%d] bitsPerPixel [%d] sizeInBytes [%d]\n", rootDepth, bitsPerPixel, sizeInBytes); #endif - pFrameBufferBits = (char *) malloc(sizeInBytes); + void * pFrameBufferBits = (char *) malloc(sizeInBytes); if (!pFrameBufferBits) { |