mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06: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:
@@ -50,7 +50,7 @@ using QStringPair = std::pair<QString, QString>;
|
||||
|
||||
namespace
|
||||
{
|
||||
const QByteArray EOH = QByteArray(CRLF).repeated(2);
|
||||
const QByteArray EOH = CRLF.repeated(2);
|
||||
|
||||
const QByteArrayView viewWithoutEndingWith(const QByteArrayView in, const QByteArrayView str)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QHostAddress>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
@@ -76,7 +77,7 @@ namespace Http
|
||||
inline const QString CONTENT_TYPE_FORM_DATA = u"multipart/form-data"_s;
|
||||
|
||||
// portability: "\r\n" doesn't guarantee mapping to the correct symbol
|
||||
inline const char CRLF[] = {0x0D, 0x0A, '\0'};
|
||||
inline const QByteArray CRLF = QByteArrayLiteral("\x0D\x0A");
|
||||
|
||||
struct Environment
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user