aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libutil
diff options
context:
space:
mode:
authorLulu <lulu.berlin.2023@gmail.com>2024-10-06 20:47:32 +0200
committerLulu <lulu.berlin.2023@gmail.com>2024-10-08 01:32:12 +0200
commitd6e1b11d3e91abc4194744310f36e37a57dd6e1d (patch)
treec2877e39ef28788c5a9596915ca40601c40ea14e /tests/unit/libutil
parented9b7f4f84fd60ad8618645cc1bae2d686ff0db6 (diff)
Fix gcc warning -Wsign-compare
Add the compile flag '-Wsign-compare' and adapt the code to fix all cases of this warning. Change-Id: I26b08fa5a03e4ac294daf697d32cf9140d84350d
Diffstat (limited to 'tests/unit/libutil')
-rw-r--r--tests/unit/libutil/compression.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/unit/libutil/compression.cc b/tests/unit/libutil/compression.cc
index 8d181f53d..6dd8c96df 100644
--- a/tests/unit/libutil/compression.cc
+++ b/tests/unit/libutil/compression.cc
@@ -1,4 +1,5 @@
#include "compression.hh"
+#include <cstddef>
#include <gtest/gtest.h>
namespace nix {
@@ -147,7 +148,7 @@ TEST_P(PerTypeNonNullCompressionTest, truncatedValidInput)
/* n.b. This also tests zero-length input, which is also invalid.
* As of the writing of this comment, it returns empty output, but is
* allowed to throw a compression error instead. */
- for (int i = 0; i < compressed.length(); ++i) {
+ for (size_t i = 0u; i < compressed.length(); ++i) {
auto newCompressed = compressed.substr(compressed.length() - i);
try {
decompress(method, newCompressed);