Skip to content

Commit

Permalink
Remove some unused variables from the library and progs
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBloomberg committed Nov 27, 2022
1 parent 60415e7 commit b21f8e9
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 34 deletions.
9 changes: 9 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,15 @@ <h2> <A NAME="BUILDING">
(4) Programs that were used to test library functions or auto-generate
library code. These are useful for testing the behavior of small
sets of functions and for providing example code.

6. Sanitizers can be used on all the regression tests in alltests_reg.c.

First run autogen.sh to generate the configure script
autogen.sh
Then run configure to generate the Makefile with the address sanitizer
./configure '--disable-shared' '--enable-debug' 'CFLAGS=-D_GLIBCXX_DEBUG -DDEBUG=1 -Wall -pedantic -g -O0 -fsanitize=address,undefined -fstack-protector-strong -ftrapv'
Make and run all the regression tests
make check
</pre>

<h2> <A NAME="DEPENDENCIES">
Expand Down
5 changes: 2 additions & 3 deletions prog/binarize_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ int main(int argc,
char **argv)
{
char *infile;
l_int32 w, d, threshval, ival, newval;
l_uint32 val;
PIX *pixs, *pixg, *pixg2;
l_int32 w, d, threshval;
PIX *pixs, *pixg;
PIX *pix1, *pix2;
PIXA *pixa;

Expand Down
2 changes: 1 addition & 1 deletion prog/boxa3_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TestBoxa(L_REGPARAMS *rp,
l_uint8 *data;
l_int32 w, h, medw, medh, isame;
size_t size;
l_float32 scalefact, devw, devh, ratiowh, fvarp, fvarm;
l_float32 scalefact, devw, ratiowh, fvarp, fvarm;
BOXA *boxa1, *boxa2, *boxa3;
PIX *pix1;

Expand Down
2 changes: 1 addition & 1 deletion prog/circle_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static const l_int32 num_erodes = 8;
int main(int argc,
char **argv)
{
l_int32 i, k, prevcount, count, nfiles, n, maxloc, maxval, minval;
l_int32 i, k, count, n, maxloc, maxval, minval;
NUMA *na;
PIX *pixs, *pixsi, *pixc, *pixoc, *pix1, *pix2, *pix3;
PIXA *pixas, *pixa1, *pixa2;
Expand Down
1 change: 0 additions & 1 deletion prog/colorquant_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

#include "allheaders.h"

static const l_int32 SPACE = 30;
static const l_int32 MAX_WIDTH = 350;
static const char *image[4] = {"marge.jpg",
"test24.jpg",
Expand Down
2 changes: 1 addition & 1 deletion prog/flipdetect_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
int main(int argc,
char **argv)
{
l_int32 i, orient, rotation;
l_int32 orient, rotation;
l_float32 upconf, leftconf, conf;
PIX *pix, *pixs, *pix1, *pix2;
PIXA *pixa;
Expand Down
2 changes: 1 addition & 1 deletion prog/grayfill_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc,
l_int32 i, j;
PIX *pixm, *pixmi, *pixs1, *pixs1_8, *pix1;
PIX *pixs2, *pixs2_8, *pixs3, *pixs3_8;
PIX *pixb1, *pixb2, *pixb3, *pixmin, *pixd;
PIX *pixb1, *pixb2, *pixb3, *pixmin;
PIXA *pixa;
L_REGPARAMS *rp;

Expand Down
2 changes: 1 addition & 1 deletion prog/iomisc_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc,
char **argv)
{
char *text;
l_int32 w, h, d, level, wpl, format, xres, yres;
l_int32 w, h, d, wpl, format, xres, yres;
l_int32 bps, spp, res, iscmap;
size_t size;
FILE *fp;
Expand Down
4 changes: 2 additions & 2 deletions prog/jbrankhaus.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ int main(int argc,
char **argv)
{
char filename[BUF_SIZE];
char *dirin, *fname;
char *dirin;
l_int32 i, size, firstpage, npages, nfiles;
l_float32 rank;
JBDATA *data;
JBCLASSER *classer;
SARRAY *safiles;
PIX *pix, *pixt;
PIX *pix;
PIXA *pixa, *pixadb;

if (argc != 4 && argc != 6)
Expand Down
2 changes: 1 addition & 1 deletion prog/lowsat_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
int main(int argc,
char **argv)
{
l_int32 i, j, w, h, wpl, val;
l_int32 i, j, wpl, val;
l_uint32 gray32;
l_uint32 *data, *line;
PIX *pix1, *pix2, *pix3, *pix4, *pix5, *pix6, *pix7;
Expand Down
2 changes: 1 addition & 1 deletion prog/maze_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int main(int argc,
char **argv)
{
l_int32 i, w, h;
PIX *pixm, *pixs, *pixg, *pixt, *pixd;
PIX *pixm, *pixg, *pixt, *pixd;
PIXA *pixa;
PIXAA *paa;
PTA *pta;
Expand Down
2 changes: 1 addition & 1 deletion prog/messagetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ l_int32 orig_severity;
L_INFO ("Second message\n", "messagetest");
L_WARNING ("Second message\n", "messagetest");
L_ERROR ("Second message\n", "messagetest");
};
}

void TestStderrRedirect() {
PIX *pix1;
Expand Down
1 change: 0 additions & 1 deletion prog/otsutest1.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ static const l_int32 NTests = 5;
static const l_int32 gaussmean1[5] = {20, 40, 60, 80, 60};
static const l_int32 gaussstdev1[5] = {10, 20, 20, 20, 30};
static const l_int32 gaussmean2[5] = {220, 200, 140, 180, 150};
static const l_int32 gaussstdev2[5] = {15, 20, 40, 20, 30};
static const l_float32 gaussfract1[5] = {0.2f, 0.3f, 0.1f, 0.5f, 0.3f};
static char buf[256];

Expand Down
2 changes: 1 addition & 1 deletion prog/pixadisp_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ char *fname;
BOX *box;
BOXA *boxa;
PIX *pixs, *pix32, *pix1, *pix2, *pix3, *pix4;
PIXA *pixa, *pixa1, *pixa2, *pixa3, *pixa4;
PIXA *pixa, *pixa1, *pixa2, *pixa3;
SARRAY *sa1, *sa2;
L_REGPARAMS *rp;

Expand Down
2 changes: 1 addition & 1 deletion prog/scale_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int main(int argc,
char **argv)
{
char *filein, *fileout;
l_int32 sharpen, antialias, togray, format, lossless, d;
l_int32 sharpen, antialias, togray, lossless, d;
l_float32 scalex, scaley;
PIX *pixs, *pixd;

Expand Down
2 changes: 1 addition & 1 deletion src/colorfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pixColorFill(PIX *pixs,
l_int32 minarea,
l_int32 debug)
{
l_int32 x, y, w, h, empty;
l_int32 x, y, w, h;
l_uint32 val;
L_KERNEL *kel;
PIX *pixm, *pixm1, *pixv, *pixnc, *pixncd, *pixss, *pixf;
Expand Down
1 change: 0 additions & 1 deletion src/dnafunc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ l_dnaRemoveDupsByHmap(L_DNA *das,
L_HASHMAP **phmap)
{
l_int32 i, tabsize;
l_uint64 key;
l_float64 dval;
L_DNA *dad;
L_HASHITEM *hitem;
Expand Down
3 changes: 1 addition & 2 deletions src/numafunc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ numaDiscretizeSortedInBins(NUMA *na,
{
NUMA *nabinval; /* average gray value in the bins */
NUMA *naeach;
l_int32 i, ntot, count, bincount, binindex, binsize;
l_int32 i, ntot, bincount, binindex, binsize;
l_float32 sum, val, ave;

if (!pnabinval)
Expand Down Expand Up @@ -1738,7 +1738,6 @@ numaDiscretizeHistoInBins(NUMA *na,
NUMA **pnarank)
{
NUMA *nabinval; /* average gray value in the bins */
NUMA *narank; /* rank value as function of input value */
NUMA *naeach, *nan;
l_int32 i, j, k, nxvals, occup, count, bincount, binindex, binsize;
l_float32 sum, ave, ntot;
Expand Down
3 changes: 1 addition & 2 deletions src/pixafunc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ pixaDisplayPairTiledInColumns(PIXA *pixas1,
l_int32 startindex,
SARRAY *sa)
{
l_int32 i, n, w, maxd, maxd1, maxd2, res, text;
l_int32 i, n, w, maxd, maxd1, maxd2, text;
NUMA *na;
PIX *pixs1, *pixs2, *pix1, *pix2, *pix3, *pix4;
PIX *pix5, *pix6, *pix7, *pix8, *pix9;
Expand Down Expand Up @@ -1482,7 +1482,6 @@ SARRAY *sa1;
pix5 = pixClone(pix3);
pix6 = pixClone(pix4);
}
if (i == 0) res = pixGetXRes(pix3);
pixDestroy(&pix3);
pixDestroy(&pix4);
if (spacing1) { /* white border */
Expand Down
7 changes: 3 additions & 4 deletions src/pnmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ static l_int32
pnmReadNextAsciiValue(FILE *fp,
l_int32 *pval)
{
l_int32 c, ignore;
l_int32 ignore;

if (!pval)
return ERROR_INT("&val not defined", __func__, 1);
Expand Down Expand Up @@ -1420,8 +1420,7 @@ pnmReadNextString(FILE *fp,
char *buff,
l_int32 size)
{
l_int32 i, c;
char fmtString[6]; /* must contain "%9999s" [*] */
char fmtString[7]; /* must contain "%9999s" [*] */

if (!buff)
return ERROR_INT("buff not defined", __func__, 1);
Expand All @@ -1441,7 +1440,7 @@ char fmtString[6]; /* must contain "%9999s" [*] */
if (pnmSkipCommentLines(fp))
return ERROR_INT("end of file reached", __func__, 1);

snprintf(fmtString, 6, "%%%ds", size-1);
snprintf(fmtString, 7, "%%%ds", size - 1);
if (fscanf(fp, fmtString, buff) == EOF)
return 1;

Expand Down
1 change: 0 additions & 1 deletion src/ptafunc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ ptaRemoveDupsByHmap(PTA *ptas,
L_HASHMAP **phmap)
{
l_int32 i, x, y, tabsize;
l_uint64 key;
PTA *ptad;
L_HASHITEM *hitem;
L_HASHMAP *hmap;
Expand Down
8 changes: 3 additions & 5 deletions src/readbarcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,7 @@ pixExtractBarcodeWidths2(PIX *pixs,
NUMA **pnac,
l_int32 debugflag)
{
l_int32 width;
NUMA *nac, *nacp, *nad;
NUMA *nacp, *nad;

if (pwidth) *pwidth = 0;
if (pnac) *pnac = NULL;
Expand Down Expand Up @@ -1005,8 +1004,8 @@ numaGetCrossingDistances(NUMA *nas,
l_float32 *pmindist,
l_float32 *pmaxdist)
{
l_int32 i, n, nspan;
l_float32 val, newval, mindist, maxdist, dist;
l_int32 i, n;
l_float32 val, newval, mindist, maxdist;
NUMA *na1, *na2, *naedist, *naodist;

if (pnaedist) *pnaedist = NULL;
Expand Down Expand Up @@ -1037,7 +1036,6 @@ NUMA *na1, *na2, *naedist, *naodist;
/* The min and max rank distances of the spans are in pixel units. */
na1 = numaCopy(naedist);
numaJoin(na1, naodist, 0, -1); /* use both bars and spaces */
nspan = numaGetCount(na1);
na2 = numaMakeHistogram(na1, 100, NULL, NULL);
numaHistogramGetValFromRank(na2, 0.1, &mindist);
numaHistogramGetValFromRank(na2, 0.9, &maxdist);
Expand Down
1 change: 0 additions & 1 deletion src/sarray2.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ sarrayRemoveDupsByHmap(SARRAY *sas,
L_HASHMAP **phmap)
{
l_int32 i, tabsize;
l_uint64 key;
char *str;
SARRAY *sad;
L_HASHITEM *hitem;
Expand Down

0 comments on commit b21f8e9

Please sign in to comment.