Reduce allocations using QStringLiteral

This commit is contained in:
Nicolas Werner 2021-12-29 04:28:08 +01:00
parent a3c4ebc460
commit d8ead9573b
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
46 changed files with 539 additions and 539 deletions

View file

@ -66,7 +66,7 @@ MxcMediaProxy::getVideoSurface()
int
MxcMediaProxy::orientation() const
{
nhlog::ui()->debug("metadata: {}", availableMetaData().join(",").toStdString());
nhlog::ui()->debug("metadata: {}", availableMetaData().join(QStringLiteral(",")).toStdString());
auto orientation = metaData(QMediaMetaData::Orientation).toInt();
nhlog::ui()->debug("Video orientation: {}", orientation);
return orientation;
@ -93,16 +93,16 @@ MxcMediaProxy::startDownload()
auto encryptionInfo = mtx::accessors::file(*event);
// If the message is a link to a non mxcUrl, don't download it
if (!mxcUrl.startsWith("mxc://")) {
if (!mxcUrl.startsWith(QLatin1String("mxc://"))) {
return;
}
QString suffix = QMimeDatabase().mimeTypeForName(mimeType).preferredSuffix();
const auto url = mxcUrl.toStdString();
const auto name = QString(mxcUrl).remove("mxc://");
const auto name = QString(mxcUrl).remove(QStringLiteral("mxc://"));
QFileInfo filename(
QString("%1/media_cache/media/%2.%3")
QStringLiteral("%1/media_cache/media/%2.%3")
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation), name, suffix));
if (QDir::cleanPath(name) != name) {
nhlog::net()->warn("mxcUrl '{}' is not safe, not downloading file", url);