Florian Weimer 2024-01-04 17:18:13 +01:00
parent 828e152f29
commit 95807b7d13
2 changed files with 38 additions and 1 deletions

33
foma-c99.patch Normal file
View File

@ -0,0 +1,33 @@
Fix BOM_codes initializer
Future compilers will reject the current initializer:
io.c:1002:7: error: initialization of char from void * makes integer from pointer without a cast
1002 | { NULL, 0, NULL },
| ^~~~
io.c:1002:16: error: initialization of char from void * makes integer from pointer without a cast
1002 | { NULL, 0, NULL },
| ^~~~
io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
996 | static BOM BOM_codes[] = {
| ^
io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
The reason is that NULL is usually a pointer constant, which is not a
valid expression for a character.
Submitted upstream: <https://github.com/mhulden/foma/pull/151>
diff --git a/foma/io.c b/foma/io.c
index 5f6644419080df49..8fcaecb9c113758a 100644
--- a/foma/io.c
+++ b/foma/io.c
@@ -999,7 +999,7 @@ static BOM BOM_codes[] = {
{ { 0x00, 0x00, 0xFE, 0xFF }, 4, "UTF-32BE" },
{ { 0xFF, 0xFE }, 2, "UTF16-LE" },
{ { 0xFE, 0xFF }, 2, "UTF16-BE" },
- { NULL, 0, NULL },
+ { { 0, } , 0, NULL },
};
BOM *check_BOM(char *buffer) {

View File

@ -9,7 +9,7 @@
Name: foma
Version: 0.10.0
Release: 0.7.%{snapshotdate}git%{shortcommit0}%{?dist}
Release: 0.8.%{snapshotdate}git%{shortcommit0}%{?dist}
Summary: Xerox-compatible finite-state compiler
License: Apache-2.0
@ -26,6 +26,7 @@ Source0: https://github.com/mhulden/%{name}/archive/%{commit0}.tar.gz#/%{
# the linker when building the shared library. For discussion on a similar
# issue, see https://lists.debian.org/debian-devel/2016/05/msg00302.html
Patch0: foma-harden-build-fedora.patch
Patch1: foma-c99.patch
BuildRequires: gcc zlib-devel readline-devel flex bison
BuildRequires: make
@ -104,6 +105,9 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';'
%changelog
* Thu Jan 04 2024 Florian Weimer <fweimer@redhat.com> - 0.10.0-0.8.20210601gitdfe1ccb
- Fix C compatibility issue
* Mon Aug 21 2023 Parag Nemade <pnemade AT fedoraproject DOT org> - 0.10.0-0.7.20210601gitdfe1ccb
- Migrate to SPDX license expression