diff --git a/db/drivers/ogr/describe.c b/db/drivers/ogr/describe.c index 8c2688575b0..bf1ce160a30 100644 --- a/db/drivers/ogr/describe.c +++ b/db/drivers/ogr/describe.c @@ -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); diff --git a/display/d.vect.thematic/main.c b/display/d.vect.thematic/main.c index 21062d35d7a..1d8336aee4e 100644 --- a/display/d.vect.thematic/main.c +++ b/display/d.vect.thematic/main.c @@ -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; diff --git a/display/d.vect/opt.c b/display/d.vect/opt.c index a58886936ae..fcb9b02d7fe 100644 --- a/display/d.vect/opt.c +++ b/display/d.vect/opt.c @@ -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); diff --git a/imagery/i.eb.soilheatflux/g0.c b/imagery/i.eb.soilheatflux/g0.c index 6c4571f89b2..c43ba256231 100644 --- a/imagery/i.eb.soilheatflux/g0.c +++ b/imagery/i.eb.soilheatflux/g0.c @@ -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; diff --git a/lib/imagery/iscatt_structs.c b/lib/imagery/iscatt_structs.c index 638f84d4423..d4d8117718d 100644 --- a/lib/imagery/iscatt_structs.c +++ b/lib/imagery/iscatt_structs.c @@ -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) diff --git a/lib/raster3d/getblock.c b/lib/raster3d/getblock.c index 884c6d03d5b..2e03a92a9ec 100644 --- a/lib/raster3d/getblock.c +++ b/lib/raster3d/getblock.c @@ -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; diff --git a/lib/vector/Vlib/build_pg.c b/lib/vector/Vlib/build_pg.c index 965c95798d7..9a00c89095b 100644 --- a/lib/vector/Vlib/build_pg.c +++ b/lib/vector/Vlib/build_pg.c @@ -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]; diff --git a/raster/r.buffer/main.c b/raster/r.buffer/main.c index 28aa87ab08e..e481aabe7c6 100644 --- a/raster/r.buffer/main.c +++ b/raster/r.buffer/main.c @@ -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; diff --git a/raster/r.fill.stats/main.c b/raster/r.fill.stats/main.c index 1f5a7a734ca..4339e42c4b1 100644 --- a/raster/r.fill.stats/main.c +++ b/raster/r.fill.stats/main.c @@ -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"; diff --git a/raster/r.resamp.rst/main.c b/raster/r.resamp.rst/main.c index d50e3b69df4..1f7ab01d4cd 100644 --- a/raster/r.resamp.rst/main.c +++ b/raster/r.resamp.rst/main.c @@ -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; diff --git a/raster3d/r3.in.bin/main.c b/raster3d/r3.in.bin/main.c index 9fc9e043753..ee5e2e8f6c3 100644 --- a/raster3d/r3.in.bin/main.c +++ b/raster3d/r3.in.bin/main.c @@ -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; diff --git a/raster3d/r3.in.v5d/v5d.c b/raster3d/r3.in.v5d/v5d.c index 515960403eb..5e2e2fcf43d 100644 --- a/raster3d/r3.in.v5d/v5d.c +++ b/raster3d/r3.in.v5d/v5d.c @@ -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", @@ -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); @@ -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') { diff --git a/raster3d/r3.out.bin/main.c b/raster3d/r3.out.bin/main.c index c80e1f48f10..ef863bee19f 100644 --- a/raster3d/r3.out.bin/main.c +++ b/raster3d/r3.out.bin/main.c @@ -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; diff --git a/raster3d/r3.out.v5d/v5d.c b/raster3d/r3.out.v5d/v5d.c index 4ba3327c5b4..460fd991fba 100644 --- a/raster3d/r3.out.v5d/v5d.c +++ b/raster3d/r3.out.v5d/v5d.c @@ -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) { @@ -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); @@ -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') { diff --git a/vector/v.normal/main.c b/vector/v.normal/main.c index 160eee044fb..d9f9fcb2072 100644 --- a/vector/v.normal/main.c +++ b/vector/v.normal/main.c @@ -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); diff --git a/vector/v.proj/main.c b/vector/v.proj/main.c index 82c0d38b624..2061d126ed2 100644 --- a/vector/v.proj/main.c +++ b/vector/v.proj/main.c @@ -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; diff --git a/vector/v.sample/main.c b/vector/v.sample/main.c index 6702ffdbc4c..f09a1c45008 100644 --- a/vector/v.sample/main.c +++ b/vector/v.sample/main.c @@ -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); diff --git a/vector/v.to.rast3/main.c b/vector/v.to.rast3/main.c index 0a117af8cfd..05383064bdc 100644 --- a/vector/v.to.rast3/main.c +++ b/vector/v.to.rast3/main.c @@ -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);