]> granicus.if.org Git - postgis/commitdiff
Address compiler warnings and add -Wextra to travis
authorRaúl Marín Rodríguez <rmrodriguez@carto.com>
Mon, 21 May 2018 15:22:38 +0000 (15:22 +0000)
committerRaúl Marín Rodríguez <rmrodriguez@carto.com>
Mon, 21 May 2018 15:22:38 +0000 (15:22 +0000)
Closes #4091
Closes https://github.com/postgis/postgis/pull/246

git-svn-id: http://svn.osgeo.org/postgis/trunk@16581 b70326c6-7e19-0410-871a-916f4a2858ee

21 files changed:
.travis.yml
extensions/address_standardizer/std_pg_hash.c
liblwgeom/cunit/cu_sfcgal.c
liblwgeom/lwchaikins.c
liblwgeom/lwgeom.c
liblwgeom/lwmval.c
liblwgeom/lwtree.c
loader/shp2pgsql-core.c
postgis/lwgeom_geos.c
postgis/lwgeom_window.c
raster/loader/raster2pgsql.c
raster/rt_core/rt_mapalgebra.c
raster/rt_core/rt_raster.c
raster/rt_core/rt_util.c
raster/rt_pg/rtpg_band_properties.c
raster/rt_pg/rtpg_geometry.c
raster/rt_pg/rtpg_mapalgebra.c
raster/rt_pg/rtpostgis.c
raster/test/cunit/cu_band_misc.c
raster/test/cunit/cu_gdal.c
raster/test/cunit/cu_raster_geometry.c

index 9c85a3010b89153b0d4b8327489bde637cc26aba..834627d2cf160a6f2cef9e76dd64b9d1eb43b136 100644 (file)
@@ -2,7 +2,7 @@ env:
   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 @@ compiler: gcc
 
 dist: trusty
 
-cache: 
+cache:
   ccache: true
   directories:
     - /home/travis/deb
index 2bf2bfd39f4bbf93b59dc173b441f5b3f919e79a..f1278605128c485aa12efc6491dd6991bc70ab7a 100644 (file)
@@ -690,7 +690,7 @@ static int load_lex(LEXICON *lex, char *tab)
     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 @@ static int load_rules(RULES *rules, char *tab)
     int ntuples;
     int total_tuples = 0;
 
-    rules_columns_t rules_columns = {rule: -1};
+    rules_columns_t rules_columns = {.rule = -1};
 
     char *rule;
 
index 220021a324f15e11d36e29f945219a5d5c288aa9..523562f0e78844d2b1a2a245cdb130602e5c9a0f 100644 (file)
@@ -21,7 +21,7 @@ extern LWGEOM* lwgeom_sfcgal_noop( const LWGEOM* geom_in );
 
 static void test_sfcgal_noop(void)
 {
-       int i;
+       size_t i;
 
        char *ewkt[] =
        {
index 91d6fb0625a0d731f5cd9f310cfa71d6db0c0f48..4312a8631730b4a7f74e8896f7e6e16cff8e4d50 100644 (file)
@@ -35,7 +35,7 @@ static POINTARRAY * ptarray_chaikin(POINTARRAY *inpts, int preserve_endpoint, in
        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 LWLINE* lwline_chaikin(const LWLINE *iline, int n_iterations)
 
 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));
 
index 480d508b78646c7cffe0023658706bb2e924bb44..6038230ae079ebbfb29bf98b34cb6541b5823b3a 100644 (file)
@@ -360,7 +360,7 @@ uint8_t MULTITYPE[NUMTYPES] =
 
 uint8_t lwtype_multitype(uint8_t type)
 {
-       if (type > 15 || type < 0) return 0;
+       if (type > 15) return 0;
        return MULTITYPE[type];
 }
 
index e3c1c986f4bd48817a28124243bc93e8eb2af9aa..078080195cfce919cd8b3aec80ab1c5d91b4d051 100644 (file)
@@ -56,7 +56,7 @@ static POINTARRAY* ptarray_filterm(POINTARRAY *pa,double min, double max, int re
        //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);
index 72fbf9d9c4921b2a4bc21ac3b56b9234bc2fca1c..c3b3f121506e9aa4e22cba4624a7768d19a47f05 100644 (file)
@@ -117,6 +117,8 @@ rect_leaf_node_intersects(RECT_NODE_LEAF *n1, RECT_NODE_LEAF *n2)
                                        lwerror("%s: unsupported segment type", __func__);
                                        break;
                        }
+
+                       break;
                }
 
                case RECT_NODE_SEG_LINEAR:
@@ -147,6 +149,8 @@ rect_leaf_node_intersects(RECT_NODE_LEAF *n1, RECT_NODE_LEAF *n2)
                                        lwerror("%s: unsupported segment type", __func__);
                                        break;
                        }
+
+                       break;
                }
                case RECT_NODE_SEG_CIRCULAR:
                {
@@ -178,6 +182,8 @@ rect_leaf_node_intersects(RECT_NODE_LEAF *n1, RECT_NODE_LEAF *n2)
                                        lwerror("%s: unsupported segment type", __func__);
                                        break;
                        }
+
+                       break;
                }
                default:
                        return LW_FALSE;
@@ -587,7 +593,7 @@ rect_node_internal_new(const RECT_NODE *seed)
 * 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 @@ rect_nodes_merge(RECT_NODE ** nodes, int num_nodes)
 
        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_tree_from_lwpoly(const LWGEOM *lwgeom)
 {
        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_tree_from_lwcurvepoly(const LWGEOM *lwgeom)
 {
        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_tree_from_lwcollection(const LWGEOM *lwgeom)
 {
        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)
index 3498d3ab30cfa5fb508e49da1d80c2e4f805c4ed..5db863b9814015cc50c1891c2c121c6c8fb0aa4a 100644 (file)
@@ -1126,6 +1126,7 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
                        }
 
                        strncpy(name, utf8str, MAXFIELDNAMELEN);
+                       name[MAXFIELDNAMELEN-1] = '\0';
                        free(utf8str);
                }
 
@@ -1161,7 +1162,12 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
                        ! 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 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
                                        return SHPLOADERERR;
                                }
                                strncpy(val, utf8str, MAXVALUELEN);
+                               val[MAXVALUELEN-1] = '\0';
                                free(utf8str);
 
                        }
index 13c3cd51f36c8e467866590a382b110f055700de..d053225589135fd48f16336af0c88319e0075f38 100644 (file)
@@ -1532,7 +1532,7 @@ Datum isvalid(PG_FUNCTION_ARGS)
 {
        GSERIALIZED *geom1;
        LWGEOM *lwgeom;
-       bool result;
+       char result;
        GEOSGeom g1;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -1715,7 +1715,7 @@ Datum overlaps(PG_FUNCTION_ARGS)
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GEOSGeometry *g1, *g2;
-       bool result;
+       char result;
        GBOX box1, box2;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -1916,7 +1916,7 @@ Datum containsproperly(PG_FUNCTION_ARGS)
 {
        GSERIALIZED *                           geom1;
        GSERIALIZED *                           geom2;
-       bool                                    result;
+       char                                    result;
        GBOX                    box1, box2;
        PrepGeomCache * prep_cache;
 
@@ -2450,7 +2450,7 @@ Datum touches(PG_FUNCTION_ARGS)
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GEOSGeometry *g1, *g2;
-       bool result;
+       char result;
        GBOX box1, box2;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -2510,7 +2510,7 @@ Datum disjoint(PG_FUNCTION_ARGS)
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GEOSGeometry *g1, *g2;
-       bool result;
+       char result;
        GBOX box1, box2;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
@@ -2570,7 +2570,7 @@ Datum relate_pattern(PG_FUNCTION_ARGS)
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        char *patt;
-       bool result;
+       char result;
        GEOSGeometry *g1, *g2;
        size_t i;
 
@@ -2688,7 +2688,7 @@ Datum ST_Equals(PG_FUNCTION_ARGS)
        GSERIALIZED *geom1;
        GSERIALIZED *geom2;
        GEOSGeometry *g1, *g2;
-       bool result;
+       char result;
        GBOX box1, box2;
 
        geom1 = PG_GETARG_GSERIALIZED_P(0);
index 508c47c908e345aa302e29aabcd1526dd37140c1..d44b53839fb433229f3e20aa12be6aaaccd36e7a 100644 (file)
@@ -119,7 +119,7 @@ Datum ST_ClusterDBSCAN(PG_FUNCTION_ARGS)
                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 ? */
index 49d3937e120236dac995c94a2036c7eb5663269b..02e11758d5f8dcabb1326f270c04e5d869910efb 100644 (file)
@@ -263,6 +263,7 @@ trim(const char *input) {
        char *rtn;
        char *ptr;
        uint32_t offset = 0;
+       size_t len = 0;
 
        if (!input)
                return NULL;
@@ -278,13 +279,13 @@ trim(const char *input) {
        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 @@ chartrim(const char *input, char *remove) {
        char *rtn = NULL;
        char *ptr = NULL;
        uint32_t offset = 0;
+       size_t len = 0;
 
        if (!input)
                return NULL;
@@ -309,12 +311,13 @@ chartrim(const char *input, char *remove) {
        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 @@ main(int argc, char **argv) {
                }
                /* 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 @@ main(int argc, char **argv) {
                }
                /* 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 @@ main(int argc, char **argv) {
                }
                /* 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 @@ main(int argc, char **argv) {
                        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 @@ main(int argc, char **argv) {
                                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 @@ main(int argc, char **argv) {
                        }
                        /* 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)]);
index a893306bc43f0a2fd34ffd29a3dcd96cdb992b7a..7cb7862dd914ed5d4e7d5cdea504bf770871dc0c 100644 (file)
@@ -1062,6 +1062,7 @@ rt_raster_iterator(
                */
                case ET_FIRST:
                        i = 0;
+                       /* FALLTHROUGH */
                case ET_SECOND:
                        if (i < 0) {
                                if (itrcount < 2)
@@ -1069,6 +1070,7 @@ rt_raster_iterator(
                                else
                                        i = 1;
                        }
+                       /* FALLTHROUGH */
                case ET_LAST:
                        if (i < 0) i = itrcount - 1;
 
@@ -1102,6 +1104,7 @@ rt_raster_iterator(
                                *rtnraster = rtnrast;
                                return ES_NONE;
                        }
+                       /* FALLTHROUGH */
                /* copy the custom extent raster */
                case ET_CUSTOM:
                        rtnrast = rtalloc(sizeof(struct rt_raster_t));
index 3cec50ed187112b5e78d7bf4952c87a84423f951..5c42d8125988508ddc741a73e6a08565bea354f5 100644 (file)
@@ -3522,6 +3522,7 @@ rt_raster_from_two_rasters(
                        i = 0;
                        _offset[0][0] = 0.;
                        _offset[0][1] = 0.;
+                       /* FALLTHROUGH */
                case ET_LAST:
                case ET_SECOND:
                        if (i < 0) {
index df10bab527a95d596ea82b5a49b53f8a10e900a9..f0f7d32800abd406df7f66456f69dbf77a3b987a 100644 (file)
@@ -285,8 +285,10 @@ rt_util_gdal_sr_auth_info(GDALDatasetH hds, char **authname, char **authcode) {
                        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 @@ rt_util_gdal_sr_auth_info(GDALDatasetH hds, char **authname, char **authcode) {
                                        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);
                        }
                }
 
index cf5aef82f4524f8609e425ef044146890cbff115..70b652fa3c0277eda0324082442322315683e615 100644 (file)
@@ -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);
index a35165539ee93b29ce691b622e9e6376c02ff294..df2b7691eb84ac93a798e3d24d8fae3df54371f5 100644 (file)
@@ -756,14 +756,14 @@ Datum RASTER_asRaster(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;
index bba510567a56272949c8c9ee659a61fa56fb8f0d..4984f3eb1c37da513c1071139fd2972eb411e265 100644 (file)
@@ -1137,7 +1137,7 @@ static int rtpg_nmapalgebraexpr_callback(
        /* run prepared plan */
        if (plan != NULL) {
                Datum values[12];
-               bool nulls[12];
+               char nulls[12];
                int err = 0;
 
                TupleDesc tupdesc;
@@ -1150,7 +1150,7 @@ static int rtpg_nmapalgebraexpr_callback(
 
                /* 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 @@ Datum RASTER_mapAlgebra2(PG_FUNCTION_ARGS)
        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 @@ Datum RASTER_mapAlgebra2(PG_FUNCTION_ARGS)
                                                                /* 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++) {
index 8361b4a8f37c4156237fb2b226c7f4eac8e989b6..018ec31cd10144ec90c73d3967339b026475090d 100644 (file)
@@ -246,7 +246,7 @@ rt_pg_debug(const char *fmt, va_list ap)
 
 static char *gdal_datapath = NULL;
 extern char *gdal_enabled_drivers;
-extern char enable_outdb_rasters;
+extern bool enable_outdb_rasters;
 
 /* ---------------------------------------------------------------- */
 /*  Useful variables                                                */
index 8340c50f13478a7936ba6bf58eacf5955d6642ed..0e168656401a133c438cb9d92fd9083ea025d952 100644 (file)
@@ -292,8 +292,8 @@ static void test_band_get_pixel_of_value() {
        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};
index 75265bc82375c73abe0f72845998978c00449d48..26dd8330a0e85ded76948f532c2b4b4037fe7401 100644 (file)
@@ -513,8 +513,8 @@ static void test_gdal_to_raster() {
        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 @@ static void test_gdal_to_raster() {
        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);
index ccc695dce899468682d694086783f5a358c7dc51..9253a3d5306f49efdada27c47140aa538f00d6c4 100644 (file)
@@ -526,8 +526,8 @@ static void test_raster_pixel_as_polygon() {
        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);