Skip to content

Commit 112aeb9

Browse files
committed
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 <[email protected]>
1 parent 629a10b commit 112aeb9

32 files changed

+123
-202
lines changed

src/ccmain/adaptions.cpp

+12-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**********************************************************************
22
* File: adaptions.cpp (Formerly adaptions.c)
33
* Description: Functions used to adapt to blobs already confidently
4-
* identified
5-
* Author: Chris Newton
6-
* Created: Thu Oct 7 10:17:28 BST 1993
4+
* identified
5+
* Author: Chris Newton
6+
* Created: Thu Oct 7 10:17:28 BST 1993
77
*
88
* (C) Copyright 1992, Hewlett-Packard Ltd.
99
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,18 +18,15 @@
1818
*
1919
**********************************************************************/
2020

21-
#ifdef __UNIX__
22-
#include <assert.h>
23-
#endif
24-
#include <ctype.h>
25-
#include <string.h>
26-
#include "tessbox.h"
27-
#include "tessvars.h"
28-
#include "memry.h"
29-
#include "reject.h"
30-
#include "control.h"
31-
#include "stopper.h"
32-
#include "tesseractclass.h"
21+
#include <ctype.h>
22+
#include <string.h>
23+
#include "tessbox.h"
24+
#include "tessvars.h"
25+
#include "memry.h"
26+
#include "reject.h"
27+
#include "control.h"
28+
#include "stopper.h"
29+
#include "tesseractclass.h"
3330

3431
// Include automatically generated configuration file if running autoconf.
3532
#ifdef HAVE_CONFIG_H

src/ccmain/applybox.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
**********************************************************************/
1919

2020
#include <ctype.h>
21-
#include <string.h>
22-
#ifdef __UNIX__
23-
#include <assert.h>
2421
#include <errno.h>
25-
#endif
22+
#include <string.h>
2623
#include "allheaders.h"
2724
#include "boxread.h"
2825
#include "chopper.h"

src/ccmain/control.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@
2727
#include <string.h>
2828
#include <cmath>
2929
#ifdef __UNIX__
30-
#include <assert.h>
3130
#include <unistd.h>
32-
#include <errno.h>
3331
#endif
3432
#include <ctype.h>
33+
#include <errno.h>
3534
#include "callcpp.h"
3635
#include "control.h"
3736
#include "docqual.h"

src/ccmain/output.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
*
1818
**********************************************************************/
1919

20-
#include <string.h>
2120
#include <ctype.h>
21+
#include <errno.h>
22+
#include <string.h>
2223
#ifdef __UNIX__
23-
#include <assert.h>
24-
#include <unistd.h>
25-
#include <errno.h>
24+
#include <unistd.h>
2625
#endif
2726
#include "helpers.h"
2827
#include "tessvars.h"

src/ccmain/reject.cpp

+12-15
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@
1717
*
1818
**********************************************************************/
1919

20-
#include "tessvars.h"
21-
#ifdef __UNIX__
22-
#include <assert.h>
23-
#include <errno.h>
24-
#endif
25-
#include "scanutils.h"
26-
#include <ctype.h>
27-
#include <string.h>
28-
#include "genericvector.h"
29-
#include "reject.h"
30-
#include "control.h"
31-
#include "docqual.h"
32-
#include "globaloc.h" // For err_exit.
33-
#include "globals.h"
34-
#include "helpers.h"
20+
#include "tessvars.h"
21+
#include "scanutils.h"
22+
#include <ctype.h>
23+
#include <errno.h>
24+
#include <string.h>
25+
#include "genericvector.h"
26+
#include "reject.h"
27+
#include "control.h"
28+
#include "docqual.h"
29+
#include "globaloc.h" // For err_exit.
30+
#include "globals.h"
31+
#include "helpers.h"
3532

3633
#include "tesseractclass.h"
3734

src/ccstruct/blread.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: blread.cpp (Formerly pdread.c)
33
* Description: Friend function of BLOCK to read the uscan pd file.
4-
* Author: Ray Smith
5-
* Created: Mon Mar 18 14:39:00 GMT 1991
4+
* Author: Ray Smith
5+
* Created: Mon Mar 18 14:39:00 GMT 1991
66
*
77
* (C) Copyright 1991, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,13 +17,10 @@
1717
*
1818
**********************************************************************/
1919

20-
#include <stdlib.h>
21-
#ifdef __UNIX__
22-
#include <assert.h>
23-
#endif
24-
#include "scanutils.h"
25-
#include "fileerr.h"
26-
#include "blread.h"
20+
#include <stdlib.h>
21+
#include "scanutils.h"
22+
#include "fileerr.h"
23+
#include "blread.h"
2724

2825
#define UNLV_EXT ".uzn" // unlv zone file
2926

src/ccstruct/coutln.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: coutln.cpp (Formerly coutline.c)
33
* Description: Code for the C_OUTLINE class.
4-
* Author: Ray Smith
5-
* Created: Mon Oct 07 16:01:57 BST 1991
4+
* Author: Ray Smith
5+
* Created: Mon Oct 07 16:01:57 BST 1991
66
*
77
* (C) Copyright 1991, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,9 +19,6 @@
1919

2020
#include <algorithm>
2121
#include <string.h>
22-
#ifdef __UNIX__
23-
#include <assert.h>
24-
#endif
2522

2623
#include "coutln.h"
2724

src/ccstruct/pageres.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
** limitations under the License.
2222
*
2323
**********************************************************************/
24-
#include <stdlib.h>
25-
#ifdef __UNIX__
26-
#include <assert.h>
27-
#endif
28-
#include "blamer.h"
29-
#include "pageres.h"
30-
#include "blobs.h"
24+
25+
#include <stdlib.h>
26+
#include <cassert>
27+
#include "blamer.h"
28+
#include "pageres.h"
29+
#include "blobs.h"
3130

3231
ELISTIZE (BLOCK_RES)
3332
CLISTIZE (BLOCK_RES) ELISTIZE (ROW_RES) ELISTIZE (WERD_RES)

src/ccstruct/polyaprx.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
*
1818
**********************************************************************/
1919

20-
#include <stdio.h>
21-
#ifdef __UNIX__
22-
#include <assert.h>
23-
#endif
20+
#include <stdio.h>
2421
#define FASTEDGELENGTH 256
25-
#include "polyaprx.h"
26-
#include "params.h"
27-
#include "tprintf.h"
22+
#include "polyaprx.h"
23+
#include "params.h"
24+
#include "tprintf.h"
2825

2926
#define EXTERN
3027

src/ccstruct/ratngs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef RATNGS_H
2121
#define RATNGS_H
2222

23-
#include <assert.h>
23+
#include <cassert>
2424

2525
#include "clst.h"
2626
#include "elst.h"

src/ccstruct/rejctmap.h

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ OF THIS IMPLIED TEMPORAL ORDERING OF THE FLAGS!!!!
4141
#ifndef REJCTMAP_H
4242
#define REJCTMAP_H
4343

44-
#ifdef __UNIX__
45-
#include <assert.h>
46-
#endif
4744
#include <memory>
4845
#include "bits16.h"
4946
#include "errcode.h"

src/ccstruct/split.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636

3737
#include <algorithm>
3838

39-
#ifdef __UNIX__
40-
#include <assert.h>
41-
#endif
42-
4339
/*----------------------------------------------------------------------
4440
V a r i a b l e s
4541
----------------------------------------------------------------------*/

src/ccutil/strngs.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: strngs.cpp (Formerly strings.c)
33
* Description: STRING class functions.
4-
* Author: Ray Smith
5-
* Created: Fri Feb 15 09:13:30 GMT 1991
4+
* Author: Ray Smith
5+
* Created: Fri Feb 15 09:13:30 GMT 1991
66
*
77
* (C) Copyright 1991, Hewlett-Packard Ltd.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,7 +19,7 @@
1919

2020
#include "strngs.h"
2121

22-
#include <assert.h>
22+
#include <cassert>
2323

2424
#include "errcode.h"
2525
#include "genericvector.h"

src/classify/adaptmatch.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@
5555
#include "werd.h"
5656

5757
#include <algorithm>
58+
#include <cassert>
5859
#include <cstdio>
5960
#include <cstring>
6061
#include <cstdlib>
6162
#include <cmath>
62-
#ifdef __UNIX__
63-
#include <assert.h>
64-
#endif
6563

6664
#define ADAPT_TEMPLATE_SUFFIX ".a"
6765

src/cutil/callcpp.cpp

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: callcpp.cpp
33
* Description: extern C interface calling C++ from C.
4-
* Author: Ray Smith
5-
* Created: Sun Feb 04 20:39:23 MST 1996
4+
* Author: Ray Smith
5+
* Created: Sun Feb 04 20:39:23 MST 1996
66
*
77
* (C) Copyright 1996, Hewlett-Packard Co.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,18 +22,15 @@
2222
#include "config_auto.h"
2323
#endif
2424

25-
#include "errcode.h"
26-
#ifdef __UNIX__
27-
#include <assert.h>
25+
#include "errcode.h"
2826
#include <stdarg.h>
29-
#endif
30-
#include <time.h>
31-
#include "memry.h"
32-
#include "scrollview.h"
33-
#include "params.h"
34-
#include "callcpp.h"
35-
#include "tprintf.h"
36-
#include "host.h"
27+
#include <time.h>
28+
#include "memry.h"
29+
#include "scrollview.h"
30+
#include "params.h"
31+
#include "callcpp.h"
32+
#include "tprintf.h"
33+
#include "host.h"
3734
#include "unichar.h"
3835

3936
#include <memory>

src/cutil/callcpp.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**********************************************************************
22
* File: callcpp.h
33
* Description: extern C interface calling C++ from C.
4-
* Author: Ray Smith
5-
* Created: Sun Feb 04 20:39:23 MST 1996
4+
* Author: Ray Smith
5+
* Created: Sun Feb 04 20:39:23 MST 1996
66
*
77
* (C) Copyright 1996, Hewlett-Packard Co.
88
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,9 +20,6 @@
2020
#ifndef CALLCPP_H
2121
#define CALLCPP_H
2222

23-
#ifndef __UNIX__
24-
#include <assert.h>
25-
#endif
2623
#include "host.h"
2724
#include "params.h"
2825
#include "unichar.h"

src/cutil/danerror.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
#include "danerror.h"
2323
#include "tprintf.h"
2424
#include "globaloc.h"
25-
#ifdef __UNIX__
26-
#include "assert.h"
27-
#endif
2825

2926
#include <cstdio>
3027

src/textord/fpchop.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@
1717
*
1818
**********************************************************************/
1919

20-
#ifdef __UNIX__
21-
#include <assert.h>
22-
#endif
23-
#include "stderr.h"
24-
#include "blobbox.h"
25-
#include "statistc.h"
26-
#include "drawtord.h"
27-
#include "tovars.h"
28-
#include "topitch.h"
29-
#include "fpchop.h"
20+
#include "stderr.h"
21+
#include "blobbox.h"
22+
#include "statistc.h"
23+
#include "drawtord.h"
24+
#include "tovars.h"
25+
#include "topitch.h"
26+
#include "fpchop.h"
3027

3128
// Include automatically generated configuration file if running autoconf.
3229
#ifdef HAVE_CONFIG_H

0 commit comments

Comments
 (0)