Skip to content

Commit c635cdf

Browse files
committed
Do not define or use macro __UNIX__
Either it was not needed, or it could be replaced by checking for not _WIN32. This fixes a compiler warning from clang: src/ccutil/platform.h:41:9: warning: macro name is a reserved identifier [-Wreserved-id-macro] Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 3a7cd2b commit c635cdf

File tree

12 files changed

+12
-40
lines changed

12 files changed

+12
-40
lines changed

src/ccmain/control.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
#include <cstdint> // for int16_t, int32_t
2828
#include <cstdio> // for fclose, fopen, FILE
2929
#include <ctime> // for clock
30-
#ifdef __UNIX__
31-
#include <unistd.h>
32-
#endif
3330
#include <cctype>
3431
#include "callcpp.h"
3532
#include "control.h"

src/ccmain/output.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
#include <ctype.h>
2121
#include <errno.h>
2222
#include <cstring>
23-
#ifdef __UNIX__
24-
#include <unistd.h>
25-
#endif
2623
#include "helpers.h"
2724
#include "tessvars.h"
2825
#include "control.h"

src/ccmain/pgedit.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ ScrollView* image_win;
104104
ParamsEditor* pe;
105105
bool stillRunning = false;
106106

107-
#ifdef __UNIX__
108-
FILE *debug_window = nullptr; // opened on demand
109-
#endif
110107
ScrollView* bln_word_window = nullptr; // baseline norm words
111108

112109
CMD_EVENTS mode = CHANGE_DISP_CMD_EVENT; // selected words op

src/ccstruct/pdblock.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ void PDBLK::plot( //draw outline
198198
// tprintf("Block %d bottom left is (%d,%d)\n",
199199
// serial,startpt.x(),startpt.y());
200200
char temp_buff[34];
201-
#if defined(__UNIX__) || defined(MINGW)
201+
#if !defined(_WIN32) || defined(MINGW)
202202
snprintf(temp_buff, sizeof(temp_buff), "%" PRId32, serial);
203-
#else
203+
#else
204204
ultoa (serial, temp_buff, 10);
205-
#endif
205+
#endif
206206
window->Text(startpt.x (), startpt.y (), temp_buff);
207207

208208
window->SetCursor(startpt.x (), startpt.y ());

src/ccstruct/polyblk.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ void POLY_BLOCK::plot(ScrollView* window, int32_t num) {
250250
if (num > 0) {
251251
window->TextAttributes("Times", 80, false, false, false);
252252
char temp_buff[34];
253-
#if defined(__UNIX__) || defined(MINGW)
253+
#if !defined(_WIN32) || defined(MINGW)
254254
snprintf(temp_buff, sizeof(temp_buff), "%" PRId32, num);
255-
#else
255+
#else
256256
ltoa (num, temp_buff, 10);
257-
#endif
257+
#endif
258258
window->Text(v.data ()->x (), v.data ()->y (), temp_buff);
259259
}
260260

src/ccutil/errcode.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
#include <stdlib.h>
2222
#include <stdarg.h>
2323
#include <cstring>
24-
#ifdef __UNIX__
25-
#include <signal.h>
26-
#endif
2724
#include "tprintf.h"
2825
#include "errcode.h"
2926

src/ccutil/mainblk.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717
*
1818
**********************************************************************/
1919

20-
#include "fileerr.h"
21-
#ifdef __UNIX__
22-
#include <unistd.h>
23-
#include <signal.h>
24-
#else
25-
#include <io.h>
20+
#include <cstdlib>
21+
#if defined(_WIN32)
22+
#include <io.h> // for _access
2623
#endif
27-
#include <stdlib.h>
28-
#include "ccutil.h"
24+
25+
#include "fileerr.h"
26+
#include "ccutil.h"
2927

3028
#define VARDIR "configs/" /**< variables files */
3129
#define EXTERN

src/ccutil/platform.h

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#endif
3939
#endif /* defined(_MSC_VER) */
4040
#else
41-
#define __UNIX__
4241
#include <limits.h>
4342
#ifndef PATH_MAX
4443
#define MAX_PATH 4096

src/classify/adaptive.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
#include "globals.h"
2525
#include "classify.h"
2626

27-
#ifdef __UNIX__
2827
#include <cassert>
29-
#endif
3028
#include <cstdio>
3129

3230
using tesseract::TFile;

src/classify/intproto.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include <cmath>
2424
#include <cstdio>
2525
#include <cassert>
26-
#ifdef __UNIX__
27-
#include <unistd.h>
28-
#endif
2926

3027
#include "classify.h"
3128
#include "callcpp.h" // for cprintf

src/textord/fpchop.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,7 @@ bool fixed_chop_coutline( //chop the outline
448448
else
449449
break;
450450
}
451-
//#ifdef __UNIX__
452451
ASSERT_HOST (head_index != tail_index);
453-
//#endif
454452
if (!first_frag) {
455453
save_chop_cfragment(head_index,
456454
head_pos,
@@ -480,9 +478,7 @@ bool fixed_chop_coutline( //chop the outline
480478
tail_index = 0;
481479
}
482480
while (tail_pos.x () != chop_coord);
483-
//#ifdef __UNIX__
484481
ASSERT_HOST (head_index != tail_index);
485-
//#endif
486482
save_chop_cfragment(head_index,
487483
head_pos,
488484
tail_index,

src/wordrec/tface.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
#include "params_model.h"
2929

3030
#include <cmath>
31-
#ifdef __UNIX__
32-
#include <unistd.h>
33-
#endif
34-
3531

3632
namespace tesseract {
3733

0 commit comments

Comments
 (0)