From dc500774a8e269df0e161ca61059d70b7d56cf57 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 20 Nov 2016 12:49:21 +0000 Subject: [PATCH] fix -Wsign-compare warnings in lnav_commands.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes these warnings: lnav_commands.cc: In function ‘std::string remaining_args(const string&, const std::vector >&, size_t)’: lnav_commands.cc:67:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int lpc = 0; lpc < index; lpc++) { ^ lnav_commands.cc: In function ‘std::string com_save_to(std::string, std::vector >&)’: lnav_commands.cc:574:53: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int lpc = 0; lpc < dls.text_line_count(); lpc++) { --- src/lnav_commands.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lnav_commands.cc b/src/lnav_commands.cc index 43b0bb0b..70502ee9 100644 --- a/src/lnav_commands.cc +++ b/src/lnav_commands.cc @@ -64,7 +64,7 @@ static string remaining_args(const string &cmdline, require(index > 0); - for (int lpc = 0; lpc < index; lpc++) { + for (unsigned int lpc = 0; lpc < index; lpc++) { start_pos += args[lpc].length(); } @@ -571,7 +571,7 @@ static string com_save_to(string cmdline, vector &args) dos.list_value_for_overlay(lnav_data.ld_views[LNV_DB], vis_line_t(0), header_line); fputs(header_line.get_string().c_str(), outfile); fputc('\n', outfile); - for (int lpc = 0; lpc < dls.text_line_count(); lpc++) { + for (unsigned int lpc = 0; lpc < dls.text_line_count(); lpc++) { string line; dls.text_value_for_line(lnav_data.ld_views[LNV_DB], lpc, line, true);