Port downstream-specific patches to C99

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2022-12-02 21:13:30 +01:00
parent b221824812
commit fa99cfecf1
2 changed files with 51 additions and 1 deletions

46
netpbm-c99.patch Normal file
View File

@ -0,0 +1,46 @@
Include "pm.h" for the declaration of the overflow_add function. This
avoids an implicit function declaration. Future C compilers will
require that all functions are declared explicitly. Implicit function
declarations are a language feature that was removed in 1999.
Likewise, include "pm.h" for the newly added declarations of realloc2.
This fixes a pointer truncation bug in pjtoppm.
Both issues are specific to downstream patches.
diff --git a/converter/pbm/pbmtoppa/pbm.c b/converter/pbm/pbmtoppa/pbm.c
index 1c8d236219b297e1..d63cab63b13f2051 100644
--- a/converter/pbm/pbmtoppa/pbm.c
+++ b/converter/pbm/pbmtoppa/pbm.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <string.h>
+#include "pm.h"
#include "ppapbm.h"
int make_pbm_stat(pbm_stat* pbm,FILE* fptr)
diff --git a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c
index c458c06457c2b9bd..5e93a6acb8d6f198 100644
--- a/converter/ppm/pjtoppm.c
+++ b/converter/ppm/pjtoppm.c
@@ -10,6 +10,7 @@
** implied warranty.
*/
+#include "pm.h"
#include "ppm.h"
#include "mallocvar.h"
diff --git a/lib/pm.h b/lib/pm.h
index 5037c2519c565fbc..435445d5e7f52fbf 100644
--- a/lib/pm.h
+++ b/lib/pm.h
@@ -457,6 +457,7 @@ pm_parse_height(const char * const arg);
void *malloc2(int, int);
void *malloc3(int, int, int);
+void *realloc2(void * a, int b, int c);
#define overflow2(a,b) __overflow2(a,b)
void __overflow2(int, int);
void overflow3(int, int, int);

View File

@ -1,7 +1,7 @@
Summary: A library for handling different graphics file formats
Name: netpbm
Version: 11.00.00
Release: 1%{?dist}
Release: 2%{?dist}
# See copyright_summary for details
License: BSD and GPLv2 and IJG and MIT and Public Domain
URL: http://netpbm.sourceforge.net/
@ -29,6 +29,7 @@ Patch14: netpbm-pamtojpeg2k.patch
Patch15: netpbm-manfix.patch
Patch16: netpbm-jasper.patch
Patch17: netpbm-libdir-so.patch
Patch18: netpbm-c99.patch
BuildRequires: make
BuildRequires: libjpeg-devel, libpng-devel, libtiff-devel, flex, gcc, jbigkit-devel
@ -229,6 +230,9 @@ popd
%doc userguide/*
%changelog
* Fri Dec 2 2022 Florian Weimer <fweimer@redhat.com> - 11.00.00-2
- Port downstream-specific patches to C99
* Tue Oct 04 2022 Josef Ridky <jridky@redhat.com> - 11.00.00-1
- New upstream release 11.00.00 (#2130384)