From 25087f03f500bf84a561571a1fd922cead793341 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 5 Jan 2024 09:11:19 +0100 Subject: [PATCH] Fix C compatibility issues Related to: --- adobe-afdko-c99-1.patch | 21 +++++++++++++++++++++ adobe-afdko-c99-2.patch | 37 +++++++++++++++++++++++++++++++++++++ adobe-afdko.spec | 9 +++++++-- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 adobe-afdko-c99-1.patch create mode 100644 adobe-afdko-c99-2.patch diff --git a/adobe-afdko-c99-1.patch b/adobe-afdko-c99-1.patch new file mode 100644 index 0000000..543d88e --- /dev/null +++ b/adobe-afdko-c99-1.patch @@ -0,0 +1,21 @@ +Upstream, this is part of this commit: + +commit 26761e9616f8a52aa14e7041ac9cbb0e139a1d83 +Author: Skef Iterum +Date: Thu May 13 05:33:44 2021 -0700 + + Antlr 4 feature file parser and CMake build system + +diff --git a/c/makeotf/makeotf_lib/source/hotconv/STAT.c b/c/makeotf/makeotf_lib/source/hotconv/STAT.c +index a93cb6571ad14fab..7d31230cf87bd941 100644 +--- a/c/makeotf/makeotf_lib/source/hotconv/STAT.c ++++ b/c/makeotf/makeotf_lib/source/hotconv/STAT.c +@@ -301,7 +301,7 @@ void STATAddDesignAxis(hotCtx g, Tag tag, uint16_t nameID, uint16_t ordering) { + + // Currently registered tags are 'wght', 'wdth', 'opsz', 'ital', 'slnt' + char tagString[4] = {TAG_ARG(tag)}; +- const uint32_t *regTags[5] = { ++ const uint32_t regTags[5] = { + TAG('i', 't', 'a', 'l'), + TAG('o', 'p', 's', 'z'), + TAG('s', 'l', 'n', 't'), diff --git a/adobe-afdko-c99-2.patch b/adobe-afdko-c99-2.patch new file mode 100644 index 0000000..f02fe9f --- /dev/null +++ b/adobe-afdko-c99-2.patch @@ -0,0 +1,37 @@ +Author: Sergei Trofimovich +Date: Wed Dec 6 20:41:57 2023 +0000 + + c/shared/source/t1write/t1write.c: fix u8/u16 type mismatch on dereference (gcc-14) + + 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. + +Submitted upstream: + +diff --git a/c/public/lib/source/t1write/t1write.c b/c/public/lib/source/t1write/t1write.c +index e16387408a953c07..b2e4c0df27d36e56 100644 +--- a/c/public/lib/source/t1write/t1write.c ++++ b/c/public/lib/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++; + } diff --git a/adobe-afdko.spec b/adobe-afdko.spec index d25107e..6f4ff04 100644 --- a/adobe-afdko.spec +++ b/adobe-afdko.spec @@ -2,7 +2,7 @@ Name: adobe-afdko Version: 3.6.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Adobe Font Development Kit for OpenType # ExternalAntlr4Cpp.cmake is BSD-3-clause # c/makeotf/makeotf_lib/build/hotpccts/pccts/* is ANTLR-PD @@ -11,6 +11,8 @@ Summary: Adobe Font Development Kit for OpenType License: Apache-2.0 AND BSD-3-clause AND ANTLR-PD AND Python-2.0.1 URL: https://github.com/adobe-type-tools/afdko Source0: https://github.com/adobe-type-tools/%{archivename}/releases/download/%{version}/%{archivename}-%{version}.tar.gz +Patch0: adobe-afdko-c99-1.patch +Patch1: adobe-afdko-c99-2.patch BuildRequires: gcc BuildRequires: make @@ -20,7 +22,7 @@ The AFDKO is a set of tools for building OpenType font files from PostScript and TrueType font data. %prep -%autosetup -n %{archivename}-%{version} +%autosetup -p1 -n %{archivename}-%{version} %build %set_build_flags @@ -40,6 +42,9 @@ find ./ -type f -executable -exec install -p -m 0755 "{}" \ %{_bindir}/* %changelog +* Fri Jan 05 2024 Florian Weimer - 3.6.1-7 +- Fix C compatibility issues + * Wed Jul 19 2023 Fedora Release Engineering - 3.6.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild