Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checks: Fix -Wunused-but-set-variable compiler warnings, part 1 #2648

Merged
merged 5 commits into from
Nov 17, 2022
Merged
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
3 changes: 1 addition & 2 deletions db/drivers/dbf/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int db__driver_fetch(dbCursor * cn, int position, int *more)
dbColumn *column;
dbValue *value;
int col, ncols;
int htype, sqltype, ctype;
int sqltype, ctype;
int dbfrow, dbfcol;

/* get cursor token */
Expand Down Expand Up @@ -75,7 +75,6 @@ int db__driver_fetch(dbCursor * cn, int position, int *more)

sqltype = db_get_column_sqltype(column);
ctype = db_sqltype_to_Ctype(sqltype);
htype = db_get_column_host_type(column);

if (db.tables[c->table].rows[dbfrow].values[dbfcol].is_null) {
db_set_value_null(value);
Expand Down
11 changes: 5 additions & 6 deletions db/drivers/dbf/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int load_table(int t)

int save_table(int t)
{
int i, j, ncols, nrows, ret, field, rec;
int i, j, ncols, nrows, field, rec;
char name[2000], fname[20], element[100];
DBFHandle dbf;
ROW *rows;
Expand Down Expand Up @@ -286,17 +286,16 @@ int save_table(int t)
else {
switch (db.tables[t].cols[j].type) {
case DBF_INT:
ret = DBFWriteIntegerAttribute(dbf, rec, field, val->i);
DBFWriteIntegerAttribute(dbf, rec, field, val->i);
break;
case DBF_CHAR:
if (val->c != NULL)
ret =
DBFWriteStringAttribute(dbf, rec, field, val->c);
DBFWriteStringAttribute(dbf, rec, field, val->c);
else
ret = DBFWriteStringAttribute(dbf, rec, field, "");
DBFWriteStringAttribute(dbf, rec, field, "");
break;
case DBF_DOUBLE:
ret = DBFWriteDoubleAttribute(dbf, rec, field, val->d);
DBFWriteDoubleAttribute(dbf, rec, field, val->d);
break;
}
}
Expand Down
7 changes: 3 additions & 4 deletions db/drivers/ogr/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int describe_table(OGRLayerH hLayer, dbTable ** table, cursor * c)

for (i = 0; i < ncols; i++, col++) {
int sqlType = DB_SQL_TYPE_UNKNOWN;
int size = 0, precision = 0, scale;
int size = 0, precision = 0 /* , scale */ ;

hFieldDefn = OGR_FD_GetFieldDefn(hFeatureDefn, i);
ogrType = OGR_Fld_GetType(hFieldDefn);
Expand Down Expand Up @@ -225,9 +225,8 @@ int describe_table(OGRLayerH hLayer, dbTable ** table, cursor * c)
db_set_column_length(column, size);
db_set_column_precision(column, precision);

/* TODO */
scale = 0;
/*
/* TODO
scale = 0;
db_set_column_scale (column, scale);
*/

Expand Down
12 changes: 7 additions & 5 deletions db/drivers/postgres/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ int describe_table(PGresult * res, dbTable ** table, cursor * c)
int i, ncols, kcols;
int pgtype, gpgtype;
char *fname;
int sqltype, fsize, precision, scale;
int sqltype, fsize;

/* TODO: int precision, scale; */
dbColumn *column;

G_debug(3, "describe_table()");
Expand Down Expand Up @@ -149,10 +151,10 @@ int describe_table(PGresult * res, dbTable ** table, cursor * c)
db_set_column_host_type(column, gpgtype);
db_set_column_sqltype(column, sqltype);

/* TODO */
precision = 0;
scale = 0;
/*
/* TODO:
precision = 0;
scale = 0;

db_set_column_precision (column, precision);
db_set_column_scale (column, scale);
*/
Expand Down
12 changes: 7 additions & 5 deletions db/drivers/sqlite/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ int describe_table(sqlite3_stmt * statement, dbTable ** table, cursor * c)
for (i = 0; i < ncols; i++) {
const char *fname;
dbColumn *column;
int litetype, sqltype, fsize, precision, scale;
int litetype, sqltype, fsize;

/* TODO: int precision, scale; */

fname = sqlite3_column_name(statement, i);

Expand Down Expand Up @@ -241,10 +243,10 @@ int describe_table(sqlite3_stmt * statement, dbTable ** table, cursor * c)
db_set_column_host_type(column, litetype);
db_set_column_sqltype(column, sqltype);

/* TODO */
precision = 0;
scale = 0;
/*
/* TODO
precision = 0;
scale = 0;

db_set_column_precision (column, precision);
db_set_column_scale (column, scale);
*/
Expand Down
7 changes: 4 additions & 3 deletions display/d.grid/plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ int plot_grid(double grid_size, double east, double north, int do_text,
double x, y, y0;
double e1, e2;
struct Cell_head window;
double row_dist, colm_dist;

/* double row_dist, colm_dist; */
char text[128];
double tx, ty, bt, bb, bl, br, w, h;

G_get_set_window(&window);

/* pull right and bottom edges back one pixel; display lib bug? */
row_dist = D_d_to_u_row(0.) - D_d_to_u_row(1.);
colm_dist = D_d_to_u_col(1.) - D_d_to_u_col(0.);
/* row_dist = D_d_to_u_row(0.) - D_d_to_u_row(1.);
colm_dist = D_d_to_u_col(1.) - D_d_to_u_col(0.); */
/* window.south += row_dist;
window.east -= colm_dist;
*/
Expand Down
5 changes: 3 additions & 2 deletions display/d.histogram/pie.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ int pie(struct stat_list *dist_stats, /* list of distribution statistics */
double y_box[6];
double height, width;
double xscale; /* scaling factors */
double yscale;

/* double yscale; */
char xlabel[1024];
char txt[1024];
char tic_name[80];
Expand All @@ -90,7 +91,7 @@ int pie(struct stat_list *dist_stats, /* list of distribution statistics */
dist_stats->mincat--;
}
xscale = ((double)(x_line[2] - x_line[1]) / ((double)num_cats));
yscale = ((double)(y_line[0] - y_line[1])) / dist_stats->maxstat;
/* yscale = ((double)(y_line[0] - y_line[1])) / dist_stats->maxstat; */
yoffset = (long)(y_line[0]);
if (num_cats >= x_line[2] - x_line[1])
xoffset = (double)x_line[1];
Expand Down
12 changes: 10 additions & 2 deletions display/d.path/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ int main(int argc, char **argv)
{
struct Option *map, *afield_opt, *nfield_opt, *afcol, *abcol, *ncol,
*type_opt;
struct Option *color_opt, *hcolor_opt, *bgcolor_opt, *coor_opt;
struct Option /* *color_opt, */ *hcolor_opt, /* *bgcolor_opt, */ *coor_opt;
struct Flag *geo_f, *bold_f;
struct GModule *module;
struct Map_info Map;
int type, afield, nfield, geo;
struct color_rgb color, hcolor, bgcolor;
struct color_rgb /* color, */ hcolor /*, bgcolor */ ;
int r, g, b;
double x1, y1, x2, y2;

Expand Down Expand Up @@ -93,13 +93,15 @@ int main(int argc, char **argv)
ncol->required = NO;
ncol->description = _("Node cost column");

#if 0 /* unused */
color_opt = G_define_option();
color_opt->key = "color";
color_opt->type = TYPE_STRING;
color_opt->answer = DEFAULT_FG_COLOR;
color_opt->description = _("Original line color");
color_opt->gisprompt = "old_color,color,color";
color_opt->guisection = _("Rendering");
#endif

hcolor_opt = G_define_option();
hcolor_opt->key = "highlight_color";
Expand All @@ -109,13 +111,15 @@ int main(int argc, char **argv)
hcolor_opt->gisprompt = "old_color,color,color";
hcolor_opt->guisection = _("Rendering");

#if 0 /* unused */
bgcolor_opt = G_define_option();
bgcolor_opt->key = "bgcolor";
bgcolor_opt->type = TYPE_STRING;
bgcolor_opt->answer = DEFAULT_BG_COLOR;
bgcolor_opt->description = _("Background color");
bgcolor_opt->gisprompt = "old_color,color,color";
bgcolor_opt->guisection = _("Rendering");
#endif

geo_f = G_define_flag();
geo_f->key = 'g';
Expand Down Expand Up @@ -152,12 +156,14 @@ int main(int argc, char **argv)

D_open_driver();

#if 0 /* unused */
color = G_standard_color_rgb(BLACK);
if (G_str_to_color(color_opt->answer, &r, &g, &b)) {
color.r = r;
color.g = g;
color.b = b;
}
#endif

hcolor = G_standard_color_rgb(RED);
if (G_str_to_color(hcolor_opt->answer, &r, &g, &b)) {
Expand All @@ -166,12 +172,14 @@ int main(int argc, char **argv)
hcolor.b = b;
}

#if 0 /* unused */
bgcolor = G_standard_color_rgb(WHITE);
if (G_str_to_color(bgcolor_opt->answer, &r, &g, &b)) {
bgcolor.r = r;
bgcolor.g = g;
bgcolor.b = b;
}
#endif

if (geo_f->answer) {
geo = 1;
Expand Down
6 changes: 3 additions & 3 deletions display/d.vect.thematic/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ int draw_line(int ltype, int line,
int *n_points, int *n_lines, int *n_centroids,
int *n_boundaries, int *n_faces, RGBA_Color * secondary_color)
{
double var_size, rotation;
/* double var_size, rotation; */
int i;
double x0, y0;
double *x, *y;
int found, cat;

rotation = 0.0;
var_size = size;
/* rotation = 0.0;
var_size = size; */
cat = -1;

if (!ltype)
Expand Down
9 changes: 5 additions & 4 deletions display/d.vect.thematic/plot1.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
{
int i, ltype, nlines = 0, line, cat = -1;
double *x, *y;
struct line_pnts *Points, *PPoints;
struct line_pnts *Points /* , *PPoints */ ;
struct line_cats *Cats;
double msize;

/* double msize; */
int x0, y0;

struct field_info *fi = NULL;
Expand Down Expand Up @@ -91,10 +92,10 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
fill_color->a = RGBA_COLOR_NONE;


msize = size * (D_d_to_u_col(2.0) - D_d_to_u_col(1.0)); /* do it better */
/* msize = size * (D_d_to_u_col(2.0) - D_d_to_u_col(1.0)); *//* do it better */

Points = Vect_new_line_struct();
PPoints = Vect_new_line_struct();
/* PPoints = Vect_new_line_struct(); */
Cats = Vect_new_cats_struct();

open_db = table_colors_flag || width_column;
Expand Down
25 changes: 12 additions & 13 deletions imagery/i.albedo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ int main(int argc, char *argv[])
int nfiles;
int infd[MAXFILES];
int outfd;
char **names;
char **ptr;
int i = 0;
int modis = 0, aster = 0, avhrr = 0;
Expand All @@ -78,9 +77,10 @@ int main(int argc, char *argv[])
int bottom1a, bottom1b;
int bottom2a, bottom2b;
int bottom3a, bottom3b;
int i_bottom1a, i_bottom1b;
int i_bottom2a, i_bottom2b;
int i_bottom3a, i_bottom3b;
int i_bottom1a /*, i_bottom1b */ ;
int /* i_bottom2a, */ i_bottom2b;

/* int i_bottom3a, i_bottom3b; */

/************************************/
int histogram[100];
Expand Down Expand Up @@ -153,7 +153,6 @@ int main(int argc, char *argv[])
if (G_parser(argc, argv))
exit(EXIT_FAILURE);

names = input->answers;
ptr = input->answers;

result = output->answer;
Expand Down Expand Up @@ -293,11 +292,11 @@ int main(int argc, char *argv[])
bottom3a = 100000;
bottom3b = 100000;
i_bottom1a = 100;
i_bottom1b = 100;
i_bottom2a = 100;
/* i_bottom1b = 100; */
/* i_bottom2a = 100; */
i_bottom2b = 100;
i_bottom3a = 100;
i_bottom3b = 100;
/* i_bottom3a = 100; */
/* i_bottom3b = 100; */
/* Water histogram lower bound */
for (i = 0; i < i_peak1; i++) {
if (histogram[i] <= bottom1a) {
Expand All @@ -309,14 +308,14 @@ int main(int argc, char *argv[])
for (i = i_peak2; i > i_peak1; i--) {
if (histogram[i] <= bottom1b) {
bottom1b = histogram[i];
i_bottom1b = i;
/* i_bottom1b = i; */
}
}
/* Land histogram lower bound */
for (i = i_peak1; i < i_peak2; i++) {
if (histogram[i] <= bottom2a) {
bottom2a = histogram[i];
i_bottom2a = i;
/* i_bottom2a = i; */
}
}
/* Land histogram higher bound */
Expand All @@ -330,14 +329,14 @@ int main(int argc, char *argv[])
for (i = i_peak2; i < i_peak3; i++) {
if (histogram[i] < bottom3a) {
bottom3a = histogram[i];
i_bottom3a = i;
/* i_bottom3a = i; */
}
}
/* Cloud/Snow histogram higher bound */
for (i = 100; i > i_peak3; i--) {
if (histogram[i] < bottom3b) {
bottom3b = histogram[i];
i_bottom3b = i;
/* i_bottom3b = i; */
}
}
if (flag5->answer) {
Expand Down
3 changes: 1 addition & 2 deletions imagery/i.aster.toar/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char *argv[])
/*File Descriptors */
int infd[MAXFILES];
int outfd[MAXFILES];
char **names, **ptr;
char **ptr;

/* For some strange reason infd[0] cannot be used later */
/* So nfiles is initialized with nfiles = 1 */
Expand Down Expand Up @@ -153,7 +153,6 @@ int main(int argc, char *argv[])
if (G_parser(argc, argv))
exit(EXIT_FAILURE);

names = input->answers;
ptr = input->answers;
doy = atof(input1->answer);
sun_elevation = atof(input2->answer);
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.eb.netrad/r_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ double r_net(double bbalb, double ndvi, double tempk, double dtair,
/* sunzangle = sun zenith angle at sat. overpass */
/* tair = air temperature (approximative, or met.station) */
double Kin = 0.0, Lin = 0.0, Lout = 0.0, Lcorr = 0.0, result = 0.0;
double ds = 0.0, e_atm = 0.0, delta = 0.0;
double ds = 0.0, e_atm = 0.0 /* , delta = 0.0 */ ;

/* double tsw_for_e_atm = 0.7; *//* Special tsw, consider it a coefficient */

Expand All @@ -27,7 +27,7 @@ double r_net(double bbalb, double ndvi, double tempk, double dtair,

/* ds = 1.0 + 0.01672 * sin(2*PI*(doy-93.5)/365); */
ds = 1.0 / pow((1 + 0.033 * cos(2 * PI * doy / 365)), 2);
delta = 0.4093 * sin((2 * PI * doy / 365) - 1.39);
/* delta = 0.4093 * sin((2 * PI * doy / 365) - 1.39); */

/* Kin is the shortwave incoming radiation */
Kin = 1358.0 * (cos(sunzangle * PI / 180) * tsw / (ds * ds));
Expand Down
Loading