QTranslator: optimize string and char usage
Port a QString::fromLatin1() to QStringLiteral. The string is never modified. Wrap char in QLatin1Char to construct a QChar with 8-bit character. Change-Id: I579ca9eae0c2a72ea893254f258b001063e9f64e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
9ac8530591
commit
eea8494fa0
@ -490,7 +490,7 @@ bool QTranslator::load(const QString & filename, const QString & directory,
|
|||||||
QString fname = filename;
|
QString fname = filename;
|
||||||
QString realname;
|
QString realname;
|
||||||
QString delims;
|
QString delims;
|
||||||
delims = search_delimiters.isNull() ? QString::fromLatin1("_.") : search_delimiters;
|
delims = search_delimiters.isNull() ? QStringLiteral("_.") : search_delimiters;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
QFileInfo fi;
|
QFileInfo fi;
|
||||||
@ -528,7 +528,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
|
|||||||
QTranslatorPrivate *d = this;
|
QTranslatorPrivate *d = this;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
if (realname.startsWith(':')) {
|
if (realname.startsWith(QLatin1Char(':'))) {
|
||||||
// If the translation is in a non-compressed resource file, the data is already in
|
// If the translation is in a non-compressed resource file, the data is already in
|
||||||
// memory, so no need to use QFile to copy it again.
|
// memory, so no need to use QFile to copy it again.
|
||||||
Q_ASSERT(!d->resource);
|
Q_ASSERT(!d->resource);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user