From 1cfd14b7fe8f9e68c5bd74461bcd17e25b9f1d15 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Fri, 26 Oct 2012 16:40:53 +0300
Subject: [PATCH] nbis: fix rest of warnings reported by gcc

https://bugs.freedesktop.org/show_bug.cgi?id=56439
---
 libfprint/nbis/mindtct/block.c  |  3 +--
 libfprint/nbis/mindtct/detect.c | 12 ++++++------
 libfprint/nbis/mindtct/loop.c   |  8 --------
 libfprint/nbis/mindtct/ridges.c | 14 +++++++-------
 4 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/libfprint/nbis/mindtct/block.c b/libfprint/nbis/mindtct/block.c
index 7c7a656..be0b3f9 100644
--- a/libfprint/nbis/mindtct/block.c
+++ b/libfprint/nbis/mindtct/block.c
@@ -86,7 +86,7 @@ int block_offsets(int **optr, int *ow, int *oh,
    int *blkoffs, bx, by, bw, bh, bi, bsize;
    int blkrow_start, blkrow_size, offset;
    int lastbw, lastbh;
-   int pad2, pw, ph;
+   int pad2, pw;
 
    /* Test if unpadded image is smaller than a single block */
    if((iw < blocksize) || (ih < blocksize)){
@@ -99,7 +99,6 @@ int block_offsets(int **optr, int *ow, int *oh,
    /* Compute padded width and height of image */
    pad2 = pad<<1;
    pw = iw + pad2;
-   ph = ih + pad2;
 
    /* Compute the number of columns and rows of blocks in the image. */
    /* Take the ceiling to account for "leftovers" at the right and   */
diff --git a/libfprint/nbis/mindtct/detect.c b/libfprint/nbis/mindtct/detect.c
index 9b1bdbc..deadf29 100644
--- a/libfprint/nbis/mindtct/detect.c
+++ b/libfprint/nbis/mindtct/detect.c
@@ -385,12 +385,12 @@ int get_minutiae(MINUTIAE **ominutiae, int **oquality_map,
                  const int id, const double ppmm, const LFSPARMS *lfsparms)
 {
    int ret;
-   MINUTIAE *minutiae;
-   int *direction_map, *low_contrast_map, *low_flow_map;
-   int *high_curve_map, *quality_map;
-   int map_w, map_h;
-   unsigned char *bdata;
-   int bw, bh;
+   MINUTIAE *minutiae = NULL;
+   int *direction_map = NULL, *low_contrast_map = NULL, *low_flow_map = NULL;
+   int *high_curve_map = NULL, *quality_map = NULL;
+   int map_w = 0, map_h = 0;
+   unsigned char *bdata = NULL;
+   int bw = 0, bh = 0;
 
    /* If input image is not 8-bit grayscale ... */
    if(id != 8){
diff --git a/libfprint/nbis/mindtct/loop.c b/libfprint/nbis/mindtct/loop.c
index 21c8d59..3792b88 100644
--- a/libfprint/nbis/mindtct/loop.c
+++ b/libfprint/nbis/mindtct/loop.c
@@ -782,7 +782,6 @@ int process_loop(MINUTIAE *minutiae,
              unsigned char *bdata, const int iw, const int ih,
              const LFSPARMS *lfsparms)
 {
-   int halfway;
    int idir, type, appearing;
    double min_dist, max_dist;
    int min_fr, max_fr, min_to, max_to;
@@ -800,9 +799,6 @@ int process_loop(MINUTIAE *minutiae,
       /* Get pixel value of feature's interior. */
       feature_pix = *(bdata + (contour_y[0] * iw) + contour_x[0]);
 
-      /* Compute half the perimeter of the loop. */
-      halfway = ncontour>>1;
-
       /* Get the aspect dimensions of the loop in units of */
       /* squared distance.                                 */
       get_loop_aspect(&min_fr, &min_to, &min_dist,
@@ -940,7 +936,6 @@ int process_loop_V2(MINUTIAE *minutiae,
              unsigned char *bdata, const int iw, const int ih,
              int *plow_flow_map, const LFSPARMS *lfsparms)
 {
-   int halfway;
    int idir, type, appearing;
    double min_dist, max_dist;
    int min_fr, max_fr, min_to, max_to;
@@ -960,9 +955,6 @@ int process_loop_V2(MINUTIAE *minutiae,
       /* Get pixel value of feature's interior. */
       feature_pix = *(bdata + (contour_y[0] * iw) + contour_x[0]);
 
-      /* Compute half the perimeter of the loop. */
-      halfway = ncontour>>1;
-
       /* Get the aspect dimensions of the loop in units of */
       /* squared distance.                                 */
       get_loop_aspect(&min_fr, &min_to, &min_dist,
diff --git a/libfprint/nbis/mindtct/ridges.c b/libfprint/nbis/mindtct/ridges.c
index 0fb2686..9fb110f 100644
--- a/libfprint/nbis/mindtct/ridges.c
+++ b/libfprint/nbis/mindtct/ridges.c
@@ -565,7 +565,7 @@ static int ridge_count(const int first, const int second, MINUTIAE *minutiae,
    MINUTIA *minutia1, *minutia2;
    int i, ret, found;
    int *xlist, *ylist, num;
-   int ridge_count, ridge_start, ridge_end;
+   int ridge_cnt, ridge_start, ridge_end;
    int prevpix, curpix;
 
    minutia1 = minutiae->list[first];
@@ -614,7 +614,7 @@ static int ridge_count(const int first, const int second, MINUTIAE *minutiae,
    }
 
    /* Ready to count ridges, so initialize counter to 0. */
-   ridge_count = 0;
+   ridge_cnt = 0;
 
    print2log("RIDGE COUNT: %d,%d to %d,%d ", minutia1->x, minutia1->y,
                                                minutia2->x, minutia2->y);
@@ -630,7 +630,7 @@ static int ridge_count(const int first, const int second, MINUTIAE *minutiae,
          print2log("\n");
 
          /* Return number of ridges counted to this point. */
-         return(ridge_count);
+         return(ridge_cnt);
       }
       /* Otherwise, we found a new ridge start transition, so store */
       /* its location (the location of the 1 in 0-to-1 transition). */
@@ -647,7 +647,7 @@ static int ridge_count(const int first, const int second, MINUTIAE *minutiae,
          print2log("\n");
 
          /* Return number of ridges counted to this point. */
-         return(ridge_count);
+         return(ridge_cnt);
       }
       /* Otherwise, we found a new ridge end transition, so store   */
       /* its location (the location of the 0 in 1-to-0 transition). */
@@ -680,7 +680,7 @@ static int ridge_count(const int first, const int second, MINUTIAE *minutiae,
       if(ret){
          /* Then assume we have found a valid ridge crossing and bump */
          /* the ridge counter.                                        */
-         ridge_count++;
+         ridge_cnt++;
       }
 
       /* Otherwise, ignore the current ridge start and end transitions */
@@ -694,7 +694,7 @@ static int ridge_count(const int first, const int second, MINUTIAE *minutiae,
    print2log("\n");
 
    /* Return the number of ridges counted. */
-   return(ridge_count);
+   return(ridge_cnt);
 }
 
 /*************************************************************************
@@ -719,7 +719,7 @@ static int count_minutia_ridges(const int first, MINUTIAE *minutiae,
                       unsigned char *bdata, const int iw, const int ih,
                       const LFSPARMS *lfsparms)
 {
-   int i, ret, *nbr_list, *nbr_nridges, nnbrs;
+   int i, ret, *nbr_list = NULL, *nbr_nridges, nnbrs;
 
    /* Find up to the maximum number of qualifying neighbors. */
    if((ret = find_neighbors(&nbr_list, &nnbrs, lfsparms->max_nbrs,