Skip to content

Commit

Permalink
Fix -Wunused-variable compiler warnings (#2158)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilason committed Feb 9, 2022
1 parent 9e4e322 commit c37871b
Show file tree
Hide file tree
Showing 38 changed files with 42 additions and 67 deletions.
3 changes: 2 additions & 1 deletion display/d.grid/plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ void init_proj(struct pj_info *info_in, struct pj_info *info_out,
info_out->pj = NULL;
if (wgs84) {
struct Key_Value *out_proj_info, *out_unit_info;
char buff[256], dum[256];

out_proj_info = G_create_key_value();
out_unit_info = G_create_key_value();
Expand All @@ -576,6 +575,8 @@ void init_proj(struct pj_info *info_in, struct pj_info *info_out,
* the WGS84 values would be meaningless), and if they are set the
* input datum to WGS84 */
#if PROJ_VERSION_MAJOR < 6
char buff[256], dum[256];

/* PROJ6+ has its own datum transformation parameters */
if (G_get_datumparams_from_projinfo(in_proj_info, buff, dum) < 0)
G_fatal_error(_("WGS84 grid output not possible as this location does not contain\n"
Expand Down
9 changes: 4 additions & 5 deletions display/d.histogram/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ int main(int argc, char **argv)
struct Option *opt5;
struct Flag *flag1;
struct Flag *flag2;
struct Flag *flag3;


/* Initialize the GIS calls */
Expand Down Expand Up @@ -131,9 +130,9 @@ int main(int argc, char **argv)
flag1->key = 'n';
flag1->description = _("Display information for null cells");

flag3 = G_define_flag();
flag3->key = 'c';
flag3->description =
flag2 = G_define_flag();
flag2->key = 'c';
flag2->description =
_("Report for ranges defined in cats file (fp maps only)");

if (G_parser(argc, argv))
Expand All @@ -160,7 +159,7 @@ int main(int argc, char **argv)
if (sscanf(opt5->answer, "%d", &nsteps) != 1)
G_fatal_error(_("Invalid number of steps: %s"), opt5->answer);

cat_ranges = flag3->answer;
cat_ranges = flag2->answer;

if (cat_ranges && nsteps != 255)
G_warning(_("When -C flag is set, the nsteps argument is ignored"));
Expand Down
3 changes: 2 additions & 1 deletion display/d.where/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ int main(int argc, char **argv)

if (have_spheroid == 1) {
struct Key_Value *in_proj_info, *in_unit_info;
char buff[100], dum[100];

/* read current projection info */
if ((in_proj_info = G_get_projinfo()) == NULL)
Expand All @@ -128,6 +127,8 @@ int main(int argc, char **argv)
* the WGS84 values would be meaningless), and if they are set the
* output datum to WGS84 */
#if PROJ_VERSION_MAJOR < 6
char buff[100], dum[100];

/* PROJ6+ has its own datum transformation parameters */
if (G_get_datumparams_from_projinfo(in_proj_info, buff, dum) < 0)
G_fatal_error(_("WGS84 output not possible as this location does not contain\n"
Expand Down
4 changes: 2 additions & 2 deletions general/g.parser/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
If global variable to output strings for translation is set it spits them out */
char *translate(const char *arg)
{
static const char *domain;

if (arg == NULL)
return (char *) arg;

Expand All @@ -23,6 +21,8 @@ char *translate(const char *arg)
}

#if defined(HAVE_LIBINTL_H) && defined(USE_NLS)
static const char *domain;

if (!domain) {
domain = getenv("GRASS_TRANSLATION_DOMAIN");
if (domain)
Expand Down
3 changes: 2 additions & 1 deletion general/g.region/printwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
struct pj_info iproj; /* input map proj parameters */
struct pj_info oproj; /* output map proj parameters */
struct pj_info tproj; /* transformation parameters */
char buff[100], dum[100];
int r, c;

/* read current projection info */
Expand All @@ -573,6 +572,8 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
G_set_key_value("proj", "ll", out_proj_info);

#if PROJ_VERSION_MAJOR < 6
char buff[100], dum[100];

/* PROJ6+ has its own datum transformation parameters */
if (G_get_datumparams_from_projinfo(in_proj_info, buff, dum) < 0)
G_fatal_error(_("WGS84 output not possible as this location does not contain "
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 @@ -57,7 +57,6 @@ int main(int argc, char *argv[])
struct Option *input1, *input2;
struct Flag *flag0, *flag1, *flag2;
struct Flag *flag3, *flag4, *flag5;
struct History history; /*metadata */

/************************************/
char *name; /*input raster name */
Expand All @@ -81,7 +80,7 @@ int main(int argc, char *argv[])
/* For some strange reason infd[0] cannot be used later */
/* So nfiles is initialized with nfiles = 1 */
int nfiles = 0;
int i = 0, j = 0;
int i = 0;
int radiance = 0;
void *inrast[MAXFILES];
DCELL *outrast[MAXFILES];
Expand Down
2 changes: 0 additions & 2 deletions imagery/i.eb.hsebal01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ int main(int argc, char *argv[])
DCELL *outrast;
int nrows = 0, ncols = 0;
int row = 0, col = 0;
int row_wet = 0, col_wet = 0;
int row_dry = 0, col_dry = 0;
double m_row_wet = 0.0, m_col_wet = 0.0;
double m_row_dry = 0.0, m_col_dry = 0.0;
int infd_Rn, infd_g0;
Expand Down
7 changes: 1 addition & 6 deletions imagery/i.eb.netrad/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,20 @@ double r_net(double bbalb, double ndvi, double tempk, double dtair,
double sunzangle);
int main(int argc, char *argv[])
{
struct Cell_head cellhd; /*region+header info */
char *mapset; /*mapset name */
int nrows, ncols;
int row, col;
struct GModule *module;
struct Option *input1, *input2, *input3, *input4, *input5;
struct Option *input6, *input7, *input8, *input9, *output1;
struct Flag *flag1;
struct History history; /*metadata */
struct Colors colors; /*Color rules */
char *name; /*input raster name */
char *result; /*output raster name */
int infd_albedo, infd_ndvi, infd_tempk, infd_time, infd_dtair;
int infd_emissivity, infd_tsw, infd_doy, infd_sunzangle;
int outfd;
char *albedo, *ndvi, *tempk, *time, *dtair, *emissivity;
char *tsw, *doy, *sunzangle;
int i = 0, j = 0;
void *inrast_albedo, *inrast_ndvi, *inrast_tempk, *inrast_rnet;
void *inrast_albedo, *inrast_ndvi, *inrast_tempk;
void *inrast_time, *inrast_dtair, *inrast_emissivity, *inrast_tsw;
void *inrast_doy, *inrast_sunzangle;
DCELL * outrast;
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 @@ -16,8 +16,8 @@ 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 temp = 0.0, ds = 0.0, e_atm = 0.0, delta = 0.0;
double tsw_for_e_atm = 0.7; /*Special tsw, consider it a coefficient */
double ds = 0.0, e_atm = 0.0, delta = 0.0;
/* double tsw_for_e_atm = 0.7; */ /* Special tsw, consider it a coefficient */

/* Atmospheric emissivity (Bastiaanssen, 1995) */
e_atm = 1.08 * pow(-log(tsw), 0.265);
Expand Down
1 change: 0 additions & 1 deletion imagery/i.emissivity/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ int main(int argc, char *argv[])
char *result1; /*output raster name */
int infd, outfd; /*File Descriptors */
char *ndvi;
char *emissivity;
void *inr;
DCELL * outr;

Expand Down
7 changes: 3 additions & 4 deletions imagery/i.evapo.time/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
int main(int argc, char *argv[])
{
struct Cell_head cellhd; /*region+header info */
char *mapset; /*mapset name */
int nrows, ncols;
int row, col;
struct GModule *module;
Expand Down Expand Up @@ -65,9 +64,9 @@ int main(int argc, char *argv[])
DCELL *outrast;
CELL val1, val2;

RASTER_MAP_TYPE in_data_type[MAXFILES]; /* ETa */
RASTER_MAP_TYPE in_data_type1[MAXFILES]; /* DOY of ETa */
RASTER_MAP_TYPE in_data_type2[MAXFILES]; /* ETo */
/* RASTER_MAP_TYPE in_data_type[MAXFILES]; */ /* ETa */
/* RASTER_MAP_TYPE in_data_type1[MAXFILES]; */ /* DOY of ETa */
/* RASTER_MAP_TYPE in_data_type2[MAXFILES]; */ /* ETo */
RASTER_MAP_TYPE out_data_type = DCELL_TYPE;

/************************************/
Expand Down
3 changes: 1 addition & 2 deletions imagery/i.ortho.photo/i.ortho.elev/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(int argc, char *argv[])
struct GModule *module;
struct Option *group_opt, *loc_opt, *mapset_opt, *elev_opt;
struct Option *math_opt, *unit_opt, *nd_opt;
struct Flag *list_flag, *print_flag;
struct Flag *print_flag;

char location[GMAPSET_MAX];
char mapset[GMAPSET_MAX];
Expand All @@ -56,7 +56,6 @@ int main(int argc, char *argv[])

char buf[GPATH_MAX];
int stat;
int overwrite;

G_gisinit(argv[0]);

Expand Down
4 changes: 1 addition & 3 deletions imagery/i.ortho.photo/i.ortho.photo/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@

int main(int argc, char **argv)
{
char title[80];
char buf[80], *p;
char *p;
struct Ortho_Image_Group group;
struct GModule *module;
struct Option *group_opt, *ortho_opt;
char *desc_ortho_opt;
char *moduletorun;
const char *grname;
char tosystem[99];
const char *to_system;
int err=0;

/* initialize grass */
Expand Down
4 changes: 1 addition & 3 deletions lib/gis/locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
void G_init_locale(void)
{
static int initialized;
const char *gisbase;

if (G_is_initialized(&initialized))
return;
Expand All @@ -35,8 +34,7 @@ void G_init_locale(void)
#ifdef LC_MESSAGES
setlocale(LC_MESSAGES, "");
#endif

gisbase = getenv("GISBASE");
const char *gisbase = getenv("GISBASE");
if (gisbase && *gisbase) {
char localedir[GPATH_MAX];

Expand Down
1 change: 0 additions & 1 deletion lib/gis/make_loc.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ int G_make_location_crs(const char *location_name,
const char *proj_wkt)
{
int ret;
char path[GPATH_MAX];

ret = G_make_location(location_name, wind, proj_info, proj_units);

Expand Down
1 change: 0 additions & 1 deletion lib/gis/parser_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ char *G__json(void)
FILE *fp = stdout;

/*FILE *fp = NULL; */
char *type;
char *file_name = NULL;
int c;
int random_int = rand();
Expand Down
1 change: 0 additions & 1 deletion lib/imagery/manage_signatures.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ int I_signatures_remove(I_SIGFILE_TYPE type, const char *name)
{
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
char dir[GNAME_MAX];
int ret = 0;

G_debug(1, "I_signatures_remove(%d, %s);", type, name);

Expand Down
3 changes: 1 addition & 2 deletions lib/proj/do_proj.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,6 @@ int GPJ_init_transform(const struct pj_info *info_in,

G_important_message(_("Found %d possible transformations"), op_count);
for (i = 0; i < op_count; i++) {
const char *str;
const char *area_of_use, *projstr;
double e, w, s, n;
PJ_PROJ_INFO pj_info;
Expand Down Expand Up @@ -609,7 +608,7 @@ int GPJ_init_transform(const struct pj_info *info_in,
pj_info.accuracy);
}
#if PROJ_VERSION_NUM >= 6020000
str = proj_get_remarks(op);
const char *str = proj_get_remarks(op);
if (str && *str) {
G_important_message(" ");
G_important_message(_("Remarks: %s"), str);
Expand Down
2 changes: 1 addition & 1 deletion lib/raster/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void Rast__error_handler(void *p)

static int init(void)
{
char *zlib, *nulls, *cname;
char *nulls, *cname;

Rast__init_window();

Expand Down
4 changes: 2 additions & 2 deletions lib/vector/Vlib/intersect2.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int n_cross;
static CROSS *cross = NULL;
static int *use_cross = NULL;

static double rethresh = 0.000001; /* TODO */
/* static double rethresh = 0.000001; */ /* TODO */

static double d_ulp(double a, double b)
{
Expand Down Expand Up @@ -1198,7 +1198,7 @@ Vect_line_intersection2(struct line_pnts *APoints,
return 1;
}

static int cross_found; /* set by find_cross() */
/* static int cross_found; */ /* set by find_cross() */

/* find segment intersection, used by Vect_line_check_intersection2 */
static int find_cross(int i, int j, int b)
Expand Down
2 changes: 1 addition & 1 deletion lib/vector/Vlib/overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Vect_overlay_and(struct Map_info *AMap, int atype, struct ilist *AList,
struct ilist *BList, struct ilist *BAList,
struct Map_info *OMap)
{
int i, j, k, node, line, altype, bltype, oltype, area, centr;
int i, j, k, line, altype, bltype, oltype, area, centr;
struct line_pnts *Points;
struct line_cats *ACats, *BCats, *OCats;
struct ilist *AOList, *BOList;
Expand Down
3 changes: 1 addition & 2 deletions lib/vector/diglib/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ void dig_line_reset_updated(struct Plus_head *Plus)
*/
void dig_line_add_updated(struct Plus_head *Plus, int line, off_t offset)
{
int i;

G_debug(3, "dig_line_add_updated(): line = %d", line);

/* undo/redo in the digitizer needs all steps,
* disable check */
#if 0
int i;
/* Check if already in list */
for (i = 0; i < Plus->uplist.n_uplines; i++) {
if (Plus->uplist.uplines[i] == line) {
Expand Down
1 change: 0 additions & 1 deletion raster/r.fill.stats/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ void print_weights_matrix(long int rows, long int cols)
{
int i, j;
int weight_matrix_line_length = 80;
int weight_matrix_weight_length = 7;
char weight_matrix_line_buf[weight_matrix_line_length + 1];
char weight_matrix_weight_buf[weight_matrix_line_length + 1];

Expand Down
2 changes: 1 addition & 1 deletion raster/r.geomorphon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ int main(int argc, char **argv)

{ /* calculate parameters */
int num_outputs = 0;
double search_radius, skip_radius, start_radius, step_radius;
double search_radius, skip_radius;
double ns_resolution;

if (!strcmp(par_comparison->answer, "anglev1"))
Expand Down
2 changes: 1 addition & 1 deletion raster/r.kappa/prt2csv_mat.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void prn2csv_error_mat(int out_cols, int hdr)
int first_col = 0, last_col = 0;
int thisone;
long t_row, t_col;
long t_rowcount, grand_count;
long t_rowcount;
const char *mapone;
FILE *fd;

Expand Down
1 change: 0 additions & 1 deletion raster/r.random.surface/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ void Init(void)
struct Cell_head Region;
int row, col, i, j, NumWeight, NumDist, NumExp;
char *Name, *Number, String[80];
char msg[128], msg2[64];
double MinRes;

G_debug(2, "Init");
Expand Down
1 change: 0 additions & 1 deletion raster/r.sim/r.sim.water/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
/****************************************/
int main(int argc, char *argv[])
{
int ii;
int threads;
int ret_val;
double x_orig, y_orig;
Expand Down
1 change: 0 additions & 1 deletion raster/r.support/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ int check_stats(const char *name)
struct Categories cats;
struct Range range;
struct FPRange fprange;
int i;
int cats_ok;
int max;

Expand Down
2 changes: 1 addition & 1 deletion raster/r.viewshed/grass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ save_io_vis_and_elev_to_GRASS(IOVisibilityGrid * visgrid, char *elevfname,
}

dimensionType i, j;
double elev = 0, viewshed_value;
double elev = 0;

for (i = 0; i < Rast_window_rows(); i++) {

Expand Down

0 comments on commit c37871b

Please sign in to comment.