diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2020-03-18 05:36:49 +0300 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2020-03-28 04:17:28 +0300 |
commit | b8be5b4002bd6163851bbae397171ebbf632f02f (patch) | |
tree | 8588fb64a7d2390bed094da24e3e8a407f250f3d /src/gui | |
parent | 865d3846d8d45bd8b9dde42f706ce40bb3c7468f (diff) |
HB-to-Qt bridge: get rid of stale/dubious safety checks
these aren't needed for quite a long time already
Change-Id: I3a5ce3199cee467d7dfba3c68256d214fee4d83c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qharfbuzzng.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index 695a190fd7..d802d1d58f 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -634,13 +634,14 @@ _hb_qt_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void *user_data) return hb_blob_get_empty(); char *buffer = static_cast<char *>(malloc(length)); - Q_CHECK_PTR(buffer); + if (q_check_ptr(buffer) == nullptr) + return nullptr; if (Q_UNLIKELY(!get_font_table(data->user_data, tag, reinterpret_cast<uchar *>(buffer), &length))) - length = 0; + return nullptr; return hb_blob_create(const_cast<const char *>(buffer), length, - HB_MEMORY_MODE_READONLY, + HB_MEMORY_MODE_WRITABLE, buffer, free); } @@ -653,10 +654,6 @@ _hb_qt_face_create(QFontEngine *fe) data->get_font_table = fe->faceData.get_font_table; hb_face_t *face = hb_face_create_for_tables(_hb_qt_reference_table, (void *)data, free); - if (Q_UNLIKELY(hb_face_is_immutable(face))) { - hb_face_destroy(face); - return NULL; - } hb_face_set_index(face, fe->faceId().index); hb_face_set_upem(face, fe->emSquareSize().truncate()); @@ -667,8 +664,7 @@ _hb_qt_face_create(QFontEngine *fe) static void _hb_qt_face_release(void *user_data) { - if (Q_LIKELY(user_data)) - hb_face_destroy(static_cast<hb_face_t *>(user_data)); + hb_face_destroy(static_cast<hb_face_t *>(user_data)); } hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe) @@ -686,16 +682,9 @@ static inline hb_font_t * _hb_qt_font_create(QFontEngine *fe) { hb_face_t *face = hb_qt_face_get_for_engine(fe); - if (Q_UNLIKELY(!face)) - return NULL; hb_font_t *font = hb_font_create(face); - if (Q_UNLIKELY(hb_font_is_immutable(font))) { - hb_font_destroy(font); - return NULL; - } - const qreal y_ppem = fe->fontDef.pixelSize; const qreal x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100.0; @@ -711,8 +700,7 @@ _hb_qt_font_create(QFontEngine *fe) static void _hb_qt_font_release(void *user_data) { - if (Q_LIKELY(user_data)) - hb_font_destroy(static_cast<hb_font_t *>(user_data)); + hb_font_destroy(static_cast<hb_font_t *>(user_data)); } hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe) |