C++ style comments are not allowed in ISO C90

git-svn-id: http://svn.osgeo.org/postgis/trunk@13473 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2015-05-04 08:36:28 +00:00
parent fec5a16278
commit d7ac463494
14 changed files with 78 additions and 74 deletions

View file

@ -591,8 +591,8 @@ LWTIN;
*/ */
typedef struct typedef struct
{ {
int64_t id; //Id, from function parameter int64_t id; /* Id, from function parameter */
LWGEOM* geom; //the geometry from function parameter LWGEOM* geom; /* the geometry from function parameter */
} }
lwgeom_id; lwgeom_id;

View file

@ -388,8 +388,9 @@ circ_nodes_merge(CIRC_NODE** nodes, int num_nodes)
int num_parents = 0; int num_parents = 0;
int j; int j;
// TODO, roll geom_type *up* as tree is built, changing to collection types as simple types are merged /* TODO, roll geom_type *up* as tree is built, changing to collection types as simple types are merged
// TODO, change the distance algorithm to drive down to simple types first, test pip on poly/other cases, then test edges * TODO, change the distance algorithm to drive down to simple types first, test pip on poly/other cases, then test edges
*/
while( num_children > 1 ) while( num_children > 1 )
{ {
@ -578,8 +579,10 @@ circ_tree_distance_tree_internal(const CIRC_NODE* n1, const CIRC_NODE* n2, doubl
int i; int i;
LWDEBUGF(4, "entered, min_dist=%.8g max_dist=%.8g, type1=%d, type2=%d", *min_dist, *max_dist, n1->geom_type, n2->geom_type); LWDEBUGF(4, "entered, min_dist=%.8g max_dist=%.8g, type1=%d, type2=%d", *min_dist, *max_dist, n1->geom_type, n2->geom_type);
// circ_tree_print(n1, 0); /*
// circ_tree_print(n2, 0); circ_tree_print(n1, 0);
circ_tree_print(n2, 0);
*/
/* Short circuit if we've already hit the minimum */ /* Short circuit if we've already hit the minimum */
if( *min_dist <= threshold ) if( *min_dist <= threshold )

View file

@ -26,7 +26,7 @@
#endif #endif
#ifndef JSON_C_VERSION #ifndef JSON_C_VERSION
// Adds support for libjson < 0.10 /* Adds support for libjson < 0.10 */
# define json_tokener_error_desc(x) json_tokener_errors[(x)] # define json_tokener_error_desc(x) json_tokener_errors[(x)]
#endif #endif
@ -99,19 +99,19 @@ parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)
return LW_FAILURE; return LW_FAILURE;
} }
// Read X coordinate /* Read X coordinate */
poObjCoord = json_object_array_get_idx( poObj, 0 ); poObjCoord = json_object_array_get_idx( poObj, 0 );
pt.x = json_object_get_double( poObjCoord ); pt.x = json_object_get_double( poObjCoord );
LWDEBUGF(3, "parse_geojson_coord pt.x = %f.", pt.x ); LWDEBUGF(3, "parse_geojson_coord pt.x = %f.", pt.x );
// Read Y coordinate /* Read Y coordinate */
poObjCoord = json_object_array_get_idx( poObj, 1 ); poObjCoord = json_object_array_get_idx( poObj, 1 );
pt.y = json_object_get_double( poObjCoord ); pt.y = json_object_get_double( poObjCoord );
LWDEBUGF(3, "parse_geojson_coord pt.y = %f.", pt.y ); LWDEBUGF(3, "parse_geojson_coord pt.y = %f.", pt.y );
if( nSize > 2 ) /* should this be >= 3 ? */ if( nSize > 2 ) /* should this be >= 3 ? */
{ {
// Read Z coordinate /* Read Z coordinate */
poObjCoord = json_object_array_get_idx( poObj, 2 ); poObjCoord = json_object_array_get_idx( poObj, 2 );
pt.z = json_object_get_double( poObjCoord ); pt.z = json_object_get_double( poObjCoord );
LWDEBUGF(3, "parse_geojson_coord pt.z = %f.", pt.z ); LWDEBUGF(3, "parse_geojson_coord pt.z = %f.", pt.z );

View file

@ -165,7 +165,7 @@ static LWPOINT* lwpoint_from_twkb_state(twkb_parse_state *s)
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
POINTARRAY *pa = ptarray_from_twkb_state(s,npoints); POINTARRAY *pa = ptarray_from_twkb_state(s,npoints);
return lwpoint_construct(0, NULL, pa); return lwpoint_construct(0, NULL, pa);
@ -181,7 +181,7 @@ static LWLINE* lwline_from_twkb_state(twkb_parse_state *s)
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
/*get number of points*/ /*get number of points*/
npoints = varint_u64_read(&(s->pos), s->twkb_end); npoints = varint_u64_read(&(s->pos), s->twkb_end);
@ -209,7 +209,7 @@ static LWPOLY* lwpoly_from_twkb_state(twkb_parse_state *s)
int i; int i;
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
/*get number of rings*/ /*get number of rings*/
nrings= varint_u64_read(&(s->pos), s->twkb_end); nrings= varint_u64_read(&(s->pos), s->twkb_end);
@ -272,7 +272,7 @@ static LWCOLLECTION* lwmultipoint_from_twkb_state(twkb_parse_state *s)
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
/*Now we switch off id reading for subgeometries*/ /*Now we switch off id reading for subgeometries*/
s->read_id=LW_FALSE; s->read_id=LW_FALSE;
@ -306,7 +306,7 @@ static LWCOLLECTION* lwmultiline_from_twkb_state(twkb_parse_state *s)
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
/*Now we switch off id reading for subgeometries*/ /*Now we switch off id reading for subgeometries*/
s->read_id=LW_FALSE; s->read_id=LW_FALSE;
@ -340,7 +340,7 @@ static LWCOLLECTION* lwmultipoly_from_twkb_state(twkb_parse_state *s)
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
/*Now we switch off id reading for subgeometries*/ /*Now we switch off id reading for subgeometries*/
s->read_id=LW_FALSE; s->read_id=LW_FALSE;
@ -375,7 +375,7 @@ static LWCOLLECTION* lwcollection_from_twkb_state(twkb_parse_state *s)
/* TODO, make an option to use the id-value and return a set with geometry and id*/ /* TODO, make an option to use the id-value and return a set with geometry and id*/
if((s->magic_byte&TWKB_ID) && s->read_id) if((s->magic_byte&TWKB_ID) && s->read_id)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over id value varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over id value */
/*Now we switch off id reading for subgeometries*/ /*Now we switch off id reading for subgeometries*/
s->read_id=LW_FALSE; s->read_id=LW_FALSE;
@ -417,7 +417,7 @@ static void magicbyte_from_twkb_state(twkb_parse_state *s)
/*If the twkb-geometry has size information we just jump over it*/ /*If the twkb-geometry has size information we just jump over it*/
if(s->magic_byte&TWKB_SIZES) if(s->magic_byte&TWKB_SIZES)
varint_64_jump_n(&(s->pos),1, s->twkb_end); //Jump over size information varint_64_jump_n(&(s->pos),1, s->twkb_end); /* Jump over size info */
/*If our dataset has bboxes we just set a flag for that. We cannot do anything about it before we know the number of dimmensions*/ /*If our dataset has bboxes we just set a flag for that. We cannot do anything about it before we know the number of dimmensions*/
if(s->magic_byte&TWKB_BBOXES) if(s->magic_byte&TWKB_BBOXES)
@ -453,7 +453,7 @@ LWGEOM* lwgeom_from_twkb_state(twkb_parse_state *s)
/*Now we know number of dommensions so we can jump over the bboxes with right number of "jumps"*/ /*Now we know number of dommensions so we can jump over the bboxes with right number of "jumps"*/
if (s->has_bboxes) if (s->has_bboxes)
{ {
varint_64_jump_n(&(s->pos),2*(s->ndims), s->twkb_end); //Jump over bbox varint_64_jump_n(&(s->pos),2*(s->ndims), s->twkb_end); /* Jump over bbox */
/*We only have bboxes at top level, so once found we forget about it*/ /*We only have bboxes at top level, so once found we forget about it*/
s->has_bboxes=LW_FALSE; s->has_bboxes=LW_FALSE;
} }

View file

@ -188,7 +188,7 @@ static size_t ptarray_to_twkb_size(const POINTARRAY *pa, uint8_t variant,int fac
double *dbl_ptr; double *dbl_ptr;
/*The variable factor is used to "shift" the double float coordinate to keep enough significant digits, /*The variable factor is used to "shift" the double float coordinate to keep enough significant digits,
for demanded precision, when cast to integer*/ for demanded precision, when cast to integer*/
// factor=pow(10,prec); /* factor=pow(10,prec); */
/* Include the npoints size if it's not a POINT type) */ /* Include the npoints size if it's not a POINT type) */
if ( ! ( variant & WKB_NO_NPOINTS ) ) if ( ! ( variant & WKB_NO_NPOINTS ) )
{ {
@ -229,7 +229,7 @@ static int ptarray_to_twkb_buf(const POINTARRAY *pa, uint8_t **buf, uint8_t vari
int dims = FLAGS_NDIMS(pa->flags); int dims = FLAGS_NDIMS(pa->flags);
int i, j; int i, j;
double *dbl_ptr; double *dbl_ptr;
//factor=pow(10,prec); /*factor=pow(10,prec);*/
@ -255,7 +255,7 @@ static int ptarray_to_twkb_buf(const POINTARRAY *pa, uint8_t **buf, uint8_t vari
varint_s64_encode_buf(r,buf); varint_s64_encode_buf(r,buf);
} }
} }
//LWDEBUGF(4, "Done (buf = %p)", buf); /* LWDEBUGF(4, "Done (buf = %p)", buf); */
return 0; return 0;
} }
@ -323,7 +323,7 @@ static int lwgeom_agg_to_twkbpoint_buf(lwgeom_id* geom_array,int n, uint8_t **bu
if(*variant&TWKB_BBOXES) if(*variant&TWKB_BBOXES)
{ {
write_bbox(buf,dims,refpoint[1],refpoint[2]); write_bbox(buf,dims,refpoint[1],refpoint[2]);
//So we only write bboxes to highest level /* So we only write bboxes to highest level */
*variant = *variant & ~TWKB_BBOXES; *variant = *variant & ~TWKB_BBOXES;
} }
@ -415,7 +415,7 @@ static int lwgeom_agg_to_twkbline_buf(lwgeom_id* geom_array,int n, uint8_t **buf
if(*variant&TWKB_BBOXES) if(*variant&TWKB_BBOXES)
{ {
write_bbox(buf,dims,refpoint[1],refpoint[2]); write_bbox(buf,dims,refpoint[1],refpoint[2]);
//So we only write bboxes to highest level /* So we only write bboxes to highest level */
*variant = *variant & ~TWKB_BBOXES; *variant = *variant & ~TWKB_BBOXES;
} }
@ -517,7 +517,7 @@ static int lwgeom_agg_to_twkbpoly_buf(lwgeom_id* geom_array,int n, uint8_t **buf
if(*variant&TWKB_BBOXES) if(*variant&TWKB_BBOXES)
{ {
write_bbox(buf,dims,refpoint[1],refpoint[2]); write_bbox(buf,dims,refpoint[1],refpoint[2]);
//So we only write bboxes to highest level /* So we only write bboxes to highest level */
*variant = *variant & ~TWKB_BBOXES; *variant = *variant & ~TWKB_BBOXES;
} }
@ -626,7 +626,7 @@ static int lwgeom_agg_to_twkbcollection_buf(lwgeom_id* geom_array,int n, uint8_t
if(*variant&TWKB_BBOXES) if(*variant&TWKB_BBOXES)
{ {
write_bbox(buf,dims,refpoint[1],refpoint[2]); write_bbox(buf,dims,refpoint[1],refpoint[2]);
//So we only write bboxes to highest level /* So we only write bboxes to highest level */
*variant = *variant & ~TWKB_BBOXES; *variant = *variant & ~TWKB_BBOXES;
} }
@ -719,7 +719,7 @@ static size_t lwgeom_to_twkb_size(const LWGEOM *geom,uint8_t *variant, int64_t f
case MULTIPOLYGONTYPE: case MULTIPOLYGONTYPE:
*variant =*variant | TWKB_NO_TYPE; *variant =*variant | TWKB_NO_TYPE;
size += lwcollection_to_twkb_size((LWCOLLECTION*)geom,variant, factor,id,refpoint); size += lwcollection_to_twkb_size((LWCOLLECTION*)geom,variant, factor,id,refpoint);
//We need to get back the possibility to write types /* We need to get back the possibility to write types */
*variant =*variant & ~TWKB_NO_TYPE; *variant =*variant & ~TWKB_NO_TYPE;
break; break;
case COLLECTIONTYPE: case COLLECTIONTYPE:
@ -749,7 +749,7 @@ static int lwgeom_to_twkb_buf(const LWGEOM *geom, uint8_t **buf, uint8_t *varian
if(*variant&TWKB_BBOXES) if(*variant&TWKB_BBOXES)
{ {
write_bbox(buf,FLAGS_NDIMS(geom->flags),refpoint[1],refpoint[2]); write_bbox(buf,FLAGS_NDIMS(geom->flags),refpoint[1],refpoint[2]);
//So we only write bboxes to highest level /* So we only write bboxes to highest level */
*variant = *variant & ~TWKB_BBOXES; *variant = *variant & ~TWKB_BBOXES;
} }
} }
@ -785,7 +785,7 @@ static int lwgeom_to_twkb_buf(const LWGEOM *geom, uint8_t **buf, uint8_t *varian
/*the NO_TYPE flag tells that the type not shall be repeated for subgeometries*/ /*the NO_TYPE flag tells that the type not shall be repeated for subgeometries*/
*variant=*variant | TWKB_NO_TYPE; *variant=*variant | TWKB_NO_TYPE;
res= lwcollection_to_twkb_buf((LWCOLLECTION*)geom, buf, variant,factor,id,refpoint); res= lwcollection_to_twkb_buf((LWCOLLECTION*)geom, buf, variant,factor,id,refpoint);
//We need to get back the possibility to write types /* We need to get back the possibility to write types */
*variant =*variant & ~TWKB_NO_TYPE; *variant =*variant & ~TWKB_NO_TYPE;
return res; return res;
} }
@ -839,8 +839,8 @@ uint8_t* lwgeom_to_twkb(const LWGEOM *geom, uint8_t variant, size_t *size_out,in
LWDEBUGF(4, "WKB output size: %d", buf_size); LWDEBUGF(4, "WKB output size: %d", buf_size);
//add the size of the bbox /* add the size of the bbox
// If empty geometry request for bbox is ignored * If empty geometry request for bbox is ignored */
if(variant&TWKB_BBOXES) if(variant&TWKB_BBOXES)
{ {
LWDEBUG(4,"We want boxes and will calculate required size"); LWDEBUG(4,"We want boxes and will calculate required size");
@ -848,7 +848,7 @@ uint8_t* lwgeom_to_twkb(const LWGEOM *geom, uint8_t variant, size_t *size_out,in
} }
//reset refpoints /* reset refpoints */
refpoint[0][0]=refpoint[0][1]=refpoint[0][2]=refpoint[0][3]=0; refpoint[0][0]=refpoint[0][1]=refpoint[0][2]=refpoint[0][3]=0;
@ -964,19 +964,19 @@ uint8_t* lwgeom_agg_to_twkb(const twkb_geom_arrays *lwgeom_arrays,uint8_t varian
if (lwgeom_arrays->n_collections > 0) if (lwgeom_arrays->n_collections > 0)
buf_size += lwgeom_agg_to_twkbcollection_size(lwgeom_arrays->collections,&variant,lwgeom_arrays->n_collections, factor,refpoint); buf_size += lwgeom_agg_to_twkbcollection_size(lwgeom_arrays->collections,&variant,lwgeom_arrays->n_collections, factor,refpoint);
//add the size of the bbox /* add the size of the bbox
// If empty geometry request for bbox is ignored * If empty geometry request for bbox is ignored */
if(variant&TWKB_BBOXES) if(variant&TWKB_BBOXES)
{ {
LWDEBUG(4,"We want boxes and will calculate required size"); LWDEBUG(4,"We want boxes and will calculate required size");
//Check how many dimmensions that have been used for the box /* Check how many dimmensions that have been used for the box */
while (nDims<MAX_N_DIMS&&refpoint[1][nDims]<INT64_MAX&&refpoint[2][nDims]>INT64_MIN) while (nDims<MAX_N_DIMS&&refpoint[1][nDims]<INT64_MAX&&refpoint[2][nDims]>INT64_MIN)
nDims++; nDims++;
buf_size += sizeof_bbox(nDims,refpoint[1],refpoint[2]); buf_size += sizeof_bbox(nDims,refpoint[1],refpoint[2]);
} }
//reset refpoints /* reset refpoints */
refpoint[0][0]=refpoint[0][1]=refpoint[0][2]=refpoint[0][3]=0; refpoint[0][0]=refpoint[0][1]=refpoint[0][2]=refpoint[0][3]=0;
LWDEBUGF(4, "WKB output size: %d", buf_size); LWDEBUGF(4, "WKB output size: %d", buf_size);

View file

@ -15,7 +15,7 @@
#include "lwgeom_log.h" #include "lwgeom_log.h"
#include <limits.h> #include <limits.h>
//Maximum number of geometry dimmensions that internal arrays can hold /* Maximum number of geometry dimmensions that internal arrays can hold */
#define MAX_N_DIMS 4 #define MAX_N_DIMS 4
/** /**
@ -68,6 +68,3 @@ static int lwcollection_to_twkb_buf(const LWCOLLECTION *col, uint8_t **buf, uint
static size_t lwgeom_to_twkb_size(const LWGEOM *geom, uint8_t *variant, int64_t factor, int64_t id,int64_t refpoint[3][4]); static size_t lwgeom_to_twkb_size(const LWGEOM *geom, uint8_t *variant, int64_t factor, int64_t id,int64_t refpoint[3][4]);
static int lwgeom_to_twkb_buf(const LWGEOM *geom, uint8_t **buf, uint8_t *variant,int64_t factor, int64_t id,int64_t refpoint[3][4]); static int lwgeom_to_twkb_buf(const LWGEOM *geom, uint8_t **buf, uint8_t *variant,int64_t factor, int64_t id,int64_t refpoint[3][4]);
//static size_t lwgeom_to_twkb_size(const LWGEOM *geom, uint8_t variant,int64_t factor);

View file

@ -667,7 +667,7 @@ asx3d3_collection_size(const LWCOLLECTION *col, char *srs, int precision, int op
size_t defidlen = strlen(defid); size_t defidlen = strlen(defid);
LWGEOM *subgeom; LWGEOM *subgeom;
//size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2; /* size = sizeof("<MultiGeometry></MultiGeometry>") + defidlen*2; */
size = defidlen*2; size = defidlen*2;
/** if ( srs ) /** if ( srs )
@ -719,14 +719,16 @@ asx3d3_collection_buf(const LWCOLLECTION *col, char *srs, char *output, int prec
/* Open outmost tag */ /* Open outmost tag */
/** @TODO: decide if we need outtermost tags, this one was just a copy from gml so is wrong **/ /** @TODO: decide if we need outtermost tags, this one was just a copy from gml so is wrong **/
#ifdef PGIS_X3D_OUTERMOST_TAGS
if ( srs ) if ( srs )
{ {
//ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs); ptr += sprintf(ptr, "<%sMultiGeometry srsName=\"%s\">", defid, srs);
} }
else else
{ {
//ptr += sprintf(ptr, "<%sMultiGeometry>", defid); ptr += sprintf(ptr, "<%sMultiGeometry>", defid);
} }
#endif
for (i=0; i<col->ngeoms; i++) for (i=0; i<col->ngeoms; i++)
{ {
@ -768,7 +770,9 @@ asx3d3_collection_buf(const LWCOLLECTION *col, char *srs, char *output, int prec
} }
/* Close outmost tag */ /* Close outmost tag */
//ptr += sprintf(ptr, "</%sMultiGeometry>", defid); #ifdef PGIS_X3D_OUTERMOST_TAGS
ptr += sprintf(ptr, "</%sMultiGeometry>", defid);
#endif
return (ptr-output); return (ptr-output);
} }

View file

@ -47,9 +47,9 @@ _varint_u64_encode_buf(uint64_t val, uint8_t **buf)
uint64_t q=val; uint64_t q=val;
while (1) while (1)
{ {
grp=127&q; //We put the 7 least significant bits in grp grp=127&q; /* We put the 7 least significant bits in grp */
q=q>>7; //We rightshift our input value 7 bits which means that the 7 next least significant bits becomes the 7 least significant q=q>>7; /* We rightshift our input value 7 bits which means that the 7 next least significant bits becomes the 7 least significant */
if(q>0) // Check if, after our rightshifting, we still have anything to read in our input value. if(q>0) /* Check if, after our rightshifting, we still have anything to read in our input value. */
{ {
/*In the next line quite a lot is happening. /*In the next line quite a lot is happening.
Since there is more to read in our input value we signalize that by setting the most siginicant bit in our byte to 1. Since there is more to read in our input value we signalize that by setting the most siginicant bit in our byte to 1.
@ -60,7 +60,7 @@ _varint_u64_encode_buf(uint64_t val, uint8_t **buf)
{ {
/*The same as above, but since there is nothing more to read in our input value we leave the most significant bit unset*/ /*The same as above, but since there is nothing more to read in our input value we leave the most significant bit unset*/
*((*buf)++)=grp; *((*buf)++)=grp;
// printf("grp1:%d\n",(int) grp); /* printf("grp1:%d\n",(int) grp); */
return 0; return 0;
} }
} }
@ -165,18 +165,18 @@ uint64_t varint_u64_read(uint8_t **data, uint8_t *the_end)
int nShift = 0; int nShift = 0;
uint8_t nByte; uint8_t nByte;
while(*data<=the_end)//Check so we don't read beyond the twkb while(*data<=the_end)/* Check so we don't read beyond the twkb */
{ {
nByte = (uint8_t) **data; //read a byte nByte = (uint8_t) **data; /* read a byte */
if (!(nByte & 0x80)) //If it is the last byte in the varInt .... if (!(nByte & 0x80)) /* is the last byte in the varInt .... */
{ {
(*data) ++; //move the "cursor" one step (*data) ++; /* move the "cursor" one step */
return nVal | ((uint64_t)nByte << nShift); //Move the last read byte to the most significant place in the result and return the whole result return nVal | ((uint64_t)nByte << nShift); /* Move the last read byte to the most significant place in the result and return the whole result */
} }
/*We get here when there is more to read in the input varInt*/ /*We get here when there is more to read in the input varInt*/
nVal |= ((uint64_t)(nByte & 0x7f)) << nShift; //Here we take the least significant 7 bits of the read byte and put it in the most significant place in the result variable. nVal |= ((uint64_t)(nByte & 0x7f)) << nShift; /* Here we take the least significant 7 bits of the read byte and put it in the most significant place in the result variable. */
(*data) ++; //move the "cursor" of the input buffer step (8 bits) (*data) ++; /* move the "cursor" of the input buffer step (8 bits) */
nShift += 7; //move the cursor in the resulting variable (7 bits) nShift += 7; /* move the cursor in the resulting variable (7 bits) */
} }
lwerror("VarInt value goes beyond TWKB"); lwerror("VarInt value goes beyond TWKB");
return 0; return 0;
@ -197,16 +197,16 @@ uint64_t varint_s64_read(uint8_t **data, uint8_t *the_end)
void varint_64_jump_n(uint8_t **data, int nValues, uint8_t *the_end) void varint_64_jump_n(uint8_t **data, int nValues, uint8_t *the_end)
{ {
uint8_t nByte; uint8_t nByte;
while(nValues>0)//Check so we don't read beyond the twkb while(nValues>0)/* Check so we don't read beyond the twkb */
{ {
if(*data>the_end) if(*data>the_end)
lwerror("VarInt value goes beyond TWKB"); lwerror("VarInt value goes beyond TWKB");
nByte = (uint8_t) **data; //read a byte nByte = (uint8_t) **data; /* read a byte */
if (!(nByte & 0x80)) //If it is the last byte in the varInt .... if (!(nByte & 0x80)) /* If it is the last byte in the varInt .... */
{ {
nValues--;//...We count one more varint nValues--;/*...We count one more varint */
} }
(*data) ++; //move the "cursor" of the input buffer step (8 bits) (*data) ++; /* move the "cursor" of the input buffer step (8 bits) */
} }
return; return;
} }

View file

@ -629,7 +629,7 @@ DBFHandle SHPAPI_CALL
DBFCreate( const char * pszFilename ) DBFCreate( const char * pszFilename )
{ {
return DBFCreateEx( pszFilename, "LDID/87" ); // 0x57 return DBFCreateEx( pszFilename, "LDID/87" ); /* 0x57 */
} }
/************************************************************************/ /************************************************************************/
@ -704,7 +704,7 @@ DBFCreateLL( const char * pszFilename, const char * pszCodePage, SAHooks *psHook
{ {
ldid = atoi( pszCodePage + 5 ); ldid = atoi( pszCodePage + 5 );
if( ldid > 255 ) if( ldid > 255 )
ldid = -1; // don't use 0 to indicate out of range as LDID/0 is a valid one ldid = -1; /* don't use 0 to indicate out of range as LDID/0 is a valid one */
} }
if( ldid < 0 ) if( ldid < 0 )
{ {
@ -1133,14 +1133,14 @@ static int DBFIsValueNULL( char chType, const char* pszValue )
case 'D': case 'D':
/* NULL date fields have value "00000000" or blank or empty */ /* NULL date fields have value "00000000" or blank or empty */
if (pszValue[0] == '\0' || // emtpy string if (pszValue[0] == '\0' || /* emtpy string */
strncmp(pszValue,"00000000",8) == 0 || strncmp(pszValue,"00000000",8) == 0 ||
strncmp(pszValue," ",8) == 0) { strncmp(pszValue," ",8) == 0) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
// return strncmp(pszValue,"00000000",8) == 0; /* return strncmp(pszValue,"00000000",8) == 0; */
case 'L': case 'L':
/* NULL boolean fields have value "?" or empty */ /* NULL boolean fields have value "?" or empty */

View file

@ -1341,7 +1341,7 @@ ShpDumperOpenTable(SHPDUMPERSTATE *state)
/* If a user-defined query has been specified, create and point the state to our new table */ /* If a user-defined query has been specified, create and point the state to our new table */
if (state->config->usrquery) if (state->config->usrquery)
{ {
state->table = malloc(20 + 20); // string + max long precision state->table = malloc(20 + 20); /* string + max long precision */
sprintf(state->table, "__pgsql2shp%lu_tmp_table", (long)getpid()); sprintf(state->table, "__pgsql2shp%lu_tmp_table", (long)getpid());
query = malloc(32 + strlen(state->table) + strlen(state->config->usrquery)); query = malloc(32 + strlen(state->table) + strlen(state->config->usrquery));

View file

@ -1543,7 +1543,7 @@ pgui_action_import(GtkWidget *widget, gpointer data)
strcpy(progress_shapefile, &loader_file_config->shp_file[i]); strcpy(progress_shapefile, &loader_file_config->shp_file[i]);
/* Display the progress dialog */ /* Display the progress dialog */
//lw_asprintf(&progress_text, _("Importing shapefile %s (%d records)..."), progress_shapefile, ShpLoaderGetRecordCount(state)); /* lw_asprintf(&progress_text, _("Importing shapefile %s (%d records)..."), progress_shapefile, ShpLoaderGetRecordCount(state)); */
snprintf(progress_text, GUIMSG_LINE_MAXLEN, _("Importing shapefile %s (%d records)..."), progress_shapefile, ShpLoaderGetRecordCount(state)); snprintf(progress_text, GUIMSG_LINE_MAXLEN, _("Importing shapefile %s (%d records)..."), progress_shapefile, ShpLoaderGetRecordCount(state));
progress_text[GUIMSG_LINE_MAXLEN] = '\0'; progress_text[GUIMSG_LINE_MAXLEN] = '\0';
gtk_label_set_text(GTK_LABEL(label_progress), progress_text); gtk_label_set_text(GTK_LABEL(label_progress), progress_text);
@ -1878,7 +1878,7 @@ pgui_action_export(GtkWidget *widget, gpointer data)
} }
/* Update the text */ /* Update the text */
//lw_asprintf(&progress_text, _("Exporting table %s (%d records)..."), dumper_table_config->table, ShpDumperGetRecordCount(state)); /* lw_asprintf(&progress_text, _("Exporting table %s (%d records)..."), dumper_table_config->table, ShpDumperGetRecordCount(state)); */
snprintf(progress_text, GUIMSG_LINE_MAXLEN, _("Exporting table %s (%d records)..."), dumper_table_config->table, ShpDumperGetRecordCount(state)); snprintf(progress_text, GUIMSG_LINE_MAXLEN, _("Exporting table %s (%d records)..."), dumper_table_config->table, ShpDumperGetRecordCount(state));
progress_text[GUIMSG_LINE_MAXLEN] = '\0'; progress_text[GUIMSG_LINE_MAXLEN] = '\0';
gtk_label_set_text(GTK_LABEL(label_progress), progress_text); gtk_label_set_text(GTK_LABEL(label_progress), progress_text);

View file

@ -1457,7 +1457,7 @@ SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject * psObject )
if( nShapeId == -1 || psSHP->panRecSize[nShapeId] < nRecordSize-8 ) if( nShapeId == -1 || psSHP->panRecSize[nShapeId] < nRecordSize-8 )
{ {
unsigned int nExpectedSize = psSHP->nFileSize + nRecordSize; unsigned int nExpectedSize = psSHP->nFileSize + nRecordSize;
if( nExpectedSize < psSHP->nFileSize ) // due to unsigned int overflow if( nExpectedSize < psSHP->nFileSize ) /* due to unsigned int overflow */
{ {
char str[128]; char str[128];
sprintf( str, "Failed to write shape object. " sprintf( str, "Failed to write shape object. "

View file

@ -2766,7 +2766,7 @@ rt_raster_gdal_rasterize(
(NULL != grid_xw && NULL != grid_xw) && (NULL != grid_xw && NULL != grid_xw) &&
FLT_NEQ(*grid_xw, extent.MinX) FLT_NEQ(*grid_xw, extent.MinX)
) { ) {
// do nothing /* do nothing */
RASTER_DEBUG(3, "Skipping extent adjustment on X-axis due to upcoming alignment"); RASTER_DEBUG(3, "Skipping extent adjustment on X-axis due to upcoming alignment");
} }
else { else {
@ -2781,7 +2781,7 @@ rt_raster_gdal_rasterize(
(NULL != grid_xw && NULL != grid_xw) && (NULL != grid_xw && NULL != grid_xw) &&
FLT_NEQ(*grid_yw, extent.MaxY) FLT_NEQ(*grid_yw, extent.MaxY)
) { ) {
// do nothing /* do nothing */
RASTER_DEBUG(3, "Skipping extent adjustment on Y-axis due to upcoming alignment"); RASTER_DEBUG(3, "Skipping extent adjustment on Y-axis due to upcoming alignment");
} }
else { else {
@ -2798,7 +2798,7 @@ rt_raster_gdal_rasterize(
(NULL != grid_xw && NULL != grid_xw) && (NULL != grid_xw && NULL != grid_xw) &&
FLT_NEQ(*grid_xw, extent.MinX) FLT_NEQ(*grid_xw, extent.MinX)
) { ) {
// do nothing /* do nothing */
RASTER_DEBUG(3, "Skipping extent adjustment on X-axis due to upcoming alignment"); RASTER_DEBUG(3, "Skipping extent adjustment on X-axis due to upcoming alignment");
} }
else { else {
@ -2814,7 +2814,7 @@ rt_raster_gdal_rasterize(
(NULL != grid_xw && NULL != grid_xw) && (NULL != grid_xw && NULL != grid_xw) &&
FLT_NEQ(*grid_yw, extent.MaxY) FLT_NEQ(*grid_yw, extent.MaxY)
) { ) {
// do nothing /* do nothing */
RASTER_DEBUG(3, "Skipping extent adjustment on Y-axis due to upcoming alignment"); RASTER_DEBUG(3, "Skipping extent adjustment on Y-axis due to upcoming alignment");
} }
else { else {

View file

@ -30,7 +30,7 @@
*/ */
#include "../../postgis_config.h" #include "../../postgis_config.h"
//#define POSTGIS_DEBUG_LEVEL 4 /* #define POSTGIS_DEBUG_LEVEL 4 */
#include "librtcore.h" #include "librtcore.h"
#include "librtcore_internal.h" #include "librtcore_internal.h"