diff Meerwald/wm_bruyn_d.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_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_bruyn_d.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;
 
   char signature_name[MAXPATHLEN];
@@ -149,18 +147,19 @@
   }
 
   // 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) {
-    char line[128];
+    char line[1024];
     fgets(line, sizeof(line), sig);
     if (strspn(line, "BRSG") >= 4) {
       if (nbit_signature == 0)
@@ -214,7 +213,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);
   }
 
@@ -231,7 +230,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);
   }
@@ -279,7 +278,6 @@
     double smax;
     int alpha, beta_minus, beta_plus;
     double mean_1A, mean_1B, mean_2A, mean_2B, mean_1, mean_2;
-    double mean__1A, mean__1B, mean__2A, mean__2B;
     int n_1A, n_1B, n_2A, n_2B, n_1, n_2;
     double sigma, sigma_1, sigma_2;
     int zone1_ok, zone2_ok;
@@ -291,8 +289,10 @@
     } while (add_coord(coords, xb, yb) < 0);
 
     // copy image block
+    fprintf(stderr, "XXX1 %d %d %d\n", xb*blocksize, yb*blocksize, blocksize);
     copy_grays_to_block(block, image, xb * blocksize, yb * blocksize, blocksize, blocksize);    
-
+    fprintf(stderr, "XXX2\n");
+    
     if (verbose > 0)
       fprintf(stderr, "detecting bit #%d in block at (%d/%d)\n", n, xb * blocksize, yb * blocksize);
 

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