Commit 24efadd4 authored by Darafei Praliaskouski's avatar Darafei Praliaskouski

Fix new GCC warnings.

Updating GCC on travis to Debian Unstable exposed strncpy and if body alignment warnings.

Closes https://github.com/postgis/postgis/pull/329



git-svn-id: http://svn.osgeo.org/postgis/trunk@16999 b70326c6-7e19-0410-871a-916f4a2858ee
parent b6eb7ec4
Pipeline #36174915 passed with stage
in 32 minutes and 55 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -127,11 +127,11 @@ rtpg_chartrim(const char *input, char *remove) {
offset++;
rtn = palloc(sizeof(char) * (strlen(input) - offset + 1));
if (rtn == NULL) {
if (!rtn) {
fprintf(stderr, "Not enough memory\n");
return NULL;
}
strncpy(rtn, input, strlen(input) - offset);
memcpy(rtn, input, strlen(input) - offset);
rtn[strlen(input) - offset] = '\0';
return rtn;
......
......@@ -1464,9 +1464,9 @@ Datum RASTER_nMapAlgebraExpr(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
strncpy(sql, "SELECT (", strlen("SELECT ("));
strncpy(sql + strlen("SELECT ("), expr, strlen(expr));
strncpy(sql + strlen("SELECT (") + strlen(expr), ")::double precision", strlen(")::double precision"));
memcpy(sql, "SELECT (", strlen("SELECT ("));
memcpy(sql + strlen("SELECT ("), expr, strlen(expr));
memcpy(sql + strlen("SELECT (") + strlen(expr), ")::double precision", strlen(")::double precision"));
sql[len] = '\0';
POSTGIS_RT_DEBUGF(3, "sql #%d: %s", exprpos[i], sql);
......@@ -4630,9 +4630,9 @@ Datum RASTER_mapAlgebraExpr(PG_FUNCTION_ARGS)
len = strlen("SELECT (") + strlen(expression) + strlen(")::double precision");
initexpr = (char *)palloc(len + 1);
strncpy(initexpr, "SELECT (", strlen("SELECT ("));
strncpy(initexpr + strlen("SELECT ("), expression, strlen(expression));
strncpy(initexpr + strlen("SELECT (") + strlen(expression), ")::double precision", strlen(")::double precision"));
memcpy(initexpr, "SELECT (", strlen("SELECT ("));
memcpy(initexpr + strlen("SELECT ("), expression, strlen(expression));
memcpy(initexpr + strlen("SELECT (") + strlen(expression), ")::double precision", strlen(")::double precision"));
initexpr[len] = '\0';
POSTGIS_RT_DEBUGF(3, "RASTER_mapAlgebraExpr: Expression is %s", initexpr);
......@@ -6676,9 +6676,9 @@ Datum RASTER_mapAlgebra2(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
strncpy(sql, "SELECT (", strlen("SELECT ("));
strncpy(sql + strlen("SELECT ("), expr, strlen(expr));
strncpy(sql + strlen("SELECT (") + strlen(expr), ")::double precision", strlen(")::double precision"));
memcpy(sql, "SELECT (", strlen("SELECT ("));
memcpy(sql + strlen("SELECT ("), expr, strlen(expr));
memcpy(sql + strlen("SELECT (") + strlen(expr), ")::double precision", strlen(")::double precision"));
sql[len] = '\0';
POSTGIS_RT_DEBUGF(3, "sql #%d: %s", i, sql);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment