From fd13b70d27ae44784b63bb0a03fccc240e2b4253 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 22 Jul 2021 18:41:06 -0400 Subject: [PATCH] windows: no sys/ioctl.h, move to compat.h --- src/compat/compat.h | 3 ++- src/lib/metric.c | 7 ++++--- src/lib/notcurses.c | 2 +- src/poc/direct.c | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/compat/compat.h b/src/compat/compat.h index 14d444f74..b14c37433 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -25,7 +25,6 @@ extern "C" { #define TCSANOW 0 #define O_CLOEXEC O_NOINHERIT #define O_NOCTTY 0 -#define nl_langinfo(x) NULL #define sigdelset(x, y) #define sigaddset(x, y) typedef struct siginfo_t { @@ -41,6 +40,8 @@ typedef struct sigaction { #define nl_langinfo(x) "UTF-8" #define sigaction(x, y, z) #define ppoll(w, x, y, z) WSAPoll((w), (x), (y)) +#else +#include #endif static inline uint64_t diff --git a/src/lib/metric.c b/src/lib/metric.c index 18988ce45..390850ff6 100644 --- a/src/lib/metric.c +++ b/src/lib/metric.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "notcurses/notcurses.h" #include "internal.h" @@ -69,7 +70,7 @@ const char *ncmetric(uintmax_t val, uintmax_t decimal, char *buf, int omitdec, // 1,024). That can overflow with large 64-bit values, but we can first // divide both sides by mult, and then scale by 100. if(omitdec && (val % dv) == 0){ - sprintfed = sprintf(buf, "%ju%lc", val / dv, (wint_t)prefixes[consumed - 1]); + sprintfed = sprintf(buf, "%" PRIu64 "%lc", val / dv, (wint_t)prefixes[consumed - 1]); }else{ sprintfed = sprintf(buf, "%.2f%lc", (double)val / dv, (wint_t)prefixes[consumed - 1]); } @@ -83,9 +84,9 @@ const char *ncmetric(uintmax_t val, uintmax_t decimal, char *buf, int omitdec, // val / decimal < dv (or we ran out of prefixes) if(omitdec && val % decimal == 0){ if(consumed){ - sprintfed = sprintf(buf, "%ju%lc", val / decimal, (wint_t)subprefixes[consumed - 1]); + sprintfed = sprintf(buf, "%" PRIu64 "%lc", val / decimal, (wint_t)subprefixes[consumed - 1]); }else{ - sprintfed = sprintf(buf, "%ju", val / decimal); + sprintfed = sprintf(buf, "%" PRIu64, val / decimal); } }else{ if(consumed){ diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 01ebf8bac..3d868876a 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -17,8 +17,8 @@ #include #include #include -#include #include +#include "compat/compat.h" #define ESC "\x1b" diff --git a/src/poc/direct.c b/src/poc/direct.c index a8ab5ec55..5261b7d3e 100644 --- a/src/poc/direct.c +++ b/src/poc/direct.c @@ -4,7 +4,6 @@ #include #include #include -#include #include // can we leave what was already on the screen there? (narrator: it seems not)