Use strlen instead of magic numbers

Change-Id: I47289b62771f358669d5a6279c1c8f4bd149cd72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2022-11-04 18:40:43 +02:00
parent 21cb6287a7
commit 516871d3e5

View File

@ -218,10 +218,10 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id,
FT_Face face;
if (!face_id.filename.isEmpty()) {
QString fileName = QFile::decodeName(face_id.filename);
if (face_id.filename.startsWith(":qmemoryfonts/")) {
if (const char *prefix = ":qmemoryfonts/"; face_id.filename.startsWith(prefix)) {
// from qfontdatabase.cpp
QByteArray idx = face_id.filename;
idx.remove(0, 14); // remove ':qmemoryfonts/'
idx.remove(0, strlen(prefix)); // remove ':qmemoryfonts/'
bool ok = false;
newFreetype->fontData = qt_fontdata_from_index(idx.toInt(&ok));
if (!ok)