From 5db6217ccdb03f5841498f6c69e338da7f06c04b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 31 Oct 2019 01:28:18 +0100 Subject: Visual.c: code improvements/desginated initializers --- nx-X11/programs/Xserver/hw/nxagent/Visual.c | 36 +++++++++++------------------ 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Visual.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Visual.c b/nx-X11/programs/Xserver/hw/nxagent/Visual.c index a29560d43..ea73ce50e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Visual.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Visual.c @@ -64,19 +64,17 @@ Visual nxagentAlphaVisual; Visual *nxagentVisual(VisualPtr pVisual) { - XVisualInfo visual; - - int i; - - visual.class = pVisual->class; - visual.bits_per_rgb = pVisual->bitsPerRGBValue; - visual.colormap_size = pVisual->ColormapEntries; - visual.depth = pVisual->nplanes; - visual.red_mask = pVisual->redMask; - visual.green_mask = pVisual->greenMask; - visual.blue_mask = pVisual->blueMask; - - for (i = 0; i < nxagentNumVisuals; i++) + XVisualInfo visual = { + .class = pVisual->class, + .bits_per_rgb = pVisual->bitsPerRGBValue, + .colormap_size = pVisual->ColormapEntries, + .depth = pVisual->nplanes, + .red_mask = pVisual->redMask, + .green_mask = pVisual->greenMask, + .blue_mask = pVisual->blueMask + }; + + for (int i = 0; i < nxagentNumVisuals; i++) { if (nxagentCompareVisuals(visual, nxagentVisuals[i]) == 1) { @@ -89,9 +87,7 @@ Visual *nxagentVisual(VisualPtr pVisual) Visual *nxagentVisualFromID(ScreenPtr pScreen, VisualID visual) { - int i; - - for (i = 0; i < pScreen->numVisuals; i++) + for (int i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].vid == visual) { @@ -104,9 +100,7 @@ Visual *nxagentVisualFromID(ScreenPtr pScreen, VisualID visual) Colormap nxagentDefaultVisualColormap(Visual *visual) { - int i; - - for (i = 0; i < nxagentNumVisuals; i++) + for (int i = 0; i < nxagentNumVisuals; i++) { if (nxagentVisuals[i].visual == visual) { @@ -126,9 +120,7 @@ Colormap nxagentDefaultVisualColormap(Visual *visual) Visual *nxagentVisualFromDepth(ScreenPtr pScreen, int depth) { - int i; - - for (i = 0; i < pScreen->numVisuals; i++) + for (int i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].nplanes == depth) { -- cgit v1.2.3 From 1bb0e999eb7ad6bbc6c470a2ecf833c22500b5c1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 31 Oct 2019 01:28:51 +0100 Subject: Visual.c: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/Visual.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Visual.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Visual.c b/nx-X11/programs/Xserver/hw/nxagent/Visual.c index ea73ce50e..43f582f16 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Visual.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Visual.c @@ -112,10 +112,9 @@ Colormap nxagentDefaultVisualColormap(Visual *visual) } /* - * This is currently unused. It should serve - * the scope of matching a visual whenever - * a drawable has a different depth than the - * real display. + * This is currently unused. It should serve the scope of matching a + * visual whenever a drawable has a different depth than the real + * display. */ Visual *nxagentVisualFromDepth(ScreenPtr pScreen, int depth) @@ -132,9 +131,8 @@ Visual *nxagentVisualFromDepth(ScreenPtr pScreen, int depth) } /* - * Create a fake 32 bits depth visual and - * initialize it based on the endianness - * of the remote display. + * Create a fake 32 bits depth visual and initialize it based on the + * endianness of the remote display. */ void nxagentInitAlphaVisual(void) @@ -142,9 +140,8 @@ void nxagentInitAlphaVisual(void) nxagentAlphaVisual.visualid = XAllocID(nxagentDisplay); /* - * Color masks are referred to bits inside - * the pixel. This is independent from the - * endianness. + * Color masks are referred to bits inside the pixel. This is + * independent from the endianness. */ nxagentAlphaVisual.red_mask = 0x00ff0000; -- cgit v1.2.3 From 22f01d23a0a324d8a7a74a8e688ff05caf828f6e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 31 Oct 2019 01:29:11 +0100 Subject: Visual.{ch}: disable unused code --- nx-X11/programs/Xserver/hw/nxagent/Visual.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Visual.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Visual.c b/nx-X11/programs/Xserver/hw/nxagent/Visual.c index 43f582f16..6be82148f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Visual.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Visual.c @@ -111,6 +111,7 @@ Colormap nxagentDefaultVisualColormap(Visual *visual) return None; } +#if 0 /* * This is currently unused. It should serve the scope of matching a * visual whenever a drawable has a different depth than the real @@ -129,6 +130,7 @@ Visual *nxagentVisualFromDepth(ScreenPtr pScreen, int depth) return NULL; } +#endif /* * Create a fake 32 bits depth visual and initialize it based on the -- cgit v1.2.3