[ot-color] Cosmetic changes (#962)

This commit is contained in:
Ebrahim Byagowi 2018-04-11 17:13:20 +04:30 committed by GitHub
parent 1e1e9086c0
commit f8bb582bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 47 deletions

View File

@ -909,7 +909,6 @@ struct UnsizedArrayOf
return_trace (true); return_trace (true);
} }
private:
inline bool sanitize_shallow (hb_sanitize_context_t *c, unsigned int count) const inline bool sanitize_shallow (hb_sanitize_context_t *c, unsigned int count) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);

View File

@ -302,7 +302,7 @@ struct BitmapSizeTable
struct GlyphBitmapDataFormat17 struct GlyphBitmapDataFormat17
{ {
SmallGlyphMetrics glyphMetrics; SmallGlyphMetrics glyphMetrics;
ArrayOf<HBUINT8, HBUINT32> data; LArrayOf<HBUINT8> data;
public: public:
DEFINE_SIZE_ARRAY(9, data); DEFINE_SIZE_ARRAY(9, data);
}; };
@ -310,14 +310,14 @@ struct GlyphBitmapDataFormat17
struct GlyphBitmapDataFormat18 struct GlyphBitmapDataFormat18
{ {
BigGlyphMetrics glyphMetrics; BigGlyphMetrics glyphMetrics;
ArrayOf<HBUINT8, HBUINT32> data; LArrayOf<HBUINT8> data;
public: public:
DEFINE_SIZE_ARRAY(12, data); DEFINE_SIZE_ARRAY(12, data);
}; };
struct GlyphBitmapDataFormat19 struct GlyphBitmapDataFormat19
{ {
ArrayOf<HBUINT8, HBUINT32> data; LArrayOf<HBUINT8> data;
public: public:
DEFINE_SIZE_ARRAY(4, data); DEFINE_SIZE_ARRAY(4, data);
}; };

View File

@ -45,7 +45,8 @@ struct SBIXGlyph
Tag graphicType; /* Indicates the format of the embedded graphic Tag graphicType; /* Indicates the format of the embedded graphic
* data: one of 'jpg ', 'png ' or 'tiff', or the * data: one of 'jpg ', 'png ' or 'tiff', or the
* special format 'dupe'. */ * special format 'dupe'. */
HBUINT8 data[VAR]; /* The actual embedded graphic data. The total UnsizedArrayOf<HBUINT8>
data; /* The actual embedded graphic data. The total
* length is inferred from sequential entries in * length is inferred from sequential entries in
* the glyphDataOffsets array and the fixed size * the glyphDataOffsets array and the fixed size
* (8 bytes) of the preceding fields. */ * (8 bytes) of the preceding fields. */
@ -61,17 +62,15 @@ struct SBIXStrike
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && return_trace (c->check_struct (this) &&
c->check_array (imageOffsetsZ, imageOffsetsZ.sanitize_shallow (c, c->num_glyphs + 1));
sizeof (HBUINT32),
1 + c->num_glyphs));
} }
protected:
HBUINT16 ppem; /* The PPEM size for which this strike was designed. */ HBUINT16 ppem; /* The PPEM size for which this strike was designed. */
HBUINT16 resolution; /* The device pixel density (in PPI) for which this HBUINT16 resolution; /* The device pixel density (in PPI) for which this
* strike was designed. (E.g., 96 PPI, 192 PPI.) */ * strike was designed. (E.g., 96 PPI, 192 PPI.) */
protected: UnsizedArrayOf<LOffsetTo<SBIXGlyph> >
LOffsetTo<SBIXGlyph> imageOffsetsZ[VAR]; // VAR=maxp.numGlyphs + 1 imageOffsetsZ; /* Offset from the beginning of the strike data header
/* Offset from the beginning of the strike data header
* to bitmap data for an individual glyph ID. */ * to bitmap data for an individual glyph ID. */
public: public:
DEFINE_SIZE_STATIC (8); DEFINE_SIZE_STATIC (8);
@ -121,7 +120,7 @@ struct sbix
if (strike.imageOffsetsZ[glyph + 1] - strike.imageOffsetsZ[glyph] > 0) if (strike.imageOffsetsZ[glyph + 1] - strike.imageOffsetsZ[glyph] > 0)
{ {
const SBIXGlyph &sbixGlyph = strike.imageOffsetsZ[glyph]((const void *) &strike); const SBIXGlyph &sbixGlyph = strike.imageOffsetsZ[glyph]((const void *) &strike);
callback ((const uint8_t*) sbixGlyph.data, callback ((const uint8_t*) &sbixGlyph.data,
strike.imageOffsetsZ[glyph + 1] - strike.imageOffsetsZ[glyph] - 8, strike.imageOffsetsZ[glyph + 1] - strike.imageOffsetsZ[glyph] - 8,
group, glyph); group, glyph);
} }
@ -141,7 +140,7 @@ struct sbix
HBUINT16 version; /* Table version number — set to 1 */ HBUINT16 version; /* Table version number — set to 1 */
HBUINT16 flags; /* Bit 0: Set to 1. Bit 1: Draw outlines. HBUINT16 flags; /* Bit 0: Set to 1. Bit 1: Draw outlines.
* Bits 2 to 15: reserved (set to 0). */ * Bits 2 to 15: reserved (set to 0). */
ArrayOf<LOffsetTo<SBIXStrike>, HBUINT32> LArrayOf<LOffsetTo<SBIXStrike> >
strikes; /* Offsets from the beginning of the 'sbix' strikes; /* Offsets from the beginning of the 'sbix'
* table to data for each individual bitmap strike. */ * table to data for each individual bitmap strike. */
public: public:

View File

@ -45,7 +45,7 @@ struct SVGDocumentIndexEntry
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && return_trace (c->check_struct (this) &&
c->check_range (&svgDoc (base), svgDocLength)); (base+svgDoc).sanitize (c, svgDocLength));
} }
protected: protected:
@ -53,7 +53,7 @@ struct SVGDocumentIndexEntry
* this index entry. */ * this index entry. */
HBUINT16 endGlyphID; /* The last glyph ID in the range described by HBUINT16 endGlyphID; /* The last glyph ID in the range described by
* this index entry. Must be >= startGlyphID. */ * this index entry. Must be >= startGlyphID. */
LOffsetTo<const uint8_t *> LOffsetTo<UnsizedArrayOf<HBUINT8> >
svgDoc; /* Offset from the beginning of the SVG Document Index svgDoc; /* Offset from the beginning of the SVG Document Index
* to an SVG document. Must be non-zero. */ * to an SVG document. Must be non-zero. */
HBUINT32 svgDocLength; /* Length of the SVG document. HBUINT32 svgDocLength; /* Length of the SVG document.
@ -88,7 +88,7 @@ struct SVG
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && return_trace (c->check_struct (this) &&
svgDocIndex (this).sanitize (c)); (this+svgDocIndex).sanitize (c));
} }
struct accelerator_t struct accelerator_t
@ -107,10 +107,11 @@ struct SVG
hb_blob_destroy (svg_blob); hb_blob_destroy (svg_blob);
} }
inline void dump (void (*callback) (const uint8_t* data, unsigned int length, inline void
dump (void (*callback) (const uint8_t* data, unsigned int length,
unsigned int start_glyph, unsigned int end_glyph)) const unsigned int start_glyph, unsigned int end_glyph)) const
{ {
const SVGDocumentIndex &index = svg->svgDocIndex (svg); const SVGDocumentIndex &index = svg+svg->svgDocIndex;
const ArrayOf<SVGDocumentIndexEntry> &entries = index.entries; const ArrayOf<SVGDocumentIndexEntry> &entries = index.entries;
for (unsigned int i = 0; i < entries.len; ++i) for (unsigned int i = 0; i < entries.len; ++i)
{ {