diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh index 3e6480cc2..35a364772 100644 --- a/src/hb-ot-color-svg-table.hh +++ b/src/hb-ot-color-svg-table.hh @@ -43,13 +43,6 @@ struct SVGDocumentIndexEntry inline int cmp (hb_codepoint_t g) const { return g < startGlyphID ? -1 : g > endGlyphID ? 1 : 0; } - static int cmp (const void *pa, const void *pb) - { - const hb_codepoint_t *a = (const hb_codepoint_t *) pa; - const SVGDocumentIndexEntry *b = (const SVGDocumentIndexEntry *) pb; - return b->cmp (*a); - } - inline hb_blob_t *reference_blob (hb_blob_t *svg_blob, unsigned int index_offset) const { if (svgDocLength == 0) return hb_blob_get_empty (); @@ -113,13 +106,8 @@ struct SVG inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const { - const SVGDocumentIndexEntry *rec = (SVGDocumentIndexEntry *) - bsearch (&glyph_id, - &(this+svgDocEntries).arrayZ, - (this+svgDocEntries).len, - sizeof (SVGDocumentIndexEntry), - SVGDocumentIndexEntry::cmp); - return likely (rec) ? *rec : Null(SVGDocumentIndexEntry); + const SortedArrayOf docs = this+svgDocEntries; + return docs[docs.bsearch (glyph_id)]; } inline bool sanitize (hb_sanitize_context_t *c) const @@ -131,7 +119,7 @@ struct SVG protected: HBUINT16 version; /* Table version (starting at 0). */ - LOffsetTo > + LOffsetTo > svgDocEntries; /* Offset (relative to the start of the SVG table) to the * SVG Documents Index. Must be non-zero. */ /* Array of SVG Document Index Entries. */