mirror of
https://git.zap.org.au/git/trader.git
synced 2025-01-03 14:57:41 -05:00
Be a little more diligent when it comes to wchar_t vs. wint_t
The %lc format is actually of type wint_t, according to printf(3), not wchar_t, even though these are of the same underlying type on most (all?) platforms.
This commit is contained in:
parent
df3ccfd583
commit
4ca99815b8
@ -290,7 +290,7 @@ static int ask_number_players (void)
|
||||
done = true;
|
||||
} else if (wcschr(keycode_contgame, key) != NULL) {
|
||||
left(curwin, getcury(curwin), getcurx(curwin), A_BOLD,
|
||||
0, 0, 1, "%lc", *keycode_contgame);
|
||||
0, 0, 1, "%lc", (wint_t) *keycode_contgame);
|
||||
wrefresh(curwin);
|
||||
|
||||
ret = 0;
|
||||
|
11
src/intf.c
11
src/intf.c
@ -156,7 +156,7 @@ typedef struct txwin {
|
||||
enum argument_type {
|
||||
TYPE_NONE, // No type yet assigned
|
||||
TYPE_CHAR, // char
|
||||
TYPE_WCHAR, // wchar_t
|
||||
TYPE_WCHAR, // wint_t
|
||||
TYPE_INT, // int
|
||||
TYPE_LONGINT, // long int
|
||||
TYPE_DOUBLE, // double
|
||||
@ -168,7 +168,7 @@ struct argument {
|
||||
enum argument_type a_type;
|
||||
union a {
|
||||
char a_char;
|
||||
wchar_t a_wchar;
|
||||
wint_t a_wchar;
|
||||
int a_int;
|
||||
long int a_longint;
|
||||
double a_double;
|
||||
@ -1092,9 +1092,10 @@ int mkchstr_parse (const wchar_t *restrict format,
|
||||
break;
|
||||
|
||||
case TYPE_WCHAR:
|
||||
format_arg->a.a_wchar = (wchar_t) (sizeof(wchar_t) < sizeof(int) ?
|
||||
va_arg(args, int) :
|
||||
va_arg(args, wchar_t));
|
||||
format_arg->a.a_wchar =
|
||||
(wint_t) (sizeof(wint_t) < sizeof(int) ?
|
||||
va_arg(args, int) :
|
||||
va_arg(args, wint_t));
|
||||
break;
|
||||
|
||||
case TYPE_INT:
|
||||
|
@ -365,7 +365,7 @@ extern int txdlgbox (int maxlines, int ncols, int begin_y, int begin_x,
|
||||
%% - Insert the ASCII percent sign (ASCII code U+0025)
|
||||
|
||||
%c - Insert the next parameter as a character (type char)
|
||||
%lc - Insert the next parameter as a wide char (type wchar_t)
|
||||
%lc - Insert the next parameter as a wide char (type wint_t)
|
||||
%s - Insert the next parameter as a string (type char *)
|
||||
%ls - Insert the next parameter as a wide string (type wchar_t *)
|
||||
%d - Insert the next parameter as an integer (type int)
|
||||
|
@ -243,7 +243,8 @@ selection_t get_move (void)
|
||||
right(curwin, 1, getmaxx(curwin) / 2, attr_normal, attr_keycode,
|
||||
attr_choice, 1,
|
||||
_("Select move [^[%lc^]-^[%lc^]/^{1^}-^{3^}/^{<CTRL><C>^}]: "),
|
||||
PRINTABLE_GAME_MOVE(0), PRINTABLE_GAME_MOVE(NUMBER_MOVES - 1));
|
||||
(wint_t) PRINTABLE_GAME_MOVE(0),
|
||||
(wint_t) PRINTABLE_GAME_MOVE(NUMBER_MOVES - 1));
|
||||
|
||||
curs_set(CURS_ON);
|
||||
wrefresh(curwin);
|
||||
@ -274,7 +275,8 @@ selection_t get_move (void)
|
||||
/* TRANSLATORS: "Move" refers to the choice of
|
||||
moves made by the current player (out of a
|
||||
selection of 20 moves). */
|
||||
_("Move ^{%lc^}"), PRINTABLE_GAME_MOVE(i));
|
||||
_("Move ^{%lc^}"),
|
||||
(wint_t) PRINTABLE_GAME_MOVE(i));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ size_t xwcrtomb (char *restrict dest, wchar_t wc, mbstate_t *restrict mbstate)
|
||||
dest[n] = EILSEQ_REPL;
|
||||
dest[n++] = '\0';
|
||||
} else {
|
||||
errno_exit(_("xwcrtomb: `%lc'"), wc);
|
||||
errno_exit(_("xwcrtomb: `%lc'"), (wint_t) wc);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user