GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
GBOX box1;
GBOX box2;
+ bool empty1, empty2;
POSTGIS_DEBUG(2, "lwgeom_lt called");
POSTGIS_DEBUG(3, "lwgeom_lt passed getSRID test");
- gserialized_get_gbox_p(geom1, &box1);
- gserialized_get_gbox_p(geom2, &box2);
+ empty1 = ( gserialized_get_gbox_p(geom1, &box1) == LW_FAILURE );
+ empty2 = ( gserialized_get_gbox_p(geom2, &box2) == LW_FAILURE );
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
POSTGIS_DEBUG(3, "lwgeom_lt getbox2d_p passed");
+ if ( empty1 != empty2 )
+ {
+ PG_RETURN_BOOL(FALSE);
+ }
+
if ( ! FPeq(box1.xmin , box2.xmin) )
{
if (box1.xmin < box2.xmin)
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
GBOX box1;
GBOX box2;
+ bool empty1, empty2;
POSTGIS_DEBUG(2, "lwgeom_le called");
error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
- gserialized_get_gbox_p(geom1, &box1);
- gserialized_get_gbox_p(geom2, &box2);
+ empty1 = ( gserialized_get_gbox_p(geom1, &box1) == LW_FAILURE );
+ empty2 = ( gserialized_get_gbox_p(geom2, &box2) == LW_FAILURE );
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
+ if ( empty1 != empty2 )
+ {
+ PG_RETURN_BOOL(FALSE);
+ }
+
if ( ! FPeq(box1.xmin , box2.xmin) )
{
if (box1.xmin < box2.xmin)
gbox_init(&box1);
gbox_init(&box2);
-
+
empty1 = ( gserialized_get_gbox_p(geom1, &box1) == LW_FAILURE );
empty2 = ( gserialized_get_gbox_p(geom2, &box2) == LW_FAILURE );
+
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
GBOX box1;
GBOX box2;
+ bool empty1, empty2;
POSTGIS_DEBUG(2, "lwgeom_ge called");
error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
- gserialized_get_gbox_p(geom1, &box1);
- gserialized_get_gbox_p(geom2, &box2);
+ empty1 = ( gserialized_get_gbox_p(geom1, &box1) == LW_FAILURE );
+ empty2 = ( gserialized_get_gbox_p(geom2, &box2) == LW_FAILURE );
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
+ if ( empty1 != empty2 )
+ {
+ PG_RETURN_BOOL(FALSE);
+ }
+
if ( ! FPeq(box1.xmin , box2.xmin) )
{
if (box1.xmin > box2.xmin)
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
GBOX box1;
GBOX box2;
+ bool empty1, empty2;
POSTGIS_DEBUG(2, "lwgeom_gt called");
error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
- gserialized_get_gbox_p(geom1, &box1);
- gserialized_get_gbox_p(geom2, &box2);
+ empty1 = ( gserialized_get_gbox_p(geom1, &box1) == LW_FAILURE );
+ empty2 = ( gserialized_get_gbox_p(geom2, &box2) == LW_FAILURE );
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
+ if ( empty1 != empty2 )
+ {
+ PG_RETURN_BOOL(FALSE);
+ }
+
if ( ! FPeq(box1.xmin , box2.xmin) )
{
if (box1.xmin > box2.xmin)
GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
GBOX box1;
GBOX box2;
+ bool empty1, empty2;
POSTGIS_DEBUG(2, "lwgeom_cmp called");
error_if_srid_mismatch(gserialized_get_srid(geom1), gserialized_get_srid(geom2));
- gserialized_get_gbox_p(geom1, &box1);
- gserialized_get_gbox_p(geom2, &box2);
+ empty1 = ( gserialized_get_gbox_p(geom1, &box1) == LW_FAILURE );
+ empty2 = ( gserialized_get_gbox_p(geom2, &box2) == LW_FAILURE );
PG_FREE_IF_COPY(geom1, 0);
PG_FREE_IF_COPY(geom2, 1);
+ if ( empty1 != empty2 )
+ {
+ PG_RETURN_BOOL(FALSE);
+ }
+
if ( ! FPeq(box1.xmin , box2.xmin) )
{
if (box1.xmin < box2.xmin)