From 8a2f75cef27ecea5036c7b72c7821435ffbfa4a9 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 29 Jan 2022 20:02:07 +0200 Subject: [PATCH] const-ify variables in QFontEngineFT::getGlyph() Signed-off-by: Ivailo Monev --- src/gui/text/qfontengine_ft.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index bec9ffae5..9175c0c4a 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -336,16 +336,15 @@ QFontGlyph* QFontEngineFT::getGlyph(glyph_t glyph) const gcache->advancex = ROUND(face->glyph->advance.x); #ifdef QT_MEMCPY_FT_OUTLINE - short n_contours = face->glyph->outline.n_contours; + const short n_contours = face->glyph->outline.n_contours; gcache->outline.n_contours = n_contours; gcache->outline.contours = static_cast(::malloc(sizeof(short) * n_contours)); ::memcpy(gcache->outline.contours, face->glyph->outline.contours, sizeof(short) * n_contours); - short n_points = face->glyph->outline.n_points; + const short n_points = face->glyph->outline.n_points; gcache->outline.points = static_cast(::malloc(sizeof(FT_Vector) * n_points)); ::memcpy(gcache->outline.points, face->glyph->outline.points, sizeof(FT_Vector) * n_points); - short n_tags = n_points; - gcache->outline.tags = static_cast(::malloc(sizeof(char) * n_tags)); - ::memcpy(gcache->outline.tags, face->glyph->outline.tags, sizeof(char) * n_tags); + gcache->outline.tags = static_cast(::malloc(sizeof(char) * n_points)); + ::memcpy(gcache->outline.tags, face->glyph->outline.tags, sizeof(char) * n_points); #else FT_Outline_New(freetype->library, face->glyph->outline.n_points, face->glyph->outline.n_contours, &gcache->outline); -- 2.11.0