From aee889fcef4fc98143e2cdeb258fc347fcef4e3e Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Fri, 26 Oct 2012 16:36:21 +0300 Subject: [PATCH 4/6] nbis: prefix global variables with "g_" It fixes a lot of warnings about shadowing global variable --- libfprint/img.c | 2 +- libfprint/nbis/include/lfs.h | 14 +++++++------- libfprint/nbis/include/log.h | 8 ++++---- libfprint/nbis/mindtct/contour.c | 8 ++++---- libfprint/nbis/mindtct/detect.c | 2 +- libfprint/nbis/mindtct/globals.c | 16 ++++++++-------- libfprint/nbis/mindtct/loop.c | 4 ++-- libfprint/nbis/mindtct/matchpat.c | 12 ++++++------ libfprint/nbis/mindtct/minutia.c | 32 ++++++++++++++++---------------- 9 files changed, 49 insertions(+), 49 deletions(-) diff --git a/libfprint/img.c b/libfprint/img.c index 1c70858..64a6240 100644 --- a/libfprint/img.c +++ b/libfprint/img.c @@ -290,7 +290,7 @@ int fpi_img_detect_minutiae(struct fp_img *img) &low_contrast_map, &low_flow_map, &high_curve_map, &map_w, &map_h, &bdata, &bw, &bh, &bd, img->data, img->width, img->height, 8, - DEFAULT_PPI / (double)25.4, &lfsparms_V2); + DEFAULT_PPI / (double)25.4, &g_lfsparms_V2); g_timer_stop(timer); fp_dbg("minutiae scan completed in %f secs", g_timer_elapsed(timer, NULL)); g_timer_destroy(timer); diff --git a/libfprint/nbis/include/lfs.h b/libfprint/nbis/include/lfs.h index 2da5d25..49aad84 100644 --- a/libfprint/nbis/include/lfs.h +++ b/libfprint/nbis/include/lfs.h @@ -1021,12 +1021,12 @@ extern int closest_dir_dist(const int, const int, const int); /*************************************************************************/ /* EXTERNAL GLOBAL VARIABLE DEFINITIONS */ /*************************************************************************/ -extern double dft_coefs[]; -extern LFSPARMS lfsparms; -extern LFSPARMS lfsparms_V2; -extern int nbr8_dx[]; -extern int nbr8_dy[]; -extern int chaincodes_nbr8[]; -extern FEATURE_PATTERN feature_patterns[]; +extern double g_dft_coefs[]; +extern LFSPARMS g_lfsparms; +extern LFSPARMS g_lfsparms_V2; +extern int g_nbr8_dx[]; +extern int g_nbr8_dy[]; +extern int g_chaincodes_nbr8[]; +extern FEATURE_PATTERN g_feature_patterns[]; #endif diff --git a/libfprint/nbis/include/log.h b/libfprint/nbis/include/log.h index 36967f1..a9cd603 100644 --- a/libfprint/nbis/include/log.h +++ b/libfprint/nbis/include/log.h @@ -36,10 +36,10 @@ identified are necessarily the best available for the purpose. #define LOG_FILE "log.txt" #endif -extern FILE *logfp; -extern int avrdir; -extern float dir_strength; -extern int nvalid; +extern FILE *g_logfp; +extern int g_avrdir; +extern float g_dir_strength; +extern int g_nvalid; extern int open_logfile(void); extern int close_logfile(void); diff --git a/libfprint/nbis/mindtct/contour.c b/libfprint/nbis/mindtct/contour.c index 24d15c4..92e77f5 100644 --- a/libfprint/nbis/mindtct/contour.c +++ b/libfprint/nbis/mindtct/contour.c @@ -742,8 +742,8 @@ static int next_contour_pixel(int *next_x_loc, int *next_y_loc, /* Set current scan pixel to the new neighbor. */ /* REMEMBER: the neighbors are being scanned around the original */ /* feature point. */ - cur_nbr_x = cur_x_loc + nbr8_dx[nbr_i]; - cur_nbr_y = cur_y_loc + nbr8_dy[nbr_i]; + cur_nbr_x = cur_x_loc + g_nbr8_dx[nbr_i]; + cur_nbr_y = cur_y_loc + g_nbr8_dy[nbr_i]; /* If new neighbor is not within image boundaries... */ if((cur_nbr_x < 0) || (cur_nbr_x >= iw) || @@ -766,8 +766,8 @@ static int next_contour_pixel(int *next_x_loc, int *next_y_loc, if(nbr_i % 2){ /* To do this, look ahead one more neighbor pixel. */ ni = next_scan_nbr(nbr_i, scan_clock); - nx = cur_x_loc + nbr8_dx[ni]; - ny = cur_y_loc + nbr8_dy[ni]; + nx = cur_x_loc + g_nbr8_dx[ni]; + ny = cur_y_loc + g_nbr8_dy[ni]; /* If new neighbor is not within image boundaries... */ if((nx < 0) || (nx >= iw) || (ny < 0) || (ny >= ih)) diff --git a/libfprint/nbis/mindtct/detect.c b/libfprint/nbis/mindtct/detect.c index 214459b..9b1bdbc 100644 --- a/libfprint/nbis/mindtct/detect.c +++ b/libfprint/nbis/mindtct/detect.c @@ -122,7 +122,7 @@ static int lfs_detect_minutiae_V2(MINUTIAE **ominutiae, /* Initialize wave form lookup tables for DFT analyses. */ /* used for direction binarization. */ - if((ret = init_dftwaves(&dftwaves, dft_coefs, lfsparms->num_dft_waves, + if((ret = init_dftwaves(&dftwaves, g_dft_coefs, lfsparms->num_dft_waves, lfsparms->windowsize))){ /* Free memory allocated to this point. */ free_dir2rad(dir2rad); diff --git a/libfprint/nbis/mindtct/globals.c b/libfprint/nbis/mindtct/globals.c index 01454db..da85aab 100644 --- a/libfprint/nbis/mindtct/globals.c +++ b/libfprint/nbis/mindtct/globals.c @@ -40,7 +40,7 @@ identified are necessarily the best available for the purpose. /*************************************************************************/ #ifdef LOG_REPORT -FILE *logfp; +FILE *g_logfp; #endif /* Constants (C) for defining 4 DFT frequencies, where */ @@ -50,10 +50,10 @@ FILE *logfp; /* 2 = twice the frequency in range X. */ /* 3 = three times the frequency in reange X. */ /* 4 = four times the frequency in ranage X. */ -double dft_coefs[NUM_DFT_WAVES] = { 1,2,3,4 }; +double g_dft_coefs[NUM_DFT_WAVES] = { 1,2,3,4 }; /* Allocate and initialize a global LFS parameters structure. */ -LFSPARMS lfsparms = { +LFSPARMS g_lfsparms = { /* Image Controls */ PAD_VALUE, JOIN_LINE_RADIUS, @@ -137,7 +137,7 @@ LFSPARMS lfsparms = { /* Allocate and initialize VERSION 2 global LFS parameters structure. */ -LFSPARMS lfsparms_V2 = { +LFSPARMS g_lfsparms_V2 = { /* Image Controls */ PAD_VALUE, JOIN_LINE_RADIUS, @@ -221,17 +221,17 @@ LFSPARMS lfsparms_V2 = { /* Variables for conducting 8-connected neighbor analyses. */ /* Pixel neighbor offsets: 0 1 2 3 4 5 6 7 */ /* 7 0 1 */ -int nbr8_dx[] = { 0, 1, 1, 1, 0,-1,-1,-1 }; /* 6 C 2 */ -int nbr8_dy[] = { -1,-1, 0, 1, 1, 1, 0,-1 }; /* 5 4 3 */ +int g_nbr8_dx[] = { 0, 1, 1, 1, 0,-1,-1,-1 }; /* 6 C 2 */ +int g_nbr8_dy[] = { -1,-1, 0, 1, 1, 1, 0,-1 }; /* 5 4 3 */ /* The chain code lookup matrix for 8-connected neighbors. */ /* Should put this in globals. */ -int chaincodes_nbr8[]={ 3, 2, 1, +int g_chaincodes_nbr8[]={ 3, 2, 1, 4,-1, 0, 5, 6, 7}; /* Global array of feature pixel pairs. */ -FEATURE_PATTERN feature_patterns[]= +FEATURE_PATTERN g_feature_patterns[]= {{RIDGE_ENDING, /* a. Ridge Ending (appearing) */ APPEARING, {0,0}, diff --git a/libfprint/nbis/mindtct/loop.c b/libfprint/nbis/mindtct/loop.c index da5de0e..21c8d59 100644 --- a/libfprint/nbis/mindtct/loop.c +++ b/libfprint/nbis/mindtct/loop.c @@ -110,14 +110,14 @@ static int chain_code_loop(int **ochain, int *onchain, /* Derive chain code index from neighbor deltas. */ /* The deltas are on the range [-1..1], so to use them as indices */ /* into the code list, they must first be incremented by one. */ - chain[i] = *(chaincodes_nbr8+((dy+1)*NBR8_DIM)+dx+1); + chain[i] = *(g_chaincodes_nbr8+((dy+1)*NBR8_DIM)+dx+1); } /* Now derive chain code between last and first points in the */ /* contour list. */ dx = contour_x[0] - contour_x[i]; dy = contour_y[0] - contour_y[i]; - chain[i] = *(chaincodes_nbr8+((dy+1)*NBR8_DIM)+dx+1); + chain[i] = *(g_chaincodes_nbr8+((dy+1)*NBR8_DIM)+dx+1); /* Store results to the output pointers. */ *ochain = chain; diff --git a/libfprint/nbis/mindtct/matchpat.c b/libfprint/nbis/mindtct/matchpat.c index ed4fc7c..04bb27b 100644 --- a/libfprint/nbis/mindtct/matchpat.c +++ b/libfprint/nbis/mindtct/matchpat.c @@ -69,8 +69,8 @@ int match_1st_pair(unsigned char p1, unsigned char p2, /* Foreach set of feature pairs ... */ for(i = 0; i < NFEATURES; i++){ /* If current scan pair matches first pair for feature ... */ - if((p1==feature_patterns[i].first[0]) && - (p2==feature_patterns[i].first[1])){ + if((p1==g_feature_patterns[i].first[0]) && + (p2==g_feature_patterns[i].first[1])){ /* Store feature as a possible match. */ possible[*nposs] = i; /* Bump number of stored possibilities. */ @@ -117,8 +117,8 @@ int match_2nd_pair(unsigned char p1, unsigned char p2, /* Foreach possible match based on first pair ... */ for(i = 0; i < tnposs; i++){ /* If current scan pair matches second pair for feature ... */ - if((p1==feature_patterns[possible[i]].second[0]) && - (p2==feature_patterns[possible[i]].second[1])){ + if((p1==g_feature_patterns[possible[i]].second[0]) && + (p2==g_feature_patterns[possible[i]].second[1])){ /* Store feature as a possible match. */ possible[*nposs] = possible[i]; /* Bump number of stored possibilities. */ @@ -160,8 +160,8 @@ int match_3rd_pair(unsigned char p1, unsigned char p2, /* Foreach possible match based on first and second pairs ... */ for(i = 0; i < tnposs; i++){ /* If current scan pair matches third pair for feature ... */ - if((p1==feature_patterns[possible[i]].third[0]) && - (p2==feature_patterns[possible[i]].third[1])){ + if((p1==g_feature_patterns[possible[i]].third[0]) && + (p2==g_feature_patterns[possible[i]].third[1])){ /* Store feature as a possible match. */ possible[*nposs] = possible[i]; /* Bump number of stored possibilities. */ diff --git a/libfprint/nbis/mindtct/minutia.c b/libfprint/nbis/mindtct/minutia.c index 6bcfaab..497336b 100644 --- a/libfprint/nbis/mindtct/minutia.c +++ b/libfprint/nbis/mindtct/minutia.c @@ -2521,7 +2521,7 @@ int process_horizontal_scan_minutia(MINUTIAE *minutiae, /* Feature location should always point to either ending */ /* of ridge or (for bifurcations) ending of valley. */ /* So, if detected feature is APPEARING... */ - if(feature_patterns[feature_id].appearing){ + if(g_feature_patterns[feature_id].appearing){ /* Set y location to second scan row. */ y_loc = cy+1; /* Set y location of neighboring edge pixel to the first scan row. */ @@ -2550,15 +2550,15 @@ int process_horizontal_scan_minutia(MINUTIAE *minutiae, else{ /* Get minutia direction based on current IMAP value. */ idir = get_low_curvature_direction(SCAN_HORIZONTAL, - feature_patterns[feature_id].appearing, + g_feature_patterns[feature_id].appearing, imapval, lfsparms->num_directions); } /* Create a minutia object based on derived attributes. */ if((ret = create_minutia(&minutia, x_loc, y_loc, x_edge, y_edge, idir, DEFAULT_RELIABILITY, - feature_patterns[feature_id].type, - feature_patterns[feature_id].appearing, feature_id))) + g_feature_patterns[feature_id].type, + g_feature_patterns[feature_id].appearing, feature_id))) /* Return system error. */ return(ret); @@ -2627,7 +2627,7 @@ int process_horizontal_scan_minutia_V2(MINUTIAE *minutiae, /* Feature location should always point to either ending */ /* of ridge or (for bifurcations) ending of valley. */ /* So, if detected feature is APPEARING... */ - if(feature_patterns[feature_id].appearing){ + if(g_feature_patterns[feature_id].appearing){ /* Set y location to second scan row. */ y_loc = cy+1; /* Set y location of neighboring edge pixel to the first scan row. */ @@ -2665,7 +2665,7 @@ int process_horizontal_scan_minutia_V2(MINUTIAE *minutiae, else{ /* Get minutia direction based on current block's direction. */ idir = get_low_curvature_direction(SCAN_HORIZONTAL, - feature_patterns[feature_id].appearing, dmapval, + g_feature_patterns[feature_id].appearing, dmapval, lfsparms->num_directions); } @@ -2680,8 +2680,8 @@ int process_horizontal_scan_minutia_V2(MINUTIAE *minutiae, /* Create a minutia object based on derived attributes. */ if((ret = create_minutia(&minutia, x_loc, y_loc, x_edge, y_edge, idir, reliability, - feature_patterns[feature_id].type, - feature_patterns[feature_id].appearing, feature_id))) + g_feature_patterns[feature_id].type, + g_feature_patterns[feature_id].appearing, feature_id))) /* Return system error. */ return(ret); @@ -2740,7 +2740,7 @@ int process_vertical_scan_minutia(MINUTIAE *minutiae, /* Feature location should always point to either ending */ /* of ridge or (for bifurcations) ending of valley. */ /* So, if detected feature is APPEARING... */ - if(feature_patterns[feature_id].appearing){ + if(g_feature_patterns[feature_id].appearing){ /* Set x location to second scan column. */ x_loc = cx+1; /* Set x location of neighboring edge pixel to the first scan column. */ @@ -2776,15 +2776,15 @@ int process_vertical_scan_minutia(MINUTIAE *minutiae, else{ /* Get minutia direction based on current IMAP value. */ idir = get_low_curvature_direction(SCAN_VERTICAL, - feature_patterns[feature_id].appearing, + g_feature_patterns[feature_id].appearing, imapval, lfsparms->num_directions); } /* Create a minutia object based on derived attributes. */ if((ret = create_minutia(&minutia, x_loc, y_loc, x_edge, y_edge, idir, DEFAULT_RELIABILITY, - feature_patterns[feature_id].type, - feature_patterns[feature_id].appearing, feature_id))) + g_feature_patterns[feature_id].type, + g_feature_patterns[feature_id].appearing, feature_id))) /* Return system error. */ return(ret); @@ -2845,7 +2845,7 @@ int process_vertical_scan_minutia_V2(MINUTIAE *minutiae, /* Feature location should always point to either ending */ /* of ridge or (for bifurcations) ending of valley. */ /* So, if detected feature is APPEARING... */ - if(feature_patterns[feature_id].appearing){ + if(g_feature_patterns[feature_id].appearing){ /* Set x location to second scan column. */ x_loc = cx+1; /* Set x location of neighboring edge pixel to the first scan column. */ @@ -2890,7 +2890,7 @@ int process_vertical_scan_minutia_V2(MINUTIAE *minutiae, else{ /* Get minutia direction based on current block's direction. */ idir = get_low_curvature_direction(SCAN_VERTICAL, - feature_patterns[feature_id].appearing, dmapval, + g_feature_patterns[feature_id].appearing, dmapval, lfsparms->num_directions); } @@ -2905,8 +2905,8 @@ int process_vertical_scan_minutia_V2(MINUTIAE *minutiae, /* Create a minutia object based on derived attributes. */ if((ret = create_minutia(&minutia, x_loc, y_loc, x_edge, y_edge, idir, reliability, - feature_patterns[feature_id].type, - feature_patterns[feature_id].appearing, feature_id))) + g_feature_patterns[feature_id].type, + g_feature_patterns[feature_id].appearing, feature_id))) /* Return system error. */ return(ret); -- 1.7.12.4