From 7dcfc5357df879491f847bd7d2941645e58f268c Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 9 Jun 2019 11:58:08 +0430 Subject: [PATCH] [stat] minor format --- src/hb-ot-stat-table.hh | 72 ++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/hb-ot-stat-table.hh b/src/hb-ot-stat-table.hh index e959263..98bdfa3 100644 --- a/src/hb-ot-stat-table.hh +++ b/src/hb-ot-stat-table.hh @@ -59,14 +59,14 @@ enum struct AxisValueFormat1 { + hb_ot_name_id_t get_value_name_id () const { return valueNameID; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this))); } - hb_ot_name_id_t get_value_name_id () const { return valueNameID; } - protected: HBUINT16 format; /* Format identifier — set to 1. */ HBUINT16 axisIndex; /* Zero-base index into the axis record array @@ -84,14 +84,14 @@ struct AxisValueFormat1 struct AxisValueFormat2 { + hb_ot_name_id_t get_value_name_id () const { return valueNameID; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this))); } - hb_ot_name_id_t get_value_name_id () const { return valueNameID; } - protected: HBUINT16 format; /* Format identifier — set to 2. */ HBUINT16 axisIndex; /* Zero-base index into the axis record array @@ -113,14 +113,14 @@ struct AxisValueFormat2 struct AxisValueFormat3 { + hb_ot_name_id_t get_value_name_id () const { return valueNameID; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this))); } - hb_ot_name_id_t get_value_name_id () const { return valueNameID; } - protected: HBUINT16 format; /* Format identifier — set to 3. */ HBUINT16 axisIndex; /* Zero-base index into the axis record array @@ -157,14 +157,14 @@ struct AxisValueRecord struct AxisValueFormat4 { + hb_ot_name_id_t get_value_name_id () const { return valueNameID; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this))); } - hb_ot_name_id_t get_value_name_id () const { return valueNameID; } - protected: HBUINT16 format; /* Format identifier — set to 4. */ HBUINT16 axisCount; /* The total number of axes contributing to @@ -183,31 +183,31 @@ struct AxisValueFormat4 struct AxisValue { - bool sanitize (hb_sanitize_context_t *c) const + hb_ot_name_id_t get_value_name_id () const { - TRACE_SANITIZE (this); - if (unlikely (!c->check_struct (this))) - return_trace (false); - switch (u.format) { - case 1: return_trace (u.format1.sanitize (c)); - case 2: return_trace (u.format2.sanitize (c)); - case 3: return_trace (u.format3.sanitize (c)); - case 4: return_trace (u.format4.sanitize (c)); - default: return_trace (true); + case 1: return u.format1.get_value_name_id (); + case 2: return u.format2.get_value_name_id (); + case 3: return u.format3.get_value_name_id (); + case 4: return u.format4.get_value_name_id (); + default:return HB_OT_NAME_ID_INVALID; } } - hb_ot_name_id_t get_value_name_id () const + bool sanitize (hb_sanitize_context_t *c) const { + TRACE_SANITIZE (this); + if (unlikely (!c->check_struct (this))) + return_trace (false); + switch (u.format) { - case 1: return u.format1.get_value_name_id (); - case 2: return u.format2.get_value_name_id (); - case 3: return u.format3.get_value_name_id (); - case 4: return u.format4.get_value_name_id (); - default: return HB_OT_NAME_ID_INVALID; + case 1: return_trace (u.format1.sanitize (c)); + case 2: return_trace (u.format2.sanitize (c)); + case 3: return_trace (u.format3.sanitize (c)); + case 4: return_trace (u.format4.sanitize (c)); + default:return_trace (true); } } @@ -226,14 +226,14 @@ struct AxisValue struct StatAxisRecord { + hb_ot_name_id_t get_name_id () const { return nameID; } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (likely (c->check_struct (this))); } - hb_ot_name_id_t get_name_id () const { return nameID; } - protected: Tag tag; /* A tag identifying the axis of design variation. */ NameID nameID; /* The name ID for entries in the 'name' table that @@ -249,16 +249,6 @@ struct STAT { static constexpr hb_tag_t tableTag = HB_OT_TAG_STAT; - bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (likely (c->check_struct (this) && - version.major == 1 && - version.minor > 0 && - designAxesOffset.sanitize (c, this, designAxisCount) && - offsetToAxisValueOffsets.sanitize (c, this, axisValueCount, &(this+offsetToAxisValueOffsets)))); - } - bool has_data () const { return version.to_int (); } unsigned get_design_axis_count () const { return designAxisCount; } @@ -295,6 +285,16 @@ struct STAT ; } + bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && + version.major == 1 && + version.minor > 0 && + designAxesOffset.sanitize (c, this, designAxisCount) && + offsetToAxisValueOffsets.sanitize (c, this, axisValueCount, &(this+offsetToAxisValueOffsets)))); + } + protected: hb_array_t const get_design_axes () const { return (this+designAxesOffset).as_array (designAxisCount); } -- 2.7.4