size_t usage cleanups.

git-svn-id: http://svn.osgeo.org/postgis/trunk@1262 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2005-01-09 20:28:59 +00:00
parent 03eedac590
commit 290717e564
4 changed files with 30 additions and 29 deletions

View file

@ -605,7 +605,7 @@ extern LWGEOM_EXPLODED *lwgeom_explode(char *serialized);
* Return the length of the serialized form corresponding
* to this exploded structure.
*/
extern uint32 lwexploded_findlength(LWGEOM_EXPLODED *exp, int wantbbox);
extern size_t lwexploded_findlength(LWGEOM_EXPLODED *exp, int wantbbox);
// Serialize an LWGEOM_EXPLODED object.
// SRID and ndims will be taken from exploded structure.
@ -687,8 +687,8 @@ extern char *lwgeom_serialized_construct(int SRID, int finalType, char hasz, cha
// construct the empty geometry (GEOMETRYCOLLECTION(EMPTY))
extern char *lwgeom_constructempty(int SRID, char hasz, char hasm);
extern void lwgeom_constructempty_buf(int SRID, char hasz, char hasm, char *buf, int *size);
int lwgeom_empty_length(int SRID);
extern void lwgeom_constructempty_buf(int SRID, char hasz, char hasm, char *buf, size_t *size);
size_t lwgeom_empty_length(int SRID);
// get the SRID from the LWGEOM
// none present => -1

View file

@ -141,8 +141,8 @@ lwcollection_serialize_size(LWCOLLECTION *col)
void
lwcollection_serialize_buf(LWCOLLECTION *coll, char *buf, size_t *retsize)
{
int size=1; // type
int subsize=0;
size_t size=1; // type
size_t subsize=0;
char hasSRID;
char *loc;
int i;

View file

@ -1273,7 +1273,7 @@ lwgeom_constructempty(int SRID, char hasz, char hasm)
return result;
}
int
size_t
lwgeom_empty_length(int SRID)
{
int size = 5;
@ -1284,7 +1284,8 @@ lwgeom_empty_length(int SRID)
// construct the empty geometry (GEOMETRYCOLLECTION(EMPTY))
// writing it into the provided buffer.
void
lwgeom_constructempty_buf(int SRID, char hasz, char hasm, char *buf, int *retsize)
lwgeom_constructempty_buf(int SRID, char hasz, char hasm,
char *buf, size_t *retsize)
{
int ngeoms = 0;
@ -2172,8 +2173,8 @@ lwexploded_sum(LWGEOM_EXPLODED *exp1, LWGEOM_EXPLODED *exp2)
char *
lwexploded_serialize(LWGEOM_EXPLODED *exploded, int wantbbox)
{
int sizecom = 0;
int size;
size_t sizecom = 0;
size_t size;
char *result;
size = lwexploded_findlength(exploded, wantbbox);
@ -2328,7 +2329,7 @@ lwexploded_serialize_buf(LWGEOM_EXPLODED *exploded, int wantbbox,
// Serialize points stripping BBOX and SRID if any
for (i=0; i<exploded->npoints; i++)
{
int subsize;
size_t subsize;
point = lwpoint_deserialize(exploded->points[i]);
point->SRID = -1;
lwpoint_serialize_buf(point, loc, &subsize);
@ -2349,7 +2350,7 @@ lwexploded_serialize_buf(LWGEOM_EXPLODED *exploded, int wantbbox,
// Serialize lines stripping BBOX and SRID if any
for (i=0; i<exploded->nlines; i++)
{
int subsize;
size_t subsize;
line = lwline_deserialize(exploded->lines[i]);
if ( line == NULL )
@ -2376,7 +2377,7 @@ lwexploded_serialize_buf(LWGEOM_EXPLODED *exploded, int wantbbox,
// Serialize polys stripping BBOX and SRID if any
for (i=0; i<exploded->npolys; i++)
{
int subsize;
size_t subsize;
poly = lwpoly_deserialize(exploded->polys[i]);
if ( poly == NULL )
@ -2444,10 +2445,10 @@ checkexplodedsize(char *srl, LWGEOM_EXPLODED *exp, int alloced, char wantbbox)
}
#endif
uint32
size_t
lwexploded_findlength(LWGEOM_EXPLODED *exploded, int wantbbox)
{
uint32 size=0;
size_t size=0;
char ntypes=0;
uint32 i;

View file

@ -64,8 +64,8 @@ PG_FUNCTION_INFO_V1(LWGEOM_mem_size);
Datum LWGEOM_mem_size(PG_FUNCTION_ARGS)
{
PG_LWGEOM *geom = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
int32 size = geom->size;
int32 computed_size = lwgeom_size(SERIALIZED_FORM(geom));
size_t size = geom->size;
size_t computed_size = lwgeom_size(SERIALIZED_FORM(geom));
computed_size += 4; // varlena size
if ( size != computed_size )
{
@ -480,8 +480,8 @@ lwgeom_force2d_recursive(char *serialized, char *optr, size_t *retsize)
{
LWGEOM_INSPECTED *inspected;
int i;
int totsize=0;
int size=0;
size_t totsize=0;
size_t size=0;
int type;
LWPOINT *point = NULL;
LWLINE *line = NULL;
@ -598,8 +598,8 @@ lwgeom_force3dz_recursive(char *serialized, char *optr, size_t *retsize)
{
LWGEOM_INSPECTED *inspected;
int i,j,k;
int totsize=0;
int size=0;
size_t totsize=0;
size_t size=0;
int type;
LWPOINT *point = NULL;
LWLINE *line = NULL;
@ -759,8 +759,8 @@ lwgeom_force3dm_recursive(unsigned char *serialized, char *optr, size_t *retsize
{
LWGEOM_INSPECTED *inspected;
int i,j,k;
int totsize=0;
int size=0;
size_t totsize=0;
size_t size=0;
int type;
unsigned char newtypefl;
LWPOINT *point = NULL;
@ -975,8 +975,8 @@ lwgeom_force4d_recursive(char *serialized, char *optr, size_t *retsize)
{
LWGEOM_INSPECTED *inspected;
int i,j,k;
int totsize=0;
int size=0;
size_t totsize=0;
size_t size=0;
int type;
LWPOINT *point = NULL;
LWLINE *line = NULL;
@ -1132,7 +1132,7 @@ Datum LWGEOM_force_2d(PG_FUNCTION_ARGS)
{
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_LWGEOM *result;
int32 size = 0;
size_t size = 0;
// already 2d
if ( lwgeom_ndims(geom->type) == 2 ) PG_RETURN_POINTER(geom);
@ -1159,7 +1159,7 @@ Datum LWGEOM_force_3dz(PG_FUNCTION_ARGS)
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_LWGEOM *result;
int olddims;
int32 size = 0;
size_t size = 0;
olddims = lwgeom_ndims(geom->type);
@ -1234,7 +1234,7 @@ Datum LWGEOM_force_4d(PG_FUNCTION_ARGS)
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_LWGEOM *result;
int olddims;
int32 size = 0;
size_t size = 0;
olddims = lwgeom_ndims(geom->type);
@ -1263,7 +1263,7 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_LWGEOM *result;
int oldtype;
int32 size = 0;
size_t size = 0;
char *iptr, *optr;
int32 nsubgeoms = 1;
@ -1340,7 +1340,7 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_LWGEOM *result;
int oldtype, newtype;
int32 size = 0;
size_t size = 0;
char *iptr, *optr;
int32 nsubgeoms = 1;