From: Sandro Santilli Date: Mon, 29 Jun 2015 07:02:04 +0000 (+0000) Subject: Do not rely on out param value in getNodeWithinDistance2D callback X-Git-Tag: 2.2.0rc1~304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65280ce386f581c301198dc487c87abf5770f240;p=postgis Do not rely on out param value in getNodeWithinDistance2D callback git-svn-id: http://svn.osgeo.org/postgis/trunk@13734 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c index a0e120d06..007757d90 100644 --- a/topology/postgis_topology.c +++ b/topology/postgis_topology.c @@ -515,7 +515,7 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo, } else if ( elems_requested > 0 ) { appendStringInfo(sql, " LIMIT %d", elems_requested); } - spi_result = SPI_execute(sql->data, true, *numelems); + spi_result = SPI_execute(sql->data, true, limit >= 0 ? limit : 0); if ( spi_result != SPI_OK_SELECT ) { cberror(topo->be_data, "unexpected return (%d) from query execution: %s", spi_result, sql->data); @@ -523,7 +523,7 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo, } pfree(sqldata.data); - lwpgnotice("cb_getNodeWithinDistance2D: edge query " + lwpgnotice("cb_getNodeWithinDistance2D: node query " "(limited by %d) returned %d rows", elems_requested, SPI_processed); if ( ! SPI_processed ) {