Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/raster3d/mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,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 = (char *)tile + length;
tile = (int *)tile + length;
}

tile = (char *)tile + xLength;
tile = (int *)tile + xLength;
}
tile = (char *)tile + yLength;
tile = (int *)tile + yLength;
}
}

Expand Down
2 changes: 1 addition & 1 deletion raster/r.in.lidar/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ int main(int argc, char *argv[])
G_debug(2, "filling base raster array");
for (row = 0; row < rows; row++) {
Rast_get_row(base_raster,
base_array +
(double *)base_array +
((size_t)row * cols *
Rast_cell_size(base_raster_data_type)),
row, base_raster_data_type);
Expand Down
66 changes: 35 additions & 31 deletions raster/r.in.lidar/point_binning.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ void write_variance(void *raster_row, void *n_array, void *sum_array,
for (col = 0; col < cols; col++) {
offset = ((size_t)row * cols + col) * Rast_cell_size(rtype);
n_offset = ((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
n = Rast_get_c_value(n_array + n_offset, CELL_TYPE);
sum = Rast_get_d_value(sum_array + offset, rtype);
sumsq = Rast_get_d_value(sumsq_array + offset, rtype);
n = Rast_get_c_value((CELL *)n_array + n_offset, CELL_TYPE);
sum = Rast_get_d_value((DCELL *)sum_array + offset, rtype);
sumsq = Rast_get_d_value((DCELL *)sumsq_array + offset, rtype);

if (n == 0)
Rast_set_null_value(ptr, 1, rtype);
Expand Down Expand Up @@ -429,12 +429,13 @@ void write_median(struct BinIndex *bin_index, void *raster_row,

for (col = 0; col < cols; col++) {
n_offset = ((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
if (Rast_is_null_value(index_array + n_offset,
if (Rast_is_null_value((CELL *)index_array + n_offset,
CELL_TYPE)) /* no points in cell */
Rast_set_null_value(ptr, 1, rtype);
else { /* one or more points in cell */

head_id = Rast_get_c_value(index_array + n_offset, CELL_TYPE);
head_id =
Rast_get_c_value((CELL *)index_array + n_offset, CELL_TYPE);
node_id = head_id;

n = 0;
Expand Down Expand Up @@ -489,11 +490,12 @@ void write_percentile(struct BinIndex *bin_index, void *raster_row,

for (col = 0; col < cols; col++) {
n_offset = ((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
if (Rast_is_null_value(index_array + n_offset,
if (Rast_is_null_value((CELL *)index_array + n_offset,
CELL_TYPE)) /* no points in cell */
Rast_set_null_value(ptr, 1, rtype);
else {
head_id = Rast_get_c_value(index_array + n_offset, CELL_TYPE);
head_id =
Rast_get_c_value((CELL *)index_array + n_offset, CELL_TYPE);
node_id = head_id;
n = 0;

Expand Down Expand Up @@ -544,11 +546,12 @@ void write_skewness(struct BinIndex *bin_index, void *raster_row,

for (col = 0; col < cols; col++) {
n_offset = ((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
if (Rast_is_null_value(index_array + n_offset,
if (Rast_is_null_value((CELL *)index_array + n_offset,
CELL_TYPE)) /* no points in cell */
Rast_set_null_value(ptr, 1, rtype);
else {
head_id = Rast_get_c_value(index_array + n_offset, CELL_TYPE);
head_id =
Rast_get_c_value((CELL *)index_array + n_offset, CELL_TYPE);
node_id = head_id;

n = 0; /* count */
Expand Down Expand Up @@ -601,11 +604,12 @@ void write_trimmean(struct BinIndex *bin_index, void *raster_row,

for (col = 0; col < cols; col++) {
n_offset = ((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
if (Rast_is_null_value(index_array + n_offset,
if (Rast_is_null_value((CELL *)index_array + n_offset,
CELL_TYPE)) /* no points in cell */
Rast_set_null_value(ptr, 1, rtype);
else {
head_id = Rast_get_c_value(index_array + n_offset, CELL_TYPE);
head_id =
Rast_get_c_value((CELL *)index_array + n_offset, CELL_TYPE);

node_id = head_id;
n = 0;
Expand Down Expand Up @@ -666,28 +670,28 @@ void write_values(struct PointBinning *point_binning,
switch (point_binning->method) {
case METHOD_N: /* n is a straight copy */
Rast_raster_cpy(raster_row,
point_binning->n_array +
(CELL *)point_binning->n_array +
((size_t)row * cols * Rast_cell_size(CELL_TYPE)),
cols, CELL_TYPE);
break;

case METHOD_MIN:
Rast_raster_cpy(raster_row,
point_binning->min_array +
(CELL *)point_binning->min_array +
((size_t)row * cols * Rast_cell_size(rtype)),
cols, rtype);
break;

case METHOD_MAX:
Rast_raster_cpy(raster_row,
point_binning->max_array +
(CELL *)point_binning->max_array +
((size_t)row * cols * Rast_cell_size(rtype)),
cols, rtype);
break;

case METHOD_SUM:
Rast_raster_cpy(raster_row,
point_binning->sum_array +
(CELL *)point_binning->sum_array +
((size_t)row * cols * Rast_cell_size(rtype)),
cols, rtype);
break;
Expand All @@ -696,10 +700,10 @@ void write_values(struct PointBinning *point_binning,
ptr = raster_row;
for (col = 0; col < cols; col++) {
size_t offset = ((size_t)row * cols + col) * Rast_cell_size(rtype);
double min =
Rast_get_d_value(point_binning->min_array + offset, rtype);
double max =
Rast_get_d_value(point_binning->max_array + offset, rtype);
double min = Rast_get_d_value(
(DCELL *)point_binning->min_array + offset, rtype);
double max = Rast_get_d_value(
(DCELL *)point_binning->max_array + offset, rtype);
Rast_set_d_value(ptr, max - min, rtype);
ptr = G_incr_void_ptr(ptr, Rast_cell_size(rtype));
}
Expand All @@ -711,10 +715,10 @@ void write_values(struct PointBinning *point_binning,
size_t offset = ((size_t)row * cols + col) * Rast_cell_size(rtype);
size_t n_offset =
((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
int n =
Rast_get_c_value(point_binning->n_array + n_offset, CELL_TYPE);
double sum =
Rast_get_d_value(point_binning->sum_array + offset, rtype);
int n = Rast_get_c_value((CELL *)point_binning->n_array + n_offset,
CELL_TYPE);
double sum = Rast_get_d_value(
(DCELL *)point_binning->sum_array + offset, rtype);

if (n == 0)
Rast_set_null_value(ptr, 1, rtype);
Expand Down Expand Up @@ -758,19 +762,19 @@ void write_values(struct PointBinning *point_binning,
size_t offset = ((size_t)row * cols + col) * Rast_cell_size(rtype);
size_t n_offset =
((size_t)row * cols + col) * Rast_cell_size(CELL_TYPE);
int n =
Rast_get_c_value(point_binning->n_array + n_offset, CELL_TYPE);
int n = Rast_get_c_value((CELL *)point_binning->n_array + n_offset,
CELL_TYPE);

if (n == 0)
continue;

double sum_x =
Rast_get_d_value(point_binning->x_array + offset, rtype);
double sum_y =
Rast_get_d_value(point_binning->y_array + offset, rtype);
double sum_x = Rast_get_d_value(
(DCELL *)point_binning->x_array + offset, rtype);
double sum_y = Rast_get_d_value(
(DCELL *)point_binning->y_array + offset, rtype);
/* TODO: we do this also in mean writing */
double sum_z =
Rast_get_d_value(point_binning->sum_array + offset, rtype);
double sum_z = Rast_get_d_value(
(DCELL *)point_binning->sum_array + offset, rtype);

/* We are not writing any categories. They are not needed
* and potentially it is too much trouble to do it and it is
Expand Down
Loading