static int GMQCC_WARN lex_finish_string(lex_file *lex, int quote)
{
- uchar_t chr;
+ utf8ch_t chr = 0;
int ch = 0;
int nextch;
bool hex;
}
}
if (OPTS_FLAG(UTF8) && chr >= 128) {
- u8len = u8_fromchar(chr, u8buf, sizeof(u8buf));
+ u8len = utf8_from(u8buf, chr);
if (!u8len)
ch = 0;
else {
lex->column += u8len;
for (uc = 0; uc < u8len; ++uc)
lex_tokench(lex, u8buf[uc]);
- /* the last character will be inserted with the tokench() call
+ /*
+ * the last character will be inserted with the tokench() call
* below the switch
*/
ch = u8buf[uc];
lex_endtoken(lex);
lex->tok.ttype = TOKEN_CHARCONST;
- /* It's a vector if we can successfully scan 3 floats */
-#ifdef _MSC_VER
- if (sscanf_s(lex->tok.value, " %f %f %f ",
- &lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
-#else
- if (sscanf(lex->tok.value, " %f %f %f ",
+
+ /* It's a vector if we can successfully scan 3 floats */
+ if (platform_sscanf(lex->tok.value, " %f %f %f ",
&lex->tok.constval.v.x, &lex->tok.constval.v.y, &lex->tok.constval.v.z) == 3)
-#endif
{
lex->tok.ttype = TOKEN_VECTORCONST;
else
{
if (!lex->flags.preprocessing && strlen(lex->tok.value) > 1) {
- uchar_t u8char;
+ utf8ch_t u8char;
/* check for a valid utf8 character */
- if (!OPTS_FLAG(UTF8) || !u8_analyze(lex->tok.value, NULL, NULL, &u8char, 8)) {
+ if (!OPTS_FLAG(UTF8) || !utf8_to(&u8char, (const unsigned char *)lex->tok.value, 8)) {
if (lexwarn(lex, WARN_MULTIBYTE_CHARACTER,
( OPTS_FLAG(UTF8) ? "invalid multibyte character sequence `%s`"
: "multibyte character: `%s`" ),