diff --git a/NEWS.md b/NEWS.md index 199ee89bf..ea5ec49fa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -21,6 +21,8 @@ rearrangements of Notcurses. its third argument. This is the absolute time viz `CLOCK_MONOTONIC` through which the frame ought be displayed. The callback must now effect delay. * Mouse coordinates are now properly translated for any margins. + * `qprefix()` and `bprefix()` now take a `uintmax_t` in place of an + `unsigned`, to match `ncprefix`. * 1.4.1 (2020-05-11) * No user-visible changes (fixed two unit tests). diff --git a/include/ncpp/NotCurses.hh b/include/ncpp/NotCurses.hh index f5eb9a26c..99e3566a2 100644 --- a/include/ncpp/NotCurses.hh +++ b/include/ncpp/NotCurses.hh @@ -61,17 +61,17 @@ namespace ncpp return *_instance == nullptr || _instance->nc == nullptr; } - static const char* ncmetric (uintmax_t val, unsigned decimal, char *buf, int omitdec, unsigned mult, int uprefix) noexcept + static const char* ncmetric (uintmax_t val, uintmax_t decimal, char *buf, int omitdec, unsigned mult, int uprefix) noexcept { return ::ncmetric (val, decimal, buf, omitdec, mult, uprefix); } - static const char* qprefix (uintmax_t val, unsigned decimal, char *buf, int omitdec) noexcept + static const char* qprefix (uintmax_t val, uintmax_t decimal, char *buf, int omitdec) noexcept { return ::qprefix (val, decimal, buf, omitdec); } - static const char* bprefix (uintmax_t val, unsigned decimal, char *buf, int omitdec) noexcept + static const char* bprefix (uintmax_t val, uintmax_t decimal, char *buf, int omitdec) noexcept { return ::bprefix (val, decimal, buf, omitdec); } diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index a40487680..ab9465963 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -2387,13 +2387,13 @@ API const char* ncmetric(uintmax_t val, uintmax_t decimal, char* buf, // Mega, kilo, gigafoo. Use PREFIXSTRLEN + 1. static inline const char* -qprefix(uintmax_t val, unsigned decimal, char* buf, int omitdec){ +qprefix(uintmax_t val, uintmax_t decimal, char* buf, int omitdec){ return ncmetric(val, decimal, buf, omitdec, 1000, '\0'); } // Mibi, kebi, gibibytes. Use BPREFIXSTRLEN + 1. static inline const char* -bprefix(uintmax_t val, unsigned decimal, char* buf, int omitdec){ +bprefix(uintmax_t val, uintmax_t decimal, char* buf, int omitdec){ return ncmetric(val, decimal, buf, omitdec, 1024, 'i'); } diff --git a/src/lib/metric.c b/src/lib/metric.c index b301ac597..41848f13f 100644 --- a/src/lib/metric.c +++ b/src/lib/metric.c @@ -5,8 +5,7 @@ #include "notcurses/notcurses.h" const char *ncmetric(uintmax_t val, uintmax_t decimal, char *buf, int omitdec, - unsigned mul, int uprefix){ - const unsigned mult = mul; // FIXME kill + unsigned mult, int uprefix){ // these two must have the same number of elements const wchar_t prefixes[] = L"KMGTPEZY"; // 10^21-1 encompasses 2^64-1 const wchar_t subprefixes[] = L"mµnpfazy"; // 10^24-1