graphics/ocropus: Fix C++ issues for modern compilers

Approved by:	portmgr (bapt, implicit)
This commit is contained in:
John Marino 2013-11-01 13:48:34 +00:00
parent 0d40a9bdaf
commit b2c0318025
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=332372
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,12 @@
--- ocr-layout/ocr-reading-order.cc.orig 2009-05-31 20:18:41.000000000 +0000
+++ ocr-layout/ocr-reading-order.cc
@@ -210,7 +210,8 @@ namespace ocropus {
// Make dummy text-lines from horizontal rulings to use them as
// separating elements for reading order.
- for(int i=0,l=hor_rulings.length(); i<l; i++){
+ int hrl;
+ for(int i=0,hrl=hor_rulings.length(); i<hrl; i++){
line l;
rectangle r = hor_rulings[i];
l.c = r.ycenter();

View File

@ -0,0 +1,11 @@
--- ocr-line/glclass.cc.orig 2009-05-31 20:18:41.000000000 +0000
+++ ocr-line/glclass.cc
@@ -95,7 +95,7 @@ namespace glinerec {
double nearest_neighbor_error(IDataset &data,int ntrials=1000) {
int total = 0;
ntrials = min(data.nsamples(),ntrials);
- for(int i=0;i<data.nsamples();i++) {
+ for(int ic=0;ic<data.nsamples();ic++) {
// FIXME use sampling without replacement
int i = lrand48()%data.nsamples();
floatarray u;

View File

@ -0,0 +1,24 @@
--- ocr-utils/enumerator.h.orig 2009-05-31 20:18:41.000000000 +0000
+++ ocr-utils/enumerator.h
@@ -32,6 +32,10 @@
#include <memory.h>
#include "ocropus.h"
+inline int Hash_hash(int x) {
+ return x;
+}
+
template <class T>
inline void memswap(T &a,T &b) {
char buf[sizeof (T)];
@@ -102,10 +106,6 @@ struct EnumHash {
}
};
-inline int Hash_hash(int x) {
- return x;
-}
-
struct Enumerator {
int n;
EnumHash<int,int> translation;