Silence the assert in NUMERIC_EVALUATOR on windows due to unicode

The reality is we parsing potentially unicode strings, char by char with the ascii functions like isdigit.
It's kind of broken already but at least I can make the assert go away lol
This commit is contained in:
Marek Roszko 2024-04-13 15:04:52 -04:00
parent 02ec894b83
commit c1afade6f9
1 changed files with 6 additions and 4 deletions

View File

@ -176,7 +176,7 @@ void NUMERIC_EVALUATOR::newString( const wxString& aString )
Clear();
m_originalText = aString;
m_token.input = aString.mb_str();
m_token.input = aString.utf8_str();
m_token.inputLen = strlen( m_token.input );
m_token.outputLen = std::max<std::size_t>( 64, m_token.inputLen + 1 );
m_token.pos = 0;
@ -272,8 +272,9 @@ NUMERIC_EVALUATOR::Token NUMERIC_EVALUATOR::getToken()
m_token.token[ idx++ ] = ch;
}
ch = m_token.input[ ++m_token.pos ];
} while( isdigit( ch ) || isDecimalSeparator( ch ) );
ch = m_token.input[++m_token.pos];
// the below static cast is to avoid partial unicode chars triggering an assert in isdigit on msvc
} while( isdigit( static_cast<unsigned char>( ch ) ) || isDecimalSeparator( ch ) );
m_token.token[ idx ] = 0;
};
@ -373,8 +374,9 @@ NUMERIC_EVALUATOR::Token NUMERIC_EVALUATOR::getToken()
{
/* End of input */
}
else if( isdigit( ch ) || isDecimalSeparator( ch ) )
else if( isdigit( static_cast<unsigned char>( ch ) ) || isDecimalSeparator( ch ) )
{
// the above static cast is to avoid partial unicode chars triggering an assert in isdigit on msvc
// VALUE
extractNumber( &siScaler );
retval.token = VALUE;