PAD
};
- static const char decode[256] =
+ static const unsigned char decode[256] =
{
WSP,INV,INV,INV,INV,INV,INV,INV,INV,WSP,WSP,INV,WSP,WSP,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
const char *p;
for ( p = src; srcLen; p++, srcLen-- )
{
- const char c = decode[(int)*p]; // cast just to suppress warnings
+ const unsigned char c = decode[wx_static_cast(unsigned char, *p)];
switch ( c )
{
case WSP:
// force the loop to stop and an error to be returned
n = -1;
- srcLen = 0;
+ srcLen = 1;
break;
case PAD:
{
// force the loop terminate with an error
n = -1;
- srcLen = 0;
+ srcLen = 1;
}
break;
{
// nothing is allowed after the end so provoke error return
n = -1;
- srcLen = 0;
+ srcLen = 1;
break;
}
if ( n )
{
if ( posErr )
- *posErr = p - src;
+ {
+ // notice that the error was on a previous position as we did one
+ // extra "p++" in the loop line after it
+ *posErr = p - src - 1;
+ }
return wxCONV_FAILED;
}