From: Raúl Marín Rodríguez Date: Wed, 24 Apr 2019 10:44:27 +0000 (+0000) Subject: Always use int32_t for srid X-Git-Tag: 3.0.0alpha1~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8eae3adb0206692a6e8cac47afde0b1dfd64a5c;p=postgis Always use int32_t for srid The main declaration was already using it, but some places still had int or mistakenly used uint32_t Closes #4384 git-svn-id: http://svn.osgeo.org/postgis/trunk@17410 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_algorithm.c b/liblwgeom/cunit/cu_algorithm.c index ca99c2504..c7f02dbce 100644 --- a/liblwgeom/cunit/cu_algorithm.c +++ b/liblwgeom/cunit/cu_algorithm.c @@ -1549,7 +1549,7 @@ static void test_lwpoly_construct_circle(void) { LWPOLY* p; const GBOX* g; - const int srid = 4326; + const int32_t srid = 4326; const uint32_t segments_per_quad = 17; const int x = 10; const int y = 20; diff --git a/liblwgeom/cunit/cu_libgeom.c b/liblwgeom/cunit/cu_libgeom.c index 43c2c9907..e36338c5b 100644 --- a/liblwgeom/cunit/cu_libgeom.c +++ b/liblwgeom/cunit/cu_libgeom.c @@ -21,7 +21,7 @@ static void test_typmod_macros(void) { int32_t typmod = 0; - int srid = 4326; + int32_t srid = 4326; int type = 6; int z = 1; int rv; @@ -1027,9 +1027,6 @@ static void test_lwline_from_lwmpoint(void) LWLINE *line; LWMPOINT *mpoint; -// LWLINE * -// lwline_from_lwmpoint(int srid, LWMPOINT *mpoint) - mpoint = (LWMPOINT*)lwgeom_from_wkt("MULTIPOINT(0 0, 0 1, 1 1, 1 2, 2 2)", LW_PARSER_CHECK_NONE); line = lwline_from_lwmpoint(SRID_DEFAULT, mpoint); CU_ASSERT_EQUAL(line->points->npoints, mpoint->ngeoms); diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in index 0f502f553..0af8e72ec 100644 --- a/liblwgeom/liblwgeom.h.in +++ b/liblwgeom/liblwgeom.h.in @@ -218,10 +218,10 @@ typedef enum LWORD_T { * what went in. * Raises an error if SRID value is out of bounds. */ -extern int clamp_srid(int srid); +extern int32_t clamp_srid(int32_t srid); /* Raise an lwerror if srids do not match */ -void error_if_srid_mismatch(int srid1, int srid2); +void error_if_srid_mismatch(int32_t srid1, int32_t srid2); /** * Global functions for memory/logging handlers. @@ -1105,7 +1105,7 @@ LWCOLLECTION* lwcollection_extract(LWCOLLECTION *col, int type); * For collections, only the parent gets an SRID, all * the children get SRID_UNKNOWN. */ -extern void lwgeom_set_srid(LWGEOM *geom, int srid); +extern void lwgeom_set_srid(LWGEOM *geom, int32_t srid); /*------------------------------------------------------ * other stuff @@ -1345,47 +1345,47 @@ extern POINTARRAY *ptarray_clone_deep(const POINTARRAY *ptarray); * passed to them, they just take references, so do not free them out * from underneath the geometries. */ -extern LWPOINT* lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point); -extern LWMPOINT *lwmpoint_construct(int srid, const POINTARRAY *pa); -extern LWLINE* lwline_construct(int srid, GBOX *bbox, POINTARRAY *points); -extern LWCIRCSTRING* lwcircstring_construct(int srid, GBOX *bbox, POINTARRAY *points); -extern LWPOLY* lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points); -extern LWCURVEPOLY* lwcurvepoly_construct(int srid, GBOX *bbox, uint32_t nrings, LWGEOM **geoms); -extern LWTRIANGLE* lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points); -extern LWCOLLECTION* lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms); +extern LWPOINT* lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point); +extern LWMPOINT *lwmpoint_construct(int32_t srid, const POINTARRAY *pa); +extern LWLINE* lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points); +extern LWCIRCSTRING* lwcircstring_construct(int32_t srid, GBOX *bbox, POINTARRAY *points); +extern LWPOLY* lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points); +extern LWCURVEPOLY* lwcurvepoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, LWGEOM **geoms); +extern LWTRIANGLE* lwtriangle_construct(int32_t srid, GBOX *bbox, POINTARRAY *points); +extern LWCOLLECTION* lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms); /* * Empty geometry constructors. */ -extern LWGEOM* lwgeom_construct_empty(uint8_t type, int srid, char hasz, char hasm); -extern LWPOINT* lwpoint_construct_empty(int srid, char hasz, char hasm); -extern LWLINE* lwline_construct_empty(int srid, char hasz, char hasm); -extern LWPOLY* lwpoly_construct_empty(int srid, char hasz, char hasm); -extern LWCURVEPOLY* lwcurvepoly_construct_empty(int srid, char hasz, char hasm); -extern LWCIRCSTRING* lwcircstring_construct_empty(int srid, char hasz, char hasm); -extern LWCOMPOUND* lwcompound_construct_empty(int srid, char hasz, char hasm); -extern LWTRIANGLE* lwtriangle_construct_empty(int srid, char hasz, char hasm); -extern LWMPOINT* lwmpoint_construct_empty(int srid, char hasz, char hasm); -extern LWMLINE* lwmline_construct_empty(int srid, char hasz, char hasm); -extern LWMPOLY* lwmpoly_construct_empty(int srid, char hasz, char hasm); -extern LWCOLLECTION* lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm); +extern LWGEOM* lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm); +extern LWPOINT* lwpoint_construct_empty(int32_t srid, char hasz, char hasm); +extern LWLINE* lwline_construct_empty(int32_t srid, char hasz, char hasm); +extern LWPOLY* lwpoly_construct_empty(int32_t srid, char hasz, char hasm); +extern LWCURVEPOLY* lwcurvepoly_construct_empty(int32_t srid, char hasz, char hasm); +extern LWCIRCSTRING* lwcircstring_construct_empty(int32_t srid, char hasz, char hasm); +extern LWCOMPOUND* lwcompound_construct_empty(int32_t srid, char hasz, char hasm); +extern LWTRIANGLE* lwtriangle_construct_empty(int32_t srid, char hasz, char hasm); +extern LWMPOINT* lwmpoint_construct_empty(int32_t srid, char hasz, char hasm); +extern LWMLINE* lwmline_construct_empty(int32_t srid, char hasz, char hasm); +extern LWMPOLY* lwmpoly_construct_empty(int32_t srid, char hasz, char hasm); +extern LWCOLLECTION* lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm); /* Other constructors */ -extern LWPOINT *lwpoint_make2d(int srid, double x, double y); -extern LWPOINT *lwpoint_make3dz(int srid, double x, double y, double z); -extern LWPOINT *lwpoint_make3dm(int srid, double x, double y, double m); -extern LWPOINT *lwpoint_make4d(int srid, double x, double y, double z, double m); -extern LWPOINT *lwpoint_make(int srid, int hasz, int hasm, const POINT4D *p); -extern LWLINE *lwline_from_lwgeom_array(int srid, uint32_t ngeoms, LWGEOM **geoms); -extern LWLINE *lwline_from_ptarray(int srid, uint32_t npoints, LWPOINT **points); /* TODO: deprecate */ -extern LWLINE *lwline_from_lwmpoint(int srid, const LWMPOINT *mpoint); +extern LWPOINT *lwpoint_make2d(int32_t srid, double x, double y); +extern LWPOINT *lwpoint_make3dz(int32_t srid, double x, double y, double z); +extern LWPOINT *lwpoint_make3dm(int32_t srid, double x, double y, double m); +extern LWPOINT *lwpoint_make4d(int32_t srid, double x, double y, double z, double m); +extern LWPOINT *lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p); +extern LWLINE *lwline_from_lwgeom_array(int32_t srid, uint32_t ngeoms, LWGEOM **geoms); +extern LWLINE *lwline_from_ptarray(int32_t srid, uint32_t npoints, LWPOINT **points); /* TODO: deprecate */ +extern LWLINE *lwline_from_lwmpoint(int32_t srid, const LWMPOINT *mpoint); extern LWLINE *lwline_addpoint(LWLINE *line, LWPOINT *point, uint32_t where); extern LWLINE *lwline_removepoint(LWLINE *line, uint32_t which); extern void lwline_setPoint4d(LWLINE *line, uint32_t which, POINT4D *newpoint); extern LWPOLY *lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes); extern LWPOLY *lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D *p4); -extern LWPOLY *lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2); -extern LWPOLY *lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior); +extern LWPOLY *lwpoly_construct_envelope(int32_t srid, double x1, double y1, double x2, double y2); +extern LWPOLY *lwpoly_construct_circle(int32_t srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior); extern LWTRIANGLE *lwtriangle_from_lwline(const LWLINE *shell); extern LWMPOINT *lwmpoint_from_lwgeom(const LWGEOM *g); /* Extract the coordinates of an LWGEOM into an LWMPOINT */ diff --git a/liblwgeom/liblwgeom_topo.h b/liblwgeom/liblwgeom_topo.h index c7c27e17e..f96c8948d 100644 --- a/liblwgeom/liblwgeom_topo.h +++ b/liblwgeom/liblwgeom_topo.h @@ -156,10 +156,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @return a topology handler, which embeds the backend data/params * or NULL on error (@see lastErrorMessage) */ - LWT_BE_TOPOLOGY* (*createTopology) ( - const LWT_BE_DATA* be, - const char* name, int srid, double precision, int hasZ - ); + LWT_BE_TOPOLOGY *(*createTopology)(const LWT_BE_DATA *be, const char *name, int32_t srid, double precision, int hasZ); /** * Load a topology from the backend @@ -906,8 +903,7 @@ typedef struct LWT_TOPOLOGY_T LWT_TOPOLOGY; * @return the handler of the topology, or NULL on error * (liblwgeom error handler will be invoked with error message) */ -LWT_TOPOLOGY *lwt_CreateTopology(LWT_BE_IFACE *iface, const char *name, - int srid, double prec, int hasz); +LWT_TOPOLOGY *lwt_CreateTopology(LWT_BE_IFACE *iface, const char *name, int32_t srid, double prec, int hasz); /** * Loads an existing topology by name from the database diff --git a/liblwgeom/liblwgeom_topo_internal.h b/liblwgeom/liblwgeom_topo_internal.h index 4f110d4a0..2413cf4e7 100644 --- a/liblwgeom/liblwgeom_topo_internal.h +++ b/liblwgeom/liblwgeom_topo_internal.h @@ -92,7 +92,7 @@ struct LWT_TOPOLOGY_T { const LWT_BE_IFACE *be_iface; LWT_BE_TOPOLOGY *be_topo; - int srid; + int32_t srid; double precision; int hasZ; }; diff --git a/liblwgeom/lwcircstring.c b/liblwgeom/lwcircstring.c index 2ae445e9d..693e452b4 100644 --- a/liblwgeom/lwcircstring.c +++ b/liblwgeom/lwcircstring.c @@ -34,8 +34,8 @@ void printLWCIRCSTRING(LWCIRCSTRING *curve); void lwcircstring_release(LWCIRCSTRING *lwcirc); char lwcircstring_same(const LWCIRCSTRING *me, const LWCIRCSTRING *you); -LWCIRCSTRING *lwcircstring_from_lwpointarray(int srid, uint32_t npoints, LWPOINT **points); -LWCIRCSTRING *lwcircstring_from_lwmpoint(int srid, LWMPOINT *mpoint); +LWCIRCSTRING *lwcircstring_from_lwpointarray(int32_t srid, uint32_t npoints, LWPOINT **points); +LWCIRCSTRING *lwcircstring_from_lwmpoint(int32_t srid, LWMPOINT *mpoint); LWCIRCSTRING *lwcircstring_addpoint(LWCIRCSTRING *curve, LWPOINT *point, uint32_t where); LWCIRCSTRING *lwcircstring_removepoint(LWCIRCSTRING *curve, uint32_t index); void lwcircstring_setPoint4d(LWCIRCSTRING *curve, uint32_t index, POINT4D *newpoint); @@ -47,7 +47,7 @@ void lwcircstring_setPoint4d(LWCIRCSTRING *curve, uint32_t index, POINT4D *newpo * use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0) */ LWCIRCSTRING * -lwcircstring_construct(int srid, GBOX *bbox, POINTARRAY *points) +lwcircstring_construct(int32_t srid, GBOX *bbox, POINTARRAY *points) { LWCIRCSTRING *result; @@ -76,7 +76,7 @@ lwcircstring_construct(int srid, GBOX *bbox, POINTARRAY *points) } LWCIRCSTRING * -lwcircstring_construct_empty(int srid, char hasz, char hasm) +lwcircstring_construct_empty(int32_t srid, char hasz, char hasm) { LWCIRCSTRING *result = lwalloc(sizeof(LWCIRCSTRING)); result->type = CIRCSTRINGTYPE; @@ -138,7 +138,7 @@ lwcircstring_same(const LWCIRCSTRING *me, const LWCIRCSTRING *you) * LWCIRCSTRING dimensions are large enough to host all input dimensions. */ LWCIRCSTRING * -lwcircstring_from_lwpointarray(int srid, uint32_t npoints, LWPOINT **points) +lwcircstring_from_lwpointarray(int32_t srid, uint32_t npoints, LWPOINT **points) { int zmflag=0; uint32_t i; @@ -189,7 +189,7 @@ lwcircstring_from_lwpointarray(int srid, uint32_t npoints, LWPOINT **points) * Construct a LWCIRCSTRING from a LWMPOINT */ LWCIRCSTRING * -lwcircstring_from_lwmpoint(int srid, LWMPOINT *mpoint) +lwcircstring_from_lwmpoint(int32_t srid, LWMPOINT *mpoint) { uint32_t i; POINTARRAY *pa; diff --git a/liblwgeom/lwcollection.c b/liblwgeom/lwcollection.c index a33cbfd30..dbe1e996a 100644 --- a/liblwgeom/lwcollection.c +++ b/liblwgeom/lwcollection.c @@ -38,10 +38,8 @@ lwcollection_release(LWCOLLECTION *lwcollection) lwgeom_release(lwcollection_as_lwgeom(lwcollection)); } - LWCOLLECTION * -lwcollection_construct(uint8_t type, int srid, GBOX *bbox, - uint32_t ngeoms, LWGEOM **geoms) +lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms) { LWCOLLECTION *ret; int hasz, hasm; @@ -91,7 +89,7 @@ lwcollection_construct(uint8_t type, int srid, GBOX *bbox, } LWCOLLECTION * -lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm) +lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm) { LWCOLLECTION *ret; if( ! lwtype_is_collection(type) ) diff --git a/liblwgeom/lwcompound.c b/liblwgeom/lwcompound.c index bcfa92b25..03f4201cd 100644 --- a/liblwgeom/lwcompound.c +++ b/liblwgeom/lwcompound.c @@ -120,7 +120,7 @@ int lwcompound_add_lwgeom(LWCOMPOUND *comp, LWGEOM *geom) } LWCOMPOUND * -lwcompound_construct_empty(int srid, char hasz, char hasm) +lwcompound_construct_empty(int32_t srid, char hasz, char hasm) { LWCOMPOUND *ret = (LWCOMPOUND*)lwcollection_construct_empty(COMPOUNDTYPE, srid, hasz, hasm); return ret; diff --git a/liblwgeom/lwcurvepoly.c b/liblwgeom/lwcurvepoly.c index 10f9b4883..aeb09747a 100644 --- a/liblwgeom/lwcurvepoly.c +++ b/liblwgeom/lwcurvepoly.c @@ -31,9 +31,8 @@ #include "liblwgeom_internal.h" #include "lwgeom_log.h" - LWCURVEPOLY * -lwcurvepoly_construct_empty(int srid, char hasz, char hasm) +lwcurvepoly_construct_empty(int32_t srid, char hasz, char hasm) { LWCURVEPOLY *ret; diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c index 893b0d7d8..702d4cd6d 100644 --- a/liblwgeom/lwgeom.c +++ b/liblwgeom/lwgeom.c @@ -406,7 +406,7 @@ lwgeom_as_curve(const LWGEOM *lwgeom) /* int hasz = FLAGS_GET_Z(lwgeom->flags); int hasm = FLAGS_GET_M(lwgeom->flags); - int srid = lwgeom->srid; + int32_t srid = lwgeom->srid; */ switch(type) @@ -2022,8 +2022,8 @@ lwgeom_scale(LWGEOM *geom, const POINT4D *factor) } } -LWGEOM* -lwgeom_construct_empty(uint8_t type, int srid, char hasz, char hasm) +LWGEOM * +lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm) { switch(type) { diff --git a/liblwgeom/lwgeom_geos.c b/liblwgeom/lwgeom_geos.c index bb22c11e5..a09dc1783 100644 --- a/liblwgeom/lwgeom_geos.c +++ b/liblwgeom/lwgeom_geos.c @@ -1462,7 +1462,7 @@ lwpoly_to_points(const LWPOLY* lwpoly, uint32_t npoints, int32_t seed) GEOSGeometry* gpt; GEOSCoordSequence* gseq; LWMPOINT* mpt; - int srid = lwgeom_get_srid(lwgeom); + int32_t srid = lwgeom_get_srid(lwgeom); int done = 0; int* cells; const size_t size = 2 * sizeof(int); @@ -1832,7 +1832,7 @@ lwgeom_voronoi_diagram(const LWGEOM* g, const GBOX* env, double tolerance, int o uint32_t num_points = lwgeom_count_vertices(g); LWGEOM* lwgeom_result; char is_3d = LW_FALSE; - int srid = lwgeom_get_srid(g); + int32_t srid = lwgeom_get_srid(g); GEOSCoordSequence* coords; GEOSGeometry* geos_geom; GEOSGeometry* geos_env = NULL; diff --git a/liblwgeom/lwgeom_sfcgal.c b/liblwgeom/lwgeom_sfcgal.c index bf4c93db0..72ff5d45a 100644 --- a/liblwgeom/lwgeom_sfcgal.c +++ b/liblwgeom/lwgeom_sfcgal.c @@ -275,7 +275,7 @@ ptarray_to_SFCGAL(const POINTARRAY *pa, int type) * Throws an error on unsupported type */ LWGEOM * -SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int srid) +SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int32_t srid) { uint32_t ngeoms, nshells, nsolids; uint32_t i, j, k; diff --git a/liblwgeom/lwgeom_sfcgal.h b/liblwgeom/lwgeom_sfcgal.h index 5efb393d1..bc85748c2 100644 --- a/liblwgeom/lwgeom_sfcgal.h +++ b/liblwgeom/lwgeom_sfcgal.h @@ -29,7 +29,7 @@ const char *lwgeom_sfcgal_version(void); /* Convert SFCGAL structure to lwgeom PostGIS */ -LWGEOM *SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int SRID); +LWGEOM *SFCGAL2LWGEOM(const sfcgal_geometry_t *geom, int force3D, int32_t SRID); /* Convert lwgeom PostGIS to SFCGAL structure */ sfcgal_geometry_t *LWGEOM2SFCGAL(const LWGEOM *geom); diff --git a/liblwgeom/lwin_wkb.c b/liblwgeom/lwin_wkb.c index 8d9910289..c7e5c905c 100644 --- a/liblwgeom/lwin_wkb.c +++ b/liblwgeom/lwin_wkb.c @@ -40,7 +40,7 @@ typedef struct int swap_bytes; /* Do an endian flip? */ int check; /* Simple validity checks on geometries */ uint32_t lwtype; /* Current type we are handling */ - uint32_t srid; /* Current SRID we are handling */ + int32_t srid; /* Current SRID we are handling */ int has_z; /* Z? */ int has_m; /* M? */ int has_srid; /* SRID? */ diff --git a/liblwgeom/lwin_wkt.c b/liblwgeom/lwin_wkt.c index 704475d52..64d0c28fe 100644 --- a/liblwgeom/lwin_wkt.c +++ b/liblwgeom/lwin_wkt.c @@ -62,12 +62,12 @@ int wkt_lexer_read_srid(char *str) { char *c = str; long i = 0; - int srid; + int32_t srid; if( ! str ) return SRID_UNKNOWN; c += 5; /* Advance past "SRID=" */ i = strtol(c, NULL, 10); - srid = clamp_srid((int)i); + srid = clamp_srid((int32_t)i); /* TODO: warn on explicit UNKNOWN srid ? */ return srid; } @@ -856,7 +856,8 @@ LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *geom, char *dimension return geom; } -void wkt_parser_geometry_new(LWGEOM *geom, int srid) +void +wkt_parser_geometry_new(LWGEOM *geom, int32_t srid) { LWDEBUG(4,"entered"); LWDEBUGF(4,"geom %p",geom); diff --git a/liblwgeom/lwin_wkt.h b/liblwgeom/lwin_wkt.h index 14f54db26..feb527c41 100644 --- a/liblwgeom/lwin_wkt.h +++ b/liblwgeom/lwin_wkt.h @@ -56,7 +56,7 @@ extern int wkt_yylex_destroy(void); /* * Functions called from within the bison parser to construct geometries. */ -int wkt_lexer_read_srid(char *str); +int32_t wkt_lexer_read_srid(char *str); POINT wkt_parser_coord_2(double c1, double c2); POINT wkt_parser_coord_3(double c1, double c2, double c3); POINT wkt_parser_coord_4(double c1, double c2, double c3, double c4); @@ -77,5 +77,4 @@ LWGEOM* wkt_parser_compound_add_geom(LWGEOM *col, LWGEOM *geom); LWGEOM* wkt_parser_collection_new(LWGEOM *geom); LWGEOM* wkt_parser_collection_add_geom(LWGEOM *col, LWGEOM *geom); LWGEOM* wkt_parser_collection_finalize(int lwtype, LWGEOM *col, char *dimensionality); -void wkt_parser_geometry_new(LWGEOM *geom, int srid); - +void wkt_parser_geometry_new(LWGEOM *geom, int32_t srid); diff --git a/liblwgeom/lwline.c b/liblwgeom/lwline.c index d39a77278..02f013345 100644 --- a/liblwgeom/lwline.c +++ b/liblwgeom/lwline.c @@ -39,7 +39,7 @@ * use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0) */ LWLINE * -lwline_construct(int srid, GBOX *bbox, POINTARRAY *points) +lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points) { LWLINE *result; result = (LWLINE*) lwalloc(sizeof(LWLINE)); @@ -61,7 +61,7 @@ lwline_construct(int srid, GBOX *bbox, POINTARRAY *points) } LWLINE * -lwline_construct_empty(int srid, char hasz, char hasm) +lwline_construct_empty(int32_t srid, char hasz, char hasm) { LWLINE *result = lwalloc(sizeof(LWLINE)); result->type = LINETYPE; @@ -157,7 +157,7 @@ lwline_same(const LWLINE *l1, const LWLINE *l2) * LWLINE dimensions are large enough to host all input dimensions. */ LWLINE * -lwline_from_lwgeom_array(int srid, uint32_t ngeoms, LWGEOM **geoms) +lwline_from_lwgeom_array(int32_t srid, uint32_t ngeoms, LWGEOM **geoms) { uint32_t i; int hasz = LW_FALSE; @@ -234,7 +234,7 @@ lwline_from_lwgeom_array(int srid, uint32_t ngeoms, LWGEOM **geoms) * LWLINE dimensions are large enough to host all input dimensions. */ LWLINE * -lwline_from_ptarray(int srid, uint32_t npoints, LWPOINT **points) +lwline_from_ptarray(int32_t srid, uint32_t npoints, LWPOINT **points) { uint32_t i; int hasz = LW_FALSE; @@ -281,7 +281,7 @@ lwline_from_ptarray(int srid, uint32_t npoints, LWPOINT **points) * Construct a LWLINE from a LWMPOINT */ LWLINE * -lwline_from_lwmpoint(int srid, const LWMPOINT *mpoint) +lwline_from_lwmpoint(int32_t srid, const LWMPOINT *mpoint) { uint32_t i; POINTARRAY *pa = NULL; diff --git a/liblwgeom/lwmline.c b/liblwgeom/lwmline.c index ab93026f2..1ea209886 100644 --- a/liblwgeom/lwmline.c +++ b/liblwgeom/lwmline.c @@ -35,7 +35,7 @@ lwmline_release(LWMLINE *lwmline) } LWMLINE * -lwmline_construct_empty(int srid, char hasz, char hasm) +lwmline_construct_empty(int32_t srid, char hasz, char hasm) { LWMLINE *ret = (LWMLINE*)lwcollection_construct_empty(MULTILINETYPE, srid, hasz, hasm); return ret; diff --git a/liblwgeom/lwmpoint.c b/liblwgeom/lwmpoint.c index ae916d74b..9f687f6f1 100644 --- a/liblwgeom/lwmpoint.c +++ b/liblwgeom/lwmpoint.c @@ -36,7 +36,7 @@ lwmpoint_release(LWMPOINT *lwmpoint) } LWMPOINT * -lwmpoint_construct_empty(int srid, char hasz, char hasm) +lwmpoint_construct_empty(int32_t srid, char hasz, char hasm) { LWMPOINT *ret = (LWMPOINT*)lwcollection_construct_empty(MULTIPOINTTYPE, srid, hasz, hasm); return ret; @@ -49,7 +49,7 @@ LWMPOINT* lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj) } LWMPOINT * -lwmpoint_construct(int srid, const POINTARRAY *pa) +lwmpoint_construct(int32_t srid, const POINTARRAY *pa) { uint32_t i; int hasz = ptarray_has_z(pa); diff --git a/liblwgeom/lwmpoly.c b/liblwgeom/lwmpoly.c index 8bd2b2d74..6dc95ce51 100644 --- a/liblwgeom/lwmpoly.c +++ b/liblwgeom/lwmpoly.c @@ -37,7 +37,7 @@ lwmpoly_release(LWMPOLY *lwmpoly) } LWMPOLY * -lwmpoly_construct_empty(int srid, char hasz, char hasm) +lwmpoly_construct_empty(int32_t srid, char hasz, char hasm) { LWMPOLY *ret = (LWMPOLY*)lwcollection_construct_empty(MULTIPOLYGONTYPE, srid, hasz, hasm); return ret; diff --git a/liblwgeom/lwpoint.c b/liblwgeom/lwpoint.c index c4731adb0..e3058276d 100644 --- a/liblwgeom/lwpoint.c +++ b/liblwgeom/lwpoint.c @@ -126,7 +126,7 @@ lwpoint_get_m(const LWPOINT *point) * use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0) */ LWPOINT * -lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point) +lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point) { LWPOINT *result; uint8_t flags = 0; @@ -148,7 +148,7 @@ lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point) } LWPOINT * -lwpoint_construct_empty(int srid, char hasz, char hasm) +lwpoint_construct_empty(int32_t srid, char hasz, char hasm) { LWPOINT *result = lwalloc(sizeof(LWPOINT)); result->type = POINTTYPE; @@ -160,7 +160,7 @@ lwpoint_construct_empty(int srid, char hasz, char hasm) } LWPOINT * -lwpoint_make2d(int srid, double x, double y) +lwpoint_make2d(int32_t srid, double x, double y) { POINT4D p = {x, y, 0.0, 0.0}; POINTARRAY *pa = ptarray_construct_empty(0, 0, 1); @@ -170,7 +170,7 @@ lwpoint_make2d(int srid, double x, double y) } LWPOINT * -lwpoint_make3dz(int srid, double x, double y, double z) +lwpoint_make3dz(int32_t srid, double x, double y, double z) { POINT4D p = {x, y, z, 0.0}; POINTARRAY *pa = ptarray_construct_empty(1, 0, 1); @@ -181,7 +181,7 @@ lwpoint_make3dz(int srid, double x, double y, double z) } LWPOINT * -lwpoint_make3dm(int srid, double x, double y, double m) +lwpoint_make3dm(int32_t srid, double x, double y, double m) { POINT4D p = {x, y, 0.0, m}; POINTARRAY *pa = ptarray_construct_empty(0, 1, 1); @@ -192,7 +192,7 @@ lwpoint_make3dm(int srid, double x, double y, double m) } LWPOINT * -lwpoint_make4d(int srid, double x, double y, double z, double m) +lwpoint_make4d(int32_t srid, double x, double y, double z, double m) { POINT4D p = {x, y, z, m}; POINTARRAY *pa = ptarray_construct_empty(1, 1, 1); @@ -203,7 +203,7 @@ lwpoint_make4d(int srid, double x, double y, double z, double m) } LWPOINT * -lwpoint_make(int srid, int hasz, int hasm, const POINT4D *p) +lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p) { POINTARRAY *pa = ptarray_construct_empty(hasz, hasm, 1); ptarray_append_point(pa, p, LW_TRUE); diff --git a/liblwgeom/lwpoly.c b/liblwgeom/lwpoly.c index b4b13f82e..e0a41617f 100644 --- a/liblwgeom/lwpoly.c +++ b/liblwgeom/lwpoly.c @@ -39,8 +39,8 @@ /* construct a new LWPOLY. arrays (points/points per ring) will NOT be copied * use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0) */ -LWPOLY* -lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points) +LWPOLY * +lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points) { LWPOLY *result; int hasz, hasm; @@ -95,7 +95,7 @@ lwpoly_construct_rectangle(char hasz, char hasm, POINT4D *p1, POINT4D *p2, } LWPOLY * -lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2) +lwpoly_construct_envelope(int32_t srid, double x1, double y1, double x2, double y2) { POINT4D p1, p2, p3, p4; LWPOLY *poly; @@ -116,8 +116,8 @@ lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2) return poly; } -LWPOLY* -lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior) +LWPOLY * +lwpoly_construct_circle(int32_t srid, double x, double y, double radius, uint32_t segments_per_quarter, char exterior) { const uint32_t segments = 4*segments_per_quarter; double theta; @@ -157,8 +157,8 @@ lwpoly_construct_circle(int srid, double x, double y, double radius, uint32_t se return lwpoly; } -LWPOLY* -lwpoly_construct_empty(int srid, char hasz, char hasm) +LWPOLY * +lwpoly_construct_empty(int32_t srid, char hasz, char hasm) { LWPOLY *result = lwalloc(sizeof(LWPOLY)); result->type = POLYGONTYPE; @@ -362,7 +362,7 @@ lwpoly_from_lwlines(const LWLINE *shell, { uint32_t nrings; POINTARRAY **rings = lwalloc((nholes+1)*sizeof(POINTARRAY *)); - int srid = shell->srid; + int32_t srid = shell->srid; LWPOLY *ret; if ( shell->points->npoints < 4 ) diff --git a/liblwgeom/lwstroke.c b/liblwgeom/lwstroke.c index 00f407a5c..26c6ed8e7 100644 --- a/liblwgeom/lwstroke.c +++ b/liblwgeom/lwstroke.c @@ -38,8 +38,7 @@ #include "liblwgeom_internal.h" - -LWGEOM* pta_unstroke(const POINTARRAY *points, int srid); +LWGEOM *pta_unstroke(const POINTARRAY *points, int32_t srid); LWGEOM* lwline_unstroke(const LWLINE *line); LWGEOM* lwpolygon_unstroke(const LWPOLY *poly); LWGEOM* lwmline_unstroke(const LWMLINE *mline); @@ -909,8 +908,8 @@ static int pt_continues_arc(const POINT4D *a1, const POINT4D *a2, const POINT4D return LW_FALSE; } -static LWGEOM* -linestring_from_pa(const POINTARRAY *pa, int srid, int start, int end) +static LWGEOM * +linestring_from_pa(const POINTARRAY *pa, int32_t srid, int start, int end) { int i = 0, j = 0; POINT4D p; @@ -924,8 +923,8 @@ linestring_from_pa(const POINTARRAY *pa, int srid, int start, int end) return lwline_as_lwgeom(lwline_construct(srid, NULL, pao)); } -static LWGEOM* -circstring_from_pa(const POINTARRAY *pa, int srid, int start, int end) +static LWGEOM * +circstring_from_pa(const POINTARRAY *pa, int32_t srid, int start, int end) { POINT4D p0, p1, p2; @@ -940,8 +939,8 @@ circstring_from_pa(const POINTARRAY *pa, int srid, int start, int end) return lwcircstring_as_lwgeom(lwcircstring_construct(srid, NULL, pao)); } -static LWGEOM* -geom_from_pa(const POINTARRAY *pa, int srid, int is_arc, int start, int end) +static LWGEOM * +geom_from_pa(const POINTARRAY *pa, int32_t srid, int is_arc, int start, int end) { LWDEBUGF(4, "srid=%d, is_arc=%d, start=%d, end=%d", srid, is_arc, start, end); if ( is_arc ) @@ -950,8 +949,8 @@ geom_from_pa(const POINTARRAY *pa, int srid, int is_arc, int start, int end) return linestring_from_pa(pa, srid, start, end); } -LWGEOM* -pta_unstroke(const POINTARRAY *points, int srid) +LWGEOM * +pta_unstroke(const POINTARRAY *points, int32_t srid) { int i = 0, j, k; POINT4D a1, a2, a3, b; diff --git a/liblwgeom/lwtriangle.c b/liblwgeom/lwtriangle.c index 39b62f104..5e917dc37 100644 --- a/liblwgeom/lwtriangle.c +++ b/liblwgeom/lwtriangle.c @@ -36,8 +36,8 @@ /* construct a new LWTRIANGLE. * use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0) */ -LWTRIANGLE* -lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points) +LWTRIANGLE * +lwtriangle_construct(int32_t srid, GBOX *bbox, POINTARRAY *points) { LWTRIANGLE *result; @@ -54,8 +54,8 @@ lwtriangle_construct(int srid, GBOX *bbox, POINTARRAY *points) return result; } -LWTRIANGLE* -lwtriangle_construct_empty(int srid, char hasz, char hasm) +LWTRIANGLE * +lwtriangle_construct_empty(int32_t srid, char hasz, char hasm) { LWTRIANGLE *result = lwalloc(sizeof(LWTRIANGLE)); result->type = TRIANGLETYPE; diff --git a/liblwgeom/lwutil.c b/liblwgeom/lwutil.c index 8d2d43f26..ea1350ffb 100644 --- a/liblwgeom/lwutil.c +++ b/liblwgeom/lwutil.c @@ -340,9 +340,8 @@ getMachineEndian(void) */ } - void -error_if_srid_mismatch(int srid1, int srid2) +error_if_srid_mismatch(int32_t srid1, int32_t srid2) { if ( srid1 != srid2 ) { @@ -350,8 +349,8 @@ error_if_srid_mismatch(int srid1, int srid2) } } -int -clamp_srid(int srid) +int32_t +clamp_srid(int32_t srid) { int newsrid = srid; diff --git a/liblwgeom/measures.c b/liblwgeom/measures.c index 633366f3f..3e2a15a34 100644 --- a/liblwgeom/measures.c +++ b/liblwgeom/measures.c @@ -81,7 +81,7 @@ lw_dist2d_distpts_init(DISTPTS *dl, int mode) Function initializing shortestline and longestline calculations. */ LWGEOM * -lw_dist2d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode) +lw_dist2d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode) { double x1,x2,y1,y2; @@ -128,7 +128,7 @@ lw_dist2d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode) Function initializing closestpoint calculations. */ LWGEOM * -lw_dist2d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2,int srid,int mode) +lw_dist2d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode) { double x,y; DISTPTS thedl; diff --git a/liblwgeom/measures.h b/liblwgeom/measures.h index 7f723ef06..5a57004b9 100644 --- a/liblwgeom/measures.h +++ b/liblwgeom/measures.h @@ -124,7 +124,7 @@ double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3); /* * Geometry returning functions */ -LWGEOM* lw_dist2d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode); -LWGEOM* lw_dist2d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode); +LWGEOM *lw_dist2d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode); +LWGEOM *lw_dist2d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode); #endif /* !defined _MEASURES_H */ \ No newline at end of file diff --git a/liblwgeom/measures3d.c b/liblwgeom/measures3d.c index 9ccfa7047..b3f1b0b8d 100644 --- a/liblwgeom/measures3d.c +++ b/liblwgeom/measures3d.c @@ -56,7 +56,7 @@ geometries lacks z-values. The vertical line crosses the 2d point that is closes and the z-range is from maxz to minz in the geometry that has z values. */ static LWGEOM * -create_v_line(const LWGEOM *lwgeom, double x, double y, int srid) +create_v_line(const LWGEOM *lwgeom, double x, double y, int32_t srid) { LWPOINT *lwpoints[2]; @@ -94,7 +94,7 @@ lwgeom_closest_point_3d(const LWGEOM *lw1, const LWGEOM *lw2) Function initializing 3dshortestline and 3dlongestline calculations. */ LWGEOM * -lw_dist3d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode) +lw_dist3d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode) { LWDEBUG(2, "lw_dist3d_distanceline is called"); double x1, x2, y1, y2, z1, z2, x, y; @@ -198,7 +198,7 @@ lw_dist3d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode) Function initializing 3dclosestpoint calculations. */ LWGEOM * -lw_dist3d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode) +lw_dist3d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode) { double x, y, z; diff --git a/liblwgeom/measures3d.h b/liblwgeom/measures3d.h index 8ae710a3b..fd79084c9 100644 --- a/liblwgeom/measures3d.h +++ b/liblwgeom/measures3d.h @@ -61,8 +61,8 @@ typedef struct /* Geometry returning functions */ -LWGEOM *lw_dist3d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode); -LWGEOM *lw_dist3d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int srid, int mode); +LWGEOM *lw_dist3d_distancepoint(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode); +LWGEOM *lw_dist3d_distanceline(const LWGEOM *lw1, const LWGEOM *lw2, int32_t srid, int mode); /* Preprocessing functions diff --git a/libpgcommon/lwgeom_cache.h b/libpgcommon/lwgeom_cache.h index abb0d5df1..936fe1b17 100644 --- a/libpgcommon/lwgeom_cache.h +++ b/libpgcommon/lwgeom_cache.h @@ -65,8 +65,8 @@ typedef struct { /* An entry in the PROJ SRS cache */ typedef struct struct_PROJSRSCacheItem { - int srid_from; - int srid_to; + int32_t srid_from; + int32_t srid_to; PJ* projection; MemoryContext projection_mcxt; } diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index 5eb6e08db..5a8338fc4 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -92,10 +92,9 @@ static void AddPJHashEntry(MemoryContext mcxt, PJ* projection); /* Internal Cache API */ /* static PROJPortalCache *GetPROJSRSCache(FunctionCallInfo fcinfo) ; */ -static bool IsInPROJSRSCache(PROJPortalCache *PROJCache, int srid_from, int srid_to); -static void AddToPROJSRSCache(PROJPortalCache *PROJCache, int srid_from, int srid_to); -static void DeleteFromPROJSRSCache(PROJPortalCache *PROJCache, int srid_from, int srid_to); - +static bool IsInPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to); +static void AddToPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to); +static void DeleteFromPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to); /* Search path for PROJ.4 library */ static bool IsPROJLibPathSet = false; @@ -340,7 +339,7 @@ static void DeletePJHashEntry(MemoryContext mcxt) */ static bool -IsInPROJSRSCache(PROJPortalCache *cache, int srid_from, int srid_to) +IsInPROJSRSCache(PROJPortalCache *cache, int32_t srid_from, int32_t srid_to) { /* * Return true/false depending upon whether the item @@ -357,8 +356,8 @@ IsInPROJSRSCache(PROJPortalCache *cache, int srid_from, int srid_to) return false; } -static PJ* -GetProjectionFromPROJCache(PROJPortalCache *cache, int srid_from, int srid_to) +static PJ * +GetProjectionFromPROJCache(PROJPortalCache *cache, int32_t srid_from, int32_t srid_to) { uint32_t i; for (i = 0; i < PROJ_CACHE_ITEMS; i++) @@ -384,7 +383,7 @@ SPI_pstrdup(const char* str) } static PjStrs -GetProjStringsSPI(int srid) +GetProjStringsSPI(int32_t srid) { const int maxprojlen = 512; const int spibufferlen = 512; @@ -474,7 +473,7 @@ GetProjStringsSPI(int srid) * return the proj4text for those. */ static PjStrs -GetProjStrings(int srid) +GetProjStrings(int32_t srid) { const int maxprojlen = 512; PjStrs strs; @@ -606,7 +605,7 @@ pgstrs_get_entry(const PjStrs *strs, int n) * needs proj4text access */ char * -GetProj4String(int srid) +GetProj4String(int32_t srid) { PjStrs strs; char *proj4str; @@ -623,7 +622,7 @@ GetProj4String(int srid) * which is the definition for the other half of the transformation. */ static void -AddToPROJSRSCache(PROJPortalCache *PROJCache, int srid_from, int srid_to) +AddToPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to) { MemoryContext PJMemoryContext; @@ -763,9 +762,8 @@ AddToPROJSRSCache(PROJPortalCache *PROJCache, int srid_from, int srid_to) PROJCache->PROJSRSCacheCount++; } - static void -DeleteFromPROJSRSCache(PROJPortalCache *PROJCache, int srid_from, int srid_to) +DeleteFromPROJSRSCache(PROJPortalCache *PROJCache, int32_t srid_from, int32_t srid_to) { /* * Delete the SRID entry from the cache @@ -837,9 +835,8 @@ void SetPROJLibPath(void) } } - int -GetPJUsingFCInfo(FunctionCallInfo fcinfo, int srid_from, int srid_to, PJ** pj) +GetPJUsingFCInfo(FunctionCallInfo fcinfo, int32_t srid_from, int32_t srid_to, PJ **pj) { PROJPortalCache *proj_cache = NULL; @@ -882,7 +879,7 @@ proj_pj_is_latlong(const PJ* pj) } static int -srid_is_latlong(FunctionCallInfo fcinfo, int srid) +srid_is_latlong(FunctionCallInfo fcinfo, int32_t srid) { PJ* pj; if ( GetPJUsingFCInfo(fcinfo, srid, srid, &pj) == LW_FAILURE) @@ -891,7 +888,7 @@ srid_is_latlong(FunctionCallInfo fcinfo, int srid) } void -srid_check_latlong(FunctionCallInfo fcinfo, int srid) +srid_check_latlong(FunctionCallInfo fcinfo, int32_t srid) { if (srid == SRID_DEFAULT || srid == SRID_UNKNOWN) return; @@ -905,7 +902,7 @@ srid_check_latlong(FunctionCallInfo fcinfo, int srid) } srs_precision -srid_axis_precision(FunctionCallInfo fcinfo, int srid, int precision) +srid_axis_precision(FunctionCallInfo fcinfo, int32_t srid, int precision) { srs_precision sp; sp.precision_xy = precision; @@ -925,7 +922,7 @@ srid_axis_precision(FunctionCallInfo fcinfo, int srid, int precision) } int -spheroid_init_from_srid(FunctionCallInfo fcinfo, int srid, SPHEROID *s) +spheroid_init_from_srid(FunctionCallInfo fcinfo, int32_t srid, SPHEROID *s) { PJ* pj; #if POSTGIS_PROJ_VERSION >= 60 diff --git a/libpgcommon/lwgeom_transform.h b/libpgcommon/lwgeom_transform.h index 8c9e45161..24377ac1f 100644 --- a/libpgcommon/lwgeom_transform.h +++ b/libpgcommon/lwgeom_transform.h @@ -21,7 +21,7 @@ typedef struct srs_precision int precision_m; } srs_precision; -char * GetProj4String(int srid); +char *GetProj4String(int32_t srid); /** * Opaque type to use in the projection cache API. @@ -29,12 +29,12 @@ char * GetProj4String(int srid); typedef void *ProjCache ; void SetPROJLibPath(void); -bool IsInPROJCache(ProjCache cache, int srid_from, int srid_to); -PJ* GetPJFromPROJCache(ProjCache cache, int srid_from, int srid_to); -int GetPJUsingFCInfo(FunctionCallInfo fcinfo, int srid_from, int srid_to, PJ** pj); -int spheroid_init_from_srid(FunctionCallInfo fcinfo, int srid, SPHEROID *s); -void srid_check_latlong(FunctionCallInfo fcinfo, int srid); -srs_precision srid_axis_precision(FunctionCallInfo fcinfo, int srid, int precision); +bool IsInPROJCache(ProjCache cache, int32_t srid_from, int32_t srid_to); +PJ *GetPJFromPROJCache(ProjCache cache, int32_t srid_from, int32_t srid_to); +int GetPJUsingFCInfo(FunctionCallInfo fcinfo, int32_t srid_from, int32_t srid_to, PJ **pj); +int spheroid_init_from_srid(FunctionCallInfo fcinfo, int32_t srid, SPHEROID *s); +void srid_check_latlong(FunctionCallInfo fcinfo, int32_t srid); +srs_precision srid_axis_precision(FunctionCallInfo fcinfo, int32_t srid, int precision); /** * Builtin SRID values diff --git a/loader/shp2pgsql-core.c b/loader/shp2pgsql-core.c index 5db863b98..a2c869774 100644 --- a/loader/shp2pgsql-core.c +++ b/loader/shp2pgsql-core.c @@ -1439,7 +1439,7 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader) if (state->config->readshape == 1 && (!state->config->geography)) { /* If they didn't specify a target SRID, see if they specified a source SRID. */ - int srid = state->to_srid; + int32_t srid = state->to_srid; if (state->config->schema) { stringbuffer_aprintf(sb, "SELECT AddGeometryColumn('%s','%s','%s','%d',", diff --git a/postgis/geography_centroid.c b/postgis/geography_centroid.c index 411bd914d..e4a15cd2a 100644 --- a/postgis/geography_centroid.c +++ b/postgis/geography_centroid.c @@ -35,10 +35,14 @@ Datum geography_centroid(PG_FUNCTION_ARGS); /* internal functions */ -LWPOINT* geography_centroid_from_wpoints(const uint32_t srid, const POINT3DM* points, const uint32_t size); +LWPOINT *geography_centroid_from_wpoints(const int32_t srid, const POINT3DM *points, const uint32_t size); LWPOINT* geography_centroid_from_mline(const LWMLINE* mline, SPHEROID* s); LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid, SPHEROID* s); -LWPOINT* cart_to_lwpoint(const double_t x_sum, const double_t y_sum, const double_t z_sum, const double_t weight_sum, const uint32_t srid); +LWPOINT *cart_to_lwpoint(const double_t x_sum, + const double_t y_sum, + const double_t z_sum, + const double_t weight_sum, + const int32_t srid); POINT3D* lonlat_to_cart(const double_t raw_lon, const double_t raw_lat); /** @@ -53,9 +57,9 @@ Datum geography_centroid(PG_FUNCTION_ARGS) LWPOINT *lwpoint_out = NULL; GSERIALIZED *g = NULL; GSERIALIZED *g_out = NULL; - uint32_t srid; - bool use_spheroid = true; - SPHEROID s; + int32_t srid; + bool use_spheroid = true; + SPHEROID s; uint32_t type; /* Get our geometry object loaded into memory. */ @@ -177,7 +181,8 @@ Datum geography_centroid(PG_FUNCTION_ARGS) * Convert lat-lon-points to x-y-z-coordinates, calculate a weighted average * point and return lat-lon-coordinated */ -LWPOINT* geography_centroid_from_wpoints(const uint32_t srid, const POINT3DM* points, const uint32_t size) +LWPOINT * +geography_centroid_from_wpoints(const int32_t srid, const POINT3DM *points, const uint32_t size) { double_t x_sum = 0; double_t y_sum = 0; @@ -229,7 +234,12 @@ POINT3D* lonlat_to_cart(const double_t raw_lon, const double_t raw_lat) return point; } -LWPOINT* cart_to_lwpoint(const double_t x_sum, const double_t y_sum, const double_t z_sum, const double_t weight_sum, const uint32_t srid) +LWPOINT * +cart_to_lwpoint(const double_t x_sum, + const double_t y_sum, + const double_t z_sum, + const double_t weight_sum, + const int32_t srid) { double_t x = x_sum / weight_sum; double_t y = y_sum / weight_sum; diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index ee5ff4e22..25aa3621d 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -214,7 +214,7 @@ Datum geography_as_gml(PG_FUNCTION_ARGS) text *result; int version; char *srs; - int srid = SRID_DEFAULT; + int32_t srid = SRID_DEFAULT; int precision = DBL_DIG; int option = 0; int lwopts = LW_GML_IS_DIMS; diff --git a/postgis/gserialized_typmod.c b/postgis/gserialized_typmod.c index 9df9c3fe0..91b330cfc 100644 --- a/postgis/gserialized_typmod.c +++ b/postgis/gserialized_typmod.c @@ -266,8 +266,7 @@ static uint32 gserialized_typmod_in(ArrayType *arr, int is_geography) } if ( i == 1 ) /* SRID */ { - int srid = pg_atoi(DatumGetCString(elem_values[i]), - sizeof(int32), '\0'); + int32_t srid = pg_atoi(DatumGetCString(elem_values[i]), sizeof(int32), '\0'); srid = clamp_srid(srid); POSTGIS_DEBUGF(3, "srid: %d", srid); if ( srid != SRID_UNKNOWN ) @@ -292,7 +291,7 @@ Datum geography_typmod_in(PG_FUNCTION_ARGS) { ArrayType *arr = (ArrayType *) DatumGetPointer(PG_GETARG_DATUM(0)); int32 typmod = gserialized_typmod_in(arr, LW_TRUE); - int srid = TYPMOD_GET_SRID(typmod); + int32_t srid = TYPMOD_GET_SRID(typmod); /* Check the SRID is legal (geographic coordinates) */ srid_check_latlong(fcinfo, srid); diff --git a/postgis/lwgeom_btree.c b/postgis/lwgeom_btree.c index 459fd8648..7152cc9c0 100644 --- a/postgis/lwgeom_btree.c +++ b/postgis/lwgeom_btree.c @@ -139,7 +139,7 @@ Datum lwgeom_hash(PG_FUNCTION_ARGS) size_t sz1 = VARSIZE(g1); size_t bsz1 = sz1 - hsz1; /* Calculate size of srid/type/coordinate buffer */ - int srid = gserialized_get_srid(g1); + int32_t srid = gserialized_get_srid(g1); size_t bsz2 = bsz1 + sizeof(int); uint8_t *b2 = palloc(bsz2); /* Copy srid into front of combined buffer */ diff --git a/postgis/lwgeom_export.c b/postgis/lwgeom_export.c index 97dd7b585..59faa3892 100644 --- a/postgis/lwgeom_export.c +++ b/postgis/lwgeom_export.c @@ -52,7 +52,8 @@ Datum LWGEOM_asEncodedPolyline(PG_FUNCTION_ARGS); * Could return SRS as short one (i.e EPSG:4326) * or as long one: (i.e urn:ogc:def:crs:EPSG::4326) */ -char * getSRSbySRID(int srid, bool short_crs) +char * +getSRSbySRID(int32_t srid, bool short_crs) { char query[256]; char *srs, *srscopy; @@ -117,7 +118,7 @@ char * getSRSbySRID(int srid, bool short_crs) int getSRIDbySRS(const char* srs) { char query[256]; - int srid, err; + int32_t srid, err; if (!srs) return 0; @@ -184,7 +185,7 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS) text *result; int version; char *srs; - int srid; + int32_t srid; int option = 0; int lwopts = LW_GML_IS_DIMS; int precision = DBL_DIG; @@ -377,7 +378,7 @@ Datum LWGEOM_asGeoJson(PG_FUNCTION_ARGS) if ( option & 2 || option & 4 ) { - int srid = gserialized_get_srid(geom); + int32_t srid = gserialized_get_srid(geom); if ( srid != SRID_UNKNOWN ) { if ( option & 2 ) @@ -466,7 +467,7 @@ Datum LWGEOM_asX3D(PG_FUNCTION_ARGS) text *result; int version; char *srs; - int srid; + int32_t srid; int option = 0; int precision = DBL_DIG; static const char* default_defid = "x3d:"; /* default defid */ diff --git a/postgis/lwgeom_export.h b/postgis/lwgeom_export.h index e9652a0aa..e01a6ee53 100644 --- a/postgis/lwgeom_export.h +++ b/postgis/lwgeom_export.h @@ -22,6 +22,5 @@ * **********************************************************************/ - -char * getSRSbySRID(int SRID, bool short_crs); +char *getSRSbySRID(int32_t SRID, bool short_crs); int getSRIDbySRS(const char* SRS); diff --git a/postgis/lwgeom_functions_analytic.c b/postgis/lwgeom_functions_analytic.c index fe24b42b8..3e32b29bb 100644 --- a/postgis/lwgeom_functions_analytic.c +++ b/postgis/lwgeom_functions_analytic.c @@ -186,7 +186,7 @@ Datum LWGEOM_line_interpolate_point(PG_FUNCTION_ARGS) GSERIALIZED *result; double distance_fraction = PG_GETARG_FLOAT8(1); int repeat = PG_NARGS() > 2 && PG_GETARG_BOOL(2); - int srid = gserialized_get_srid(gser); + int32_t srid = gserialized_get_srid(gser); LWLINE* lwline; LWGEOM* lwresult; POINTARRAY* opa; diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index a7c518152..cd7281e7c 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -452,7 +452,7 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS) GSERIALIZED *result; LWGEOM **lwgeoms; LWGEOM *lwgeom; - int srid; + int32_t srid; GBOX *bbox; POSTGIS_DEBUG(2, "LWGEOM_force_collection called"); @@ -1148,7 +1148,7 @@ Datum LWGEOM_collect(PG_FUNCTION_ARGS) LWGEOM *lwgeoms[2], *outlwg; uint32 type1, type2; uint8_t outtype; - int srid; + int32_t srid; POSTGIS_DEBUG(2, "LWGEOM_collect called."); @@ -1231,7 +1231,7 @@ Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS) LWGEOM **lwgeoms, *outlwg; uint32 outtype; int count; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; GBOX *box = NULL; ArrayIterator iterator; @@ -1404,7 +1404,7 @@ Datum LWGEOM_makeline_garray(PG_FUNCTION_ARGS) LWGEOM **geoms; LWGEOM *outlwg; uint32 ngeoms; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; ArrayIterator iterator; Datum value; @@ -1607,7 +1607,7 @@ Datum LWGEOM_expand(PG_FUNCTION_ARGS) { GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0); LWGEOM *lwgeom = lwgeom_from_gserialized(geom); - int srid = lwgeom_get_srid(lwgeom); + int32_t srid = lwgeom_get_srid(lwgeom); LWPOLY *poly; GSERIALIZED *result; GBOX gbox; @@ -1708,7 +1708,7 @@ Datum LWGEOM_envelope(PG_FUNCTION_ARGS) { GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0); LWGEOM *lwgeom = lwgeom_from_gserialized(geom); - int srid = lwgeom->srid; + int32_t srid = lwgeom->srid; POINT4D pt; GBOX box; POINTARRAY *pa; @@ -2069,7 +2069,7 @@ Datum ST_MakeEnvelope(PG_FUNCTION_ARGS) LWPOLY *poly; GSERIALIZED *result; double x1, y1, x2, y2; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; POSTGIS_DEBUG(2, "ST_MakeEnvelope called"); @@ -2369,7 +2369,7 @@ Datum LWGEOM_azimuth(PG_FUNCTION_ARGS) LWPOINT *lwpoint; POINT2D p1, p2; double result; - int srid; + int32_t srid; /* Extract first point */ geom = PG_GETARG_GSERIALIZED_P(0); @@ -2445,7 +2445,7 @@ Datum LWGEOM_angle(PG_FUNCTION_ARGS) POINT2D points[4]; double az1, az2; double result; - int srids[4]; + int32_t srids[4]; int i = 0; int j = 0; int err_code = 0; @@ -2884,7 +2884,7 @@ Datum ST_BoundingDiagonal(PG_FUNCTION_ARGS) const GBOX *gbox; int hasz = FLAGS_GET_Z(lwgeom_in->flags); int hasm = FLAGS_GET_M(lwgeom_in->flags); - int srid = lwgeom_in->srid; + int32_t srid = lwgeom_in->srid; POINT4D pt; POINTARRAY *pa; diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index 16a64ffae..072ac099b 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -358,7 +358,7 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS) GEOSGeometry *g_union = NULL; GEOSGeometry **geoms = NULL; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; int empty_type = 0; @@ -765,7 +765,7 @@ Datum boundary(PG_FUNCTION_ARGS) GEOSGeometry *g1, *g3; GSERIALIZED *result; LWGEOM *lwgeom; - int srid; + int32_t srid; geom1 = PG_GETARG_GSERIALIZED_P(0); @@ -837,7 +837,7 @@ Datum convexhull(PG_FUNCTION_ARGS) GEOSGeometry *g1, *g3; GSERIALIZED *result; LWGEOM *lwout; - int srid; + int32_t srid; GBOX bbox; geom1 = PG_GETARG_GSERIALIZED_P(0); @@ -2912,7 +2912,7 @@ Datum polygonize_garray(PG_FUNCTION_ARGS) GSERIALIZED *result; GEOSGeometry *geos_result; const GEOSGeometry **vgeoms; - int srid=SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; #if POSTGIS_DEBUG_LEVEL >= 3 static int call=1; #endif @@ -2969,7 +2969,7 @@ Datum clusterintersecting_garray(PG_FUNCTION_ARGS) int is3d = 0; uint32 nelems, nclusters, i; GEOSGeometry **geos_inputs, **geos_results; - int srid=SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; /* Parameters used to construct a result array */ int16 elmlen; @@ -3037,7 +3037,7 @@ Datum cluster_within_distance_garray(PG_FUNCTION_ARGS) LWGEOM** lw_inputs; LWGEOM** lw_results; double tolerance; - int srid=SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; /* Parameters used to construct a result array */ int16 elmlen; @@ -3503,7 +3503,7 @@ Datum ST_MinimumClearanceLine(PG_FUNCTION_ARGS) GSERIALIZED* result; GEOSGeometry* input_geos; GEOSGeometry* result_geos; - int srid; + int32_t srid; initGEOS(lwpgnotice, lwgeom_geos_error); @@ -3539,7 +3539,7 @@ Datum ST_OrientedEnvelope(PG_FUNCTION_ARGS) GSERIALIZED* result; GEOSGeometry* input_geos; GEOSGeometry* result_geos; - int srid; + int32_t srid; initGEOS(lwpgnotice, lwgeom_geos_error); diff --git a/postgis/lwgeom_in_gml.c b/postgis/lwgeom_in_gml.c index 4eb505ab5..57b2846ca 100644 --- a/postgis/lwgeom_in_gml.c +++ b/postgis/lwgeom_in_gml.c @@ -68,7 +68,7 @@ static LWGEOM* parse_gml(xmlNodePtr xnode, bool *hasz, int *root_srid); typedef struct struct_gmlSrs { - int srid; + int32_t srid; bool reverse_axis; } gmlSrs; @@ -299,7 +299,8 @@ static xmlNodePtr get_xlink_node(xmlNodePtr xnode) #if POSTGIS_PROJ_VERSION < 60 -static POINTARRAY* gml_reproject_pa(POINTARRAY *pa, int srid_in, int srid_out) +static POINTARRAY * +gml_reproject_pa(POINTARRAY *pa, int32_t srid_in, int32_t srid_out) { PJ pj; char *text_in, *text_out; @@ -332,7 +333,8 @@ static POINTARRAY* gml_reproject_pa(POINTARRAY *pa, int srid_in, int srid_out) * lookups, and use the Proj 6+ EPSG catalogue and built-in SRID * lookups directly. Drop this ugly hack. */ -static POINTARRAY* gml_reproject_pa(POINTARRAY *pa, int srid_in, int srid_out) +static POINTARRAY * +gml_reproject_pa(POINTARRAY *pa, int32_t srid_in, int32_t srid_out) { PJ *pj; char text_in[32]; @@ -360,7 +362,8 @@ static POINTARRAY* gml_reproject_pa(POINTARRAY *pa, int srid_in, int srid_out) * Return 1 if given srid is planar (0 otherwise, i.e geocentric srid) * Return -1 if srid is not in spatial_ref_sys */ -static int gml_is_srid_planar(int srid) +static int +gml_is_srid_planar(int32_t srid) { char *result; char query[256]; diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c index 647a80391..94924d13f 100644 --- a/postgis/lwgeom_inout.c +++ b/postgis/lwgeom_inout.c @@ -89,7 +89,7 @@ Datum LWGEOM_in(PG_FUNCTION_ARGS) LWGEOM_PARSER_RESULT lwg_parser_result; LWGEOM *lwgeom; GSERIALIZED *ret; - int srid = 0; + int32_t srid = 0; if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) ) { geom_typmod = PG_GETARG_INT32(2); diff --git a/postgis/lwgeom_ogc.c b/postgis/lwgeom_ogc.c index b72d1c8e0..3ae38c298 100644 --- a/postgis/lwgeom_ogc.c +++ b/postgis/lwgeom_ogc.c @@ -96,7 +96,7 @@ PG_FUNCTION_INFO_V1(LWGEOM_get_srid); Datum LWGEOM_get_srid(PG_FUNCTION_ARGS) { GSERIALIZED *geom=PG_GETARG_GSERIALIZED_P(0); - int srid = gserialized_get_srid (geom); + int32_t srid = gserialized_get_srid(geom); PG_FREE_IF_COPY(geom,0); PG_RETURN_INT32(srid); } @@ -106,7 +106,7 @@ PG_FUNCTION_INFO_V1(LWGEOM_set_srid); Datum LWGEOM_set_srid(PG_FUNCTION_ARGS) { GSERIALIZED *g = (GSERIALIZED *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)); - int srid = PG_GETARG_INT32(1); + int32_t srid = PG_GETARG_INT32(1); gserialized_set_srid(g, srid); PG_RETURN_POINTER(g); } diff --git a/postgis/lwgeom_sfcgal.c b/postgis/lwgeom_sfcgal.c index ff92f200d..074596502 100644 --- a/postgis/lwgeom_sfcgal.c +++ b/postgis/lwgeom_sfcgal.c @@ -103,7 +103,7 @@ POSTGIS2SFCGALPreparedGeometry(GSERIALIZED *pglwgeom) /* Conversion from SFCGAL::Geometry to GSERIALIZED */ GSERIALIZED * -SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int SRID) +SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int32_t SRID) { GSERIALIZED *result; LWGEOM *lwgeom = SFCGAL2LWGEOM(geom, force3D, SRID); diff --git a/postgis/lwgeom_sfcgal.h b/postgis/lwgeom_sfcgal.h index eec9eb6ad..e3ffec2af 100644 --- a/postgis/lwgeom_sfcgal.h +++ b/postgis/lwgeom_sfcgal.h @@ -31,7 +31,7 @@ sfcgal_geometry_t *POSTGIS2SFCGALGeometry(GSERIALIZED *pglwgeom); sfcgal_prepared_geometry_t *POSTGIS2SFCGALPreparedGeometry(GSERIALIZED *pglwgeom); /* Conversion from SFCGAL::Geometry to GSERIALIZED */ -GSERIALIZED *SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int SRID); +GSERIALIZED *SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int32_t SRID); /* Conversion from SFCGAL::PreparedGeometry to GSERIALIZED */ GSERIALIZED *SFCGALPreparedGeometry2POSTGIS(const sfcgal_prepared_geometry_t *geom, int force3D); diff --git a/postgis/lwgeom_transform.c b/postgis/lwgeom_transform.c index 785e3828c..0a634a3f1 100644 --- a/postgis/lwgeom_transform.c +++ b/postgis/lwgeom_transform.c @@ -176,8 +176,8 @@ Datum LWGEOM_asKML(PG_FUNCTION_ARGS) const char *default_prefix = ""; /* default prefix */ char *prefixbuf; const char *prefix = default_prefix; - int srid_from; - const int srid_to = 4326; + int32_t srid_from; + const int32_t srid_to = 4326; /* Get the geometry */ GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P_COPY(0); diff --git a/raster/loader/raster2pgsql.h b/raster/loader/raster2pgsql.h index 7e8a574e9..85d5a1a35 100644 --- a/raster/loader/raster2pgsql.h +++ b/raster/loader/raster2pgsql.h @@ -97,7 +97,7 @@ typedef struct raster_loader_config { int quoteident; /* SRID of input raster */ - int srid; + int32_t srid; /* SRID of output raster (reprojection) */ int out_srid; @@ -163,7 +163,7 @@ typedef struct raster_loader_config { typedef struct rasterinfo_t { /* SRID of raster */ - int srid; + int32_t srid; /* srs of raster */ char *srs; diff --git a/raster/rt_core/rt_geometry.c b/raster/rt_core/rt_geometry.c index e300952fe..745f55b4f 100644 --- a/raster/rt_core/rt_geometry.c +++ b/raster/rt_core/rt_geometry.c @@ -192,7 +192,7 @@ rt_errorstate rt_raster_get_perimeter( uint16_t trim[4] = {0}; /* top, right, bottom, left */ int isset[4] = {0}; double gt[6] = {0.0}; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; POINTARRAY *pts = NULL; POINT4D p4d; @@ -612,7 +612,7 @@ rt_raster_pixel_as_polygon(rt_raster rast, int x, int y) double scale_x, scale_y; double skew_x, skew_y; double ul_x, ul_y; - int srid; + int32_t srid; POINTARRAY **points; POINT4D p, p0; LWPOLY *poly; @@ -669,7 +669,7 @@ rt_raster_pixel_as_polygon(rt_raster rast, int x, int y) rt_errorstate rt_raster_get_envelope_geom(rt_raster raster, LWGEOM **env) { double gt[6] = {0.0}; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; POINTARRAY *pts = NULL; POINT4D p4d; @@ -802,7 +802,7 @@ rt_raster_get_envelope_geom(rt_raster raster, LWGEOM **env) { rt_errorstate rt_raster_get_convex_hull(rt_raster raster, LWGEOM **hull) { double gt[6] = {0.0}; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; POINTARRAY *pts = NULL; POINT4D p4d; diff --git a/raster/rt_pg/rtpg_create.c b/raster/rt_pg/rtpg_create.c index 7dceed40d..992fc517f 100644 --- a/raster/rt_pg/rtpg_create.c +++ b/raster/rt_pg/rtpg_create.c @@ -947,7 +947,7 @@ Datum RASTER_tile(PG_FUNCTION_ARGS) struct { rt_raster raster; double gt[6]; - int srid; + int32_t srid; int width; int height; } raster; diff --git a/raster/rt_pg/rtpg_gdal.c b/raster/rt_pg/rtpg_gdal.c index c4581af9e..0cb95ef70 100644 --- a/raster/rt_pg/rtpg_gdal.c +++ b/raster/rt_pg/rtpg_gdal.c @@ -65,7 +65,7 @@ Datum RASTER_fromGDALRaster(PG_FUNCTION_ARGS) int data_len = 0; VSILFILE *vsifp = NULL; GDALDatasetH hdsSrc; - int srid = -1; /* -1 for NULL */ + int32_t srid = -1; /* -1 for NULL */ rt_pgraster *pgraster = NULL; rt_raster raster; @@ -155,7 +155,7 @@ Datum RASTER_asGDALRaster(PG_FUNCTION_ARGS) char **options = NULL; text *optiontext = NULL; char *option = NULL; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; char *srs = NULL; ArrayType *array; diff --git a/raster/rt_pg/rtpg_geometry.c b/raster/rt_pg/rtpg_geometry.c index 97acc5017..4b2ceaa58 100644 --- a/raster/rt_pg/rtpg_geometry.c +++ b/raster/rt_pg/rtpg_geometry.c @@ -782,7 +782,7 @@ Datum RASTER_asRaster(PG_FUNCTION_ARGS) uint32_t num_bands = 0; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; char *srs = NULL; POSTGIS_RT_DEBUG(3, "RASTER_asRaster: Starting"); diff --git a/raster/rt_pg/rtpg_internal.c b/raster/rt_pg/rtpg_internal.c index 44089536c..8f101531a 100644 --- a/raster/rt_pg/rtpg_internal.c +++ b/raster/rt_pg/rtpg_internal.c @@ -278,8 +278,9 @@ rtpg_strrstr(const char *s1, const char *s2) { return NULL; } -char* -rtpg_getSR(int srid) { +char * +rtpg_getSR(int32_t srid) +{ int i = 0; int len = 0; char *sql = NULL; diff --git a/raster/rt_pg/rtpg_internal.h b/raster/rt_pg/rtpg_internal.h index f738088ae..8a6dc4ec6 100644 --- a/raster/rt_pg/rtpg_internal.h +++ b/raster/rt_pg/rtpg_internal.h @@ -63,7 +63,6 @@ rtpg_trim(const char* input); char * rtpg_strrstr(const char *s1, const char *s2); -char * -rtpg_getSR(int srid); +char *rtpg_getSR(int32_t srid); #endif /* RTPG_INTERNAL_H_INCLUDED */ diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c index 648dba0d2..cf928fa73 100644 --- a/raster/rt_pg/rtpg_mapalgebra.c +++ b/raster/rt_pg/rtpg_mapalgebra.c @@ -3014,7 +3014,7 @@ Datum RASTER_clip(PG_FUNCTION_ARGS) rt_pgraster *pgraster = NULL; LWGEOM *rastgeom = NULL; double gt[6] = {0}; - int srid = SRID_UNKNOWN; + int32_t srid = SRID_UNKNOWN; rt_pgraster *pgrtn = NULL; rt_raster rtn = NULL; diff --git a/raster/rt_pg/rtpg_pixel.c b/raster/rt_pg/rtpg_pixel.c index 749bcbae9..06c952b2e 100644 --- a/raster/rt_pg/rtpg_pixel.c +++ b/raster/rt_pg/rtpg_pixel.c @@ -1188,7 +1188,7 @@ Datum RASTER_setPixelValuesGeomval(PG_FUNCTION_ARGS) int numbands = 0; int width = 0; int height = 0; - int srid = 0; + int32_t srid = 0; double gt[6] = {0}; rt_pixtype pixtype = PT_END; diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c index 13c9c83d3..199e1104e 100644 --- a/topology/postgis_topology.c +++ b/topology/postgis_topology.c @@ -83,7 +83,7 @@ struct LWT_BE_TOPOLOGY_T LWT_BE_DATA* be_data; char *name; int id; - int srid; + int32_t srid; double precision; int hasZ; Oid geometryOID; @@ -124,7 +124,7 @@ _lwtype_upper_name(int type, char *buf, size_t buflen) /* Return an lwalloc'ed geometrical representation of the box */ static LWGEOM * -_box2d_to_lwgeom(const GBOX *bbox, int srid) +_box2d_to_lwgeom(const GBOX *bbox, int32_t srid) { POINTARRAY *pa = ptarray_construct(0, 0, 2); POINT4D p; @@ -142,7 +142,7 @@ _box2d_to_lwgeom(const GBOX *bbox, int srid) /* Return lwalloc'ed hexwkb representation for a GBOX */ static char * -_box2d_to_hexwkb(const GBOX *bbox, int srid) +_box2d_to_hexwkb(const GBOX *bbox, int32_t srid) { char *hex; size_t sz; @@ -647,7 +647,7 @@ addNodeValues(StringInfo str, const LWT_ISO_NODE *node, int fields) /* Add face values for an insert, in text form */ static void -addFaceValues(StringInfo str, LWT_ISO_FACE *face, int srid) +addFaceValues(StringInfo str, LWT_ISO_FACE *face, int32_t srid) { if ( face->face_id != -1 ) appendStringInfo(str, "(%" LWTFMT_ELEMID, face->face_id);