aboutsummaryrefslogtreecommitdiffstats
path: root/libparsepcf_get_tables.c
diff options
context:
space:
mode:
Diffstat (limited to 'libparsepcf_get_tables.c')
-rw-r--r--libparsepcf_get_tables.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libparsepcf_get_tables.c b/libparsepcf_get_tables.c
index 56cffc2..d1963e7 100644
--- a/libparsepcf_get_tables.c
+++ b/libparsepcf_get_tables.c
@@ -3,22 +3,25 @@
int
-libparsepcf_get_tables(const char *file, size_t size, struct libparsepcf_table *tables, size_t first, size_t count)
+libparsepcf_get_tables(const void *file, size_t size,
+ struct libparsepcf_table *tables,
+ size_t first, size_t count)
{
+ const char *text = file;
size_t pos = 8 + first * 16;
size_t i;
for (i = 0; i < count; i++, pos += 16) {
- tables[i].type = libparsepcf_parse_lsb_uint32__(&file[pos + 0]);
- tables[i].format = libparsepcf_parse_lsb_uint32__(&file[pos + 4]);
- tables[i].size = libparsepcf_parse_lsb_uint32__(&file[pos + 8]);
- tables[i].offset = libparsepcf_parse_lsb_uint32__(&file[pos + 12]);
+ tables[i].type = libparsepcf_parse_lsb_uint32__(&text[pos + 0]);
+ tables[i].format = libparsepcf_parse_lsb_uint32__(&text[pos + 4]);
+ tables[i].size = libparsepcf_parse_lsb_uint32__(&text[pos + 8]);
+ tables[i].offset = libparsepcf_parse_lsb_uint32__(&text[pos + 12]);
if ((size_t)tables[i].offset > size)
goto ebfont;
- /* For some reasons files specify table sizes such that they
- * actually except the boundary of the file, despite not using
+ /* For some reason files specify table sizes such that they
+ * actually exceed the boundary of the file, despite not using
* that much data. Don't including this fix, but instead check
* that the table size is not too large, will break your
* favourite fonts. */