[HarfBuzz] harfbuzz: Branch 'master' - 3 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Sat Nov 10 20:39:21 UTC 2018
src/hb-aat-layout-feat-table.hh | 14 +++++++-------
src/hb-aat-layout-trak-table.hh | 35 +++++++++++++++++++----------------
src/hb-dsalgs.hh | 8 +++++---
src/hb-ot-color-colr-table.hh | 18 ++++++------------
4 files changed, 37 insertions(+), 38 deletions(-)
New commits:
commit 929f07dbfc8b8c40771d27a502f6e5842c1c1e90
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Nov 10 15:38:48 2018 -0500
Fix hb_bytes_t.cmp()
Ouch!
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index ffa43870..e98566e7 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -530,10 +530,12 @@ struct hb_bytes_t
inline int cmp (const hb_bytes_t &a) const
{
- if (len != a.len)
- return (int) a.len - (int) len;
+ if (!len) return 0; /* glibc's memcmp() args are declared nonnull. Meh. */
- return memcmp (a.arrayZ, arrayZ, len);
+ int r = memcmp (a.arrayZ, arrayZ, len);
+ if (r) return r;
+
+ return a.len < len ? -1 : a.len > len ? +1 : 0;
}
static inline int cmp (const void *pa, const void *pb)
{
commit 5547bfa9f2815df727fa524b0ea0f136a6f955b7
Merge: 3a9fa8c0 1d82b476
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Nov 10 15:35:12 2018 -0500
Merge pull request #1376 from ebraminio/minor
[colr/feat/trak] minor
commit 1d82b4761d0a2e2e0be002e8a6bfe060f7b6dec3
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Sat Nov 10 18:08:11 2018 +0330
[colr/feat/trak] minor
diff --git a/src/hb-aat-layout-feat-table.hh b/src/hb-aat-layout-feat-table.hh
index b670caab..87ab4abd 100644
--- a/src/hb-aat-layout-feat-table.hh
+++ b/src/hb-aat-layout-feat-table.hh
@@ -54,13 +54,6 @@ struct SettingName
struct FeatureName
{
- inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
- {
- TRACE_SANITIZE (this);
- return_trace (likely (c->check_struct (this) &&
- (base+settingTable).sanitize (c, nSettings)));
- }
-
enum {
Exclusive = 0x8000, /* If set, the feature settings are mutually exclusive. */
NotDefault = 0x4000, /* If clear, then the setting with an index of 0 in
@@ -75,6 +68,13 @@ struct FeatureName
* as the default. */
};
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this) &&
+ (base+settingTable).sanitize (c, nSettings)));
+ }
+
protected:
HBUINT16 feature; /* Feature type. */
HBUINT16 nSettings; /* The number of records in the setting name array. */
diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index 68218ecb..3b55967c 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -171,15 +171,6 @@ struct trak
inline bool has_data (void) const { return version.to_int () != 0; }
- inline bool sanitize (hb_sanitize_context_t *c) const
- {
- TRACE_SANITIZE (this);
-
- return_trace (likely (c->check_struct (this) &&
- horizData.sanitize (c, this, this) &&
- vertData.sanitize (c, this, this)));
- }
-
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@@ -221,15 +212,27 @@ struct trak
return_trace (true);
}
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+
+ return_trace (likely (c->check_struct (this) &&
+ version.major == 1 &&
+ horizData.sanitize (c, this, this) &&
+ vertData.sanitize (c, this, this)));
+ }
+
protected:
- FixedVersion<> version; /* Version of the tracking table
+ FixedVersion<>version; /* Version of the tracking table
* (0x00010000u for version 1.0). */
- HBUINT16 format; /* Format of the tracking table (set to 0). */
- OffsetTo<TrackData> horizData; /* Offset from start of tracking table to TrackData
- * for horizontal text (or 0 if none). */
- OffsetTo<TrackData> vertData; /* Offset from start of tracking table to TrackData
- * for vertical text (or 0 if none). */
- HBUINT16 reserved; /* Reserved. Set to 0. */
+ HBUINT16 format; /* Format of the tracking table (set to 0). */
+ OffsetTo<TrackData>
+ horizData; /* Offset from start of tracking table to TrackData
+ * for horizontal text (or 0 if none). */
+ OffsetTo<TrackData>
+ vertData; /* Offset from start of tracking table to TrackData
+ * for vertical text (or 0 if none). */
+ HBUINT16 reserved; /* Reserved. Set to 0. */
public:
DEFINE_SIZE_STATIC (12);
diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh
index b480af51..fa40223b 100644
--- a/src/hb-ot-color-colr-table.hh
+++ b/src/hb-ot-color-colr-table.hh
@@ -103,7 +103,12 @@ struct COLR
unsigned int *count, /* IN/OUT. May be NULL. */
hb_ot_color_layer_t *layers /* OUT. May be NULL. */) const
{
- const BaseGlyphRecord &record = get_glyph_record (glyph);
+ const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph,
+ &(this+baseGlyphsZ),
+ numBaseGlyphs,
+ sizeof (BaseGlyphRecord),
+ BaseGlyphRecord::cmp);
+ const BaseGlyphRecord &record = rec ? *rec : Null (BaseGlyphRecord);
hb_array_t<const LayerRecord> all_layers ((this+layersZ).arrayZ, numLayers);
hb_array_t<const LayerRecord> glyph_layers = all_layers.sub_array (record.firstLayerIdx,
@@ -129,17 +134,6 @@ struct COLR
(this+layersZ).sanitize (c, numLayers)));
}
- private:
- inline const BaseGlyphRecord &get_glyph_record (hb_codepoint_t glyph_id) const
- {
- const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph_id,
- &(this+baseGlyphsZ),
- numBaseGlyphs,
- sizeof (BaseGlyphRecord),
- BaseGlyphRecord::cmp);
- return rec ? *rec : Null(BaseGlyphRecord);
- }
-
protected:
HBUINT16 version; /* Table version number (starts at 0). */
HBUINT16 numBaseGlyphs; /* Number of Base Glyph Records. */
More information about the HarfBuzz
mailing list