diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2019-07-25 23:58:30 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2019-09-29 17:10:05 +0200 |
commit | fc7cb8657f285ef46d0f1b16abcfec448246c4f5 (patch) | |
tree | 7dcee3e4e73b08e5813af7469087e1cb57beec2d /nx-X11/programs | |
parent | f8a1f79b30f5996109646d890b39d9453342a7b9 (diff) | |
download | nx-libs-fc7cb8657f285ef46d0f1b16abcfec448246c4f5.tar.gz nx-libs-fc7cb8657f285ef46d0f1b16abcfec448246c4f5.tar.bz2 nx-libs-fc7cb8657f285ef46d0f1b16abcfec448246c4f5.zip |
Pixels.c: scope improvements
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Pixels.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixels.c b/nx-X11/programs/Xserver/hw/nxagent/Pixels.c index e59ef97ab..93038eab6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixels.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixels.c @@ -63,10 +63,6 @@ int nxagentUniquePixels(XImage *image) int elements = PIXEL_ELEMENTS; int unique = 0; - int total; - int ratio; - int step; - int last = -1; const char *next = image -> data; @@ -80,9 +76,9 @@ int nxagentUniquePixels(XImage *image) * Take at most 256 pixels from the image. */ - total = image -> width * image -> height; + int total = image -> width * image -> height; - step = total / elements; + int step = total / elements; if (step < PIXEL_STEP) { @@ -231,7 +227,7 @@ int nxagentUniquePixels(XImage *image) #endif } - ratio = unique * 100 / elements; + int ratio = unique * 100 / elements; #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Found [%d] unique pixels out of [%d] with ratio [%d%%].\n", @@ -267,13 +263,11 @@ unsigned int Get16(const char *buffer, int order) unsigned int Get24(const char *buffer, int order) { - int i; - const char *next = (order == MSBFirst ? buffer : buffer + 2); unsigned int result = 0; - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { result <<= 8; @@ -294,13 +288,11 @@ unsigned int Get24(const char *buffer, int order) unsigned int Get32(const char *buffer, int order) { - int i; - const char *next = (order == MSBFirst ? buffer : buffer + 3); unsigned int result = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { result <<= 8; @@ -341,13 +333,11 @@ void Put16(unsigned int value, char *buffer, int order) void Put24(unsigned int value, char *buffer, int order) { - int i; - if (order == MSBFirst) { buffer += 2; - for (i = 3; i > 0; i--) + for (int i = 3; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); @@ -356,7 +346,7 @@ void Put24(unsigned int value, char *buffer, int order) } else { - for (i = 3; i > 0; i--) + for (int i = 3; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); @@ -367,13 +357,11 @@ void Put24(unsigned int value, char *buffer, int order) void Put32(unsigned int value, char *buffer, int order) { - int i; - if (order == MSBFirst) { buffer += 3; - for (i = 4; i > 0; i--) + for (int i = 4; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); @@ -382,7 +370,7 @@ void Put32(unsigned int value, char *buffer, int order) } else { - for (i = 4; i > 0; i--) + for (int i = 4; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); |