Skip to content

Commit

Permalink
Use AsciiStrToLower to lower-case a string (#1271)
Browse files Browse the repository at this point in the history
This makes the code compatible with a future Protobuf release where various methods return absl::string_view instead of std::string or const std::string&.

Signed-off-by: Yury Kats <[email protected]>
  • Loading branch information
yurykats authored Jan 1, 2025
1 parent 9569ed9 commit 1f6f8e9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions source/client/output_formatter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ std::vector<std::string> OutputFormatterImpl::getLowerCaseOutputFormats() {
// We skip the first, which is DEFAULT, as it's not selectable.
for (int i = 1; i < enum_descriptor->value_count(); ++i) {
auto* value_descriptor = enum_descriptor->value(i);
std::string name = value_descriptor->name();
std::transform(name.begin(), name.end(), name.begin(),
[](unsigned char c) { return std::tolower(c); });
std::string name = absl::AsciiStrToLower(value_descriptor->name());
values.push_back(name);
}
return values;
Expand Down

0 comments on commit 1f6f8e9

Please sign in to comment.