From: Regina Obe Date: Tue, 12 Dec 2017 22:16:55 +0000 (+0000) Subject: Move input_srid == output_srid check after input_srid is initialized X-Git-Tag: 2.5.0alpha~289 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17452e2e0ff7e447e5eda9889be3dee7f2460652;p=postgis Move input_srid == output_srid check after input_srid is initialized Closes #3940 git-svn-id: http://svn.osgeo.org/postgis/trunk@16148 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_transform.c b/postgis/lwgeom_transform.c index c0ab2ce32..34d89f6c9 100644 --- a/postgis/lwgeom_transform.c +++ b/postgis/lwgeom_transform.c @@ -59,12 +59,15 @@ Datum transform(PG_FUNCTION_ARGS) PG_RETURN_NULL(); } + geom = PG_GETARG_GSERIALIZED_P_COPY(0); + input_srid = gserialized_get_srid(geom); + + /* Moved this back down after input_srid set otherwise FreeBSD 11 (bessie goes nuts) + Refer to https://trac.osgeo.org/postgis/ticket/3940 */ /* Input SRID and output SRID are equal, noop */ if ( input_srid == output_srid ) PG_RETURN_POINTER(PG_GETARG_DATUM(0)); - geom = PG_GETARG_GSERIALIZED_P_COPY(0); - input_srid = gserialized_get_srid(geom); if ( input_srid == SRID_UNKNOWN ) { PG_FREE_IF_COPY(geom, 0); @@ -72,6 +75,8 @@ Datum transform(PG_FUNCTION_ARGS) PG_RETURN_NULL(); } + + if ( GetProjectionsUsingFCInfo(fcinfo, input_srid, output_srid, &input_pj, &output_pj) == LW_FAILURE ) { PG_FREE_IF_COPY(geom, 0);