aboutsummaryrefslogtreecommitdiffstats
path: root/libparsepcf_get_swidth_count.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_swidth_count.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 '')
-rw-r--r--libparsepcf_get_swidth_count.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libparsepcf_get_swidth_count.c b/libparsepcf_get_swidth_count.c
index 90a5f4a..f6010d0 100644
--- a/libparsepcf_get_swidth_count.c
+++ b/libparsepcf_get_swidth_count.c
@@ -3,8 +3,11 @@
int
-libparsepcf_get_swidth_count(const char *file, size_t size, const struct libparsepcf_table *table, size_t *countp)
+libparsepcf_get_swidth_count(const void *file, size_t size,
+ const struct libparsepcf_table *table,
+ size_t *count)
{
+ const char *text = file;
size_t pos;
int msb = table->format & LIBPARSEPCF_BYTE;
@@ -13,14 +16,14 @@ libparsepcf_get_swidth_count(const char *file, size_t size, const struct libpars
pos = table->offset;
- if (table->format != libparsepcf_parse_lsb_uint32__(&file[pos]))
+ if (table->format != libparsepcf_parse_lsb_uint32__(&text[pos]))
goto ebfont;
pos += 4;
- *countp = (size_t)PARSE_UINT32(&file[pos], msb);
+ *count = (size_t)PARSE_UINT32(&text[pos], msb);
pos += 4;
- if (*countp > (size - pos) / 4)
+ if (*count > (size - pos) / 4)
goto ebfont;
return 0;