mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 00:06:16 -07:00
Avoid redundant string length function calls
Also switch to `std::string_view` as it is more generic and can handle more types (including view types). PR #21861.
This commit is contained in:
parent
530631322d
commit
6ddde3f4b6
9 changed files with 112 additions and 108 deletions
|
@ -49,14 +49,14 @@ QString Utils::String::fromDouble(const double n, const int precision)
|
|||
return QLocale::system().toString(std::floor(n * prec) / prec, 'f', precision);
|
||||
}
|
||||
|
||||
QString Utils::String::fromLatin1(const std::string &string)
|
||||
QString Utils::String::fromLatin1(const std::string_view string)
|
||||
{
|
||||
return QString::fromLatin1(string.c_str(), string.size());
|
||||
return QString::fromLatin1(string.data(), string.size());
|
||||
}
|
||||
|
||||
QString Utils::String::fromLocal8Bit(const std::string &string)
|
||||
QString Utils::String::fromLocal8Bit(const std::string_view string)
|
||||
{
|
||||
return QString::fromLocal8Bit(string.c_str(), string.size());
|
||||
return QString::fromLocal8Bit(string.data(), string.size());
|
||||
}
|
||||
|
||||
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue