changeset 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 2b350281f8b0
children e496e3b113b6
files Meerwald/cmp_bruyn_sig.c Meerwald/cmp_corvi_sig.c Meerwald/cmp_cox_sig.c Meerwald/cmp_dct.c Meerwald/cmp_dct8x8.c Meerwald/cmp_dugad_sig.c Meerwald/cmp_dwt.c Meerwald/cmp_frid2_sig.c Meerwald/cmp_kim_sig.c Meerwald/cmp_koch_sig.c Meerwald/cmp_kund2_sig.c Meerwald/cmp_kund3_sig.c Meerwald/cmp_pgm.c Meerwald/cmp_wang_sig.c Meerwald/cmp_xia_sig.c Meerwald/cmp_xie2_sig.c Meerwald/cmp_xie_sig.c Meerwald/cmp_zhu_sig.c Meerwald/coord.c Meerwald/dct.c Meerwald/dwt.c Meerwald/gen_bruyn_sig.c Meerwald/gen_corvi_sig.c Meerwald/gen_cox_sig.c Meerwald/gen_dugad_sig.c Meerwald/gen_frid2_sig.c Meerwald/gen_kim_sig.c Meerwald/gen_koch_sig.c Meerwald/gen_kund2_sig.c Meerwald/gen_kund3_sig.c Meerwald/gen_wang_sig.c Meerwald/gen_xia_sig.c Meerwald/gen_xie2_sig.c Meerwald/gen_xie_sig.c Meerwald/gen_zhu_sig.c Meerwald/param_stuff.c Meerwald/signature.c Meerwald/wang_common.c Meerwald/wavelet.c Meerwald/wavelet.h Meerwald/wm.h Meerwald/wm_bruyn_d.c Meerwald/wm_bruyn_e.c Meerwald/wm_corvi_d.c Meerwald/wm_corvi_e.c Meerwald/wm_cox_d.c Meerwald/wm_cox_e.c Meerwald/wm_dugad_d.c Meerwald/wm_dugad_e.c Meerwald/wm_frid2_d.c Meerwald/wm_frid2_e.c Meerwald/wm_kim_d.c Meerwald/wm_kim_e.c Meerwald/wm_koch_d.c Meerwald/wm_koch_e.c Meerwald/wm_kund2_d.c Meerwald/wm_kund2_e.c Meerwald/wm_kund3_d.c Meerwald/wm_kund3_e.c Meerwald/wm_wang_d.c Meerwald/wm_wang_e.c Meerwald/wm_xia_d.c Meerwald/wm_xia_e.c Meerwald/wm_xie2_d.c Meerwald/wm_xie2_e.c Meerwald/wm_xie_d.c Meerwald/wm_xie_e.c Meerwald/wm_zhu_d.c Meerwald/wm_zhu_e.c make/make.linux
diffstat 70 files changed, 348 insertions(+), 374 deletions(-) [+]
line wrap: on
line diff
--- a/Meerwald/cmp_bruyn_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_bruyn_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -80,14 +80,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "BRSG") >= 4) {
@@ -109,7 +110,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_corvi_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_corvi_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -74,14 +74,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  } 
+  
   if (!sig) {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
     exit(1);
--- a/Meerwald/cmp_cox_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_cox_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -24,7 +24,7 @@
 
   int c;
   int sig_n, in_n;
-  double sig_a, in_a;
+  double sig_a;
   double sig_mean, sig_variance;
   double s1, s2, s3;
   char line[32];
@@ -75,14 +75,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (!sig) {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
     exit(1);
--- a/Meerwald/cmp_dct.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_dct.c	Tue Apr 22 13:36:05 2008 +0200
@@ -102,14 +102,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig && !no_orig) {
     fprintf(stderr, "%s: original image file not specified, using zero image\n", progname);
     strcpy(orig_name, "(zero)");
--- a/Meerwald/cmp_dct8x8.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_dct8x8.c	Tue Apr 22 13:36:05 2008 +0200
@@ -97,14 +97,15 @@
     exit(1);
   }
 
-  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]);
-
+  } 
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
@@ -119,6 +120,11 @@
     exit(1);
   }
 
+  cols = in_cols;
+  rows = in_rows;
+  format = in_format;
+  maxval = in_maxval;
+
   if (cols % NJPEG) {
     fprintf(stderr, "%s: image width %d not a multiple of %d\n", progname, cols, NJPEG);
     exit(1);
@@ -129,11 +135,6 @@
     exit(1);
   }
 
-  cols = in_cols;
-  rows = in_rows;
-  format = in_format;
-  maxval = in_maxval;
-
   input_image = pgm_allocarray(cols, NJPEG);
   orig_image = pgm_allocarray(cols, NJPEG);
 
--- a/Meerwald/cmp_dugad_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_dugad_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -15,7 +15,6 @@
 
   FILE *in = stdin;
   FILE *out = stdout;
-  FILE *sig = NULL;
 
   char output_name[MAXPATHLEN] = "(stdout)";
   char input_name[MAXPATHLEN] = "(stdin)";
@@ -28,7 +27,6 @@
 
   int correlation_only = 0;
   int verbose = 0;
-  double corr;
 	
   progname = argv[0];
 
@@ -68,14 +66,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   fgets(line, sizeof(line), in);
   if (strspn(line, "DGWM") < 4) {
     fprintf(stderr, "%s: watermark file %s invalid\n", progname, input_name);
@@ -94,11 +93,12 @@
 
     // HL subband
     fscanf(in, "%d %lf %lf\n", &m, &z, &v);
-    if (verbose && !correlation_only)
+    if (verbose && !correlation_only) {
       if (m)
         fprintf(out, "%f %f\n",  z /  (double) m, (v * alpha) / (double) (1.0 * m));
       else
         fprintf(out, "0.0 0.0\n");
+    }
     if (m) {
       ok += (z > v * alpha / (double) 1.0) ? 1 : 0;
       diff += ((z - v * alpha) / (double) (1.0 * m)); 
@@ -108,11 +108,12 @@
 
     // LH subband
     fscanf(in, "%d %lf %lf\n", &m, &z, &v);
-    if (verbose && !correlation_only)
+    if (verbose && !correlation_only) {
       if (m)
         fprintf(out, "%f %f\n", z / (double) m, (v * alpha) / (double) (1.0 * m));
       else
         fprintf(out, "0.0 0.0\n");
+    }
     if (m) {
       ok += (z > v * alpha / (double) 1.0) ? 1 : 0;
       diff += ((z - v * alpha) / (double) (1.0 * m)); 
@@ -122,12 +123,13 @@
 
     // HH subband
     fscanf(in, "%d %lf %lf\n", &m, &z, &v);
-    if (verbose && !correlation_only)
+    if (verbose && !correlation_only) {
       if (m)
         fprintf(out, "%f %f\n", z / (double) m, (v * alpha) / (double) (1.0 * m));
       else
         fprintf(out, "0.0 0.0\n");
- 
+    }
+    
     if (m) {
       ok += (z > v * alpha / (double) 1.0) ? 1 : 0;
       diff += ((z - v * alpha) / (double) (1.0 * m)); 
--- a/Meerwald/cmp_dwt.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_dwt.c	Tue Apr 22 13:36:05 2008 +0200
@@ -26,7 +26,6 @@
 }
 
 void process_subband_var(gray **output, int cols, int rows, Image_tree p, Image_tree q, int type, double min, double max, gray maxval) {
-  int i;
   int col, row, startcol, startrow;
 
   if (!p || !q) return;
@@ -41,7 +40,6 @@
 }
 
 void process_subband_fixed(gray **output, int cols, int rows, Image_tree p, Image_tree q, int type, double m) {
-  int i;
   int col, row, startcol, startrow;
 
   if (!p || !q) return;
@@ -95,7 +93,7 @@
   gray orig_maxval;
   int cols, rows, format;
   gray maxval;
-  int col, row;
+  int row;
 
   int no_orig = 0;
   int m = 0;
@@ -210,14 +208,15 @@
 
   print = print_psnr_only ? out : stderr;
 
-  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]);
-
+  }
+  
   if (!orig && !no_orig) {
     fprintf(stderr, "%s: original image file not specified, using zero image\n", progname);
     strcpy(orig_name, "(zero)");
--- a/Meerwald/cmp_frid2_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_frid2_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -29,10 +29,8 @@
   int corr1 = 0, match1 = 0;
   int corr2 = 0, match2 = 0;
   int verbose = 0;
-  char filter_name[MAXPATHLEN] = "";
 
-  int seed;
-  char line[32];
+  char line[1024];
 
   progname = argv[0];
 
@@ -77,14 +75,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "FR2SG") >= 5) {
@@ -100,7 +99,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_kim_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_kim_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -22,7 +22,7 @@
   char output_name[MAXPATHLEN] = "(stdout)";
   char input_name[MAXPATHLEN] = "(stdin)";
 
-  int c, i, j, n;
+  int c, i;
   int in_level;
   double *input_watermark, *orig_watermark;
   int sig_n, in_n;
@@ -80,13 +80,14 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
+  }
 
   if (!sig) {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_koch_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_koch_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -77,14 +77,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "KCSG") >= 4) {
@@ -101,7 +102,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_kund2_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_kund2_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -84,14 +84,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "KD2SG") >= 5) {
@@ -115,7 +116,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_kund3_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_kund3_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -83,14 +83,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "KD3SG") >= 5) {
@@ -113,7 +114,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_pgm.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_pgm.c	Tue Apr 22 13:36:05 2008 +0200
@@ -36,7 +36,6 @@
   gray maxval;
   int col, row;
 
-  int i;
   int c;
 
   int m = 0;
@@ -99,14 +98,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/cmp_wang_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_wang_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -75,14 +75,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+    
   if (!sig) {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
     exit(1);
--- a/Meerwald/cmp_xia_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_xia_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -80,14 +80,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (!sig) {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
     exit(1);
--- a/Meerwald/cmp_xie2_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_xie2_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -33,8 +33,6 @@
   int level = 0;
   int quant = 0;
   double alpha = 0.0;
-  double intensity = 0.0;
-  int subband = 0;
   char filter_name[MAXPATHLEN] = "";
 
   int seed;
@@ -83,14 +81,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "XE2SG") >= 5) {
@@ -111,7 +110,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_xie_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_xie_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -32,8 +32,6 @@
   int method = 0;
   int level = 0;
   double alpha = 0.0;
-  double intensity = 0.0;
-  int subband = 0;
   char filter_name[MAXPATHLEN] = "";
 
   int seed;
@@ -82,14 +80,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (sig) {
     fgets(line, sizeof(line), sig);
     if (strspn(line, "XESG") >= 4) {
@@ -109,7 +108,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
   else {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
--- a/Meerwald/cmp_zhu_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/cmp_zhu_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -80,14 +80,15 @@
     exit(1);
   }
 
-  if (argc == 1 && *argv[0] != '-')
+  if (argc == 1 && *argv[0] != '-') {
     if ((in = fopen(argv[0], "r")) == NULL) {
       fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
       exit(1);
     }
     else
       strcpy(input_name, argv[0]);
-
+  }
+  
   if (!sig) {
     fprintf(stderr, "%s: original signature file not specified, use -s file option\n", progname);
     exit(1);
--- a/Meerwald/coord.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/coord.c	Tue Apr 22 13:36:05 2008 +0200
@@ -5,7 +5,7 @@
 struct coords *alloc_coords(int n) {
   struct coords *c;
 
-  if (c = malloc(sizeof(struct coords)))
+  if ((c = malloc(sizeof(struct coords))) != NULL)
     init_coords(c, n);
 #ifdef DEBUG
   else
@@ -39,7 +39,7 @@
   c->count = 0;
   c->max = n;
 
-  if (c->values = malloc(n * sizeof(struct coord)))
+  if ((c->values = malloc(n * sizeof(struct coord))) != NULL)
     return 0;
   else
     return -1;
--- a/Meerwald/dct.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/dct.c	Tue Apr 22 13:36:05 2008 +0200
@@ -556,7 +556,7 @@
 }
 
 void fdct_block_8x8(gray **input, int col, int row, double **output) {
-  int i, j;
+  int i;
   gray *input_array[NJPEG];
 
   for (i = 0; i < NJPEG; i++)
@@ -600,7 +600,7 @@
 }
 
 void idct_block_8x8(double **input, gray **output, int col, int row) {
-  int i, j;
+  int i;
   gray *output_array[NJPEG];
 
   for (i = 0; i < NJPEG; i++)
--- a/Meerwald/dwt.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/dwt.c	Tue Apr 22 13:36:05 2008 +0200
@@ -278,7 +278,7 @@
     switch (which) {
         case FILTERG:
         case FILTERGi:
-          filter[k] = (double) (((i+1 & 0x01) * 2) - 1) * tf[i++];
+          filter[k] = (double) ((((i+1) & 0x01) * 2) - 1) * tf[i++];
           break;
         case FILTERH:
         case FILTERHi:
@@ -294,8 +294,6 @@
   return filterlength;
 }
 
-
-
 void dwt_param_filter(double alpha[], int param_len[]) {
   FilterGH filter;  
   int i;
--- a/Meerwald/gen_bruyn_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_bruyn_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -131,17 +131,18 @@
   }
 
   if (b % 2 > 0 || b <= 2) {
-    fprintf(stderr, "%s: block size has to be even and greater than 2\n");
+    fprintf(stderr, "%s: block size has to be even and greater than 2\n", progname);
     exit(1);
   }
 
-  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
@@ -221,7 +222,7 @@
   fprintf(out, "%f\n", t1);
   fprintf(out, "%f\n", t2);
   fprintf(out, "%d\n", b);
-  fprintf(out, "%d\n", random());
+  fprintf(out, "%ld\n", random());
   fwrite(signature, sizeof(char), nb, out);
   fprintf(out, "\n");
 
--- a/Meerwald/gen_corvi_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_corvi_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -23,7 +23,6 @@
   char output_name[MAXPATHLEN] = "(stdout)";
 
   int c;
-  int i;
   int n = 1000;
   int s = 0;
   int e = 2;
--- a/Meerwald/gen_cox_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_cox_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -23,7 +23,6 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 100;
   int s = 0;
   double a = 0.3;
@@ -115,7 +114,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
 
   if (s)
--- a/Meerwald/gen_dugad_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_dugad_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -29,7 +29,6 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 1000;
   int s = 0;
   int e = 2;
@@ -84,7 +83,7 @@
       case 'l':      
         l = atoi(optarg);
         if (l <= 0) {
-          fprintf(stderr, "%s: decomposition level %d out of range\n", l);
+          fprintf(stderr, "%s: decomposition level %d out of range\n", progname, l);
           exit(1);
         }
         break;
--- a/Meerwald/gen_frid2_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_frid2_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -94,13 +94,14 @@
     exit(1);
   }
 
-  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);   
+  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]);
   }
-  else
-    strcpy(input_name, argv[0]);
 
   if (!s)
     s = time(NULL) * getpid();
--- a/Meerwald/gen_kim_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_kim_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -28,7 +28,6 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 1000;
   int s = 0;
   int e = 2;
--- a/Meerwald/gen_koch_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_koch_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -64,7 +64,7 @@
       case 'q':
         q = atoi(optarg);
         if (q <= 0 || q > 100) {
-          fprintf(stderr, "%s: quantization factor %f out of range\n", progname, q);
+          fprintf(stderr, "%s: quantization factor %d out of range\n", progname, q);
           exit(1);
         }
         break;
@@ -89,14 +89,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (s)
     srandom(s);
   else
@@ -147,7 +148,7 @@
   fprintf(out, "%d\n", n);
   fprintf(out, "%f\n", l);
   fprintf(out, "%d\n", q);
-  fprintf(out, "%d\n", random());
+  fprintf(out, "%ld\n", random());
   fwrite(signature, sizeof(char), nb, out);
   fprintf(out, "\n");
 
--- a/Meerwald/gen_kund2_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_kund2_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -129,14 +129,15 @@
     exit(1);
   }
 
-  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);
+  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]);
   }
-  else
-    strcpy(input_name, argv[0]);
-
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
@@ -174,7 +175,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
 
   if (s)
@@ -208,7 +209,7 @@
   fprintf(out, "%d\n", f);
   fprintf(out, "%s\n", F);
   fprintf(out, "%d\n", l);
-  fprintf(out, "%d\n", random());
+  fprintf(out, "%ld\n", random());
   binstr = malloc((nbit_signature + 1) * sizeof(char));
   sig_to_binstr(binstr);
   fprintf(out, "%s\n", binstr);
--- a/Meerwald/gen_kund3_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_kund3_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -122,13 +122,14 @@
     exit(1);
   }
 
-  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);
+  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]);
   }
-  else
-    strcpy(input_name, argv[0]);
 
   if (sig) {
     char line[32];
@@ -163,7 +164,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
 
   if (s)
@@ -195,7 +196,7 @@
   fprintf(out, "%d\n", f);
   fprintf(out, "%s\n", F);
   fprintf(out, "%d\n", l);
-  fprintf(out, "%d\n", random());
+  fprintf(out, "%ld\n", random());
   nbit_signature = NBYTESTOBITS(n_signature);
   binstr = malloc((nbit_signature + 1) * sizeof(char));
   sig_to_binstr(binstr);
--- a/Meerwald/gen_wang_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_wang_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -27,7 +27,6 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 1000;
   int s = 0;
   int e = 2;
--- a/Meerwald/gen_xia_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_xia_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -27,7 +27,6 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 1000;
   int s = 0;
   int e = 2;
--- a/Meerwald/gen_xie2_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_xie2_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -125,14 +125,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
@@ -170,7 +171,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
 
   if (s)
@@ -203,7 +204,7 @@
   fprintf(out, "%s\n", F);
   fprintf(out, "%d\n", q);
   fprintf(out, "%d\n", l);
-  fprintf(out, "%d\n", random());
+  fprintf(out, "%ld\n", random());
   fwrite(signature, sizeof(char), nb, out);
   fprintf(out, "\n");
 
--- a/Meerwald/gen_xie_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_xie_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -120,13 +120,14 @@
     exit(1);
   }
 
-  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]);
+  }
 
   if (sig) {
     char line[32];
@@ -161,7 +162,7 @@
       fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name);
       exit(1);
     }
-    close(sig);
+    fclose(sig);
   }
 
   if (s)
@@ -193,7 +194,7 @@
   fprintf(out, "%d\n", f);
   fprintf(out, "%s\n", F);
   fprintf(out, "%d\n", l);
-  fprintf(out, "%d\n", random());
+  fprintf(out, "%ld\n", random());
   fwrite(signature, sizeof(char), nb, out);
   fprintf(out, "\n");
 
--- a/Meerwald/gen_zhu_sig.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/gen_zhu_sig.c	Tue Apr 22 13:36:05 2008 +0200
@@ -27,7 +27,6 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 1000;
   int s = 0;
   int e = 2;
--- a/Meerwald/param_stuff.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/param_stuff.c	Tue Apr 22 13:36:05 2008 +0200
@@ -35,7 +35,7 @@
 
         alpha[alpha_len] = alpha_value;
         alpha_len++;
-      } while (v = strtok(NULL, "\",; "));
+      } while ((v = strtok(NULL, "\",; ")));
       
 
       if( param_len_str && strlen(param_len_str) < sizeof(buf)
@@ -59,7 +59,7 @@
 	  param_len_len++;
 	  param_len_sum += param_len_value;
 
-	} while (v = strtok(NULL, "\",; "));
+	} while ((v = strtok(NULL, "\",; ")));
 
       } else {
 	/* No length variable given.
--- a/Meerwald/signature.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/signature.c	Tue Apr 22 13:36:05 2008 +0200
@@ -36,7 +36,7 @@
   return _get_signature_bit(signature2, NSIGNATURE, n);
 }
 
-void _set_signature_bit(char *s, int lim, int n, int v) {
+void _set_signature_bit(char *s, int limit, int n, int v) {
   int byte = n >> 3;
   int bit = n & 7;
 
@@ -83,15 +83,15 @@
 }
 
 int binstr_to_sig(const char *binstr) {
-  _binstr_to_sig(binstr, signature, &n_signature, &nbit_signature);
+  return _binstr_to_sig(binstr, signature, &n_signature, &nbit_signature);
 }
 
 int binstr_to_sig1(const char *binstr) {
-  _binstr_to_sig(binstr, signature1, &n_signature1, &nbit_signature1);
+  return _binstr_to_sig(binstr, signature1, &n_signature1, &nbit_signature1);
 }
 
 int binstr_to_sig2(const char *binstr) {
-  _binstr_to_sig(binstr, signature2, &n_signature2, &nbit_signature2);
+  return _binstr_to_sig(binstr, signature2, &n_signature2, &nbit_signature2);
 }
 
 int _sig_to_binstr(char *binstr, char *sig, int bits) {
--- a/Meerwald/wang_common.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wang_common.c	Tue Apr 22 13:36:05 2008 +0200
@@ -130,7 +130,7 @@
 }
 
 int select_subband_coeff(Subband_data subband) {
-  select_subband_coeff_from(subband, 0);
+  return select_subband_coeff_from(subband, 0);
 }
 
 void mark_subband_coeff(Subband_data subband, int coeff) {
--- a/Meerwald/wavelet.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wavelet.c	Tue Apr 22 13:36:05 2008 +0200
@@ -4,6 +4,7 @@
 #include <math.h>
 #include "wavelet.h"
 #include <ctype.h>
+#include <values.h>
 
 static int read_char(FILE *fp);
 static int read_int(FILE *fp);
@@ -140,7 +141,7 @@
  *	This function loads an IntImage with load_intimage
  *	and then converts to Image.
  ************************************************************************/
-extern Image load_image(char *file, int max_val)
+Image load_image(char *file, int max_val)
 {
 	Image img;
 	IntImage intimg;
@@ -164,7 +165,7 @@
 /*	                                              			*/
 /************************************************************************/
 
-extern int save_image_P5(char *file, Image img)
+int save_image_P5(char *file, Image img)
 {       FILE *fp;
         Pixel *data;
         long i;
@@ -202,7 +203,7 @@
 		(img->data)[i]=(Pixel) 0;
 }
 
-extern void copy_into_image(Image img1,Image img2,int x,int y)
+void copy_into_image(Image img1,Image img2,int x,int y)
 /* copy img2 into img1 at position (x,y)*/
 {
         int start,i,j,aim;
@@ -219,7 +220,7 @@
         }
 }
 
-extern void copy_into_intimage(IntImage img1,IntImage img2,int x,int y)
+void copy_into_intimage(IntImage img1,IntImage img2,int x,int y)
 {/* copy img2 into img1 at position (x,y)*/
 
         int start,i,j,aim;
@@ -258,7 +259,7 @@
 	}
 }
 
-extern void copy_part_of_image(Image img1,Image img2,int x,int y)
+void copy_part_of_image(Image img1,Image img2,int x,int y)
 /* copy part of img2 begining at position (x,y) into img1 */
 {	int i,j,width,height,start,step;
 	Pixel *data;
@@ -277,10 +278,10 @@
 }
 
 
-extern void scale_image(Image img,int maximum)
+void scale_image(Image img, int maximum)
 /* scale image to [0..maximum]*/
 { 	int i;
-	Pixel max,min,multi;
+	Pixel max = MINDOUBLE, min = MAXDOUBLE, multi;
 
 	for (i=0;i<img->size;i++) {
   	  if (img->data[i]<min) min=img->data[i];
@@ -951,8 +952,6 @@
 	int fstart,fend;
 	int in_pos;
 
-	int in_dir,in_div,in_mod;
-
 	Entering;
 	PreCondition(out_len == in_len/2,"out_len != in_len/2 !!!");
 
@@ -1002,9 +1001,9 @@
 		Filter f)
 {
 	int i,j;
-	Pixel *out_pix, *in_pix, *f_data;
+	Pixel *out_pix, *in_pix;
 	int fstart,fend; /* Source interval */
-	int in_pos,in_dir,in_div,in_mod;
+	int in_pos;
 
 	Entering;
 	PreCondition(out_len == in_len*2,"out_len != in_len*2 !!!");
@@ -1353,8 +1352,8 @@
 static int compute_best(Image_tree tree,int level,int max_level,FilterGH *flt,
                         enum FilterMethod method,enum Information_Cost cost,double epsilon);                           
 static double compute_entropy(Image img,enum Information_Cost cost,double epsilon);
-static compute_levels(Image_tree tree,double *entropies,enum Information_Cost cost,double epsilon);
-static free_levels(Image_tree tree,int best);
+static void compute_levels(Image_tree tree,double *entropies,enum Information_Cost cost,double epsilon);
+static void free_levels(Image_tree tree,int best);
 
 static Pixel sumationq(Image img);
 static Pixel normq(Image_tree tree);
@@ -1374,7 +1373,7 @@
 /* 	Description: Carries out the wavelettransform 			*/
 /*	                           		           		*/
 /************************************************************************/
-extern Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method)
+Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method)
 {	int i,width,height,min,max_level,e;
         Image coarsei,horizontali,verticali,diagonali,tempi;
 	Image_tree ret_tree,temp_tree;
@@ -1532,8 +1531,8 @@
     return NULL;		
 }
 
-extern Image_tree wavelettransform_wp(Image original, int level, FilterGH *flt, enum FilterMethod method) {
-  wavelettransform__wp(original, 0, level, flt, method);
+Image_tree wavelettransform_wp(Image original, int level, FilterGH *flt, enum FilterMethod method) {
+  return wavelettransform__wp(original, 0, level, flt, method);
 }
 
 
@@ -1551,7 +1550,7 @@
 /* 	Description: carries best basis and near best basis selection	*/
 /*			out						*/
 /************************************************************************/
-extern Image_tree best_basis(Image original,int level,FilterGH *flt,
+Image_tree best_basis(Image original,int level,FilterGH *flt,
 				enum FilterMethod method,enum Information_Cost cost,double epsilon)
 
 {       Image_tree tree;
@@ -1598,7 +1597,7 @@
 /* 	Description: Carries out the best level selection		*/
 /*	                           		           		*/
 /************************************************************************/
-extern Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method,
+Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method,
 				enum Information_Cost cost,double epsilon)
 {	Image_tree tree;
 	Image img;
@@ -1752,7 +1751,7 @@
 /* 	Description: whole decompositing down to maxlevel          	*/
 /*		The original image must be in tree->image		*/
 /************************************************************************/
-extern int decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method,
+int decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method,
 				enum Information_Cost cost,double epsilon)
 {	
 	Image original,coarse,horizontal,vertical,diagonal;
@@ -1819,7 +1818,7 @@
 /* -------------------------------------------------------------------- */
 /* 	Description: Compute the entropies of all decomposition	levels	*/
 /************************************************************************/
-static compute_levels(Image_tree tree,double *entropies,enum Information_Cost cost,double epsilon)
+static void compute_levels(Image_tree tree,double *entropies,enum Information_Cost cost,double epsilon)
 {	
 	if (tree->image){
 		entropies[tree->level]+=compute_entropy(tree->image,cost,epsilon);
@@ -1840,7 +1839,7 @@
 /* -------------------------------------------------------------------- */
 /* 	Description: clean the image tree except the best level      	*/
 /************************************************************************/
-static free_levels(Image_tree tree,int best)
+static void free_levels(Image_tree tree,int best)
 {
 	if (tree->level<best)
 	{
@@ -1876,7 +1875,7 @@
 /* 	Description: Decomposes an image to an certain level and stores	*/
 /*	     only this level in the returned quadtree      		*/
 /************************************************************************/
-extern Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method)
+Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method)
 {	Image_tree tree;
 	int e;
 	
@@ -2004,7 +2003,7 @@
 /* 	Description: builds up an image out of an Image_tree		*/
 /*	                           		           		*/
 /************************************************************************/
-extern Image build_image(Image_tree quadtree,int width,int height)
+Image build_image(Image_tree quadtree,int width,int height)
 { 	Image ret_img,coarse,horizontal,vertical,diagonal;
 
 	
@@ -2051,7 +2050,7 @@
 /* 	Description: Inverts the wavelettransform,best_basis,best_level */
 /*	                           		           		*/
 /************************************************************************/
-extern Image inv_transform(Image_tree tree,FilterGH *flt,
+Image inv_transform(Image_tree tree,FilterGH *flt,
                                 enum FilterMethod method)
 
 {	int er,width,height;
@@ -2109,7 +2108,7 @@
 /* 	Description: Finds the deepest possible level where width and 	*/
 /*			height can divided by two exactly.		*/
 /************************************************************************/
-extern int find_deepest_level(int width,int height)
+int find_deepest_level(int width,int height)
 {
 	int level=0,w=width,h=height;
 	
@@ -2388,7 +2387,7 @@
 	recarea(tree,list,list_size);
 	abs_list(list,*list_size);
 
-	qsort(list,*list_size, sizeof(Pixel), &comp);
+	qsort(list,*list_size, sizeof(Pixel), (int (*)(const void*, const void*)) comp);
 
 	for (k=0;k<size;k++)
 	{
@@ -2407,7 +2406,7 @@
 }
 
 static Pixel comp_number(Image_tree tree,int size,int p,double f)
-{	Pixel sum=0,*list,min,norm,npf,normf;
+{	Pixel sum=0,*list,min=MAXDOUBLE,norm,npf,normf;
 	int *list_size=0,k;
 
 	list_size=(int *)malloc(sizeof(int));
@@ -2419,7 +2418,7 @@
 	recarea(tree,list,list_size);
 	abs_list(list,*list_size);
 
-	qsort(list,*list_size, sizeof(Pixel), &comp);
+	qsort(list,*list_size, sizeof(Pixel), (int (*)(const void*, const void*)) comp);
 
 	norm=sum_list(list,p,size);
 	normf=norm*f;
@@ -2458,7 +2457,7 @@
 	recarea(tree,list,list_size);
 	abs_list(list,*list_size);
 	
-	qsort(list,*list_size, sizeof(Pixel), &comp);
+	qsort(list,*list_size, sizeof(Pixel), (int (*)(const void*, const void*)) comp);
 
 	norm=sum_list(list,p,size);
 
@@ -2494,7 +2493,7 @@
 
 	recarea(tree,list,list_size);
 	
-	qsort(list,*list_size, sizeof(Pixel), &comp);
+	qsort(list,*list_size, sizeof(Pixel), (int (*)(const void*, const void*)) comp);
 
 	min=list[0];
 	max=list[size-1];
@@ -2534,7 +2533,7 @@
 
 	recarea(tree,list,list_size);
 	
-	qsort(list,*list_size, sizeof(Pixel), &comp);
+	qsort(list,*list_size, sizeof(Pixel), (int (*)(const void*, const void*)) comp);
 
 	min=list[0];
 	max=list[size-1];
@@ -2576,7 +2575,7 @@
 
 	recarea(tree,list,list_size);
 	
-	qsort(list,*list_size, sizeof(Pixel), &comp);
+	qsort(list,*list_size, sizeof(Pixel), (int (*)(const void*, const void*)) comp);
 
 	min=list[0];
 	max=list[size-1];
@@ -2694,7 +2693,7 @@
 /************************************************************************/
 static Pixel compute_non_additive(Image_tree tree,int size,enum Information_Cost cost,double epsilon,int down)
 {	Pixel sum=0,normx;
-	Image img;
+	Image img=NULL;
 
 	if (down)
 	{
@@ -2744,7 +2743,7 @@
 	return sum;
 }
 
-extern int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon)
+int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon)
 
 {	int min,width,height;
 	double sum=0;
@@ -2854,7 +2853,7 @@
 	  	return 0;		
 }		
 
-static save_structur(Image_tree tree,FILE *fp,int pos)
+static void save_structur(Image_tree tree,FILE *fp,int pos)
 {
 	int shift,next_pos,max;
 
@@ -2870,7 +2869,6 @@
 		if (tree->vertical) save_structur(tree->vertical,fp,next_pos+2);
 		if (tree->diagonal) save_structur(tree->diagonal,fp,next_pos+3);	
 	}
-	
 }
 
 static int is_in_list(int *list,int len, int x)
@@ -2889,7 +2887,7 @@
 	return found;
 }
 
-static write_flags(Image_tree tree,int *list,int len,int pos)
+static void write_flags(Image_tree tree,int *list,int len,int pos)
 {
 	int shift,next_pos,max;
 
@@ -2908,21 +2906,6 @@
 	}
 }
 
-static read_structur(Image_tree tree,FILE *fp)
-{
-	int e, flags[1000],len=0,i=0;
-
-	do
-	{
-		e=fscanf(fp,"%d ",&flags[i++]);
-		if (e!=-1) len++;
-	}
-	while (e!=-1);
-
-	write_flags(tree,flags,len,0);
-
-}
-
 /************************************************************************/
 /*	Functionname:		err_simple_message			*/
 /* -------------------------------------------------------------------- */
--- a/Meerwald/wavelet.h	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wavelet.h	Tue Apr 22 13:36:05 2008 +0200
@@ -5,10 +5,10 @@
 extern char dbgstr[1000];
 
 /* this are internal functions - don't use 'em! */
-extern void out_dbg_str(const char *str);
-extern void start_trace(void);
-extern void stop_trace(void);
-extern void flush_trace_file(void);
+void out_dbg_str(const char *str);
+void start_trace(void);
+void stop_trace(void);
+void flush_trace_file(void);
 
 /* public functions / macros */
 #define StartTrace
@@ -158,47 +158,47 @@
 
 /* functions: */
 
-extern IntImage new_intimage(int width, int height);
-extern IntImage load_intimage(char *file, int max_val);
-extern void free_intimage(IntImage img);
+IntImage new_intimage(int width, int height);
+IntImage load_intimage(char *file, int max_val);
+void free_intimage(IntImage img);
 
-extern void clear_intimage(IntImage img);
-extern void copy_into_intimage(IntImage img1,IntImage img2,int x,int y);
-extern void copy_part_of_intimage(IntImage img1,IntImage img2,int x,int y);
+void clear_intimage(IntImage img);
+void copy_into_intimage(IntImage img1,IntImage img2,int x,int y);
+void copy_part_of_intimage(IntImage img1,IntImage img2,int x,int y);
 
-extern Image new_image(int width, int height);
-extern void free_image(Image img);
-extern void clear_image(Image img);
-extern void copy_into_image(Image img1,Image img2,int x,int y);
-extern void scale_image(Image img,int maximum);
-extern void copy_part_of_image(Image img1,Image img2,int x,int y);
+Image new_image(int width, int height);
+void free_image(Image img);
+void clear_image(Image img);
+void copy_into_image(Image img1,Image img2,int x,int y);
+void scale_image(Image img,int maximum);
+void copy_part_of_image(Image img1,Image img2,int x,int y);
 
-extern void copy_part_of_image_into_image(
+void copy_part_of_image_into_image(
 				Image dest_img, int dest_x, int dest_y,
 				Image src_img, int src_x, int src_y,
 				int width, int height);
 
 
-extern int string_to_pixel(char *str, Pixel *p);
+int string_to_pixel(char *str, Pixel *p);
 
-extern Image load_image(char *file, int max_val);
-extern int save_image_P5(char *file, Image img);
+Image load_image(char *file, int max_val);
+int save_image_P5(char *file, Image img);
 
-extern Image intimage_to_image(IntImage i);
-extern IntImage image_to_intimage(Image i);
+Image intimage_to_image(IntImage i);
+IntImage image_to_intimage(Image i);
 
-extern Image_tree new_image_tree();
-extern void free_image_tree(Image_tree t);
+Image_tree new_image_tree();
+void free_image_tree(Image_tree t);
 
-extern Image get_difference_image(Image image1, Image image2);
+Image get_difference_image(Image image1, Image image2);
 
-extern void get_image_infos(Image image, Image_info info);
+void get_image_infos(Image image, Image_info info);
 
-extern void get_intimage_infos(IntImage image, IntPixel *min, IntPixel *max, Pixel *avg, Pixel *var);
+void get_intimage_infos(IntImage image, IntPixel *min, IntPixel *max, Pixel *avg, Pixel *var);
 
-extern void init_zigzag(Zigzag_data zz, int width, int height);
-extern void next_zigzag(Zigzag_data zz);
-extern Image get_absolute_image_scaled(Image img);
+void init_zigzag(Zigzag_data zz, int width, int height);
+void next_zigzag(Zigzag_data zz);
+Image get_absolute_image_scaled(Image img);
 
 /* common macros */
 
@@ -221,33 +221,33 @@
 	int len;
 	} *Filter;
 
-extern Filter new_filter(int size);
+Filter new_filter(int size);
 
-extern int filter_cutoff(Image in, int in_start, int in_len, int in_step,
+int filter_cutoff(Image in, int in_start, int in_len, int in_step,
 		Image out, int out_start, int out_len, int out_step,
 		Filter f);
 
-extern int filter_inv_cutoff(Image in, int in_start, int in_len, int in_step,
+int filter_inv_cutoff(Image in, int in_start, int in_len, int in_step,
 		Image out, int out_start, int out_len, int out_step,
 		Filter f);
 
-extern int filter_periodical(Image in, int in_start, int in_len, int in_step,
+int filter_periodical(Image in, int in_start, int in_len, int in_step,
 		Image out, int out_start, int out_len, int out_step,
 		Filter f);
 
-extern int filter_inv_periodical(Image in, int in_start, int in_len, int in_step,
+int filter_inv_periodical(Image in, int in_start, int in_len, int in_step,
 		Image out, int out_start, int out_len, int out_step,
 		Filter f);
 
-extern int filter_mirror(Image in, int in_start, int in_len, int in_step,
+int filter_mirror(Image in, int in_start, int in_len, int in_step,
 		Image out, int out_start, int out_len, int out_step,
 		Filter f);
 
-extern int filter_inv_mirror(Image in, int in_start, int in_len, int in_step,
+int filter_inv_mirror(Image in, int in_start, int in_len, int in_step,
 		Image out, int out_start, int out_len, int out_step,
 		Filter f);
 
-extern Pixel get_filter_center(Filter f);
+Pixel get_filter_center(Filter f);
 
 enum FilterGHType { FTOrtho, FTBiOrtho, FTOther};
 
@@ -263,7 +263,7 @@
 	} *AllFilters;
 
 
-extern AllFilters load_filters(char *name);
+AllFilters load_filters(char *name);
 
 typedef struct SegmentsStruct	{
 		int width,height; /* segment width & height*/
@@ -276,59 +276,32 @@
 		shanon,weak_l,weak_lq,compression_number,compression_numberq,
 		compression_area,compression_areaq,sdiscrepancy,discrepancy,concentration};
 
-extern Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method);
-extern Image_tree wavelettransform_wp(Image original,int level,FilterGH *flt,enum FilterMethod method);
+Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method);
+Image_tree wavelettransform_wp(Image original,int level,FilterGH *flt,enum FilterMethod method);
                             
-extern Image_tree best_basis(Image original,int level,FilterGH *flt,
+Image_tree best_basis(Image original,int level,FilterGH *flt,
 				enum FilterMethod method,enum Information_Cost cost,double epsilon);
 				                             
-extern Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method,
-				enum Information_Cost cost,double epsilon);
-
-extern Image build_image(Image_tree quadtree,int width,int height);
-
-extern Image inv_transform(Image_tree quadtree,FilterGH *flt,
-                                 enum FilterMethod method);
-
-extern Image inv_transform_wp(Image_tree quadtree,FilterGH *flt,
-                                 enum FilterMethod method);
-
-extern int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon);
-
-extern Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method);
-
-extern decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method,
+Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method,
 				enum Information_Cost cost,double epsilon);
 
-extern int find_deepest_level(int width,int height);
-
-			/*Selective methods*/
-extern int selectiv_tiling1(Image img,Segments seg,int filternumber,char *file,
-                                enum Information_Cost cost,double epsilon);
-extern Image inv_selectiv_tiling1(char *file);
+Image build_image(Image_tree quadtree,int width,int height);
 
-extern int selectiv_tiling2(Image img,Segments seg,int filternumber,char *file,
-                                enum Information_Cost cost,double epsilon);
-extern Image inv_selectiv_tiling2(char *file);                    
+Image inv_transform(Image_tree quadtree,FilterGH *flt,
+                                 enum FilterMethod method);
 
-extern int selectiv_quant1(Image img,IntImage area,int filternumber,char *file,
-                                enum Information_Cost cost,double epsilon);
-extern Image inv_selectiv_quant1(char *file);
+Image inv_transform_wp(Image_tree quadtree,FilterGH *flt,
+                                 enum FilterMethod method);
 
-extern int selectiv_quant2(Image img,IntImage area,int filternumber,char *file,
-                                enum Information_Cost cost,double epsilon);
-extern Image inv_selectiv_quant2(char *file);
+int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon);
+
+Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method);
 
-extern int selectiv_quant3(Image img,IntImage area,int filternumber,char *file,
-                                enum Information_Cost cost,double epsilon);
-extern Image inv_selectiv_quant3(char *file);
+int decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method,
+				enum Information_Cost cost,double epsilon);
 
-extern smooth_block(Image img,int x,int y, int width,int height);
+int find_deepest_level(int width,int height);
 
-extern compute_map(Image_tree tree,IntImage map);
-
-extern int *pixelarray_to_intarray(Pixel *pdata,int size);
-extern Pixel *intarray_to_pixelarray(int *idata,int size);
 
 #define WAVELET_H
 #endif
--- a/Meerwald/wm.h	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm.h	Tue Apr 22 13:36:05 2008 +0200
@@ -17,6 +17,8 @@
 #elif defined(LINUX)
 #include <values.h>
 #include <sys/param.h>
+#include <unistd.h>
+#include <time.h>
 #else
 #error plattform not supported
 #endif
--- 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);
 
--- 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++) {
--- a/Meerwald/wm_corvi_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_corvi_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -34,7 +34,6 @@
   char orig_name[MAXPATHLEN];
 
   int c;
-  int i;
   int n = 0;
   int method = -1;
   int filter = 0;
@@ -135,14 +134,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/wm_corvi_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_corvi_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -45,7 +45,7 @@
   Image_tree dwts;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   progname = argv[0];
 
@@ -113,13 +113,14 @@
     exit(1);
   }
 
-  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]);
+  }
 
   if (sig) {
     char line[32];
--- a/Meerwald/wm_cox_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_cox_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -1,6 +1,7 @@
 #include "wm.h"
 #include "dct.h"
 #include "pgm.h"
+#include "sort.h"
 
 char *progname;
 
@@ -32,7 +33,6 @@
   char orig_name[MAXPATHLEN];
 
   int c;
-  int r;
   int i, j;
   int n = 100;
 
@@ -46,7 +46,7 @@
   int orig_rows, orig_cols, orig_format;
   gray orig_maxval;
   int rows, cols;
-  int row, col;
+  int row;
 
   double threshold;
   double *largest;
@@ -121,14 +121,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/wm_cox_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_cox_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -25,7 +25,7 @@
   char signature_name[MAXPATHLEN];
 
   int c;
-  int row, col;
+  int row;
   int i,j;
 
   int n;
@@ -39,7 +39,7 @@
   double **dcts;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   progname = argv[0];
 
@@ -83,14 +83,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_dugad_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_dugad_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -47,7 +47,7 @@
   char output_name[MAXPATHLEN] = "(stdout)";
   char input_name[MAXPATHLEN] = "(stdin)";
 
-  int c, w;
+  int c;
   int i;
   int n = 0;
   int method = -1;
@@ -61,7 +61,7 @@
   int in_rows, in_cols, in_format;
   gray in_maxval;
   int rows, cols;
-  int row, col;
+  int row;
 
   double *watermark;
 
@@ -106,7 +106,7 @@
       case 'l':      
         level = atoi(optarg);
         if (level <= 0) {
-          fprintf(stderr, "%s: decomposition level %d out of range\n", level);
+          fprintf(stderr, "%s: decomposition level %d out of range\n", progname, level);
           exit(1);
         }
         break;
@@ -157,14 +157,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_dugad_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_dugad_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -40,7 +40,7 @@
   char signature_name[MAXPATHLEN];
 
   int i, c;
-  int row, col;
+  int row;
 
   int n;
 
@@ -58,7 +58,7 @@
   Image_tree dwts, s;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   double *watermark;
 
@@ -99,7 +99,7 @@
       case 'l': 
         level = atoi(optarg);
         if (level <= 0) {
-          fprintf(stderr, "%s: decomposition level %d out of range\n", level);
+          fprintf(stderr, "%s: decomposition level %d out of range\n", progname, level);
           exit(1);
         }
         break;
@@ -142,14 +142,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_frid2_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_frid2_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -29,7 +29,6 @@
 
   int c;
   int row, col;
-  int n;
   double normalization = 1024.0;
   int seed, format;
 
@@ -110,14 +109,15 @@
     exit(1);
   }
 	
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_frid2_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_frid2_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -30,7 +30,6 @@
 
   int c;
   int row, col;
-  int n;
   double normalization = 1024.0;
   int seed, format;
 
@@ -110,14 +109,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_kim_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_kim_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -67,7 +67,6 @@
   char orig_name[MAXPATHLEN];
 
   int c, w;
-  int i;
   int n = 0;
   int method = -1;
   int filter = 0;
@@ -82,7 +81,7 @@
   int orig_rows, orig_cols, orig_format;
   gray orig_maxval;
   int rows, cols;
-  int row, col;
+  int row;
 
   double *watermark;
 
@@ -177,14 +176,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/wm_kim_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_kim_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -58,7 +58,7 @@
   char signature_name[MAXPATHLEN];
 
   int i, c, w;
-  int row, col;
+  int row;
 
   int n;
 
@@ -77,7 +77,7 @@
   Image_tree p, dwts;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   double *watermark;
 
@@ -161,14 +161,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_koch_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_koch_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -30,16 +30,12 @@
   char input_name[MAXPATHLEN] = "(stdin)";
   char output_name[MAXPATHLEN] = "(stdout)";
 
-  int i;
-  int j;
   int c;
   int n;
-  int x;
-  int y;
 
   int rows, cols, format;
   gray maxval;
-  int row, col;
+  int row;
 
   int seed;
   int verbose = 0;
@@ -105,14 +101,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[128];
     fgets(line, sizeof(line), sig);
@@ -184,7 +181,6 @@
     int yb;
     int c1, c2;
     double v1, v2;
-    double q = 1.0;
 
     do {
       xb = random() % (cols / NJPEG);
--- a/Meerwald/wm_koch_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_koch_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -27,19 +27,15 @@
   char input_name[MAXPATHLEN] = "(stdin)";
   char output_name[MAXPATHLEN] = "(stdout)";
 
-  int i;
-  int j;
   int c;
   int n;
-  int x;
-  int y;
 
   int seed;
   int verbose = 0;
 
   int rows, cols, format;
   gray maxval;
-  int row, col;
+  int row;
 
   int quantization = 0;
   double quality = 0.0;
@@ -105,13 +101,14 @@
     exit(1);
   }
 
-  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]);
+  }
 
   if (sig) {
     char line[128];
--- a/Meerwald/wm_kund2_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_kund2_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -33,7 +33,6 @@
   char input_name[MAXPATHLEN] = "(stdin)";
 
   int r, c;
-  int i;
   int quality = 0;
   int blocksize = 0;
   int seed = 0;
@@ -132,14 +131,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[1024];
     fgets(line, sizeof(line), sig);
@@ -227,7 +227,6 @@
   while (p->coarse->level < level) {
     int lwidth = p->vertical->image->width;
     int lheight =  p->vertical->image->height;
-    int l = p->vertical->level;
     int bx, by;
     int nblock;
 
--- a/Meerwald/wm_kund2_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_kund2_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -129,14 +129,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[1024];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_kund3_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_kund3_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -32,7 +32,6 @@
   char input_name[MAXPATHLEN] = "(stdin)";
 
   int r, c;
-  int i;
   int quality = 0;
   int seed = 0;
   int n = 0;
@@ -43,7 +42,6 @@
   char *binstr;
 
   int level = 0;
-  double alpha = 0.0;
 
   int in_rows, in_cols, in_format;
   gray in_maxval;
@@ -128,14 +126,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_kund3_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_kund3_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -48,7 +48,7 @@
   Image_tree dwts, p;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   progname = argv[0];
 
@@ -124,14 +124,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_wang_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_wang_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -38,7 +38,6 @@
   char orig_name[MAXPATHLEN];
 
   int c, w;
-  int i;
   int n = 0;
   int method = -1;
   int filter = 0;
@@ -53,7 +52,7 @@
   int orig_rows, orig_cols, orig_format;
   gray orig_maxval;
   int rows, cols;
-  int row, col;
+  int row;
 
   double *watermark;
 
@@ -149,14 +148,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/wm_wang_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_wang_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -31,7 +31,7 @@
   char signature_name[MAXPATHLEN];
 
   int i, c, w;
-  int row, col;
+  int row;
 
   int n;
 
@@ -49,7 +49,7 @@
   Image_tree dwts;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   double *watermark;
 
@@ -126,14 +126,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_xia_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_xia_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -65,8 +65,7 @@
   char input_name[MAXPATHLEN] = "(stdin)";
   char orig_name[MAXPATHLEN];
 
-  int c, w;
-  int i;
+  int c;
   int n = 0;
   int method = -1;
   int filter = 0;
@@ -80,7 +79,7 @@
   int orig_rows, orig_cols, orig_format;
   gray orig_maxval;
   int rows, cols;
-  int row, col;
+  int row;
 
   double *watermark;
 
@@ -168,14 +167,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/wm_xia_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_xia_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -50,8 +50,8 @@
   char input_name[MAXPATHLEN] = "(stdin)";
   char signature_name[MAXPATHLEN];
 
-  int i, c, w;
-  int row, col;
+  int i, c;
+  int row;
 
   int n;
 
@@ -69,7 +69,7 @@
   Image_tree p, dwts;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   double *watermark;
 
@@ -146,14 +146,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_xie2_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_xie2_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -65,7 +65,7 @@
   Image_tree dwts, p;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   progname = argv[0];
 
@@ -143,13 +143,14 @@
     exit(1);
   }
 
-  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]);
+  }
 
   if (sig) {
     char line[32];
--- a/Meerwald/wm_xie2_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_xie2_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -59,7 +59,7 @@
   Image_tree dwts, p;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   progname = argv[0];
 
@@ -137,13 +137,14 @@
     exit(1);
   }
 
-  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]);
+  }
 
   if (sig) {
     char line[32];
--- a/Meerwald/wm_xie_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_xie_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -63,7 +63,7 @@
   Image_tree dwts, p;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   progname = argv[0];
 
@@ -138,14 +138,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_xie_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_xie_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -132,14 +132,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/Meerwald/wm_zhu_d.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_zhu_d.c	Tue Apr 22 13:36:05 2008 +0200
@@ -1,6 +1,7 @@
 #include "wm.h"
 #include "dwt.h"
 #include "pgm.h"
+#include "sort.h"
 
 char *progname;
 
@@ -58,7 +59,7 @@
   int orig_rows, orig_cols, orig_format;
   gray orig_maxval;
   int rows, cols;
-  int row, col;
+  int row;
 
   double *watermark;
 
@@ -146,14 +147,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (!orig) {
     fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
     exit(1);
--- a/Meerwald/wm_zhu_e.c	Wed Apr 16 15:55:52 2008 +0200
+++ b/Meerwald/wm_zhu_e.c	Tue Apr 22 13:36:05 2008 +0200
@@ -30,7 +30,7 @@
   char signature_name[MAXPATHLEN];
 
   int i, c, w;
-  int row, col;
+  int row;
 
   int n;
 
@@ -48,7 +48,7 @@
   Image_tree p, dwts;
 
   gray maxval;
-  int rows, cols, colors, format;
+  int rows, cols, format;
 
   double *watermark;
 
@@ -125,14 +125,15 @@
     exit(1);
   }
 
-  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]);
-
+  }
+  
   if (sig) {
     char line[32];
     fgets(line, sizeof(line), sig);
--- a/make/make.linux	Wed Apr 16 15:55:52 2008 +0200
+++ b/make/make.linux	Tue Apr 22 13:36:05 2008 +0200
@@ -1,5 +1,5 @@
 CC = gcc
-CFLAGS = -O2 -g -DLINUX
+CFLAGS = -O2 -g -DLINUX -Wall -DDEBUG
 LDFLAGS = -g
 LIBS = -lm
 PGMLIBS = -lnetpbm

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