diff --git a/include/clipp.h b/include/clipp.h index d7b101e..a8cf257 100644 --- a/include/clipp.h +++ b/include/clipp.h @@ -1406,9 +1406,7 @@ class action_provider //--------------------------------------------------------------- /** @brief executes all argument actions */ void execute_actions(const arg_string& arg) const { - int i = 0; for(const auto& a : argActions_) { - ++i; a(arg.c_str()); } } @@ -4959,9 +4957,9 @@ class parser //go through all exclusive groups of matching pattern for(const auto& m : match.stack()) { if(m.parent->exclusive()) { - for(auto i = int(missCand_.size())-1; i >= 0; --i) { + for(auto i = static_cast(missCand_.size())-1; i >= 0; --i) { bool removed = false; - for(const auto& c : missCand_[i].pos.stack()) { + for(const auto& c : missCand_[static_cast(i)].pos.stack()) { //sibling within same exclusive group => discard if(c.parent == m.parent && c.cur != m.cur) { missCand_.erase(missCand_.begin() + i); @@ -4972,9 +4970,9 @@ class parser } //remove miss candidates only within current repeat cycle if(i > 0 && removed) { - if(missCand_[i-1].startsRepeatGroup) break; + if(missCand_[static_cast(i-1)].startsRepeatGroup) break; } else { - if(missCand_[i].startsRepeatGroup) break; + if(missCand_[static_cast(i)].startsRepeatGroup) break; } } } @@ -5103,8 +5101,8 @@ class parsing_result */ arg_mappings::size_type unmapped_args_count() const noexcept { - return std::count_if(arg2param_.begin(), arg2param_.end(), - [](const arg_mapping& a){ return !a.param(); }); + return static_cast(std::count_if(arg2param_.begin(), arg2param_.end(), + [](const arg_mapping& a){ return !a.param(); })); } /** @brief returns if any argument could only be matched by an @@ -6239,7 +6237,7 @@ class usage_lines os << buf.str(); if(i < group.size()-1) { if(cur.line > 0) { - os << string(fmt_.line_spacing(), '\n'); + os << string(static_cast(fmt_.line_spacing()), '\n'); } ++cur.line; os << '\n'; @@ -6312,7 +6310,7 @@ class usage_lines if(surrAlt) lbl += fmt_.alternative_flags_prefix(); bool sep = false; - for(int i = 0; i < n; ++i) { + for(std::size_t i = 0; i < static_cast(n); ++i) { if(sep) { if(cur.is_singleton()) lbl += fmt_.alternative_group_separator(); @@ -6715,9 +6713,9 @@ class documentation const auto& flags = param.flags(); if(!flags.empty()) { lbl += flags[0]; - const int n = std::min(fmt.max_flags_per_param_in_doc(), - int(flags.size())); - for(int i = 1; i < n; ++i) { + const auto n = static_cast(std::min(fmt.max_flags_per_param_in_doc(), + int(flags.size()))); + for(std::size_t i = 1; i < n; ++i) { lbl += fmt.flag_separator() + flags[i]; } } @@ -6872,7 +6870,7 @@ OStream& operator << (OStream& os, const man_page& man) { bool first = true; - const auto secSpc = doc_string(man.section_row_spacing() + 1, '\n'); + const auto secSpc = doc_string(static_cast(man.section_row_spacing()) + std::size_t(1), '\n'); for(const auto& section : man) { if(!section.content().empty()) { if(first) first = false; else os << secSpc; @@ -7003,7 +7001,7 @@ void print(OStream& os, const pattern& param, int level = 0) template void print(OStream& os, const group& g, int level) { - auto indent = doc_string(4*level, ' '); + auto indent = doc_string(static_cast(4*level), ' '); os << indent; if(g.blocking()) os << '~'; if(g.joinable()) os << 'J';