From 91b78c7cdb8b549ea157fd5c27c34a9acd4c5f87 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 31 Mar 2015 10:55:28 +0300
Subject: Haiku patch


diff --git a/src/sarray.c b/src/sarray.c
index 32ff12f..531bb9d 100644
--- a/src/sarray.c
+++ b/src/sarray.c
@@ -137,6 +137,7 @@
 #include <string.h>
 #ifndef _WIN32
 #include <dirent.h>     /* unix only */
+#include <sys/stat.h>
 #endif  /* ! _WIN32 */
 #include "allheaders.h"
 
@@ -1868,6 +1869,7 @@ l_int32         len;
 SARRAY         *safiles;
 DIR            *pdir;
 struct dirent  *pdirentry;
+struct stat     s;
 
     PROCNAME("getFilenamesInDirectory");
 
@@ -1887,7 +1889,8 @@ struct dirent  *pdirentry;
          * define _BSD_SOURCE in the CC command, because the DT_DIR
          * flag is non-standard.  */
 #if !defined(__SOLARIS__)
-        if (pdirentry->d_type == DT_DIR)
+        stat(pdirentry->d_name, &s);
+        if(S_ISDIR(s.st_mode))
             continue;
 #endif
 
-- 
1.8.3.4


From cc2615d0dbf87f8f1d204006d4af9414d245a2bc Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Tue, 31 Mar 2015 10:56:57 +0300
Subject: gcc2 fixes


diff --git a/src/boxfunc1.c b/src/boxfunc1.c
index 9b4705d..eb3813f 100644
--- a/src/boxfunc1.c
+++ b/src/boxfunc1.c
@@ -77,6 +77,7 @@
  *                       box1, and 0 otherwise)
  *      Return: 0 if OK, 1 on error
  */
+l_int32  x1, y1, w1, h1, x2, y2, w2, h2;
 l_int32
 boxContains(BOX     *box1,
             BOX     *box2,
@@ -87,7 +88,6 @@ boxContains(BOX     *box1,
     if (!box1 || !box2)
         return ERROR_INT("box1 and box2 not both defined", procName, 1);
 
-l_int32  x1, y1, w1, h1, x2, y2, w2, h2;
 
     boxGetGeometry(box1, &x1, &y1, &w1, &h1);
     boxGetGeometry(box2, &x2, &y2, &w2, &h2);
diff --git a/src/compare.c b/src/compare.c
index 11f0f37..841d1ca 100644
--- a/src/compare.c
+++ b/src/compare.c
@@ -1909,6 +1909,7 @@ l_int32   *tab;
 l_float32  maxscore, score;
 FPIX      *fpix;
 PIX       *pix3, *pix4;
+char  buf[128];
 
     PROCNAME("pixBestCorrelation");
 
@@ -1955,7 +1956,6 @@ PIX       *pix3, *pix4;
 
     if (debugflag > 0) {
         lept_mkdir("lept");
-        char  buf[128];
         pix3 = fpixDisplayMaxDynamicRange(fpix);
         pix4 = pixExpandReplicate(pix3, 20);
         snprintf(buf, sizeof(buf), "/tmp/lept/correl_%d.png", debugflag);
diff --git a/src/recogident.c b/src/recogident.c
index 3db8b36..adea42b 100644
--- a/src/recogident.c
+++ b/src/recogident.c
@@ -781,6 +781,7 @@ l_float32   maxscore, score;
 l_float32  *ycent1;
 FPIX       *fpix;
 PIX        *pixt, *pixt1, *pixt2;
+char  buf[128];
 
     PROCNAME("pixCorrelationBestShift");
 
@@ -869,7 +870,6 @@ PIX        *pixt, *pixt1, *pixt2;
 
     if (debugflag > 0) {
         lept_mkdir("recog");
-        char  buf[128];
         pixt1 = fpixDisplayMaxDynamicRange(fpix);
         pixt2 = pixExpandReplicate(pixt1, 5);
         snprintf(buf, sizeof(buf), "/tmp/recog/junkbs_%d.png", debugflag);
-- 
1.8.3.4

