diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index 993e7eb6f..91854f84e 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -110,16 +110,7 @@ typedef struct OffsetTable public: inline bool sanitize (SANITIZE_ARG_DEF, void *base) { TRACE_SANITIZE (); - if (!(SANITIZE_SELF () && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables))) return false; - return true; - /* No need to check tables individually since we don't sanitize the - * referenced table, just the table directory. Code retaind to make - * sure TableDirectory has a baseless sanitize(). */ - unsigned int count = numTables; - for (unsigned int i = 0; i < count; i++) - if (!SANITIZE (tableDir[i])) - return false; - return true; + return SANITIZE_SELF () && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables); } private: @@ -143,11 +134,7 @@ struct TTCHeader STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (TTCHeader, 1, 2); inline unsigned int get_face_count (void) const { return table.len; } - - inline const OpenTypeFontFace& get_face (unsigned int i) const - { - return this+table[i]; - } + inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; } inline bool sanitize (SANITIZE_ARG_DEF) { TRACE_SANITIZE (); @@ -199,13 +186,6 @@ struct OpenTypeFontFile } } - /* This is how you get a table */ - inline const char* get_table_data (const OpenTypeTable& table) const - { - if (HB_UNLIKELY (table.offset == 0)) return NULL; - return CharP(this) + table.offset; - } - inline bool sanitize (SANITIZE_ARG_DEF) { TRACE_SANITIZE (); if (!SANITIZE_SELF ()) return false; diff --git a/src/main.cc b/src/main.cc index 025175998..b2aee2b3a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -99,7 +99,7 @@ main (int argc, char **argv) case GSUBGPOS::GPOSTag: { - const GSUBGPOS &g = GSUBGPOS::get_for_data (ot.get_table_data (table)); + const GSUBGPOS &g = GSUBGPOS::get_for_data ((const char *) &ot + table.offset); int num_scripts = g.get_script_count (); printf (" %d script(s) found in table\n", num_scripts); @@ -162,7 +162,7 @@ main (int argc, char **argv) case GDEF::Tag: { - const GDEF &gdef = GDEF::get_for_data (ot.get_table_data (table)); + const GDEF &gdef = GDEF::get_for_data ((const char *) &ot + table.offset); printf (" Has %sglyph classes\n", gdef.has_glyph_classes () ? "" : "no ");