From d34e4778918390bf453f5efd3e5d578463c8b46a Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 22 Dec 2011 08:01:43 +0000 Subject: [PATCH] Replace INFINITY with MAXFLOAT. Should fix Solaris build [#1396] I don't think it makes a difference as those functions are not documented about the exceptional return, and no regression test fails with the change. git-svn-id: http://svn.osgeo.org/postgis/trunk@8499 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/gserialized_gist_2d.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/postgis/gserialized_gist_2d.c b/postgis/gserialized_gist_2d.c index add618bbc..84efa9e9e 100644 --- a/postgis/gserialized_gist_2d.c +++ b/postgis/gserialized_gist_2d.c @@ -32,6 +32,7 @@ #include "liblwgeom.h" /* For standard geometry types. */ #include "lwgeom_pg.h" /* For debugging macros. */ #include "gserialized_gist.h" /* For utility functions. */ +#include "liblwgeom_internal.h" /* For MAXFLOAT */ /* ** When is a node split not so good? If more than 90% of the entries @@ -465,7 +466,7 @@ static double box2df_distance(const BOX2DF *a, const BOX2DF *b) return b->ymin - a->ymax; } - return INFINITY; + return MAXFLOAT; } @@ -572,7 +573,7 @@ Datum gserialized_distance_centroid_2d(PG_FUNCTION_ARGS) POSTGIS_DEBUGF(3, "got boxes %s and %s", box2df_to_string(&b1), box2df_to_string(&b2)); PG_RETURN_FLOAT8(distance); } - PG_RETURN_FLOAT8(INFINITY); + PG_RETURN_FLOAT8(MAXFLOAT); } PG_FUNCTION_INFO_V1(gserialized_distance_box_2d); @@ -592,7 +593,7 @@ Datum gserialized_distance_box_2d(PG_FUNCTION_ARGS) POSTGIS_DEBUGF(3, "got boxes %s and %s", box2df_to_string(&b1), box2df_to_string(&b2)); PG_RETURN_FLOAT8(distance); } - PG_RETURN_FLOAT8(INFINITY); + PG_RETURN_FLOAT8(MAXFLOAT); } PG_FUNCTION_INFO_V1(gserialized_same_2d); @@ -958,14 +959,14 @@ Datum gserialized_gist_distance_2d(PG_FUNCTION_ARGS) * and '14' as the gist distance-between-boxes strategy number */ if ( strategy != 13 && strategy != 14 ) { elog(ERROR, "unrecognized strategy number: %d", strategy); - PG_RETURN_FLOAT8(INFINITY); + PG_RETURN_FLOAT8(MAXFLOAT); } /* Null box should never make this far. */ if ( gserialized_datum_get_box2df_p(PG_GETARG_DATUM(1), &query_box) == LW_FAILURE ) { POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!"); - PG_RETURN_FLOAT8(INFINITY); + PG_RETURN_FLOAT8(MAXFLOAT); } /* Get the entry box */ -- 2.40.0