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:
dist: trusty
-cache:
+cache:
ccache: true
directories:
- /home/travis/deb
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;
int ntuples;
int total_tuples = 0;
- rules_columns_t rules_columns = {rule: -1};
+ rules_columns_t rules_columns = {.rule = -1};
char *rule;
static void test_sfcgal_noop(void)
{
- int i;
+ size_t i;
char *ewkt[] =
{
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);
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));
uint8_t lwtype_multitype(uint8_t type)
{
- if (type > 15 || type < 0) return 0;
+ if (type > 15) return 0;
return MULTITYPE[type];
}
//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);
lwerror("%s: unsupported segment type", __func__);
break;
}
+
+ break;
}
case RECT_NODE_SEG_LINEAR:
lwerror("%s: unsupported segment type", __func__);
break;
}
+
+ break;
}
case RECT_NODE_SEG_CIRCULAR:
{
lwerror("%s: unsupported segment type", __func__);
break;
}
+
+ break;
}
default:
return LW_FALSE;
* 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)
{
while (num_nodes > 1)
{
- int i, k = 0;
+ uint32_t i, k = 0;
RECT_NODE *node = NULL;
for (i = 0; i < num_nodes; i++)
{
{
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)
{
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)
{
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)
}
strncpy(name, utf8str, MAXFIELDNAMELEN);
+ name[MAXFIELDNAMELEN-1] = '\0';
free(utf8str);
}
! 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);
return SHPLOADERERR;
}
strncpy(val, utf8str, MAXVALUELEN);
+ val[MAXVALUELEN-1] = '\0';
free(utf8str);
}
{
GSERIALIZED *geom1;
LWGEOM *lwgeom;
- bool result;
+ char result;
GEOSGeom g1;
geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom1;
GSERIALIZED *geom2;
GEOSGeometry *g1, *g2;
- bool result;
+ char result;
GBOX box1, box2;
geom1 = PG_GETARG_GSERIALIZED_P(0);
{
GSERIALIZED * geom1;
GSERIALIZED * geom2;
- bool result;
+ char result;
GBOX box1, box2;
PrepGeomCache * prep_cache;
GSERIALIZED *geom1;
GSERIALIZED *geom2;
GEOSGeometry *g1, *g2;
- bool result;
+ char result;
GBOX box1, box2;
geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom1;
GSERIALIZED *geom2;
GEOSGeometry *g1, *g2;
- bool result;
+ char result;
GBOX box1, box2;
geom1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *geom1;
GSERIALIZED *geom2;
char *patt;
- bool result;
+ char result;
GEOSGeometry *g1, *g2;
size_t i;
GSERIALIZED *geom1;
GSERIALIZED *geom2;
GEOSGeometry *g1, *g2;
- bool result;
+ char result;
GBOX box1, box2;
geom1 = PG_GETARG_GSERIALIZED_P(0);
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 ? */
char *rtn;
char *ptr;
uint32_t offset = 0;
+ size_t len = 0;
if (!input)
return NULL;
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;
}
char *rtn = NULL;
char *ptr = NULL;
uint32_t offset = 0;
+ size_t len = 0;
if (!input)
return NULL;
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;
}
/* 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")) {
}
/* 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 */
}
/* 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) {
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) {
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);
}
}
}
/* 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)]);
*/
case ET_FIRST:
i = 0;
+ /* FALLTHROUGH */
case ET_SECOND:
if (i < 0) {
if (itrcount < 2)
else
i = 1;
}
+ /* FALLTHROUGH */
case ET_LAST:
if (i < 0) i = itrcount - 1;
*rtnraster = rtnrast;
return ES_NONE;
}
+ /* FALLTHROUGH */
/* copy the custom extent raster */
case ET_CUSTOM:
rtnrast = rtalloc(sizeof(struct rt_raster_t));
i = 0;
_offset[0][0] = 0.;
_offset[0][1] = 0.;
+ /* FALLTHROUGH */
case ET_LAST:
case ET_SECOND:
if (i < 0) {
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");
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);
}
}
#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);
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;
/* run prepared plan */
if (plan != NULL) {
Datum values[12];
- bool nulls[12];
+ char nulls[12];
int err = 0;
TupleDesc tupdesc;
/* 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;
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;
/* 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++) {
static char *gdal_datapath = NULL;
extern char *gdal_enabled_drivers;
-extern char enable_outdb_rasters;
+extern bool enable_outdb_rasters;
/* ---------------------------------------------------------------- */
/* Useful variables */
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};
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);
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);
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);