mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-10 17:35:00 -06:00
Replace QString::split() by faster alternatives
This commit is contained in:
@@ -1501,10 +1501,12 @@ void Session::enableBandwidthScheduler()
|
||||
void Session::populateAdditionalTrackers()
|
||||
{
|
||||
m_additionalTrackerList.clear();
|
||||
for (QString tracker : asConst(additionalTrackers().split('\n'))) {
|
||||
|
||||
const QString trackers = additionalTrackers();
|
||||
for (QStringRef tracker : asConst(trackers.splitRef('\n'))) {
|
||||
tracker = tracker.trimmed();
|
||||
if (!tracker.isEmpty())
|
||||
m_additionalTrackerList << tracker;
|
||||
m_additionalTrackerList << tracker.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -429,9 +429,10 @@ void TorrentInfo::stripRootFolder()
|
||||
lt::file_storage files = m_nativeInfo->files();
|
||||
|
||||
// Solution for case of renamed root folder
|
||||
const std::string testName = filePath(0).split('/').value(0).toStdString();
|
||||
if (files.name() != testName) {
|
||||
files.set_name(testName);
|
||||
const QString path = filePath(0);
|
||||
const std::string newName = path.left(path.indexOf('/')).toStdString();
|
||||
if (files.name() != newName) {
|
||||
files.set_name(newName);
|
||||
for (int i = 0; i < files.num_files(); ++i)
|
||||
files.rename_file(LTFileIndex {i}, files.file_path(LTFileIndex {i}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user