From 5aba94355ec638c6f8612f86be309ed684979ae3 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 11 Dec 2024 19:20:51 +0100 Subject: Fix warnings. --- getoptpp.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'getoptpp.hpp') diff --git a/getoptpp.hpp b/getoptpp.hpp index 92f8e82..a9791d1 100644 --- a/getoptpp.hpp +++ b/getoptpp.hpp @@ -116,14 +116,14 @@ class Options { if(index >= (int)options.size()) { break; } - auto const & opt = options.at(index); - std::string args; + auto const & opt = options.at(static_cast(index)); + std::string _args; switch(opt.has_arg) { case required_argument: - args = ""; + _args = ""; break; case optional_argument: - args = "[x]"; + _args = "[x]"; break; case no_argument: default: @@ -133,11 +133,12 @@ class Options { std::string option_str; if(opt.val >= '!' && opt.val <= '~') { - option_str = " -" + std::string(1, opt.val) + ", --" + opt.name + " " + args; + auto c = static_cast(opt.val); + option_str = " -" + std::string(1, c) + ", --" + opt.name + " " + _args; } else { - option_str = " --" + std::string(opt.name) + " " + args; + option_str = " --" + std::string(opt.name) + " " + _args; } std::string padding; @@ -158,8 +159,8 @@ class Options { { if((c == '\n') || (i > column_width && (c == ' ' || c == '\t'))) { - std::string padding(width, ' '); - std::cout << '\n' << padding; + std::string _padding(width, ' '); + std::cout << '\n' << _padding; i = width; continue; } @@ -172,7 +173,7 @@ class Options { } private: - std::size_t num_flags{}; + int num_flags{}; std::vector