mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Improve "split to byte array views" function
1. Utilize string matcher 2. Remove split behavior parameter Previously `KeepEmptyParts` behavior doesn't match Qt's implementation and since our codebase doesn't really make use of it, we can just remove the parameter. 3. Add tests. PR #22352.
This commit is contained in:
@@ -172,8 +172,10 @@ namespace
|
||||
return nonstd::make_unexpected(readResult.error().message);
|
||||
}
|
||||
|
||||
const QList<QByteArrayView> lines = Utils::ByteArray::splitToViews(readResult.value(), "\n");
|
||||
QStringList history;
|
||||
for (const QByteArrayView line : asConst(Utils::ByteArray::splitToViews(readResult.value(), "\n")))
|
||||
history.reserve(lines.size());
|
||||
for (const QByteArrayView line : lines)
|
||||
history.append(QString::fromUtf8(line));
|
||||
|
||||
return history;
|
||||
|
||||
Reference in New Issue
Block a user