aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/RdBitF.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-02 17:57:08 +0000
committermarha <marha@users.sourceforge.net>2010-11-02 17:57:08 +0000
commita8af7fec323ca1a7796fc9587796095fe3dcc954 (patch)
tree3296cb355b5fe935111b160e310f8bc156e6f0b7 /libX11/src/RdBitF.c
parente917c45e1fe37347084167de1b92dd10ee63bebf (diff)
downloadvcxsrv-a8af7fec323ca1a7796fc9587796095fe3dcc954.tar.gz
vcxsrv-a8af7fec323ca1a7796fc9587796095fe3dcc954.tar.bz2
vcxsrv-a8af7fec323ca1a7796fc9587796095fe3dcc954.zip
Use table lookup again for HexTable
Diffstat (limited to 'libX11/src/RdBitF.c')
-rw-r--r--libX11/src/RdBitF.c55
1 files changed, 19 insertions, 36 deletions
diff --git a/libX11/src/RdBitF.c b/libX11/src/RdBitF.c
index 07b47494b..e9a509c55 100644
--- a/libX11/src/RdBitF.c
+++ b/libX11/src/RdBitF.c
@@ -54,41 +54,24 @@ from The Open Group.
#define MAX_SIZE 255
/* shared data for the image read/parse logic */
-/*
-static const short hexTable[256] = {
- ['0'] = 0, ['1'] = 1,
- ['2'] = 2, ['3'] = 3,
- ['4'] = 4, ['5'] = 5,
- ['6'] = 6, ['7'] = 7,
- ['8'] = 8, ['9'] = 9,
- ['A'] = 10, ['B'] = 11,
- ['C'] = 12, ['D'] = 13,
- ['E'] = 14, ['F'] = 15,
- ['a'] = 10, ['b'] = 11,
- ['c'] = 12, ['d'] = 13,
- ['e'] = 14, ['f'] = 15,
-
- [' '] = -1, [','] = -1,
- ['}'] = -1, ['\n'] = -1,
- ['\t'] = -1
+static const signed char hexTable[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ ,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0
+ , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0
+ , 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-*/
-short hexTable(unsigned char Char)
-{
- if (Char<'0')
- return -1;
- if (Char<='9')
- return Char-'0';
- if (Char<'A')
- return -1;
- if (Char<='F')
- return Char-'A'+10;
- if (Char<'a')
- return -1;
- if (Char<='f')
- return Char-'a'+10;
- return -1;
-}
/*
* read next hex value in the input stream, return -1 if EOF
@@ -114,9 +97,9 @@ NextInt (
/* trim high bits, check type and accumulate */
ch &= 0xff;
if (isascii(ch) && isxdigit(ch)) {
- value = (value << 4) + hexTable(ch);
+ value = (value << 4) + hexTable[ch];
gotone++;
- } else if ((hexTable(ch)) < 0 && gotone)
+ } else if ((hexTable[ch]) < 0 && gotone)
done++;
}
}