Skip to content

Commit

Permalink
Fix MSVC warning. (#935)
Browse files Browse the repository at this point in the history
This fixes the Visual Studio 2019 warning:

`C4244: '=': conversion from 'int' to 'char', possible loss of data`

When implicitly casting the return value of tolower() (int) to char.

Fixes: #932
  • Loading branch information
ben-clayton authored Feb 7, 2020
1 parent e5ea03c commit 8982e1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commandlineflags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ bool IsTruthyFlagValue(const std::string& value) {
!(v == '0' || v == 'f' || v == 'F' || v == 'n' || v == 'N');
} else if (!value.empty()) {
std::string value_lower(value);
std::transform(value_lower.begin(), value_lower.end(),
value_lower.begin(), ::tolower);
std::transform(value_lower.begin(), value_lower.end(), value_lower.begin(),
[](char c) { return static_cast<char>(::tolower(c)); });
return !(value_lower == "false" || value_lower == "no" ||
value_lower == "off");
} else
Expand Down

0 comments on commit 8982e1e

Please sign in to comment.