mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 13:11:25 -07:00
Use slice method where applicable
These code segments already have its boundary checked and can thus be faster. PR #22411.
This commit is contained in:
parent
d174bc75e4
commit
5a4b3b25d3
23 changed files with 113 additions and 63 deletions
|
@ -365,7 +365,7 @@ QString Session::subcategoryName(const QString &category)
|
|||
{
|
||||
const int sepIndex = category.lastIndexOf(u'/');
|
||||
if (sepIndex >= 0)
|
||||
return category.mid(sepIndex + 1);
|
||||
return category.sliced(sepIndex + 1);
|
||||
|
||||
return category;
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ QString Session::parentCategoryName(const QString &category)
|
|||
{
|
||||
const int sepIndex = category.lastIndexOf(u'/');
|
||||
if (sepIndex >= 0)
|
||||
return category.left(sepIndex);
|
||||
return category.first(sepIndex);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ QStringList Session::expandCategory(const QString &category)
|
|||
int index = 0;
|
||||
while ((index = category.indexOf(u'/', index)) >= 0)
|
||||
{
|
||||
result << category.left(index);
|
||||
result << category.first(index);
|
||||
++index;
|
||||
}
|
||||
result << category;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue