Changeset: 26edd685dde9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/26edd685dde9
Modified Files:
geom/monetdb5/geod.c
geom/monetdb5/geod.h
geom/monetdb5/geom.c
geom/monetdb5/geom.h
geom/monetdb5/geomBulk.c
Branch: geo-update
Log Message:
Do not change the value of MAL input parameters, so use const properly.
diffs (197 lines):
diff --git a/geom/monetdb5/geod.c b/geom/monetdb5/geod.c
--- a/geom/monetdb5/geod.c
+++ b/geom/monetdb5/geod.c
@@ -242,7 +242,7 @@ cartPointFromXYZ(double x, double y, dou
/* Converts Well-Known Bytes into Geos Geometries, if they are not NULL and
have the same SRID (used for geographic functions) */
str
-wkbGetCompatibleGeometries(wkb **a, wkb **b, GEOSGeom *ga, GEOSGeom *gb)
+wkbGetCompatibleGeometries(wkb * const *a, wkb * const *b, GEOSGeom *ga,
GEOSGeom *gb)
{
str err = MAL_SUCCEED;
@@ -769,7 +769,7 @@ geoDistanceInternal(GEOSGeom a, GEOSGeom
**/
/* Calculates the distance, in meters, between two geographic geometries with
latitude/longitude coordinates */
str
-wkbDistanceGeographic(dbl *out, wkb **a, wkb **b)
+wkbDistanceGeographic(dbl *out, wkb * const *a, wkb * const *b)
{
str err = MAL_SUCCEED;
GEOSGeom ga, gb;
@@ -788,7 +788,7 @@ wkbDistanceGeographic(dbl *out, wkb **a,
**/
/* Checks if two geographic geometries are within d meters of one another */
str
-wkbDWithinGeographic(bit *out, wkb **a, wkb **b, dbl *d)
+wkbDWithinGeographic(bit *out, wkb * const *a, wkb * const *b, const dbl *d)
{
str err = MAL_SUCCEED;
GEOSGeom ga, gb;
@@ -809,7 +809,7 @@ wkbDWithinGeographic(bit *out, wkb **a,
**/
/* Checks if two geographic geometries intersect at any point */
str
-wkbIntersectsGeographic(bit *out, wkb **a, wkb **b)
+wkbIntersectsGeographic(bit *out, wkb * const *a, wkb * const *b)
{
str err = MAL_SUCCEED;
GEOSGeom ga, gb;
@@ -913,7 +913,7 @@ geoCoversInternal(GEOSGeom a, GEOSGeom b
**/
/* Checks if no point of Geometry B is outside Geometry A */
str
-wkbCoversGeographic(bit *out, wkb **a, wkb **b)
+wkbCoversGeographic(bit *out, wkb * const *a, wkb * const *b)
{
str err = MAL_SUCCEED;
GEOSGeom ga, gb;
@@ -939,7 +939,7 @@ geosDistanceWithin (GEOSGeom geom1, GEOS
//TODO Change BUNappend with manual insertion into the result BAT
static str
-filterSelectGeomGeomDoubleToBit(bat* outid, const bat *bid , const bat *sid,
wkb *wkb_const, dbl double_flag, bit anti, bit (*func) (GEOSGeom, GEOSGeom,
dbl), const char *name)
+filterSelectGeomGeomDoubleToBit(bat* outid, const bat *bid , const bat *sid,
const wkb *wkb_const, dbl double_flag, bit anti, bit (*func) (GEOSGeom,
GEOSGeom, dbl), const char *name)
{
BAT *out = NULL, *b = NULL, *s = NULL;
BATiter b_iter;
@@ -1016,7 +1016,7 @@ filterSelectGeomGeomDoubleToBit(bat* out
}
static str
-filterJoinGeomGeomDoubleToBit(bat *lres_id, bat *rres_id, const bat *l_id,
const bat *r_id, double double_flag, const bat *ls_id, const bat *rs_id, bit
nil_matches, lng *estimate, bit anti, bit (*func) (GEOSGeom, GEOSGeom, dbl),
const char *name)
+filterJoinGeomGeomDoubleToBit(bat *lres_id, bat *rres_id, const bat *l_id,
const bat *r_id, double double_flag, const bat *ls_id, const bat *rs_id, bit
nil_matches, const lng *estimate, bit anti, bit (*func) (GEOSGeom, GEOSGeom,
dbl), const char *name)
{
BAT *lres = NULL, *rres = NULL, *l = NULL, *r = NULL, *ls = NULL, *rs =
NULL;
BATiter l_iter, r_iter;
@@ -1024,6 +1024,7 @@ filterJoinGeomGeomDoubleToBit(bat *lres_
struct canditer l_ci, r_ci;
GEOSGeom l_geom, r_geom;
GEOSGeom *l_geoms = NULL, *r_geoms = NULL;
+ BUN est;
//get the input BATs
if ((l = BATdescriptor(*l_id)) == NULL || (r = BATdescriptor(*r_id)) ==
NULL) {
@@ -1041,13 +1042,12 @@ filterJoinGeomGeomDoubleToBit(bat *lres_
canditer_init(&l_ci, l, ls);
canditer_init(&r_ci, r, rs);
//create new BATs for the output
- if (is_lng_nil(*estimate) || *estimate == 0)
- *estimate = l_ci.ncand;
- if ((lres = COLnew(0, ATOMindex("oid"), *estimate, TRANSIENT)) == NULL)
{
+ est = is_lng_nil(*estimate) || *estimate == 0 ? l_ci.ncand : (BUN)
*estimate;
+ if ((lres = COLnew(0, ATOMindex("oid"), est, TRANSIENT)) == NULL) {
msg = createException(MAL, name, SQLSTATE(HY013)
MAL_MALLOC_FAIL);
goto free;
}
- if ((rres = COLnew(0, ATOMindex("oid"), *estimate, TRANSIENT)) == NULL)
{
+ if ((rres = COLnew(0, ATOMindex("oid"), est, TRANSIENT)) == NULL) {
msg = createException(MAL, name, SQLSTATE(HY013)
MAL_MALLOC_FAIL);
goto free;
}
@@ -1165,7 +1165,7 @@ free:
}
str
-wkbDWithinGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id, const
bat *r_id, const bat *d_id, const bat *ls_id, const bat *rs_id, bit
*nil_matches, lng *estimate, bit *anti) {
+wkbDWithinGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id, const
bat *r_id, const bat *d_id, const bat *ls_id, const bat *rs_id, const bit
*nil_matches, const lng *estimate, const bit *anti) {
double distance_within = 0;
BAT *d = NULL;
//Get the distance BAT and get the double value
@@ -1182,17 +1182,17 @@ wkbDWithinGeographicJoin(bat *lres_id, b
}
str
-wkbDWithinGeographicSelect(bat* outid, const bat *bid , const bat *sid, wkb
**wkb_const, dbl *distance_within, bit *anti) {
+wkbDWithinGeographicSelect(bat* outid, const bat *bid , const bat *sid, wkb *
const *wkb_const, const dbl *distance_within, const bit *anti) {
return
filterSelectGeomGeomDoubleToBit(outid,bid,sid,*wkb_const,*distance_within,*anti,geosDistanceWithin,"geom.wkbDWithinGeographicSelect");
}
str
-wkbIntersectsGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id, const
bat *r_id, const bat *ls_id, const bat *rs_id, bit *nil_matches, lng *estimate,
bit *anti) {
+wkbIntersectsGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id, const
bat *r_id, const bat *ls_id, const bat *rs_id, const bit *nil_matches, const
lng *estimate, const bit *anti) {
return
filterJoinGeomGeomDoubleToBit(lres_id,rres_id,l_id,r_id,0,ls_id,rs_id,*nil_matches,estimate,*anti,geosDistanceWithin,"geom.wkbIntersectsGeographicJoin");
}
str
-wkbIntersectsGeographicSelect(bat* outid, const bat *bid , const bat *sid, wkb
**wkb_const, bit *anti) {
+wkbIntersectsGeographicSelect(bat* outid, const bat *bid , const bat *sid, wkb
* const *wkb_const, const bit *anti) {
return
filterSelectGeomGeomDoubleToBit(outid,bid,sid,*wkb_const,0,*anti,geosDistanceWithin,"geom.wkbIntersectsGeographicSelect");
}
diff --git a/geom/monetdb5/geod.h b/geom/monetdb5/geod.h
--- a/geom/monetdb5/geod.h
+++ b/geom/monetdb5/geod.h
@@ -49,20 +49,20 @@ typedef struct CartPoint2D
double y;
} CartPoint2D;
-str wkbGetCompatibleGeometries(wkb **a, wkb **b, GEOSGeom *ga, GEOSGeom *gb);
+str wkbGetCompatibleGeometries(wkb * const *a, wkb * const *b, GEOSGeom *ga,
GEOSGeom *gb);
/* Geographic functions */
-str wkbCoversGeographic(bit* out, wkb** a, wkb** b);
+str wkbCoversGeographic(bit* out, wkb * const * a, wkb * const * b);
-str wkbDistanceGeographic(dbl* out, wkb** a, wkb** b);
-str wkbDistanceGeographic_bat(bat *outBAT_id, bat *aBAT_id, bat *bBAT_id);
-str wkbDistanceGeographic_bat_cand(bat *out_id, bat *a_id, bat *b_id, bat
*s1_id, bat *s2_id);
+str wkbDistanceGeographic(dbl* out, wkb * const * a, wkb * const * b);
+str wkbDistanceGeographic_bat(bat *outBAT_id, const bat *aBAT_id, const bat
*bBAT_id);
+str wkbDistanceGeographic_bat_cand(bat *out_id, const bat *a_id, const bat
*b_id, const bat *s1_id, const bat *s2_id);
-str wkbDWithinGeographic(bit* out, wkb** a, wkb** b, dbl *distance);
-str wkbDWithinGeographicSelect(bat* outid, const bat *bid , const bat *sid,
wkb **wkb_const, dbl *distance_within, bit *anti);
-str wkbDWithinGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id,
const bat *r_id, const bat *d_id, const bat *ls_id, const bat *rs_id, bit
*nil_matches, lng *estimate, bit *anti);
-str wkbIntersectsGeographic(bit* out, wkb** a, wkb** b);
-str wkbIntersectsGeographicSelect(bat* outid, const bat *bid , const bat *sid,
wkb **wkb_const, bit *anti);
-str wkbIntersectsGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id,
const bat *r_id, const bat *ls_id, const bat *rs_id, bit *nil_matches, lng
*estimate, bit *anti);
+str wkbDWithinGeographic(bit* out, wkb * const * a, wkb * const * b, const dbl
*distance);
+str wkbDWithinGeographicSelect(bat* outid, const bat *bid , const bat *sid,
wkb * const *wkb_const, const dbl *distance_within, const bit *anti);
+str wkbDWithinGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id,
const bat *r_id, const bat *d_id, const bat *ls_id, const bat *rs_id, const bit
*nil_matches, const lng *estimate, const bit *anti);
+str wkbIntersectsGeographic(bit* out, wkb * const * a, wkb * const * b);
+str wkbIntersectsGeographicSelect(bat* outid, const bat *bid , const bat *sid,
wkb * const *wkb_const, const bit *anti);
+str wkbIntersectsGeographicJoin(bat *lres_id, bat *rres_id, const bat *l_id,
const bat *r_id, const bat *ls_id, const bat *rs_id, const bit *nil_matches,
const lng *estimate, const bit *anti);
str geodeticEdgeBoundingBox(const CartPoint3D* p1, const CartPoint3D* p2,
BoundingBox* mbox);
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -285,8 +285,8 @@ wkbCollectAggr (wkb **out, const bat *bi
return msg;
}
-str
-wkbCollect (wkb **out, wkb **a, wkb **b) {
+static str
+wkbCollect (wkb **out, wkb * const *a, wkb * const *b) {
str err = MAL_SUCCEED;
GEOSGeom ga, gb, collection;
GEOSGeom *collect = NULL;
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -236,4 +236,3 @@ geom_export str mbrIntersects(bit* out,
geom_export str wkbCollectAggr (wkb **out, const bat *bid);
geom_export str wkbCollectAggrSubGrouped(bat *out, const bat *bid, const bat
*gid, const bat *eid, const bit *skip_nils);
geom_export str wkbCollectAggrSubGroupedCand(bat* outid, const bat* bid, const
bat* gid, const bat* eid, const bat* sid, const bit* skip_nils);
-geom_export str wkbCollect (wkb **out, wkb **a, wkb **b);
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -836,13 +836,13 @@ wkbTransform_bat_cand(bat *outBAT_id, ba
/* ST_DistanceGeographic Bulk function */
str
-wkbDistanceGeographic_bat(bat *out_id, bat *a_id, bat *b_id)
+wkbDistanceGeographic_bat(bat *out_id, const bat *a_id, const bat *b_id)
{
return wkbDistanceGeographic_bat_cand(out_id,a_id,b_id,NULL,NULL);
}
str
-wkbDistanceGeographic_bat_cand(bat *out_id, bat *a_id, bat *b_id, bat *s1_id,
bat *s2_id)
+wkbDistanceGeographic_bat_cand(bat *out_id, const bat *a_id, const bat *b_id,
const bat *s1_id, const bat *s2_id)
{
BAT *out = NULL, *a = NULL, *b = NULL, *s1 = NULL, *s2 = NULL;
BATiter a_iter, b_iter;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]