From cf97f10ed85f42807fba4f34918b1d50e5de49eb Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Sat, 18 Mar 2023 21:20:39 +0100 Subject: [PATCH] fix -Wgnu-pointer-arith compiler warnings (#2875) --- lib/raster3d/mask.c | 8 ++++---- raster/r.fill.stats/main.c | 12 ++++++------ raster/r.in.xyz/main.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/raster3d/mask.c b/lib/raster3d/mask.c index 74efe15e218..69e7a498774 100644 --- a/lib/raster3d/mask.c +++ b/lib/raster3d/mask.c @@ -34,7 +34,7 @@ static float RASTER3D_MASKNUMmaskValue; /*--------------------------------------------------------------------------*/ -int Rast3d_mask_close() +int Rast3d_mask_close(void) { /* No Idea if this is correct return value */ if (!Rast3d_maskMapExistsVar) @@ -304,12 +304,12 @@ void Rast3d_mask_tile(RASTER3D_Map *map, int tileIndex, void *tile, int type) for (dy = y; dy < rows; dy++) { for (dx = x; dx < cols; dx++) { RASTER3D_MASKNUM(map, dx, dy, dz, tile, type); - tile += length; + tile = (char *)tile + length; } - tile += xLength; + tile = (char *)tile + xLength; } - tile += yLength; + tile = (char *)tile + yLength; } } diff --git a/raster/r.fill.stats/main.c b/raster/r.fill.stats/main.c index 3e76a6720c1..5a99dd19092 100644 --- a/raster/r.fill.stats/main.c +++ b/raster/r.fill.stats/main.c @@ -193,14 +193,14 @@ void print_weights_matrix(long int rows, long int cols) void *get_input_row(unsigned long row_idx) { unsigned long i; - void *my_cell = NULL; + char *my_cell = NULL; my_cell = CELL_INPUT_HANDLES[row_idx]; for (i = 0; i < PADDING_WIDTH; i++) my_cell += CELL_IN_SIZE; - return (my_cell); + return (void *)my_cell; } /* NEIGHBORHOOD STATISTICS @@ -331,7 +331,7 @@ void read_neighborhood(unsigned long row_index, unsigned long col, double min, double max, int preserve, stats_struct *stats) { unsigned long i, j; - void *cell; + char *cell; double cell_value; stats->overwrite = 0; @@ -511,7 +511,7 @@ void init_handles(void) void advance_one_row(int file_desc, long current_row) { unsigned long i, j; - void *cell_input; + char *cell_input; static unsigned long replace_row = 0; /* points to the row which will be replaced next */ unsigned long replace_pos = 0; @@ -556,7 +556,7 @@ void interpolate_row(unsigned long row_index, unsigned long cols, double min, stats_struct *stats, int write_err) { unsigned long j; - void *cell_output; + char *cell_output; FCELL *err_output; cell_output = CELL_OUTPUT; @@ -744,7 +744,7 @@ int main(int argc, char *argv[]) int write_error; /* file handlers */ - void *cell_input; + char *cell_input; int in_fd; int out_fd; int err_fd; diff --git a/raster/r.in.xyz/main.c b/raster/r.in.xyz/main.c index 08264657a0f..0257f22a97d 100644 --- a/raster/r.in.xyz/main.c +++ b/raster/r.in.xyz/main.c @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) RASTER_MAP_TYPE rtype; struct History history; char title[64]; - void *n_array, *min_array, *max_array, *sum_array, *sumsq_array, + char *n_array, *min_array, *max_array, *sum_array, *sumsq_array, *index_array; void *raster_row, *ptr; struct Cell_head region;