Fix casting problems in TextParsers breaking TrimString for non-ASCII (bug 3800, r+a12=dvander)
This commit is contained in:
parent
5096aef6e7
commit
f74380b3e9
@ -48,7 +48,7 @@ static int g_ws_chartable[255] = {0};
|
||||
|
||||
bool TextParsers::IsWhitespace(const char *stream)
|
||||
{
|
||||
return g_ws_chartable[(unsigned)*stream] == 1;
|
||||
return g_ws_chartable[(unsigned char)*stream] == 1;
|
||||
}
|
||||
|
||||
TextParsers::TextParsers()
|
||||
@ -508,7 +508,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
|
||||
else
|
||||
{
|
||||
/* Check if we're whitespace or not */
|
||||
if (!g_ws_chartable[(unsigned)c])
|
||||
if (!g_ws_chartable[(unsigned char)c])
|
||||
{
|
||||
bool restage = false;
|
||||
/* Check various special tokens:
|
||||
@ -823,7 +823,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
***************************************************/
|
||||
|
||||
/* First strip beginning whitespace */
|
||||
while (*ptr != '\0' && g_ws_chartable[(unsigned)*ptr] != 0)
|
||||
while (*ptr != '\0' && g_ws_chartable[(unsigned char)*ptr] != 0)
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
@ -876,7 +876,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
/* Lastly, strip ending whitespace off */
|
||||
for (size_t i=len-1; i>=0 && i<len; i--)
|
||||
{
|
||||
if (g_ws_chartable[(unsigned)ptr[i]])
|
||||
if (g_ws_chartable[(unsigned char)ptr[i]])
|
||||
{
|
||||
ptr[i] = '\0';
|
||||
len--;
|
||||
@ -917,7 +917,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
||||
}
|
||||
} else {
|
||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0);
|
||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
|
||||
}
|
||||
if (!alnum)
|
||||
{
|
||||
@ -970,12 +970,12 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
||||
}
|
||||
} else {
|
||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0);
|
||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
|
||||
}
|
||||
|
||||
if (!alnum)
|
||||
{
|
||||
if (g_ws_chartable[(unsigned)c])
|
||||
if (g_ws_chartable[(unsigned char)c])
|
||||
{
|
||||
/* if it's a space, keep track of the first occurring space */
|
||||
if (!first_space)
|
||||
@ -1014,7 +1014,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
if (val_ptr)
|
||||
{
|
||||
/* eat up spaces! there shouldn't be any h*/
|
||||
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned)*val_ptr] != 0)
|
||||
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned char)*val_ptr] != 0)
|
||||
{
|
||||
val_ptr++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user