]> granicus.if.org Git - postgis/commitdiff
Move input_srid == output_srid check after input_srid is initialized
authorRegina Obe <lr@pcorp.us>
Tue, 12 Dec 2017 22:16:55 +0000 (22:16 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 12 Dec 2017 22:16:55 +0000 (22:16 +0000)
Closes #3940

git-svn-id: http://svn.osgeo.org/postgis/trunk@16148 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_transform.c

index c0ab2ce32c942ce1ed5eeb433686e3a56631f47e..34d89f6c9544580157ab78770aaeb6e4439b2cb1 100644 (file)
@@ -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);