C99 compatibility fixes
Backport an upstream patch to the bundled previous version, and apply a new patch to fix compilation errors with future compilers. Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
5b63c4e9a8
commit
4027e2bac2
|
@ -0,0 +1,17 @@
|
|||
Include <math.h> for isnan. This avoids an implicit function
|
||||
declaration and a build failure with future compilers.
|
||||
|
||||
Submitted upstream: <https://github.com/postgis/postgis/pull/725>
|
||||
|
||||
diff -ur postgis-3.3.2.orig/loader/shp2pgsql-core.c postgis-3.3.2/loader/shp2pgsql-core.c
|
||||
--- postgis-3.3.2.orig/loader/shp2pgsql-core.c 2022-11-13 08:09:23.000000000 +0100
|
||||
+++ postgis-3.3.2/loader/shp2pgsql-core.c 2023-04-09 22:01:46.377934865 +0200
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "../postgis_config.h"
|
||||
|
||||
+#include <math.h> /* for isnan */
|
||||
+
|
||||
#include "shp2pgsql-core.h"
|
||||
#include "../liblwgeom/liblwgeom.h"
|
||||
#include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */
|
|
@ -0,0 +1,54 @@
|
|||
commit ae53a53246ccb26a6e82fede1a4184b41bcf097d
|
||||
Author: Regina Obe <lr@pcorp.us>
|
||||
Date: Sat Feb 19 00:21:01 2022 -0500
|
||||
|
||||
Fix PG 15 building atoi removed. References #5100 for PostGIS 3.3.0
|
||||
|
||||
diff -ur postgis-3.3.2.orig/postgis-2.5.5/postgis/gserialized_typmod.c postgis-3.3.2/postgis-2.5.5/postgis/gserialized_typmod.c
|
||||
--- postgis-3.3.2.orig/postgis-2.5.5/postgis/gserialized_typmod.c 2023-04-09 21:52:47.909294055 +0200
|
||||
+++ postgis-3.3.2/postgis-2.5.5/postgis/gserialized_typmod.c 2023-04-09 21:55:24.744826310 +0200
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "utils/elog.h"
|
||||
#include "utils/array.h"
|
||||
-#include "utils/builtins.h" /* for pg_atoi */
|
||||
+#include "utils/builtins.h" /* for cstring_to_text */
|
||||
#include "lib/stringinfo.h" /* For binary input */
|
||||
#include "catalog/pg_type.h" /* for CSTRINGOID */
|
||||
|
||||
@@ -267,8 +267,33 @@
|
||||
}
|
||||
if ( i == 1 ) /* SRID */
|
||||
{
|
||||
- int srid = pg_atoi(DatumGetCString(elem_values[i]),
|
||||
- sizeof(int32), '\0');
|
||||
+ char *int_string = DatumGetCString(elem_values[i]);
|
||||
+ char *endp;
|
||||
+ long l;
|
||||
+ int32_t srid;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ l = strtol(int_string, &endp, 10);
|
||||
+
|
||||
+ if (int_string == endp)
|
||||
+ ereport(ERROR,
|
||||
+ (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
|
||||
+ errmsg("invalid input syntax for type %s: \"%s\"",
|
||||
+ "integer", int_string)));
|
||||
+
|
||||
+ if (errno == ERANGE || l < INT_MIN || l > INT_MAX)
|
||||
+ ereport(ERROR,
|
||||
+ (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||
+ errmsg("value \"%s\" is out of range for type %s", int_string,
|
||||
+ "integer")));
|
||||
+
|
||||
+ if (*endp != '\0')
|
||||
+ ereport(ERROR,
|
||||
+ (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
|
||||
+ errmsg("invalid input syntax for type %s: \"%s\"",
|
||||
+ "integer", int_string)));
|
||||
+
|
||||
+ srid = clamp_srid(l);
|
||||
srid = clamp_srid(srid);
|
||||
POSTGIS_DEBUGF(3, "srid: %d", srid);
|
||||
if ( srid != SRID_UNKNOWN )
|
10
postgis.spec
10
postgis.spec
|
@ -15,7 +15,7 @@
|
|||
|
||||
Name: postgis
|
||||
Version: 3.3.2
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Geographic Information Systems Extensions to PostgreSQL
|
||||
License: GPLv2+
|
||||
|
||||
|
@ -26,6 +26,8 @@ Source3: http://download.osgeo.org/%{name}/source/%{name}-%{prevversion}.t
|
|||
|
||||
# Add proj8 compatibility to postgis-2.x (needed for upgrade package)
|
||||
Patch1: postgis2-proj8.patch
|
||||
Patch2: postgis-c99.patch
|
||||
Patch3: postgis-c99-2.patch
|
||||
|
||||
%ifnarch armv7hl
|
||||
BuildRequires: SFCGAL-devel
|
||||
|
@ -154,9 +156,12 @@ tar xf %{SOURCE0}
|
|||
|
||||
cd %{name}-%{prevversion}
|
||||
%patch1 -p1
|
||||
%patch -P 2 -p2
|
||||
%patch -P 3 -p1
|
||||
./autogen.sh
|
||||
)
|
||||
%endif
|
||||
%patch -P 3 -p1
|
||||
cp -p %{SOURCE2} .
|
||||
|
||||
|
||||
|
@ -404,6 +409,9 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Sun Apr 09 2023 Florian Weimer <fweimer@redhat.com> - 3.3.2-4
|
||||
- C99 compatibility fixes
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
|
|
Loading…
Reference in New Issue