Skip to content

Commit 9867dc9

Browse files
nilasonneteler
authored andcommitted
rst/interpfl lib: change devi arg to bool (#1271)
Output deviation argument to IL_init_params_2d() and in the interp_params struct, was defined as FILE*. In practice a char* of the file path was given to the function in 'v.surf.rst/main.c' and this pointer's only use was to check whether it was NULL or not. It was used as a flag. This changes the argument to be a bool. Addresses a -Wincompatible-pointer-types compiler warning.
1 parent db68d02 commit 9867dc9

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

lib/rst/interp_float/init2d.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void IL_init_params_2d(struct interp_params *params,
5454
double scl, /*!< anisotropy scaling factor */
5555
FILE * t1, FILE * t2, FILE * t3, FILE * t4, FILE * t5,
5656
FILE * t6, /*!< temp files for writing interp. values (t1-t6) */
57-
FILE * dev, /*!< pointer to deviations file */
57+
bool create_devi, /*!< create deviations file? */
5858
struct TimeStamp *ts,
5959
int c, /*!< cross validation */
6060
const char *wheresql /*!< SQL WHERE statement */
@@ -99,7 +99,7 @@ void IL_init_params_2d(struct interp_params *params,
9999
params->Tmp_fd_xx = t4;
100100
params->Tmp_fd_yy = t5;
101101
params->Tmp_fd_xy = t6;
102-
params->fddevi = dev;
102+
params->create_devi = create_devi;
103103
params->ts = ts;
104104
params->cv = c;
105105
params->wheresql = wheresql;

lib/rst/interp_float/interpf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct interp_params
9292
FILE *Tmp_fd_z, *Tmp_fd_dx,
9393
*Tmp_fd_dy, *Tmp_fd_xx,
9494
*Tmp_fd_yy, *Tmp_fd_xy; /**< temp files for writing interp. values */
95-
FILE *fddevi; /**< pointer to deviations file */
95+
bool create_devi; /**< create deviations file? */
9696

9797
grid_calc_fn *grid_calc; /**< calculates grid for given segm */
9898
matrix_create_fn *matrix_create; /**< creates matrix for a given segm */
@@ -118,7 +118,7 @@ void IL_init_params_2d(struct interp_params *, FILE *, int, int, double,
118118
double, int, int, int, int, double,
119119
char *, char *, char *, char *, char *, char *,
120120
double, double, double, int, double, double,
121-
FILE *, FILE *, FILE *, FILE *, FILE *, FILE *, FILE *,
121+
FILE *, FILE *, FILE *, FILE *, FILE *, FILE *, bool,
122122
struct TimeStamp *, int, const char *);
123123

124124
void IL_init_func_2d(struct interp_params *, grid_calc_fn *,

lib/rst/interp_float/point2d.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ int IL_check_at_points_2d(struct interp_params *params,
110110
else
111111
inside = 0;
112112

113-
if (params->fddevi != NULL) {
113+
if (params->create_devi) {
114114

115115
if (inside) { /* if the point is inside the region */
116116
Vect_reset_line(Pnts);

raster/r.resamp.rst/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ int main(int argc, char *argv[])
451451
fi, MAXPOINTS, SCIK1, SCIK2, SCIK3, smc, elev, slope,
452452
aspect, pcurv, tcurv, mcurv, dmin, inp_x_orig,
453453
inp_y_orig, deriv, theta, scalex, Tmp_fd_z, Tmp_fd_dx,
454-
Tmp_fd_dy, Tmp_fd_xx, Tmp_fd_yy, Tmp_fd_xy, NULL, NULL,
454+
Tmp_fd_dy, Tmp_fd_xx, Tmp_fd_yy, Tmp_fd_xy, false, NULL,
455455
0, NULL);
456456

457457
/* In the above line, the penultimate argument is supposed to be a

vector/v.surf.rst/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ static char *tcurv = NULL;
8888
static char *mcurv = NULL;
8989
static char *maskmap = NULL;
9090
static char *devi = NULL;
91+
static bool create_devi = false;
9192
static char *cvdev = NULL;
9293
static int sdisk, disk, ddisk, sddisk;
9394
static FILE *Tmp_fd_z = NULL;
@@ -631,6 +632,7 @@ int main(int argc, char *argv[])
631632
}
632633
db_begin_transaction(driver2);
633634
count = 1;
635+
create_devi = true;
634636

635637
}
636638

@@ -643,7 +645,7 @@ int main(int argc, char *argv[])
643645
SCIK1, SCIK2, SCIK3, rsm, elev, slope, aspect, pcurv,
644646
tcurv, mcurv, dmin, x_orig, y_orig, deriv, theta,
645647
scalex, Tmp_fd_z, Tmp_fd_dx, Tmp_fd_dy, Tmp_fd_xx,
646-
Tmp_fd_yy, Tmp_fd_xy, devi, NULL, cv,
648+
Tmp_fd_yy, Tmp_fd_xy, create_devi, NULL, cv,
647649
parm.wheresql->answer);
648650

649651
IL_init_func_2d(&params, IL_grid_calc_2d, IL_matrix_create,

0 commit comments

Comments
 (0)