From 7de8c84e8f996ece9b5af00ffbca9de9effcb472 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Mon, 19 Jul 2021 09:12:17 +0200 Subject: Fix a signedness compiler warning --- sdn.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdn.cpp b/sdn.cpp index 0078f31..ddcb342 100644 --- a/sdn.cpp +++ b/sdn.cpp @@ -93,8 +93,8 @@ fun to_mb (const wstring &wide) -> string { return mb; } -fun prefix_length (const wstring &in, const wstring &of) -> int { - int score = 0; +fun prefix_length (const wstring &in, const wstring &of) -> size_t { + size_t score = 0; for (size_t i = 0; i < of.size () && in.size () >= i && in[i] == of[i]; i++) score++; return score; @@ -1008,10 +1008,10 @@ fun show_help () { fun search (const wstring &needle, int push) -> int { int best = g.cursor, best_n = 0, matches = 0, step = push != 0 ? push : 1; for (int i = 0, count = g.entries.size (); i < count; i++) { - auto o = (g.cursor + (count + i * step) + (count + push)) % count; - int n = prefix_length (to_wide (g.entries[o].filename), needle); + int o = (g.cursor + (count + i * step) + (count + push)) % count; + size_t n = prefix_length (to_wide (g.entries[o].filename), needle); matches += n == needle.size (); - if (n > best_n) { + if (n > (size_t) best_n) { best = o; best_n = n; } -- cgit v1.2.3-70-g09d2