mirror of https://github.com/qt/qtgrpc.git
tools [utils]: fix invalid erase on ltrim()
When the string is entirely whitespace all characters except one gets erased. Rather use size() to denote the end of the string. Change-Id: I80bf92319d4725b9400e0f67e968e3cb8c27dd86 Pick-to: 6.9 6.8 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
839b9372f8
commit
cb5cc69cb3
|
@ -137,7 +137,7 @@ std::string &rtrim(std::string &s)
|
||||||
std::string <rim(std::string &s)
|
std::string <rim(std::string &s)
|
||||||
{
|
{
|
||||||
const size_t cut = s.find_first_not_of(asciiSpacing);
|
const size_t cut = s.find_first_not_of(asciiSpacing);
|
||||||
s.erase(0, cut == std::string::npos ? s.size() - 1 : cut);
|
s.erase(0, cut == std::string::npos ? s.size() : cut);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue