summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-22 14:46:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-06 12:13:20 +0100
commitece0c0a5e7e0b18beb58ccd868bde54c7be64f78 (patch)
treefa4a0fdbda040d24f1a2d07a320635c76980f431 /src/gui/text/qfontengine.cpp
parentb19220d17fa66de5ded41690ffff263ee2af5c63 (diff)
Tidy nullptr usage
Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r--src/gui/text/qfontengine.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 1668fac5a3..3ca9e9bbde 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -221,7 +221,7 @@ static bool qt_get_font_table_default(void *user_data, uint tag, uchar *buffer,
#ifdef QT_BUILD_INTERNAL
// for testing purpose only, not thread-safe!
-static QList<QFontEngine *> *enginesCollector = 0;
+static QList<QFontEngine *> *enginesCollector = nullptr;
Q_AUTOTEST_EXPORT void QFontEngine_startCollectingEngines()
{
@@ -234,7 +234,7 @@ Q_AUTOTEST_EXPORT QList<QFontEngine *> QFontEngine_stopCollectingEngines()
Q_ASSERT(enginesCollector);
QList<QFontEngine *> ret = *enginesCollector;
delete enginesCollector;
- enginesCollector = 0;
+ enginesCollector = nullptr;
return ret;
}
#endif // QT_BUILD_INTERNAL
@@ -569,9 +569,9 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform
void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
{
glyph_metrics_t gi = boundingBox(glyph);
- if (leftBearing != 0)
+ if (leftBearing != nullptr)
*leftBearing = gi.leftBearing().toReal();
- if (rightBearing != 0)
+ if (rightBearing != nullptr)
*rightBearing = gi.rightBearing().toReal();
}
@@ -1022,7 +1022,7 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
{
QByteArray table;
uint len = 0;
- if (!getSfntTableData(tag, 0, &len))
+ if (!getSfntTableData(tag, nullptr, &len))
return table;
table.resize(len);
if (!getSfntTableData(tag, reinterpret_cast<uchar *>(table.data()), &len))
@@ -1231,11 +1231,11 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
// version check
quint16 version;
if (!qSafeFromBigEndian(header, endPtr, &version) || version != 0)
- return 0;
+ return nullptr;
quint16 numTables;
if (!qSafeFromBigEndian(header + 2, endPtr, &numTables))
- return 0;
+ return nullptr;
const uchar *maps = table + 4;
@@ -1255,11 +1255,11 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
for (int n = 0; n < numTables; ++n) {
quint16 platformId;
if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId))
- return 0;
+ return nullptr;
quint16 platformSpecificId = 0;
if (!qSafeFromBigEndian(maps + 8 * n + 2, endPtr, &platformSpecificId))
- return 0;
+ return nullptr;
switch (platformId) {
case 0: // Unicode
@@ -1309,38 +1309,38 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
}
}
if(tableToUse < 0)
- return 0;
+ return nullptr;
resolveTable:
*isSymbolFont = (symbolTable > -1);
quint32 unicode_table = 0;
if (!qSafeFromBigEndian(maps + 8 * tableToUse + 4, endPtr, &unicode_table))
- return 0;
+ return nullptr;
if (!unicode_table)
- return 0;
+ return nullptr;
// get the header of the unicode table
header = table + unicode_table;
quint16 format;
if (!qSafeFromBigEndian(header, endPtr, &format))
- return 0;
+ return nullptr;
quint32 length;
if (format < 8) {
quint16 tmp;
if (!qSafeFromBigEndian(header + 2, endPtr, &tmp))
- return 0;
+ return nullptr;
length = tmp;
} else {
if (!qSafeFromBigEndian(header + 4, endPtr, &length))
- return 0;
+ return nullptr;
}
if (table + unicode_table + length > endPtr)
- return 0;
+ return nullptr;
*cmapSize = length;
// To support symbol fonts that contain a unicode table for the symbol area
@@ -1844,7 +1844,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
return engine;
}
- return 0;
+ return nullptr;
}
glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
@@ -1865,7 +1865,7 @@ glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
const_cast<QFontEngineMulti *>(this)->ensureEngineAt(x);
engine = m_engines.at(x);
}
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == Box)
continue;
@@ -1934,7 +1934,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
if (!engine)
continue;
}
- Q_ASSERT(engine != 0);
+ Q_ASSERT(engine != nullptr);
if (engine->type() == Box)
continue;
@@ -2308,7 +2308,7 @@ QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosit
*/
QFontEngine *QFontEngineMulti::createMultiFontEngine(QFontEngine *fe, int script)
{
- QFontEngine *engine = 0;
+ QFontEngine *engine = nullptr;
QFontCache::Key key(fe->fontDef, script, /*multi = */true);
QFontCache *fc = QFontCache::instance();
// We can't rely on the fontDef (and hence the cache Key)