aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-20 16:13:17 -0700
committerJade Lovelace <lix@jade.fyi>2024-08-20 16:13:17 -0700
commitc25c43d8c8e42767f2dcb8c45a7547f31bac4866 (patch)
tree187b9112996c7b2dfdea120175fcfe2bc1736478 /src/nix/flake.cc
parente727dbc3a3d59d7742a24a2b394b63a04ecb4d24 (diff)
flake: fix compiler warning
GCC was complaining, rightfully, about mixed-sign comparisons in there. I removed some extra sign mixing too. Change-Id: I949a618c7405c23d4dc3fd17440ea2d7b5c22c9d
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index d4eca86b8..15c393c90 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -1275,13 +1275,15 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
// FIXME: handle utf8 visible width properly once we get KJ which has utf8 support
// technically filterANSIEscapes knows how to do this but there is absolutely
// no clear usage of it that would actually let us do this layout.
- int spaceForDescription = screenWidth - output.size() - quotesAndSepsWidth;
+ assert(output.size() < std::numeric_limits<int>::max());
+ int spaceForDescription = screenWidth - int(output.size()) - quotesAndSepsWidth;
if (spaceForDescription <= 0) {
// do nothing, it is going to wrap no matter what, and it's better to output *something*
} else {
const char *ellipsis = "";
- if (spaceForDescription < firstLineDesc.size()) {
+ assert(firstLineDesc.size() < std::numeric_limits<int>::max());
+ if (spaceForDescription < int(firstLineDesc.size())) {
// subtract one to make space for the ellipsis
firstLineDesc.resize(spaceForDescription - 1);
ellipsis = "…";