@@ -85,7 +85,9 @@ bool readfile(const char * fname, const char * basepath, char ** data, int * len
85
85
#define isq (n ) (((0x2227 ^ (0x0101 * (n))) - 0x0101UL ) & ~(0x2227 ^ (0x0101 * (n))) & 0x8080UL )
86
86
#define isqp (n ) (((0x22272829 ^ (0x01010101 * (n))) - 0x01010101UL ) & ~(0x22272829 ^ (0x01010101 * (n))) & 0x80808080UL )
87
87
88
- const bool qparlut[256 ] = {
88
+ // RPG Hacker: Only index this with ASCII characters.
89
+ // Anything else doesn't make sense, anyways.
90
+ const bool qparlut[128 ] = {
89
91
1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
90
92
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
91
93
0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -94,14 +96,6 @@ const bool qparlut[256] = {
94
96
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
95
97
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
96
98
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
97
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
98
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
99
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
100
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
101
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
102
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
103
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
104
- 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
105
99
};
106
100
107
101
// this will leave the last char found as the one pointed at
@@ -261,7 +255,7 @@ bool confirmqpar(const char * str)
261
255
{
262
256
// todo fully optimize
263
257
int par = 0 ;
264
- while (!qparlut[*str]) str++;
258
+ while (( unsigned char )*str >= 128 || !qparlut[*str]) str++;
265
259
while (*str)
266
260
{
267
261
if (*str == ' "' )
@@ -281,7 +275,7 @@ bool confirmqpar(const char * str)
281
275
par += 1 - ((*str++ - ' (' ) << 1 );
282
276
if (par < 0 ) return false ;
283
277
}
284
- while (!qparlut[*str]) str++;
278
+ while (( unsigned char )*str >= 128 || !qparlut[*str]) str++;
285
279
}
286
280
return !par;
287
281
}
0 commit comments