Skip to content

Commit

Permalink
raster: Fix uninitialized variable issue for C raster modules (OSGeo#…
Browse files Browse the repository at this point in the history
…4065)

raster: Fix uninitialized variable issue for c files in raster
  • Loading branch information
ShubhamDesai authored Jul 18, 2024
1 parent 972bd32 commit 0c3fded
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion raster/r.coin/print_coin.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int print_coin(int Conformat, int out_cols, int tofile)
double colarea_no_0, rowarea_no_0;
double area;

int addflag;
int addflag = 0;
char topformat[133], midformat[133], namformat[133];
char fillformat[133];
const char *mapone;
Expand Down
2 changes: 1 addition & 1 deletion raster/r.mapcalc/map3.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void translate_from_cats(map *m, CELL *cell, DCELL *xcell, int ncols)
{
struct Categories *pcats;
BTREE *btree;
int i, idx;
int i = 0, idx = 0;
CELL cat, key;
double vbuf[1 << SHIFT];
double *values;
Expand Down
2 changes: 1 addition & 1 deletion raster/r.object.geometry/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char *argv[])
} *obj_geos;
double unit_area;
int n_objects;
int planimetric, compute_areas;
int planimetric = 0, compute_areas = 0;
struct Cell_head cellhd;

G_gisinit(argv[0]);
Expand Down
2 changes: 1 addition & 1 deletion raster/r.out.mpeg/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static int load_files(void)
register int i, rowoff, row, col, vxoff, vyoff, offset;
int cnt, fd, size, tsiz, coff;
int vnum;
int y_rows, y_cols;
int y_rows = 0, y_cols = 0;
char *pr, *pg, *pb;
unsigned char *tr, *tg, *tb, *tset;
char *mpfilename, *name;
Expand Down
4 changes: 2 additions & 2 deletions raster/r.sim/simlib/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ double gasdev(void)
double ret_val;

/* Local variables */
double r = 0., vv1, vv2, fac;
double r = 0.0, vv1 = 0.0, vv2 = 0.0, fac = 0.0;

if (iset == 0) {
while (r >= 1. || r == 0.) {
Expand All @@ -47,7 +47,7 @@ double gasdev(void)

void gasdev_for_paralel(double *x, double *y)
{
double r = 0., vv1, vv2, fac;
double r = 0.0, vv1 = 0.0, vv2 = 0.0, fac = 0.0;

while (r >= 1. || r == 0.) {
vv1 = simwe_rand() * 2. - 1.;
Expand Down
2 changes: 1 addition & 1 deletion raster/r.spreadpath/path_finder.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

void path_finder(int row, int col, int backrow, int backcol)
{
int data, new_backrow, new_backcol;
int data = 0, new_backrow = 0, new_backcol = 0;
extern char *value;
extern int nrows, ncols;
extern SEGMENT in_row_seg, in_col_seg, out_seg;
Expand Down
2 changes: 1 addition & 1 deletion raster/r.statistics/o_kurt.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int o_kurt(const char *basemap, const char *covermap, const char *outputmap,
{
struct Popen stats_child, reclass_child;
FILE *stats, *reclass;
int first, i, count;
int first, i, count = 0;
size_t mem;
long basecat, covercat, catb, catc;
double value, var, x;
Expand Down
2 changes: 1 addition & 1 deletion raster/r.statistics/o_sdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int o_sdev(const char *basemap, const char *covermap, const char *outputmap,
{
struct Popen stats_child, reclass_child;
FILE *stats, *reclass;
int first, i, count;
int first, i, count = 0;
size_t mem;
long basecat, covercat, catb, catc;
double value, sdev, x;
Expand Down
2 changes: 1 addition & 1 deletion raster/r.statistics/o_skew.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int o_skew(const char *basemap, const char *covermap, const char *outputmap,
{
struct Popen stats_child, reclass_child;
FILE *stats, *reclass;
int first, i, count;
int first, i, count = 0;
size_t mem;
long basecat, covercat, catb, catc;
double value, var, x;
Expand Down

0 comments on commit 0c3fded

Please sign in to comment.