Commit 42fb6833 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Screen.c: scope improvements

parent f534a486
...@@ -837,24 +837,10 @@ void freeDepths(DepthPtr depths, int num) ...@@ -837,24 +837,10 @@ void freeDepths(DepthPtr depths, int num)
SAFE_free(depths); SAFE_free(depths);
} }
Bool nxagentOpenScreen(ScreenPtr pScreen, Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
int argc, char *argv[])
{ {
VisualPtr visuals;
DepthPtr depths;
int numVisuals, numDepths;
int depthIndex;
Bool resetAgentPosition = False; Bool resetAgentPosition = False;
VisualID defaultVisual;
int rootDepth;
void * pFrameBufferBits;
int bitsPerPixel;
int sizeInBytes;
int defaultVisualIndex = 0;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentOpenScreen: Called for screen index [%d].\n", fprintf(stderr, "nxagentOpenScreen: Called for screen index [%d].\n",
pScreen->myNum); pScreen->myNum);
...@@ -1161,7 +1147,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, ...@@ -1161,7 +1147,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
* Initialize the depths. * Initialize the depths.
*/ */
depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec)); DepthPtr depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec));
for (int i = 0; i < nxagentNumDepths; i++) for (int i = 0; i < nxagentNumDepths; i++)
{ {
...@@ -1179,10 +1165,12 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, ...@@ -1179,10 +1165,12 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
"[%d].\n", nxagentNumVisuals); "[%d].\n", nxagentNumVisuals);
#endif #endif
numVisuals = 0; int numVisuals = 0;
numDepths = nxagentNumDepths; 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++) for (int i = 0; i < nxagentNumVisuals; i++)
{ {
...@@ -1231,10 +1219,9 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, ...@@ -1231,10 +1219,9 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
if (j < numVisuals) if (j < numVisuals)
continue; continue;
} }
depthIndex = UNDEFINED; int depthIndex = UNDEFINED;
#if defined(DEBUG) || defined(DEBUG_COLORMAP) #if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Added visual [%lu].\n" , fprintf(stderr, "Debug: Added visual [%lu].\n" ,
...@@ -1292,12 +1279,13 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, ...@@ -1292,12 +1279,13 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
visuals[defaultVisualIndex].nplanes); visuals[defaultVisualIndex].nplanes);
#endif #endif
defaultVisual = visuals[defaultVisualIndex].vid; VisualID defaultVisual = visuals[defaultVisualIndex].vid;
rootDepth = visuals[defaultVisualIndex].nplanes; int rootDepth = visuals[defaultVisualIndex].nplanes;
nxagentInitAlphaVisual(); nxagentInitAlphaVisual();
bitsPerPixel = nxagentBitsPerPixel(rootDepth); int bitsPerPixel = nxagentBitsPerPixel(rootDepth);
int sizeInBytes;
if (bitsPerPixel == 1) if (bitsPerPixel == 1)
{ {
...@@ -1313,7 +1301,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, ...@@ -1313,7 +1301,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
"[%d] bitsPerPixel [%d] sizeInBytes [%d]\n", rootDepth, bitsPerPixel, sizeInBytes); "[%d] bitsPerPixel [%d] sizeInBytes [%d]\n", rootDepth, bitsPerPixel, sizeInBytes);
#endif #endif
pFrameBufferBits = (char *) malloc(sizeInBytes); void * pFrameBufferBits = (char *) malloc(sizeInBytes);
if (!pFrameBufferBits) if (!pFrameBufferBits)
{ {
......
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