Changeset: 12afcb3a6bcb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=12afcb3a6bcb
Modified Files:
geom/monetdb5/geomBulk.c
Branch: Jun2016
Log Message:
Ran through indent.
diffs (truncated from 1892 to 300 lines):
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -16,22 +16,23 @@
/********** One input **********/
/*******************************/
-str geom_2_geom_bat(bat* outBAT_id, bat* inBAT_id, int* columnType, int*
columnSRID) {
+str
+geom_2_geom_bat(bat *outBAT_id, bat *inBAT_id, int *columnType, int
*columnSRID)
+{
BAT *outBAT = NULL, *inBAT = NULL;
wkb *inWKB = NULL, *outWKB = NULL;
- BUN p =0, q =0;
+ BUN p = 0, q = 0;
BATiter inBAT_iter;
//get the descriptor of the BAT
if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
throw(MAL, "batcalc.wkb", RUNTIME_OBJECT_MISSING);
}
-
- if ( inBAT->htype != TYPE_void ) { //header type of BAT not void
+
+ if (inBAT->htype != TYPE_void) { //header type of BAT not void
BBPunfix(inBAT->batCacheid);
throw(MAL, "batcalc.wkb", "the arguments must have dense and
aligned heads");
}
-
//create a new BAT
if ((outBAT = BATnew(TYPE_void, ATOMindex("wkb"), BATcount(inBAT),
TRANSIENT)) == NULL) {
BBPunfix(inBAT->batCacheid);
@@ -40,28 +41,28 @@ str geom_2_geom_bat(bat* outBAT_id, bat*
//set the first idx of the new BAT equal to that of the input BAT
BATseqbase(outBAT, inBAT->hseqbase);
- //iterator over the BAT
+ //iterator over the BAT
inBAT_iter = bat_iterator(inBAT);
- //for (i = 0; i < BATcount(inBAT); i++) {
- BATloop(inBAT, p, q) { //iterate over all valid elements
+ //for (i = 0; i < BATcount(inBAT); i++) {
+ BATloop(inBAT, p, q) { //iterate over all valid elements
str err = NULL;
//if for used --> inWKB = (wkb *) BUNtail(inBATi, i +
BUNfirst(inBAT));
- inWKB = (wkb*) BUNtail(inBAT_iter, p);
- if ((err = geom_2_geom(&outWKB, &inWKB, columnType,
columnSRID)) != MAL_SUCCEED) { //check type
+ inWKB = (wkb *) BUNtail(inBAT_iter, p);
+ if ((err = geom_2_geom(&outWKB, &inWKB, columnType,
columnSRID)) != MAL_SUCCEED) { //check type
BBPunfix(inBAT->batCacheid);
BBPunfix(outBAT->batCacheid);
return err;
}
- BUNappend(outBAT,outWKB,TRUE); //add the point to the new BAT
+ BUNappend(outBAT, outWKB, TRUE); //add the point to the
new BAT
GDKfree(outWKB);
outWKB = NULL;
}
//set some properties of the new BAT
BATsetcount(outBAT, BATcount(inBAT));
- BATsettrivprop(outBAT);
- BATderiveProps(outBAT,FALSE);
+ BATsettrivprop(outBAT);
+ BATderiveProps(outBAT, FALSE);
BBPunfix(inBAT->batCacheid);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
return MAL_SUCCEED;
@@ -69,22 +70,23 @@ str geom_2_geom_bat(bat* outBAT_id, bat*
}
/*create WKB from WKT */
-str wkbFromText_bat(bat *outBAT_id, bat *inBAT_id, int *srid, int *tpe) {
+str
+wkbFromText_bat(bat *outBAT_id, bat *inBAT_id, int *srid, int *tpe)
+{
BAT *outBAT = NULL, *inBAT = NULL;
char *inWKB = NULL;
- BUN p =0, q =0;
+ BUN p = 0, q = 0;
BATiter inBAT_iter;
//get the descriptor of the BAT
if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
throw(MAL, "batgeom.wkbFromText", RUNTIME_OBJECT_MISSING);
}
-
- if ( inBAT->htype != TYPE_void ) { //header type of BAT not void
+
+ if (inBAT->htype != TYPE_void) { //header type of BAT not void
BBPunfix(inBAT->batCacheid);
throw(MAL, "batgeom.wkbFromText", "the arguments must have
dense and aligned heads");
}
-
//create a new for the output BAT
if ((outBAT = BATnew(TYPE_void, ATOMindex("wkb"), BATcount(inBAT),
TRANSIENT)) == NULL) {
BBPunfix(inBAT->batCacheid);
@@ -93,52 +95,53 @@ str wkbFromText_bat(bat *outBAT_id, bat
//set the first idx of the new BAT equal to that of the input BAT
BATseqbase(outBAT, inBAT->hseqbase);
- //iterator over the input BAT
+ //iterator over the input BAT
inBAT_iter = bat_iterator(inBAT);
- BATloop(inBAT, p, q) { //iterate over all valid elements
+ BATloop(inBAT, p, q) { //iterate over all valid elements
str err = NULL;
- wkb* outSingle;
+ wkb *outSingle;
- inWKB = (char*) BUNtail(inBAT_iter, p);
+ inWKB = (char *) BUNtail(inBAT_iter, p);
if ((err = wkbFromText(&outSingle, &inWKB, srid, tpe)) !=
MAL_SUCCEED) {
BBPunfix(inBAT->batCacheid);
BBPunfix(outBAT->batCacheid);
return err;
}
- BUNappend(outBAT,outSingle,TRUE); //add the result to the new
BAT
+ BUNappend(outBAT, outSingle, TRUE); //add the result to the
new BAT
GDKfree(outSingle);
outSingle = NULL;
}
//set the number of elements in the outBAT
BATsetcount(outBAT, BATcount(inBAT));
-
+
BBPunfix(inBAT->batCacheid);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
-
+
return MAL_SUCCEED;
}
/*****************************************************************************/
/********************* IN: mbr - OUT: double - FLAG :int *********************/
/*****************************************************************************/
-str wkbCoordinateFromMBR_bat(bat *outBAT_id, bat *inBAT_id, int*
coordinateIdx) {
+str
+wkbCoordinateFromMBR_bat(bat *outBAT_id, bat *inBAT_id, int *coordinateIdx)
+{
BAT *outBAT = NULL, *inBAT = NULL;
mbr *inMBR = NULL;
double outDbl = 0.0;
- BUN p =0, q =0;
+ BUN p = 0, q = 0;
BATiter inBAT_iter;
//get the descriptor of the BAT
if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
throw(MAL, "batgeom.coordinateFromMBR", RUNTIME_OBJECT_MISSING);
}
-
- if ( inBAT->htype != TYPE_void ) { //header type of BAT not void
+
+ if (inBAT->htype != TYPE_void) { //header type of BAT not void
BBPunfix(inBAT->batCacheid);
throw(MAL, "batgeom.coordinateFromMBR", "the arguments must
have dense and aligned heads");
}
-
//create a new BAT for the output
if ((outBAT = BATnew(TYPE_void, ATOMindex("dbl"), BATcount(inBAT),
TRANSIENT)) == NULL) {
BBPunfix(inBAT->batCacheid);
@@ -147,24 +150,24 @@ str wkbCoordinateFromMBR_bat(bat *outBAT
//set the first idx of the new BAT equal to that of the input BAT
BATseqbase(outBAT, inBAT->hseqbase);
- //iterator over the BAT
+ //iterator over the BAT
inBAT_iter = bat_iterator(inBAT);
- BATloop(inBAT, p, q) { //iterate over all valid elements
+ BATloop(inBAT, p, q) { //iterate over all valid elements
str err = NULL;
- inMBR = (mbr*) BUNtail(inBAT_iter, p);
+ inMBR = (mbr *) BUNtail(inBAT_iter, p);
if ((err = wkbCoordinateFromMBR(&outDbl, &inMBR,
coordinateIdx)) != MAL_SUCCEED) {
BBPunfix(inBAT->batCacheid);
BBPunfix(outBAT->batCacheid);
return err;
}
- BUNappend(outBAT,&outDbl,TRUE);
+ BUNappend(outBAT, &outDbl, TRUE);
}
//set some properties of the new BAT
BATsetcount(outBAT, BATcount(inBAT));
- BATsettrivprop(outBAT);
- BATderiveProps(outBAT,FALSE);
+ BATsettrivprop(outBAT);
+ BATderiveProps(outBAT, FALSE);
BBPunfix(inBAT->batCacheid);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
return MAL_SUCCEED;
@@ -174,22 +177,23 @@ str wkbCoordinateFromMBR_bat(bat *outBAT
/**************************************************************************/
/********************* IN: wkb - OUT: str - FLAG :int *********************/
/**************************************************************************/
-static str WKBtoSTRflagINT_bat(bat *outBAT_id, bat *inBAT_id, int* flag, str
(*func)(char**, wkb**, int*), const char *name) {
+static str
+WKBtoSTRflagINT_bat(bat *outBAT_id, bat *inBAT_id, int *flag, str (*func)
(char **, wkb **, int *), const char *name)
+{
BAT *outBAT = NULL, *inBAT = NULL;
wkb *inWKB = NULL;
- BUN p =0, q =0;
+ BUN p = 0, q = 0;
BATiter inBAT_iter;
//get the descriptor of the BAT
if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
throw(MAL, name, RUNTIME_OBJECT_MISSING);
}
-
- if ( inBAT->htype != TYPE_void ) { //header type of BAT not void
+
+ if (inBAT->htype != TYPE_void) { //header type of BAT not void
BBPunfix(inBAT->batCacheid);
throw(MAL, name, "the arguments must have dense and aligned
heads");
}
-
//create a new for the output BAT
if ((outBAT = BATnew(TYPE_void, ATOMindex("str"), BATcount(inBAT),
TRANSIENT)) == NULL) {
BBPunfix(inBAT->batCacheid);
@@ -198,37 +202,42 @@ static str WKBtoSTRflagINT_bat(bat *outB
//set the first idx of the new BAT equal to that of the input BAT
BATseqbase(outBAT, inBAT->hseqbase);
- //iterator over the input BAT
+ //iterator over the input BAT
inBAT_iter = bat_iterator(inBAT);
- BATloop(inBAT, p, q) { //iterate over all valid elements
+ BATloop(inBAT, p, q) { //iterate over all valid elements
str err = NULL;
- char* outSingle;
+ char *outSingle;
- inWKB = (wkb*) BUNtail(inBAT_iter, p);
- if ((err = (*func)(&outSingle, &inWKB, flag)) != MAL_SUCCEED) {
+ inWKB = (wkb *) BUNtail(inBAT_iter, p);
+ if ((err = (*func) (&outSingle, &inWKB, flag)) != MAL_SUCCEED) {
BBPunfix(inBAT->batCacheid);
BBPunfix(outBAT->batCacheid);
return err;
}
- BUNappend(outBAT,outSingle,TRUE); //add the result to the new
BAT
+ BUNappend(outBAT, outSingle, TRUE); //add the result to the
new BAT
GDKfree(outSingle);
outSingle = NULL;
}
//set the number of elements in the outBAT
BATsetcount(outBAT, BATcount(inBAT));
-
+
BBPunfix(inBAT->batCacheid);
BBPkeepref(*outBAT_id = outBAT->batCacheid);
-
+
return MAL_SUCCEED;
}
/*create textual representation of the wkb */
-str wkbAsText_bat(bat *outBAT_id, bat *inBAT_id, int* withSRID) {
+str
+wkbAsText_bat(bat *outBAT_id, bat *inBAT_id, int *withSRID)
+{
return WKBtoSTRflagINT_bat(outBAT_id, inBAT_id, withSRID, wkbAsText,
"batgeom.wkbAsText");
}
-str wkbGeometryType_bat(bat *outBAT_id, bat *inBAT_id, int* flag) {
+
+str
+wkbGeometryType_bat(bat *outBAT_id, bat *inBAT_id, int *flag)
+{
return WKBtoSTRflagINT_bat(outBAT_id, inBAT_id, flag, wkbGeometryType,
"batgeom.wkbGeometryType");
}
@@ -236,22 +245,23 @@ str wkbGeometryType_bat(bat *outBAT_id,
/*************************** IN: wkb - OUT: wkb ****************************/
/***************************************************************************/
-static str WKBtoWKB_bat(bat *outBAT_id, bat *inBAT_id, str (*func)(wkb**,
wkb**), const char *name) {
+static str
+WKBtoWKB_bat(bat *outBAT_id, bat *inBAT_id, str (*func) (wkb **, wkb **),
const char *name)
+{
BAT *outBAT = NULL, *inBAT = NULL;
wkb *inWKB = NULL;
- BUN p =0, q =0;
+ BUN p = 0, q = 0;
BATiter inBAT_iter;
//get the descriptor of the BAT
if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
throw(MAL, name, RUNTIME_OBJECT_MISSING);
}
-
- if ( inBAT->htype != TYPE_void ) { //header type of BAT not void
+
+ if (inBAT->htype != TYPE_void) { //header type of BAT not void
BBPunfix(inBAT->batCacheid);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list