diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-03-03 05:57:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-03 11:11:20 +0100 |
commit | 78d115f8f28a7e3f15c0280e8d87d7041ecff793 (patch) | |
tree | e43a96ca2e54ba2381367d856a8b5ffc67b5daf1 /src/gui/text | |
parent | 3567d62ed347fa70ad7e9ef424f675b33ec646e7 (diff) |
Unify QFontEngine*::stringToCMap() behavior
Ensure the params are valid and make QCoreTextFontEngine::stringToCMap()
handle the unsufficient buffer case exactly like the other engines does.
Change-Id: I078af37da917cf2bac709b12aa827ed4128e5f30
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_qpa.cpp | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index d654772e86..6f62d24f1e 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1410,6 +1410,7 @@ QFontEngineBox::~QFontEngineBox() bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 43e24b3943..140bf16394 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1528,6 +1528,7 @@ void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index 3ffc809f75..c12cb37edf 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -342,6 +342,7 @@ bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) con bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; |