diff Meerwald/wm_bruyn_e.c @ 8:f83ef905a63d

fixing many warnings increase capacity for coordinates in bruyn fix some uninit. variables
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Tue, 22 Apr 2008 13:36:05 +0200
parents be303a3f5ea8
children 4987db85cfae
line wrap: on
line diff
--- a/Meerwald/wm_bruyn_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_bruyn_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -37,13 +37,11 @@
   gray **category1, **category2;
   gray maxval;
   double *slope;
-  int rows, cols, colors, format;
+  int rows, cols, format;
   int c;
   int i, j;
-  int r;
   int n;
   int col, row;
-  int bwidth, bheight;
   int n_block;
   int skipping = 0;
 
@@ -149,14 +147,15 @@
   }
 
   // open input image file or read from stdin
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "rb")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   // read signature file and set options
   // command line options override signature file options
   if (sig) {
@@ -213,7 +212,7 @@
   }
 
   if (pattern1 <= 0 || pattern2 <= 0 || pattern1 > NPATTERN || pattern2 > NPATTERN) {
-    fprintf(stderr, "%s: invalid pattern type specified\n");
+    fprintf(stderr, "%s: invalid pattern type specified\n", progname);
     exit(1);
   }
 
@@ -230,7 +229,7 @@
 
   // allocate structure to remember which blocks we already touched,
   // allow plenty of room to skip over blocks
-  if ((coords = alloc_coords(nbit_signature * 2)) == NULL) {
+  if ((coords = alloc_coords(nbit_signature * 16)) == NULL) {
     fprintf(stderr, "%s: unable to allocate memory\n", progname);
     exit(1);
   }
@@ -380,6 +379,7 @@
 
     // calculate mean values for zone/categories
     mean_1A = mean_1B = mean_2A = mean_2B = mean_1 = mean_2 = 0.0;
+    mean__1A = mean__1B = mean__2A = mean__2B  = 0.0;
     n_1A = n_1B = n_2A = n_2B = n_1 = n_2 = 0;
     for (i = 0; i < blocksize; i++)
       for (j = 0; j < blocksize; j++) {

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.