From 583d7f9586ce69754f1354aa3895e6d732a0c2ce Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 5 May 2010 01:49:22 -0400 Subject: [PATCH] Cosmetic --- src/hb-open-file-private.hh | 3 ++- src/hb-open-type-private.hh | 6 ++++-- src/hb-ot-layout-common-private.hh | 15 ++++++++++----- src/hb-ot-layout-gpos-private.hh | 5 ++--- src/hb-ot-layout-gsub-private.hh | 3 ++- src/hb-ot-layout-gsubgpos-private.hh | 9 +++++---- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index ed9369bd..56843834 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -100,7 +100,8 @@ typedef struct OffsetTable public: inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE_SELF () && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables); + return SANITIZE_SELF () + && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables); } private: diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 78a1c3bd..8e901335 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -555,7 +555,8 @@ struct GenericArrayOf private: inline bool sanitize_shallow (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE_SELF() && SANITIZE_ARRAY (this, Type::get_size (), len); + return SANITIZE_SELF() + && SANITIZE_ARRAY (this, Type::get_size (), len); } public: @@ -622,7 +623,8 @@ struct HeadlessArrayOf { return len.get_size () + (len ? len - 1 : 0) * Type::get_size (); } inline bool sanitize_shallow (hb_sanitize_context_t *context) { - return SANITIZE_SELF() && SANITIZE_ARRAY (this, Type::get_size (), len); + return SANITIZE_SELF() + && SANITIZE_ARRAY (this, Type::get_size (), len); } inline bool sanitize (hb_sanitize_context_t *context) { diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index d9b2da33..22a5432a 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -166,7 +166,8 @@ struct LangSys inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE_SELF () && SANITIZE (featureIndex); + return SANITIZE_SELF () + && SANITIZE (featureIndex); } Offset lookupOrder; /* = Null (reserved for an offset to a @@ -234,7 +235,8 @@ struct Feature inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE_SELF () && SANITIZE (lookupIndex); + return SANITIZE_SELF () + && SANITIZE (lookupIndex); } /* LONGTERMTODO: implement get_feature_parameters() */ @@ -285,7 +287,8 @@ struct Lookup inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); /* Real sanitize of the subtables is done by GSUB/GPOS/... */ - if (!(SANITIZE_SELF () && likely (subTable.sanitize (context)))) return false; + if (!(SANITIZE_SELF () + && likely (subTable.sanitize (context)))) return false; if (unlikely (lookupFlag & LookupFlag::UseMarkFilteringSet)) { USHORT &markFilteringSet = StructAfter (subTable); @@ -454,7 +457,8 @@ struct ClassDefFormat1 inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE_SELF () && SANITIZE (classValue); + return SANITIZE_SELF () + && SANITIZE (classValue); } USHORT classFormat; /* Format identifier--format = 1 */ @@ -594,7 +598,8 @@ struct Device inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE_SELF() && SANITIZE_MEM (this, this->get_size ()); + return SANITIZE_SELF() + && SANITIZE_MEM (this, this->get_size ()); } private: diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index 613fd0b2..145fc044 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -159,9 +159,8 @@ struct ValueFormat : USHORT inline bool sanitize_value (hb_sanitize_context_t *context, void *base, const Value *values) { TRACE_SANITIZE (); - - return SANITIZE_MEM (values, get_size ()) && - (!has_device () || sanitize_value_devices (context, base, values)); + return SANITIZE_MEM (values, get_size ()) + && (!has_device () || sanitize_value_devices (context, base, values)); } inline bool sanitize_values (hb_sanitize_context_t *context, void *base, const Value *values, unsigned int count) { diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index 7290e985..9083db57 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -428,7 +428,8 @@ struct Ligature public: inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - return SANITIZE (ligGlyph) && SANITIZE (component); + return SANITIZE (ligGlyph) + && SANITIZE (component); } private: diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 24889b9a..6ed1bf7e 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -287,8 +287,9 @@ struct Rule public: inline bool sanitize (hb_sanitize_context_t *context) { TRACE_SANITIZE (); - if (!(SANITIZE (inputCount) && SANITIZE (lookupCount))) return false; - return SANITIZE_MEM (input, + return SANITIZE (inputCount) + && SANITIZE (lookupCount) + && SANITIZE_MEM (input, input[0].get_size () * inputCount + lookupRecordX[0].get_size () * lookupCount); } @@ -444,10 +445,10 @@ struct ContextFormat3 TRACE_SANITIZE (); if (!SANITIZE_SELF ()) return false; unsigned int count = glyphCount; - if (!SANITIZE_ARRAY (coverage, OffsetTo::get_size (), glyphCount)) return false; + if (!SANITIZE_ARRAY (coverage, OffsetTo::get_size (), count)) return false; for (unsigned int i = 0; i < count; i++) if (!SANITIZE_WITH_BASE (this, coverage[i])) return false; - LookupRecord *lookupRecord = &StructAtOffset (coverage, OffsetTo::get_size () * glyphCount); + LookupRecord *lookupRecord = &StructAtOffset (coverage, OffsetTo::get_size () * count); return SANITIZE_ARRAY (lookupRecord, LookupRecord::get_size (), lookupCount); } -- GitLab