From 85423674ad6fec0609726ab4d0e22674e9c1c6c1 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Tue, 27 Aug 2019 23:10:09 -0400 Subject: Cast %lc parameter to wint_t I hadn't realized that's what type %lc takes and suddenly started seeing warnings about it for some reason. --- bin/aes.c | 4 ++-- bin/psfed.c | 5 ++++- bin/shotty.c | 10 +++++----- bin/ttpre.c | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/aes.c b/bin/aes.c index 1472338f..705970dc 100644 --- a/bin/aes.c +++ b/bin/aes.c @@ -36,7 +36,7 @@ static const wchar_t Table[128] = { static void enwiden(const char *ch) { for (; *ch; ++ch) { - if ((byte)*ch < 128) printf("%lc", Table[(byte)*ch]); + if ((byte)*ch < 128) printf("%lc", (wint_t)Table[(byte)*ch]); else printf("%c", *ch); } } @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { setlocale(LC_CTYPE, ""); for (int i = 1; i < argc; ++i) { enwiden(argv[i]); - if (i < argc - 1) printf("%lc", Table[' ']); + if (i < argc - 1) printf("%lc", (wint_t)Table[' ']); else printf("\n"); } if (argc > 1) return EXIT_SUCCESS; diff --git a/bin/psfed.c b/bin/psfed.c index 18627a83..4f46b500 100644 --- a/bin/psfed.c +++ b/bin/psfed.c @@ -289,7 +289,10 @@ static void normalInc(uint32_t n) { } static void normalPrint(const char *prefix) { if (normal.index <= 256) { - printf("%s: %02X '%lc'\n", prefix, normal.index, CP437[normal.index]); + printf( + "%s: %02X '%lc'\n", + prefix, normal.index, (wint_t)CP437[normal.index] + ); } else { printf("%s: %02X\n", prefix, normal.index); } diff --git a/bin/shotty.c b/bin/shotty.c index 41cb4e97..c458f5d2 100644 --- a/bin/shotty.c +++ b/bin/shotty.c @@ -98,7 +98,7 @@ static void span(const struct Style *prev, const struct Cell *cell) { break; case '&': printf("&"); break; case '<': printf("<"); break; case '>': printf(">"); - break; default: printf("%lc", cell->ch); + break; default: printf("%lc", (wint_t)cell->ch); } } @@ -150,7 +150,7 @@ static char updateNUL(wchar_t ch) { return NUL; } if (x + width > cols) { - warnx("cannot fit '%lc'", ch); + warnx("cannot fit '%lc'", (wint_t)ch); return NUL; } @@ -218,7 +218,7 @@ static char updateESC(wchar_t ch) { case '>': return NUL; case CSI: return CSI; case OSC: return OSC; - default: warnx("unhandled ESC %lc", ch); return NUL; + default: warnx("unhandled ESC %lc", (wint_t)ch); return NUL; } } @@ -350,7 +350,7 @@ static char updateCSI(wchar_t ch) { } break; case 't': // ignore - break; default: warnx("unhandled CSI %lc", ch); + break; default: warnx("unhandled CSI %lc", (wint_t)ch); } if (opts.debug) { @@ -361,7 +361,7 @@ static char updateCSI(wchar_t ch) { if (ch < 128 && Name[ch]) { printf("%s\n", Name[ch]); } else { - printf("%lc\n", ch); + printf("%lc\n", (wint_t)ch); } html(); } diff --git a/bin/ttpre.c b/bin/ttpre.c index be000c42..4917be37 100644 --- a/bin/ttpre.c +++ b/bin/ttpre.c @@ -24,7 +24,7 @@ static void put(wchar_t ch) { break; case L'&': printf("&"); break; case L'<': printf("<"); break; case L'>': printf(">"); - break; default: printf("%lc", ch); + break; default: printf("%lc", (wint_t)ch); } } -- cgit 1.4.1