From 51394a1f08fd12a6a973e967c3002af74ed52d44 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 6 Dec 2023 20:35:16 +0000 Subject: [PATCH 1/4] c/shared/source/uforead/uforead.c: fix `message()` format argument (gcc-14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upcoming `gcc-14` enabled a few warnings into errors, like `-Wint-conversion`. This caused `afdko` build to fail as: /build/afdko/c/shared/source/uforead/uforead.c:1243:20: error: passing argument 2 of ‘message’ makes pointer from integer without a cast [-Wint-conversion] 1243 | message(h, ufoErrParse, "Encountered glyph reference %s in alternate layer's contents.plist with an empty file path. ", glyphName); | ^~~~~~~~~~~ | | | int It looks like `ufoErrParse` is an unexpected parameter here. While at it fixed build failure related to int/pointer error: /build/afdko/c/shared/source/uforead/uforead.c:2007:16: error: returning ‘void *’ from a function with return type ‘long int’ makes integer from pointer without a cast [-Wint-conversion] 2007 | return NULL; | ^~~~ --- c/shared/source/uforead/uforead.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c/shared/source/uforead/uforead.c b/c/shared/source/uforead/uforead.c index f1a4df896..2dea0c61c 100644 --- a/c/shared/source/uforead/uforead.c +++ b/c/shared/source/uforead/uforead.c @@ -1240,7 +1240,7 @@ static void updateGLIFRec(ufoCtx h, char* glyphName, xmlNodePtr cur) { if (fileName == NULL) { /* this is basically muted for now, as the previous check will return and skip if not parseable. We'll add this back once we add verbosity flag */ - message(h, ufoErrParse, "Encountered glyph reference %s in alternate layer's contents.plist with an empty file path. ", glyphName); + message(h, "Encountered glyph reference %s in alternate layer's contents.plist with an empty file path. ", glyphName); return; } @@ -2004,7 +2004,7 @@ static long strtolCheck(ufoCtx h, char* keyValue, bool fail, char* msg, int base fatal(h, ufoErrParse, msg); else if (msg) message(h, msg); - return NULL; + return 0; } } @@ -2019,7 +2019,7 @@ static unsigned long strtoulCheck(ufoCtx h, char* keyValue, bool fail, char* msg fatal(h, ufoErrParse, msg); else if (msg) message(h, msg); - return NULL; + return 0; } } From 057e354fdc3f29df90dcb8aa70c7cdeff8f9245d Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 6 Dec 2023 20:39:24 +0000 Subject: [PATCH 2/4] /build/afdko/c/shared/source/tx_shared/tx_shared.c: fix parameter type (gcc-14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upcoming `gcc-14` enabled a few warnings into errors, like `-Wincompatible-pointer-types`. This caused `afdko` build to fail as: /build/afdko/c/shared/source/tx_shared/tx_shared.c: In function ‘stmInit’: /build/afdko/c/shared/source/tx_shared/tx_shared.c:526:20: error: assignment to ‘size_t (*)(ctlStreamCallbacks *, void *, char **)’ {aka ‘long unsigned int (*)(struct ctlStreamCallbacks_ *, void *, char **)’} from incompatible pointer type ‘size_t (*)(ctlStreamCallbacks *, Stream *, char **)’ {aka ‘long unsigned int (*)(struct ctlStreamCallbacks_ *, Stream *, char **)’} [-Wincompatible-pointer-types] 526 | h->cb.stm.read = stm_read; | ^ The change fixes opaque parameter to pass as `void *`. --- c/shared/source/tx_shared/tx_shared.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/shared/source/tx_shared/tx_shared.c b/c/shared/source/tx_shared/tx_shared.c index 10d51ba54..936b243c2 100644 --- a/c/shared/source/tx_shared/tx_shared.c +++ b/c/shared/source/tx_shared/tx_shared.c @@ -386,7 +386,7 @@ static long stm_tell(ctlStreamCallbacks *cb, void *stream) { } /* Read from stream. */ -static size_t stm_read(ctlStreamCallbacks *cb, Stream *stream, char **ptr) { +static size_t stm_read(ctlStreamCallbacks *cb, void *stream, char **ptr) { Stream *s = stream; switch (s->type) { case stm_Src: @@ -405,7 +405,7 @@ static size_t stm_read(ctlStreamCallbacks *cb, Stream *stream, char **ptr) { return 0; /* Suppress compiler warning */ } -static size_t stm_xml_read(ctlStreamCallbacks *cb, Stream *stream, xmlDocPtr *doc){ +static size_t stm_xml_read(ctlStreamCallbacks *cb, void *stream, xmlDocPtr *doc){ int res; int readAmt = 0; xmlParserCtxtPtr ctxt; From cdef7b332483637322e014c3e64b580f53bf9d6e Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 6 Dec 2023 20:41:57 +0000 Subject: [PATCH 3/4] c/shared/source/t1write/t1write.c: fix u8/u16 type mismatch on dereference (gcc-14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upcoming `gcc-14` enabled a few warnings into errors, like `-Wincompatible-pointer-types`. This caused `afdko` build to fail as: /build/afdko/c/shared/source/t1write/t1write.c: In function ‘saveCstr’: /build/afdko/c/shared/source/t1write/t1write.c:348:28: error: passing argument 3 of ‘writeTmp’ from incompatible pointer type [-Wincompatible-pointer-types] 348 | if (writeTmp(h, 1, &info->iFD)) | ^~~~~~~~~~ | | | uint16_t * {aka short unsigned int *} The code attempts to use only one byte of 16-bit value. The code very likely is broken on a big-endian system. The change explicitly truncates 16-bit value down to 8 bit value to retain existing behaviour on both BE and LE systems. --- c/shared/source/t1write/t1write.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c/shared/source/t1write/t1write.c b/c/shared/source/t1write/t1write.c index 6405b6537..266a11953 100644 --- a/c/shared/source/t1write/t1write.c +++ b/c/shared/source/t1write/t1write.c @@ -345,7 +345,8 @@ static int saveCstr(t1wCtx h, abfGlyphInfo *info, if (info != NULL && info->flags & ABF_GLYPH_CID && !(h->arg.flags & T1W_TYPE_HOST)) { /* CID-keyed incremental download; write fd index */ - if (writeTmp(h, 1, &info->iFD)) + unsigned char c = info->iFD; + if (writeTmp(h, 1, &c)) return 1; cstr->length++; } From 79dbb7657bdabf890d459f990ee3a7825fecb00f Mon Sep 17 00:00:00 2001 From: Skef Iterum Date: Wed, 10 Jan 2024 19:49:14 -0800 Subject: [PATCH 4/4] Skip copyright line in test --- tests/tx_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tx_test.py b/tests/tx_test.py index cd9842e7f..199d31f26 100644 --- a/tests/tx_test.py +++ b/tests/tx_test.py @@ -1677,7 +1677,7 @@ def test_alt_missing_glyph(): assert msg in output expected_path = generate_ps_dump(expected_path) output_path = generate_ps_dump(output_path) - assert differ([expected_path, output_path]) + assert differ([expected_path, output_path, '-s', PFA_SKIP[0]]) def test_parsing_attrs_bug1673():