[postgis-tickets] r16581 - Address compiler warnings and add -Wextra to travis

Raul raul at rmr.ninja
Mon May 21 08:22:39 PDT 2018


Author: algunenano
Date: 2018-05-21 08:22:38 -0700 (Mon, 21 May 2018)
New Revision: 16581

Modified:
   trunk/.travis.yml
   trunk/extensions/address_standardizer/std_pg_hash.c
   trunk/liblwgeom/cunit/cu_sfcgal.c
   trunk/liblwgeom/lwchaikins.c
   trunk/liblwgeom/lwgeom.c
   trunk/liblwgeom/lwmval.c
   trunk/liblwgeom/lwtree.c
   trunk/loader/shp2pgsql-core.c
   trunk/postgis/lwgeom_geos.c
   trunk/postgis/lwgeom_window.c
   trunk/raster/loader/raster2pgsql.c
   trunk/raster/rt_core/rt_mapalgebra.c
   trunk/raster/rt_core/rt_raster.c
   trunk/raster/rt_core/rt_util.c
   trunk/raster/rt_pg/rtpg_band_properties.c
   trunk/raster/rt_pg/rtpg_geometry.c
   trunk/raster/rt_pg/rtpg_mapalgebra.c
   trunk/raster/rt_pg/rtpostgis.c
   trunk/raster/test/cunit/cu_band_misc.c
   trunk/raster/test/cunit/cu_gdal.c
   trunk/raster/test/cunit/cu_raster_geometry.c
Log:
Address compiler warnings and add -Wextra to travis

Closes #4091
Closes https://github.com/postgis/postgis/pull/246


Modified: trunk/.travis.yml
===================================================================
--- trunk/.travis.yml	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/.travis.yml	2018-05-21 15:22:38 UTC (rev 16581)
@@ -2,7 +2,7 @@
   matrix:
     - CFLAGS="-g -Og" MATRIX_EVAL="touch check-no-trailing-blanks"
     - CFLAGS="-g -O2 -fstack-protector -Wformat -Werror=format-security" LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro"
-    - CFLAGS="-g -O3 -mtune=generic -fno-omit-frame-pointer -Werror -Wall"
+    - CFLAGS="-g -O3 -mtune=generic -fno-omit-frame-pointer -Werror -Wall -Wextra -Wno-unused-parameter"
     - CFLAGS="-g -O0 --coverage -fprofile-arcs -ftest-coverage" LDFLAGS="--coverage -fprofile-arcs -ftest-coverage" CONFIGURE_FLAGS="--enable-debug"
 
 addons:
@@ -47,7 +47,7 @@
 
 dist: trusty
 
-cache: 
+cache:
   ccache: true
   directories:
     - /home/travis/deb

Modified: trunk/extensions/address_standardizer/std_pg_hash.c
===================================================================
--- trunk/extensions/address_standardizer/std_pg_hash.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/extensions/address_standardizer/std_pg_hash.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -690,7 +690,7 @@
     int ntuples;
     int total_tuples = 0;
 
-    lex_columns_t lex_columns = {seq: -1, word: -1, stdword: -1, token: -1};
+    lex_columns_t lex_columns = {.seq = -1, .word = -1, .stdword = -1, .token = -1};
 
     int seq;
     char *word;
@@ -816,7 +816,7 @@
     int ntuples;
     int total_tuples = 0;
 
-    rules_columns_t rules_columns = {rule: -1};
+    rules_columns_t rules_columns = {.rule = -1};
 
     char *rule;
 

Modified: trunk/liblwgeom/cunit/cu_sfcgal.c
===================================================================
--- trunk/liblwgeom/cunit/cu_sfcgal.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/liblwgeom/cunit/cu_sfcgal.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -21,7 +21,7 @@
 
 static void test_sfcgal_noop(void)
 {
-	int i;
+	size_t i;
 
 	char *ewkt[] =
 	{

Modified: trunk/liblwgeom/lwchaikins.c
===================================================================
--- trunk/liblwgeom/lwchaikins.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/liblwgeom/lwchaikins.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -35,7 +35,7 @@
 	POINTARRAY *opts;
 	double *dlist;
 	double deltaval, quarter_delta, val1, val2;
-	int ndims = 2 + ptarray_has_z(inpts) + ptarray_has_m(inpts);
+	uint32_t ndims = 2 + ptarray_has_z(inpts) + ptarray_has_m(inpts);
 	int new_npoints = inpts->npoints * 2;
 	opts = ptarray_construct_empty(FLAGS_GET_Z(inpts->flags), FLAGS_GET_M(inpts->flags), new_npoints);
 
@@ -125,7 +125,8 @@
 
 static LWPOLY* lwpoly_chaikin(const LWPOLY *ipoly, int n_iterations, int preserve_endpoint)
 {
-	uint32_t i, j;
+	uint32_t i;
+	int j;
 	POINTARRAY *pa, *pa_new;
 	LWPOLY *opoly = lwpoly_construct_empty(ipoly->srid, FLAGS_GET_Z(ipoly->flags), FLAGS_GET_M(ipoly->flags));
 

Modified: trunk/liblwgeom/lwgeom.c
===================================================================
--- trunk/liblwgeom/lwgeom.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/liblwgeom/lwgeom.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -360,7 +360,7 @@
 
 uint8_t lwtype_multitype(uint8_t type)
 {
-	if (type > 15 || type < 0) return 0;
+	if (type > 15) return 0;
 	return MULTITYPE[type];
 }
 

Modified: trunk/liblwgeom/lwmval.c
===================================================================
--- trunk/liblwgeom/lwmval.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/liblwgeom/lwmval.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -56,7 +56,7 @@
 	//M-value will always be the last dimension
 	int m_pos = ndims-1;
 
-	int i, counter=0;
+	uint32_t i, counter=0;
 	for(i=0;i<pa->npoints;i++)
 	{
 		m_val = *((double*)pa->serialized_pointlist + i*ndims + m_pos);

Modified: trunk/liblwgeom/lwtree.c
===================================================================
--- trunk/liblwgeom/lwtree.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/liblwgeom/lwtree.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -117,6 +117,8 @@
 					lwerror("%s: unsupported segment type", __func__);
 					break;
 			}
+
+			break;
 		}
 
 		case RECT_NODE_SEG_LINEAR:
@@ -147,6 +149,8 @@
 					lwerror("%s: unsupported segment type", __func__);
 					break;
 			}
+
+			break;
 		}
 		case RECT_NODE_SEG_CIRCULAR:
 		{
@@ -178,6 +182,8 @@
 					lwerror("%s: unsupported segment type", __func__);
 					break;
 			}
+
+			break;
 		}
 		default:
 			return LW_FALSE;
@@ -587,7 +593,7 @@
 * spatially coherent structure.
 */
 static RECT_NODE *
-rect_nodes_merge(RECT_NODE ** nodes, int num_nodes)
+rect_nodes_merge(RECT_NODE ** nodes, uint32_t num_nodes)
 {
 	if (num_nodes < 1)
 	{
@@ -596,7 +602,7 @@
 
 	while (num_nodes > 1)
 	{
-		int i, k = 0;
+		uint32_t i, k = 0;
 		RECT_NODE *node = NULL;
 		for (i = 0; i < num_nodes; i++)
 		{
@@ -740,7 +746,7 @@
 {
 	RECT_NODE **nodes;
 	RECT_NODE *tree;
-	int i, j = 0;
+	uint32_t i, j = 0;
 	const LWPOLY *lwpoly = (const LWPOLY*)lwgeom;
 
 	if (lwpoly->nrings < 1)
@@ -767,7 +773,7 @@
 {
 	RECT_NODE **nodes;
 	RECT_NODE *tree;
-	int i, j = 0;
+	uint32_t i, j = 0;
 	const LWCURVEPOLY *lwcol = (const LWCURVEPOLY*)lwgeom;
 
 	if (lwcol->nrings < 1)
@@ -813,7 +819,7 @@
 {
 	RECT_NODE **nodes;
 	RECT_NODE *tree;
-	int i, j = 0;
+	uint32_t i, j = 0;
 	const LWCOLLECTION *lwcol = (const LWCOLLECTION*)lwgeom;
 
 	if (lwcol->ngeoms < 1)

Modified: trunk/loader/shp2pgsql-core.c
===================================================================
--- trunk/loader/shp2pgsql-core.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/loader/shp2pgsql-core.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -1126,6 +1126,7 @@
 			}
 
 			strncpy(name, utf8str, MAXFIELDNAMELEN);
+			name[MAXFIELDNAMELEN-1] = '\0';
 			free(utf8str);
 		}
 
@@ -1161,7 +1162,12 @@
 		        ! strcmp(name, "primary") ||
 		        ! strcmp(name, "oid") || ! strcmp(name, "ctid"))
 		{
-			strncpy(name2 + 2, name, MAXFIELDNAMELEN - 2);
+			size_t len = strlen(name);
+			if (len > (MAXFIELDNAMELEN - 2))
+				len = MAXFIELDNAMELEN - 2;
+			strncpy(name2 + 2, name, len);
+			name2[MAXFIELDNAMELEN-1] = '\0';
+			name2[len + 2] = '\0';
 			name2[0] = '_';
 			name2[1] = '_';
 			strcpy(name, name2);
@@ -1651,6 +1657,7 @@
 					return SHPLOADERERR;
 				}
 				strncpy(val, utf8str, MAXVALUELEN);
+				val[MAXVALUELEN-1] = '\0';
 				free(utf8str);
 
 			}

Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/postgis/lwgeom_geos.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -1532,7 +1532,7 @@
 {
 	GSERIALIZED *geom1;
 	LWGEOM *lwgeom;
-	bool result;
+	char result;
 	GEOSGeom g1;
 
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -1715,7 +1715,7 @@
 	GSERIALIZED *geom1;
 	GSERIALIZED *geom2;
 	GEOSGeometry *g1, *g2;
-	bool result;
+	char result;
 	GBOX box1, box2;
 
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -1916,7 +1916,7 @@
 {
 	GSERIALIZED *				geom1;
 	GSERIALIZED *				geom2;
-	bool 					result;
+	char 					result;
 	GBOX 			box1, box2;
 	PrepGeomCache *	prep_cache;
 
@@ -2450,7 +2450,7 @@
 	GSERIALIZED *geom1;
 	GSERIALIZED *geom2;
 	GEOSGeometry *g1, *g2;
-	bool result;
+	char result;
 	GBOX box1, box2;
 
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -2510,7 +2510,7 @@
 	GSERIALIZED *geom1;
 	GSERIALIZED *geom2;
 	GEOSGeometry *g1, *g2;
-	bool result;
+	char result;
 	GBOX box1, box2;
 
 	geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -2570,7 +2570,7 @@
 	GSERIALIZED *geom1;
 	GSERIALIZED *geom2;
 	char *patt;
-	bool result;
+	char result;
 	GEOSGeometry *g1, *g2;
 	size_t i;
 
@@ -2688,7 +2688,7 @@
 	GSERIALIZED *geom1;
 	GSERIALIZED *geom2;
 	GEOSGeometry *g1, *g2;
-	bool result;
+	char result;
 	GBOX box1, box2;
 
 	geom1 = PG_GETARG_GSERIALIZED_P(0);

Modified: trunk/postgis/lwgeom_window.c
===================================================================
--- trunk/postgis/lwgeom_window.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/postgis/lwgeom_window.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -119,7 +119,7 @@
 		uf = UF_create(ngeoms);
 		for (i = 0; i < ngeoms; i++)
 		{
-			geoms[i] = read_lwgeom_from_partition(win_obj, i, &(context->cluster_assignments[i].is_null));
+			geoms[i] = read_lwgeom_from_partition(win_obj, i, (bool*)&(context->cluster_assignments[i].is_null));
 
 			if (!geoms[i]) {
 				/* TODO release memory ? */

Modified: trunk/raster/loader/raster2pgsql.c
===================================================================
--- trunk/raster/loader/raster2pgsql.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/loader/raster2pgsql.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -263,6 +263,7 @@
 	char *rtn;
 	char *ptr;
 	uint32_t offset = 0;
+	size_t len = 0;
 
 	if (!input)
 		return NULL;
@@ -278,13 +279,13 @@
 	while (isspace(*--ptr))
 		offset++;
 
-	rtn = rtalloc(sizeof(char) * (strlen(input) - offset + 1));
+	len = strlen(input) - offset + 1;
+	rtn = rtalloc(sizeof(char) * len);
 	if (NULL == rtn) {
 		rterror(_("trim: Not enough memory"));
 		return NULL;
 	}
-	strncpy(rtn, input, strlen(input) - offset);
-	rtn[strlen(input) - offset] = '\0';
+	strncpy(rtn, input, len);
 
 	return rtn;
 }
@@ -294,6 +295,7 @@
 	char *rtn = NULL;
 	char *ptr = NULL;
 	uint32_t offset = 0;
+	size_t len = 0;
 
 	if (!input)
 		return NULL;
@@ -309,12 +311,13 @@
 	while (strchr(remove, *--ptr) != NULL)
 		offset++;
 
-	rtn = rtalloc(sizeof(char) * (strlen(input) - offset + 1));
+	len = strlen(input) - offset + 1;
+	rtn = rtalloc(sizeof(char) * len);
 	if (NULL == rtn) {
 		rterror(_("chartrim: Not enough memory"));
 		return NULL;
 	}
-	strncpy(rtn, input, strlen(input) - offset);
+	strncpy(rtn, input, len);
 	rtn[strlen(input) - offset] = '\0';
 
 	return rtn;
@@ -2475,13 +2478,14 @@
 		}
 		/* raster column name */
 		else if (CSEQUAL(argv[argit], "-f") && argit < argc - 1) {
-			config->raster_column = rtalloc(sizeof(char) * (strlen(argv[++argit]) + 1));
+			const size_t len = (strlen(argv[++argit]) + 1);
+			config->raster_column = rtalloc(sizeof(char) * len);
 			if (config->raster_column == NULL) {
 				rterror(_("Could not allocate memory for storing raster column name"));
 				rtdealloc_config(config);
 				exit(1);
 			}
-			strncpy(config->raster_column, argv[argit], strlen(argv[argit]) + 1);
+			strncpy(config->raster_column, argv[argit], len);
 		}
 		/* filename column */
 		else if (CSEQUAL(argv[argit], "-F")) {
@@ -2489,13 +2493,14 @@
 		}
 		/* filename column name */
 		else if (CSEQUAL(argv[argit], "-n") && argit < argc - 1) {
-			config->file_column_name = rtalloc(sizeof(char) * (strlen(argv[++argit]) + 1));
+			const size_t len = (strlen(argv[++argit]) + 1);
+			config->file_column_name = rtalloc(sizeof(char) * len);
 			if (config->file_column_name == NULL) {
 				rterror(_("Could not allocate memory for storing filename column name"));
 				rtdealloc_config(config);
 				exit(1);
 			}
-			strncpy(config->file_column_name, argv[argit], strlen(argv[argit]) + 1);
+			strncpy(config->file_column_name, argv[argit], len);
 			config->file_column = 1;
 		}
 		/* overview factors */
@@ -2558,23 +2563,25 @@
 		}
 		/* tablespace of new table */
 		else if (CSEQUAL(argv[argit], "-T") && argit < argc - 1) {
-			config->tablespace = rtalloc(sizeof(char) * (strlen(argv[++argit]) + 1));
+			const size_t len = (strlen(argv[++argit]) + 1);
+			config->tablespace = rtalloc(len);
 			if (config->tablespace == NULL) {
 				rterror(_("Could not allocate memory for storing tablespace of new table"));
 				rtdealloc_config(config);
 				exit(1);
 			}
-			strncpy(config->tablespace, argv[argit], strlen(argv[argit]) + 1);
+			strncpy(config->tablespace, argv[argit], len);
 		}
 		/* tablespace of new index */
 		else if (CSEQUAL(argv[argit], "-X") && argit < argc - 1) {
-			config->idx_tablespace = rtalloc(sizeof(char) * (strlen(argv[++argit]) + 1));
+			const size_t len = (strlen(argv[++argit]) + 1);
+			config->idx_tablespace = rtalloc(len);
 			if (config->idx_tablespace == NULL) {
 				rterror(_("Could not allocate memory for storing tablespace of new indices"));
 				rtdealloc_config(config);
 				exit(1);
 			}
-			strncpy(config->idx_tablespace, argv[argit], strlen(argv[argit]) + 1);
+			strncpy(config->idx_tablespace, argv[argit], len);
 		}
 		/* nodata value */
 		else if (CSEQUAL(argv[argit], "-N") && argit < argc - 1) {
@@ -2632,6 +2639,7 @@
 			exit(0);
 		}
 		else {
+			size_t len;
 			config->rt_file_count++;
 			config->rt_file = (char **) rtrealloc(config->rt_file, sizeof(char *) * config->rt_file_count);
 			if (config->rt_file == NULL) {
@@ -2640,13 +2648,14 @@
 				exit(1);
 			}
 
-			config->rt_file[config->rt_file_count - 1] = rtalloc(sizeof(char) * (strlen(argv[argit]) + 1));
+			len = strlen(argv[argit]) + 1;
+			config->rt_file[config->rt_file_count - 1] = rtalloc(sizeof(char) * len);
 			if (config->rt_file[config->rt_file_count - 1] == NULL) {
 				rterror(_("Could not allocate memory for storing raster filename"));
 				rtdealloc_config(config);
 				exit(1);
 			}
-			strncpy(config->rt_file[config->rt_file_count - 1], argv[argit], strlen(argv[argit]) + 1);
+			strncpy(config->rt_file[config->rt_file_count - 1], argv[argit], len);
 		}
 	}
 
@@ -2699,13 +2708,14 @@
 			}
 			/* table */
 			else {
-				config->table = rtalloc(sizeof(char) * strlen(config->rt_file[config->rt_file_count - 1]) + 1);
+				const size_t len = strlen(config->rt_file[config->rt_file_count - 1]) + 1;
+				config->table = rtalloc(sizeof(char) * len);
 				if (config->table == NULL) {
 					rterror(_("Could not allocate memory for storing table name"));
 					rtdealloc_config(config);
 					exit(1);
 				}
-				strncpy(config->table, config->rt_file[config->rt_file_count - 1], strlen(config->rt_file[config->rt_file_count - 1]) + 1);
+				strncpy(config->table, config->rt_file[config->rt_file_count - 1], len);
 			}
 
 			rtdealloc(config->rt_file[--(config->rt_file_count)]);

Modified: trunk/raster/rt_core/rt_mapalgebra.c
===================================================================
--- trunk/raster/rt_core/rt_mapalgebra.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_core/rt_mapalgebra.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -1062,6 +1062,7 @@
 		*/
 		case ET_FIRST:
 			i = 0;
+			/* FALLTHROUGH */
 		case ET_SECOND:
 			if (i < 0) {
 				if (itrcount < 2)
@@ -1069,6 +1070,7 @@
 				else
 					i = 1;
 			}
+			/* FALLTHROUGH */
 		case ET_LAST:
 			if (i < 0) i = itrcount - 1;
 
@@ -1102,6 +1104,7 @@
 				*rtnraster = rtnrast;
 				return ES_NONE;
 			}
+			/* FALLTHROUGH */
 		/* copy the custom extent raster */
 		case ET_CUSTOM:
 			rtnrast = rtalloc(sizeof(struct rt_raster_t));

Modified: trunk/raster/rt_core/rt_raster.c
===================================================================
--- trunk/raster/rt_core/rt_raster.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_core/rt_raster.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -3522,6 +3522,7 @@
 			i = 0;
 			_offset[0][0] = 0.;
 			_offset[0][1] = 0.;
+			/* FALLTHROUGH */
 		case ET_LAST:
 		case ET_SECOND:
 			if (i < 0) {

Modified: trunk/raster/rt_core/rt_util.c
===================================================================
--- trunk/raster/rt_core/rt_util.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_core/rt_util.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -285,8 +285,10 @@
 			const char* pszAuthorityCode = OSRGetAuthorityCode(hSRS, NULL);
 
 			if (pszAuthorityName != NULL && pszAuthorityCode != NULL) {
-				*authname = rtalloc(sizeof(char) * (strlen(pszAuthorityName) + 1));
-				*authcode = rtalloc(sizeof(char) * (strlen(pszAuthorityCode) + 1));
+				size_t authorityName_len = strlen(pszAuthorityName) +1;
+				size_t authorityCode_len = strlen(pszAuthorityCode) + 1;
+				*authname = rtalloc(sizeof(char) * authorityName_len);
+				*authcode = rtalloc(sizeof(char) * authorityCode_len);
 
 				if (*authname == NULL || *authcode == NULL) {
 					rterror("rt_util_gdal_sr_auth_info: Could not allocate memory for auth name and code");
@@ -296,8 +298,8 @@
 					return ES_ERROR;
 				}
 
-				strncpy(*authname, pszAuthorityName, strlen(pszAuthorityName) + 1);
-				strncpy(*authcode, pszAuthorityCode, strlen(pszAuthorityCode) + 1);
+				strncpy(*authname, pszAuthorityName, authorityName_len);
+				strncpy(*authcode, pszAuthorityCode, authorityCode_len);
 			}
 		}
 

Modified: trunk/raster/rt_pg/rtpg_band_properties.c
===================================================================
--- trunk/raster/rt_pg/rtpg_band_properties.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_pg/rtpg_band_properties.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -46,7 +46,7 @@
 
 #include "rtpostgis.h"
 
-extern char enable_outdb_rasters;
+extern bool enable_outdb_rasters;
 
 /* Get all the properties of a raster band */
 Datum RASTER_getBandPixelType(PG_FUNCTION_ARGS);

Modified: trunk/raster/rt_pg/rtpg_geometry.c
===================================================================
--- trunk/raster/rt_pg/rtpg_geometry.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_pg/rtpg_geometry.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -756,14 +756,14 @@
 	char *pixeltype = NULL;
 	rt_pixtype pixtype = PT_END;
 	rt_pixtype *pixtypes = NULL;
-	int pixtypes_len = 0;
+	uint32_t pixtypes_len = 0;
 
 	double *values = NULL;
-	int values_len = 0;
+	uint32_t values_len = 0;
 
 	uint8_t *hasnodatas = NULL;
 	double *nodatavals = NULL;
-	int nodatavals_len = 0;
+	uint32_t nodatavals_len = 0;
 
 	double ulw[2] = {0};
 	double *ul_xw = NULL;

Modified: trunk/raster/rt_pg/rtpg_mapalgebra.c
===================================================================
--- trunk/raster/rt_pg/rtpg_mapalgebra.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_pg/rtpg_mapalgebra.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -1137,7 +1137,7 @@
 	/* run prepared plan */
 	if (plan != NULL) {
 		Datum values[12];
-		bool nulls[12];
+		char nulls[12];
 		int err = 0;
 
 		TupleDesc tupdesc;
@@ -1150,7 +1150,7 @@
 
 		/* init values and nulls */
 		memset(values, (Datum) NULL, sizeof(Datum) * callback->kw.count);
-		memset(nulls, FALSE, sizeof(bool) * callback->kw.count);
+		memset(nulls, FALSE, sizeof(char) * callback->kw.count);
 
 		if (callback->expr[id].spi_argcount) {
 			int idx = 0;
@@ -6122,7 +6122,7 @@
 	uint8_t argpos[3][8] = {{0}};
 	char *argkw[] = {"[rast1.x]", "[rast1.y]", "[rast1.val]", "[rast1]", "[rast2.x]", "[rast2.y]", "[rast2.val]", "[rast2]"};
 	Datum values[argkwcount];
-	bool nulls[argkwcount];
+	char nulls[argkwcount];
 	TupleDesc tupdesc;
 	SPITupleTable *tuptable = NULL;
 	HeapTuple tuple;
@@ -7009,7 +7009,7 @@
 								/* reset values to (Datum) NULL */
 								memset(values, (Datum) NULL, sizeof(Datum) * argkwcount);
 								/* reset nulls to FALSE */
-								memset(nulls, FALSE, sizeof(bool) * argkwcount);
+								memset(nulls, FALSE, sizeof(char) * argkwcount);
 
 								/* set values and nulls */
 								for (j = 0; j < argkwcount; j++) {

Modified: trunk/raster/rt_pg/rtpostgis.c
===================================================================
--- trunk/raster/rt_pg/rtpostgis.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/rt_pg/rtpostgis.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -246,7 +246,7 @@
 
 static char *gdal_datapath = NULL;
 extern char *gdal_enabled_drivers;
-extern char enable_outdb_rasters;
+extern bool enable_outdb_rasters;
 
 /* ---------------------------------------------------------------- */
 /*  Useful variables                                                */

Modified: trunk/raster/test/cunit/cu_band_misc.c
===================================================================
--- trunk/raster/test/cunit/cu_band_misc.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/test/cunit/cu_band_misc.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -292,8 +292,8 @@
 	rt_band band;
 	uint32_t x, y;
 	int rtn;
-	const int maxX = 10;
-	const int maxY = 10;
+	uint32_t maxX = 10;
+	uint32_t maxY = 10;
 	rt_pixel pixels = NULL;
 
 	double search0[1] = {0};

Modified: trunk/raster/test/cunit/cu_gdal.c
===================================================================
--- trunk/raster/test/cunit/cu_gdal.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/test/cunit/cu_gdal.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -513,8 +513,8 @@
 	CU_ASSERT(gddrv != NULL);
 	CU_ASSERT_EQUAL(destroy, 0);
 	CU_ASSERT(gdds != NULL);
-	CU_ASSERT_EQUAL(GDALGetRasterXSize(gdds), width);
-	CU_ASSERT_EQUAL(GDALGetRasterYSize(gdds), height);
+	CU_ASSERT_EQUAL((uint32_t)GDALGetRasterXSize(gdds), width);
+	CU_ASSERT_EQUAL((uint32_t)GDALGetRasterYSize(gdds), height);
 
 	rast = rt_raster_from_gdal_dataset(gdds);
 	CU_ASSERT(rast != NULL);
@@ -559,8 +559,8 @@
 	CU_ASSERT(gddrv != NULL);
 	CU_ASSERT_EQUAL(destroy, 0);
 	CU_ASSERT(gdds != NULL);
-	CU_ASSERT_EQUAL(GDALGetRasterXSize(gdds), width);
-	CU_ASSERT_EQUAL(GDALGetRasterYSize(gdds), height);
+	CU_ASSERT_EQUAL((uint32_t)GDALGetRasterXSize(gdds), width);
+	CU_ASSERT_EQUAL((uint32_t)GDALGetRasterYSize(gdds), height);
 
 	rast = rt_raster_from_gdal_dataset(gdds);
 	CU_ASSERT(rast != NULL);

Modified: trunk/raster/test/cunit/cu_raster_geometry.c
===================================================================
--- trunk/raster/test/cunit/cu_raster_geometry.c	2018-05-21 11:03:01 UTC (rev 16580)
+++ trunk/raster/test/cunit/cu_raster_geometry.c	2018-05-21 15:22:38 UTC (rev 16581)
@@ -526,8 +526,8 @@
 	rt_raster rast;
 	rt_band band;
 	uint32_t x, y;
-	const int maxX = 10;
-	const int maxY = 10;
+	const uint32_t maxX = 10;
+	const uint32_t maxY = 10;
 	LWPOLY *poly = NULL;
 
 	rast = rt_raster_new(maxX, maxY);



More information about the postgis-tickets mailing list