version 1.43, 2021/06/20 18:41:27 |
version 1.44, 2021/06/20 18:44:48 |
|
|
lex_wide_character_constant(void) |
lex_wide_character_constant(void) |
{ |
{ |
static char buf[MB_LEN_MAX + 1]; |
static char buf[MB_LEN_MAX + 1]; |
size_t i, imax; |
size_t n, nmax; |
int c; |
int c; |
wchar_t wc; |
wchar_t wc; |
|
|
imax = MB_CUR_MAX; |
nmax = MB_CUR_MAX; |
|
|
i = 0; |
n = 0; |
while ((c = get_escaped_char('\'')) >= 0) { |
while ((c = get_escaped_char('\'')) >= 0) { |
if (i < imax) |
if (n < nmax) |
buf[i] = (char)c; |
buf[n] = (char)c; |
i++; |
n++; |
} |
} |
|
|
wc = 0; |
wc = 0; |
Line 880 lex_wide_character_constant(void) |
|
Line 880 lex_wide_character_constant(void) |
|
if (c == -2) { |
if (c == -2) { |
/* unterminated character constant */ |
/* unterminated character constant */ |
error(253); |
error(253); |
} else if (i == 0) { |
} else if (n == 0) { |
/* empty character constant */ |
/* empty character constant */ |
error(73); |
error(73); |
} else if (i > imax) { |
} else if (n > nmax) { |
i = imax; |
n = nmax; |
/* too many characters in character constant */ |
/* too many characters in character constant */ |
error(71); |
error(71); |
} else { |
} else { |
buf[i] = '\0'; |
buf[n] = '\0'; |
(void)mbtowc(NULL, NULL, 0); |
(void)mbtowc(NULL, NULL, 0); |
if (mbtowc(&wc, buf, imax) < 0) |
if (mbtowc(&wc, buf, nmax) < 0) |
/* invalid multibyte character */ |
/* invalid multibyte character */ |
error(291); |
error(291); |
} |
} |