mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-08 06:40:11 +08:00
Fix get_tok_str wrt wide characters
Fixes both, character constants and string literals.
This commit is contained in:
parent
deb410710c
commit
5fd6f7bd44
6
tcc.c
6
tcc.c
@ -1770,8 +1770,9 @@ char *get_tok_str(int v, CValue *cv)
|
|||||||
/* XXX: not quite exact, but only useful for testing */
|
/* XXX: not quite exact, but only useful for testing */
|
||||||
sprintf(p, "%Lu", cv->ull);
|
sprintf(p, "%Lu", cv->ull);
|
||||||
break;
|
break;
|
||||||
case TOK_CCHAR:
|
|
||||||
case TOK_LCHAR:
|
case TOK_LCHAR:
|
||||||
|
cstr_ccat(&cstr_buf, 'L');
|
||||||
|
case TOK_CCHAR:
|
||||||
cstr_ccat(&cstr_buf, '\'');
|
cstr_ccat(&cstr_buf, '\'');
|
||||||
add_char(&cstr_buf, cv->i);
|
add_char(&cstr_buf, cv->i);
|
||||||
cstr_ccat(&cstr_buf, '\'');
|
cstr_ccat(&cstr_buf, '\'');
|
||||||
@ -1784,8 +1785,9 @@ char *get_tok_str(int v, CValue *cv)
|
|||||||
add_char(&cstr_buf, ((unsigned char *)cstr->data)[i]);
|
add_char(&cstr_buf, ((unsigned char *)cstr->data)[i]);
|
||||||
cstr_ccat(&cstr_buf, '\0');
|
cstr_ccat(&cstr_buf, '\0');
|
||||||
break;
|
break;
|
||||||
case TOK_STR:
|
|
||||||
case TOK_LSTR:
|
case TOK_LSTR:
|
||||||
|
cstr_ccat(&cstr_buf, 'L');
|
||||||
|
case TOK_STR:
|
||||||
cstr = cv->cstr;
|
cstr = cv->cstr;
|
||||||
cstr_ccat(&cstr_buf, '\"');
|
cstr_ccat(&cstr_buf, '\"');
|
||||||
if (v == TOK_STR) {
|
if (v == TOK_STR) {
|
||||||
|
Loading…
Reference in New Issue
Block a user