aboutsummaryrefslogtreecommitdiffstats
path: root/libparsepcf_get_tables.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2024-10-13 11:17:48 +0200
committerMattias Andrée <m@maandree.se>2024-10-13 11:17:48 +0200
commita81c96c0348af8caf6ae45e2d942a676792a2a31 (patch)
tree24cc725efa3eba381c98ebed7cb2cbf7e0e34f0c /libparsepcf_get_tables.c
parentUpdate e-mail (diff)
downloadlibparsepcf-a81c96c0348af8caf6ae45e2d942a676792a2a31.tar.gz
libparsepcf-a81c96c0348af8caf6ae45e2d942a676792a2a31.tar.bz2
libparsepcf-a81c96c0348af8caf6ae45e2d942a676792a2a31.tar.xz
Documentation and minor improvements
Signed-off-by: Mattias Andrée <m@maandree.se>
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. */