diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-03 11:21:35 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-03 11:21:35 +0000 |
commit | a8158d443e6a4bafae28a46b883cbdcfd5789eec (patch) | |
tree | e98abba8c71cefaefaafb053dd8f9abb057d87fe /src/cairo-truetype-subset.c | |
parent | e4b1f871e9cbb04590df5dc6f6f7854642fa0340 (diff) |
[truetype] Move the sizeof asserts to compile time.
Eliminate the need for a runtime test on the sizeof the private structures
by performing the check at compile time. This was provoked by Ginn Chenn
noting that the test was including a private header.
Diffstat (limited to 'src/cairo-truetype-subset.c')
-rw-r--r-- | src/cairo-truetype-subset.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c index d01b0895..31e39710 100644 --- a/src/cairo-truetype-subset.c +++ b/src/cairo-truetype-subset.c @@ -94,6 +94,21 @@ struct _cairo_truetype_font { }; +/* + * Test that the structs we define for TrueType tables have the + * correct size, ie. they are not padded. + */ +#define check(T, S) COMPILE_TIME_ASSERT (sizeof (T) == (S)) +check (tt_head_t, 54); +check (tt_hhea_t, 36); +check (tt_maxp_t, 32); +check (tt_name_record_t, 12); +check (tt_name_t, 18); +check (tt_name_t, 18); +check (tt_composite_glyph_t, 18); +check (tt_glyph_data_t, 28); +#undef check + static cairo_status_t cairo_truetype_font_use_glyph (cairo_truetype_font_t *font, unsigned short glyph, |