Skip to content

Commit

Permalink
Fix -Wsometimes-uninitialized compiler warnings (#2165)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilason authored Nov 8, 2022
1 parent 5d64de2 commit 5184a91
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions db/drivers/ogr/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ int describe_table(OGRLayerH hLayer, dbTable ** table, cursor * c)
}

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

hFieldDefn = OGR_FD_GetFieldDefn(hFeatureDefn, i);
ogrType = OGR_Fld_GetType(hFieldDefn);
Expand Down
2 changes: 1 addition & 1 deletion display/d.vect.thematic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char **argv)
int *cats, ncat, nrec, ctype;
struct Map_info Map;
struct field_info *fi;
dbDriver *driver;
dbDriver *driver = NULL;
dbHandle handle;
dbCatValArray cvarr;
struct Cell_head window;
Expand Down
2 changes: 1 addition & 1 deletion display/d.vect/opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void options_to_lattr(LATTR *lattr, const char *layer,

int option_to_color(struct color_rgb *color, const char *color_val)
{
int has_color, ret;
int has_color = 0, ret;
int r, g, b;

ret = G_str_to_color(color_val, &r, &g, &b);
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.eb.soilheatflux/g0.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ double g_0(double bbalb, double ndvi, double tempk, double rnet,
double time, int roerink)
{
double a, b, result;
double r0_coef;
double r0_coef = 1.1;

if (time <= 9.0 || time > 15.0)
r0_coef = 1.1;
Expand Down
2 changes: 1 addition & 1 deletion lib/imagery/iscatt_structs.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void I_sc_free_cats(struct scCats *cats)
*/
int I_sc_add_cat(struct scCats *cats)
{
int i_scatt, i_cat_id, cat_id;
int i_scatt, i_cat_id, cat_id = 0;
int n_a_cats = cats->n_a_cats;

if (cats->n_a_cats >= cats->n_cats)
Expand Down
2 changes: 1 addition & 1 deletion lib/raster3d/getblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void
Rast3d_get_block_nocache(RASTER3D_Map * map, int x0, int y0, int z0, int nx,
int ny, int nz, void *block, int type)
{
void *tile;
void *tile = NULL;
int tileX0, tileY0, tileZ0, tileOffsX0, tileOffsY0, tileOffsZ0;
int tileX1, tileY1, tileZ1, tileOffsX1, tileOffsY1, tileOffsZ1;
int tx, ty, tz, dx, dy, dz, x, y, z, rows, cols, depths;
Expand Down
2 changes: 1 addition & 1 deletion lib/vector/Vlib/build_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int Vect_build_pg(struct Map_info *Map, int build)
*/
int build_topo(struct Map_info *Map, int build)
{
int line, type, s, n_nodes;
int line, type, s, n_nodes = 0;
int area, nareas, isle, nisles;
int face[2];
char stmt[DB_SQL_MAX];
Expand Down
2 changes: 1 addition & 1 deletion raster/r.buffer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char *argv[])
struct Distance *pd;
const char *input, *output, *mapset;
char **zone_list;
double to_meters;
double to_meters = 1.0;
const char *units;
int offset;
int count;
Expand Down
4 changes: 2 additions & 2 deletions raster/r.fill.stats/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,8 +1073,8 @@ int main(int argc, char *argv[])
}
}
}
char *data_type_string_in;
char *data_type_string_out;
char *data_type_string_in = NULL;
char *data_type_string_out = NULL;

if (IN_TYPE == CELL_TYPE) {
data_type_string_in = "integer";
Expand Down
2 changes: 1 addition & 1 deletion raster/r.resamp.rst/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int main(int argc, char *argv[])
{
int m1;
struct FPRange range;
DCELL cellmin, cellmax;
DCELL cellmin = 0.0, cellmax;
FCELL *cellrow, fcellmin;

struct GModule *module;
Expand Down
2 changes: 1 addition & 1 deletion raster3d/r3.in.bin/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ int main(int argc, char *argv[])
int is_integer;
int is_signed;
int bytes;
int order;
int order = 0;
int byte_swap;
RASTER_MAP_TYPE map_type;
off_t file_size;
Expand Down
6 changes: 3 additions & 3 deletions raster3d/r3.in.v5d/v5d.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ v5dstruct *v5dOpenFile(const char *filename, v5dstruct * v)
int v5dReadCompressedGrid(v5dstruct * v, int time, int var,
float *ga, float *gb, void *compdata)
{
int pos, n, k;
int pos, n, k = 0;

if (time < 0 || time >= v->NumTimes) {
printf("Error in v5dReadCompressedGrid: bad timestep argument (%d)\n",
Expand Down Expand Up @@ -2097,7 +2097,7 @@ int v5dReadGrid(v5dstruct * v, int time, int var, float data[])
{
float ga[MAXLEVELS], gb[MAXLEVELS];
void *compdata;
int bytes;
int bytes = 0;

if (time < 0 || time >= v->NumTimes) {
printf("Error in v5dReadGrid: bad timestep argument (%d)\n", time);
Expand Down Expand Up @@ -2490,7 +2490,7 @@ int v5dWriteGrid(v5dstruct * v, int time, int var, const float data[])
{
float ga[MAXLEVELS], gb[MAXLEVELS];
void *compdata;
int n, bytes;
int n, bytes = 0;
float min, max;

if (v->Mode != 'w') {
Expand Down
2 changes: 1 addition & 1 deletion raster3d/r3.out.bin/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int main(int argc, char *argv[])
char *outfile;
double null_val;
int do_stdout;
int order;
int order = 0;
int swap_flag;
int bytes;
int as_integer = 0;
Expand Down
6 changes: 3 additions & 3 deletions raster3d/r3.out.v5d/v5d.c
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,7 @@ v5dstruct *v5dOpenFile(const char *filename, v5dstruct * v)
int v5dReadCompressedGrid(v5dstruct * v, int time, int var,
float *ga, float *gb, void *compdata)
{
int n, k;
int n, k = 0;
off_t pos;

if (time < 0 || time >= v->NumTimes) {
Expand Down Expand Up @@ -2096,7 +2096,7 @@ int v5dReadGrid(v5dstruct * v, int time, int var, float data[])
{
float ga[MAXLEVELS], gb[MAXLEVELS];
void *compdata;
int bytes;
int bytes = 0;

if (time < 0 || time >= v->NumTimes) {
printf("Error in v5dReadGrid: bad timestep argument (%d)\n", time);
Expand Down Expand Up @@ -2491,7 +2491,7 @@ int v5dWriteGrid(v5dstruct * v, int time, int var, const float data[])
{
float ga[MAXLEVELS], gb[MAXLEVELS];
void *compdata;
int n, bytes;
int n, bytes = 0;
float min, max;

if (v->Mode != 'w') {
Expand Down
2 changes: 1 addition & 1 deletion vector/v.normal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int main(int argc, char **argv)
nsites = 0;
for (line = 1; line <= nlines; line++) {
int type, cat, ret, cval;
double dval;
double dval = 0.0;

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

Expand Down
2 changes: 1 addition & 1 deletion vector/v.proj/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char *argv[])
#ifdef HAVE_PROJ_H
struct Option *pipeline; /* name of custom PROJ pipeline */
#endif
struct Key_Value *in_proj_keys, *in_unit_keys;
struct Key_Value *in_proj_keys = NULL, *in_unit_keys = NULL;
struct Key_Value *out_proj_keys, *out_unit_keys;
struct line_pnts *Points, *Points2;
struct line_cats *Cats;
Expand Down
2 changes: 1 addition & 1 deletion vector/v.sample/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ int main(int argc, char **argv)
nlines = Vect_get_num_lines(&In);

for (line = 1; line <= nlines; line++) {
int type, cat, ret, cval;
int type, cat = -1, ret, cval;
double dval;

G_debug(3, "line = %d", line);
Expand Down
2 changes: 1 addition & 1 deletion vector/v.to.rast3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int main(int argc, char *argv[])

nlines = Vect_get_num_lines(&Map);
for (line = 1; line <= nlines; line++) {
int type, cat, depth, row, col, ret;
int type, cat, depth, row, col, ret = DB_FAILED;
double value;

G_percent(line, nlines, 2);
Expand Down

0 comments on commit 5184a91

Please sign in to comment.