Clean usage of assert.h

Remove unneeded include statements, remove conditional statements and
replace the remaining assert.h by their standard C++ variant cassert.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-06-21 19:28:30 +02:00
parent 629a10b504
commit 112aeb9826
32 changed files with 123 additions and 202 deletions

View File

@ -1,9 +1,9 @@
/**********************************************************************
* File: adaptions.cpp (Formerly adaptions.c)
* Description: Functions used to adapt to blobs already confidently
* identified
* Author: Chris Newton
* Created: Thu Oct 7 10:17:28 BST 1993
* identified
* Author: Chris Newton
* Created: Thu Oct 7 10:17:28 BST 1993
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -18,18 +18,15 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include <ctype.h>
#include <string.h>
#include "tessbox.h"
#include "tessvars.h"
#include "memry.h"
#include "reject.h"
#include "control.h"
#include "stopper.h"
#include "tesseractclass.h"
#include <ctype.h>
#include <string.h>
#include "tessbox.h"
#include "tessvars.h"
#include "memry.h"
#include "reject.h"
#include "control.h"
#include "stopper.h"
#include "tesseractclass.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H

View File

@ -18,11 +18,8 @@
**********************************************************************/
#include <ctype.h>
#include <string.h>
#ifdef __UNIX__
#include <assert.h>
#include <errno.h>
#endif
#include <string.h>
#include "allheaders.h"
#include "boxread.h"
#include "chopper.h"

View File

@ -27,11 +27,10 @@
#include <string.h>
#include <cmath>
#ifdef __UNIX__
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#endif
#include <ctype.h>
#include <errno.h>
#include "callcpp.h"
#include "control.h"
#include "docqual.h"

View File

@ -17,12 +17,11 @@
*
**********************************************************************/
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#ifdef __UNIX__
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <unistd.h>
#endif
#include "helpers.h"
#include "tessvars.h"

View File

@ -17,21 +17,18 @@
*
**********************************************************************/
#include "tessvars.h"
#ifdef __UNIX__
#include <assert.h>
#include <errno.h>
#endif
#include "scanutils.h"
#include <ctype.h>
#include <string.h>
#include "genericvector.h"
#include "reject.h"
#include "control.h"
#include "docqual.h"
#include "globaloc.h" // For err_exit.
#include "globals.h"
#include "helpers.h"
#include "tessvars.h"
#include "scanutils.h"
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include "genericvector.h"
#include "reject.h"
#include "control.h"
#include "docqual.h"
#include "globaloc.h" // For err_exit.
#include "globals.h"
#include "helpers.h"
#include "tesseractclass.h"

View File

@ -1,8 +1,8 @@
/**********************************************************************
* File: blread.cpp (Formerly pdread.c)
* Description: Friend function of BLOCK to read the uscan pd file.
* Author: Ray Smith
* Created: Mon Mar 18 14:39:00 GMT 1991
* Author: Ray Smith
* Created: Mon Mar 18 14:39:00 GMT 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -17,13 +17,10 @@
*
**********************************************************************/
#include <stdlib.h>
#ifdef __UNIX__
#include <assert.h>
#endif
#include "scanutils.h"
#include "fileerr.h"
#include "blread.h"
#include <stdlib.h>
#include "scanutils.h"
#include "fileerr.h"
#include "blread.h"
#define UNLV_EXT ".uzn" // unlv zone file

View File

@ -1,8 +1,8 @@
/**********************************************************************
* File: coutln.cpp (Formerly coutline.c)
* Description: Code for the C_OUTLINE class.
* Author: Ray Smith
* Created: Mon Oct 07 16:01:57 BST 1991
* Author: Ray Smith
* Created: Mon Oct 07 16:01:57 BST 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -19,9 +19,6 @@
#include <algorithm>
#include <string.h>
#ifdef __UNIX__
#include <assert.h>
#endif
#include "coutln.h"

View File

@ -21,13 +21,12 @@
** limitations under the License.
*
**********************************************************************/
#include <stdlib.h>
#ifdef __UNIX__
#include <assert.h>
#endif
#include "blamer.h"
#include "pageres.h"
#include "blobs.h"
#include <stdlib.h>
#include <cassert>
#include "blamer.h"
#include "pageres.h"
#include "blobs.h"
ELISTIZE (BLOCK_RES)
CLISTIZE (BLOCK_RES) ELISTIZE (ROW_RES) ELISTIZE (WERD_RES)

View File

@ -17,14 +17,11 @@
*
**********************************************************************/
#include <stdio.h>
#ifdef __UNIX__
#include <assert.h>
#endif
#include <stdio.h>
#define FASTEDGELENGTH 256
#include "polyaprx.h"
#include "params.h"
#include "tprintf.h"
#include "polyaprx.h"
#include "params.h"
#include "tprintf.h"
#define EXTERN

View File

@ -20,7 +20,7 @@
#ifndef RATNGS_H
#define RATNGS_H
#include <assert.h>
#include <cassert>
#include "clst.h"
#include "elst.h"

View File

@ -41,9 +41,6 @@ OF THIS IMPLIED TEMPORAL ORDERING OF THE FLAGS!!!!
#ifndef REJCTMAP_H
#define REJCTMAP_H
#ifdef __UNIX__
#include <assert.h>
#endif
#include <memory>
#include "bits16.h"
#include "errcode.h"

View File

@ -36,10 +36,6 @@
#include <algorithm>
#ifdef __UNIX__
#include <assert.h>
#endif
/*----------------------------------------------------------------------
V a r i a b l e s
----------------------------------------------------------------------*/

View File

@ -1,8 +1,8 @@
/**********************************************************************
* File: strngs.cpp (Formerly strings.c)
* Description: STRING class functions.
* Author: Ray Smith
* Created: Fri Feb 15 09:13:30 GMT 1991
* Author: Ray Smith
* Created: Fri Feb 15 09:13:30 GMT 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -19,7 +19,7 @@
#include "strngs.h"
#include <assert.h>
#include <cassert>
#include "errcode.h"
#include "genericvector.h"

View File

@ -55,13 +55,11 @@
#include "werd.h"
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#ifdef __UNIX__
#include <assert.h>
#endif
#define ADAPT_TEMPLATE_SUFFIX ".a"

View File

@ -1,8 +1,8 @@
/**********************************************************************
* File: callcpp.cpp
* Description: extern C interface calling C++ from C.
* Author: Ray Smith
* Created: Sun Feb 04 20:39:23 MST 1996
* Author: Ray Smith
* Created: Sun Feb 04 20:39:23 MST 1996
*
* (C) Copyright 1996, Hewlett-Packard Co.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -22,18 +22,15 @@
#include "config_auto.h"
#endif
#include "errcode.h"
#ifdef __UNIX__
#include <assert.h>
#include "errcode.h"
#include <stdarg.h>
#endif
#include <time.h>
#include "memry.h"
#include "scrollview.h"
#include "params.h"
#include "callcpp.h"
#include "tprintf.h"
#include "host.h"
#include <time.h>
#include "memry.h"
#include "scrollview.h"
#include "params.h"
#include "callcpp.h"
#include "tprintf.h"
#include "host.h"
#include "unichar.h"
#include <memory>

View File

@ -1,8 +1,8 @@
/**********************************************************************
* File: callcpp.h
* Description: extern C interface calling C++ from C.
* Author: Ray Smith
* Created: Sun Feb 04 20:39:23 MST 1996
* Author: Ray Smith
* Created: Sun Feb 04 20:39:23 MST 1996
*
* (C) Copyright 1996, Hewlett-Packard Co.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -20,9 +20,6 @@
#ifndef CALLCPP_H
#define CALLCPP_H
#ifndef __UNIX__
#include <assert.h>
#endif
#include "host.h"
#include "params.h"
#include "unichar.h"

View File

@ -22,9 +22,6 @@
#include "danerror.h"
#include "tprintf.h"
#include "globaloc.h"
#ifdef __UNIX__
#include "assert.h"
#endif
#include <cstdio>

View File

@ -17,16 +17,13 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include "stderr.h"
#include "blobbox.h"
#include "statistc.h"
#include "drawtord.h"
#include "tovars.h"
#include "topitch.h"
#include "fpchop.h"
#include "stderr.h"
#include "blobbox.h"
#include "statistc.h"
#include "drawtord.h"
#include "tovars.h"
#include "topitch.h"
#include "fpchop.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H

View File

@ -17,24 +17,21 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include "stderr.h"
#include "blobbox.h"
#include "ccstruct.h"
#include "detlinefit.h"
#include "statistc.h"
#include "drawtord.h"
#include "blkocc.h"
#include "sortflts.h"
#include "oldbasel.h"
#include "textord.h"
#include "tordmain.h"
#include "underlin.h"
#include "makerow.h"
#include "tprintf.h"
#include "tovars.h"
#include "stderr.h"
#include "blobbox.h"
#include "ccstruct.h"
#include "detlinefit.h"
#include "statistc.h"
#include "drawtord.h"
#include "blkocc.h"
#include "sortflts.h"
#include "oldbasel.h"
#include "textord.h"
#include "tordmain.h"
#include "underlin.h"
#include "makerow.h"
#include "tprintf.h"
#include "tovars.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H

View File

@ -17,16 +17,13 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include <math.h>
#include "memry.h"
#include "makerow.h"
#include "pitsync1.h"
#include "topitch.h"
#include "pithsync.h"
#include "tprintf.h"
#include <math.h>
#include "memry.h"
#include "makerow.h"
#include "pitsync1.h"
#include "topitch.h"
#include "pithsync.h"
#include "tprintf.h"
#define PROJECTION_MARGIN 10 //arbitrary

View File

@ -1,8 +1,8 @@
/**********************************************************************
* File: pitsync1.cpp (Formerly pitsync.c)
* Description: Code to find the optimum fixed pitch segmentation of some blobs.
* Author: Ray Smith
* Created: Thu Nov 19 11:48:05 GMT 1992
* Author: Ray Smith
* Created: Thu Nov 19 11:48:05 GMT 1992
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -17,12 +17,9 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include <math.h>
#include "memry.h"
#include "pitsync1.h"
#include <math.h>
#include "memry.h"
#include "pitsync1.h"
ELISTIZE (FPSEGPT) CLISTIZE (FPSEGPT_LIST)
#define EXTERN

View File

@ -17,20 +17,17 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include "stderr.h"
#include "blobbox.h"
#include "statistc.h"
#include "drawtord.h"
#include "makerow.h"
#include "pitsync1.h"
#include "pithsync.h"
#include "tovars.h"
#include "wordseg.h"
#include "topitch.h"
#include "helpers.h"
#include "stderr.h"
#include "blobbox.h"
#include "statistc.h"
#include "drawtord.h"
#include "makerow.h"
#include "pitsync1.h"
#include "pithsync.h"
#include "tovars.h"
#include "wordseg.h"
#include "topitch.h"
#include "helpers.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H

View File

@ -21,9 +21,6 @@
#include "config_auto.h"
#endif
#ifdef __UNIX__
#include <assert.h>
#endif
#include "stderr.h"
#include "globaloc.h"
#include "blread.h"

View File

@ -17,10 +17,7 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include "underlin.h"
#include "underlin.h"
#define PROJECTION_MARGIN 10 //arbitrary
#define EXTERN

View File

@ -17,21 +17,18 @@
*
**********************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include "stderr.h"
#include "blobbox.h"
#include "statistc.h"
#include "drawtord.h"
#include "makerow.h"
#include "pitsync1.h"
#include "tovars.h"
#include "topitch.h"
#include "cjkpitch.h"
#include "textord.h"
#include "fpchop.h"
#include "wordseg.h"
#include "stderr.h"
#include "blobbox.h"
#include "statistc.h"
#include "drawtord.h"
#include "makerow.h"
#include "pitsync1.h"
#include "tovars.h"
#include "topitch.h"
#include "cjkpitch.h"
#include "textord.h"
#include "fpchop.h"
#include "wordseg.h"
// Include automatically generated configuration file if running autoconf.
#ifdef HAVE_CONFIG_H

View File

@ -14,7 +14,6 @@
#include "commontraining.h"
#include <algorithm>
#include <assert.h>
#include <cmath>
#include "allheaders.h"

View File

@ -20,7 +20,6 @@
#include "normstrngs.h"
#include <assert.h>
#include <string>
#include <unordered_map>
#include <vector>

View File

@ -19,11 +19,8 @@
///////////////////////////////////////////////////////////////////////
#include <cstdio>
#ifdef __UNIX__
#include <assert.h>
#endif
#include <cmath>
#include <cstdio>
#include "associate.h"
#include "normalis.h"

View File

@ -31,7 +31,6 @@
#include "chopper.h"
#include "assert.h"
#include "associate.h"
#include "blobs.h"
#include "callcpp.h"

View File

@ -31,10 +31,6 @@
#include "outlines.h"
#include "wordrec.h"
#ifdef __UNIX__
#include <assert.h>
#endif
namespace tesseract {
/*----------------------------------------------------------------------
F u n c t i o n s

View File

@ -22,9 +22,6 @@
** limitations under the License.
*
*********************************************************************************/
#ifdef __UNIX__
#include <assert.h>
#endif
#include "plotedges.h"
#include "render.h"

View File

@ -25,9 +25,6 @@
#include "render.h"
#include "blobs.h"
#ifdef __UNIX__
#include <assert.h>
#endif
#include <cmath>
#include "vecfuncs.h"