Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
Updating from master.
  • Loading branch information
theraysmith committed May 13, 2015
2 parents c34dea6 + b13691f commit 7bc6d3e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 36 deletions.
4 changes: 4 additions & 0 deletions api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ TessBaseAPI::~TessBaseAPI() {
* Returns the version identifier as a static string. Do not delete.
*/
const char* TessBaseAPI::Version() {
#if defined(DEBUG) && defined(GIT_REV)
return GIT_REV;
#else
return TESSERACT_VERSION_STR;
#endif
}

/**
Expand Down
4 changes: 3 additions & 1 deletion ccutil/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
#define ultoa _ultoa
#endif /* __GNUC__ */
#define SIGNED
#if defined(_MSC_VER)
#define snprintf _snprintf
#if (_MSC_VER <= 1400)
#define vsnprintf _vsnprintf
#endif /* _WIN32 */
#endif /* (_MSC_VER <= 1400) */
#endif /* defined(_MSC_VER) */
#else
#define __UNIX__
#include <limits.h>
Expand Down
12 changes: 9 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
# ----------------------------------------
# Initialization
# ----------------------------------------

AC_PREREQ(2.50)
AC_INIT([tesseract], [3.04], [http://code.google.com/p/tesseract-ocr/issues/list])
CXXFLAGS=${CXXFLAGS:-""}
AC_CONFIG_MACRO_DIR([m4])
AC_REVISION([$Revision$])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(api/tesseractmain.cpp)
AC_PREFIX_DEFAULT(/usr/local)
Expand All @@ -21,6 +19,14 @@ AC_PREFIX_DEFAULT(/usr/local)
PACKAGE_YEAR=2014
PACKAGE_DATE="08/13"

abs_top_srcdir=`AS_DIRNAME([$0])`
gitrev="`git --git-dir=${abs_top_srcdir}/.git --work-tree=${abs_top_srcdir} describe --always --tags`"
if test -n "${gitrev}" ; then
AC_REVISION("${gitrev}")
AC_DEFINE_UNQUOTED(GIT_REV,"${gitrev}", [Define to be the git revision])
echo "Using git revision: ${gitrev}"
fi

AC_DEFINE_UNQUOTED(PACKAGE_NAME,["${PACKAGE_NAME}"],[Name of package])
AC_DEFINE_UNQUOTED(PACKAGE_VERSION,["${PACKAGE_VERSION}"],[Version number])
AC_DEFINE_UNQUOTED(PACKAGE_YEAR,"$PACKAGE_YEAR",[Official year for this release])
Expand Down Expand Up @@ -85,7 +91,7 @@ case "${host_os}" in
AM_CONDITIONAL(ADD_RT, false)
AM_CONDITIONAL(T_WIN, true)
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
;;
;;
solaris*)
LIBS="-lsocket -lnsl -lrt -lxnet"
AM_CONDITIONAL(ADD_RT, true)
Expand Down
2 changes: 1 addition & 1 deletion cube/tess_lang_mod_edge.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class TessLangModEdge : public LangModEdge {
// to quickly lookup exisiting edges to converge during search
inline unsigned int Hash() const {
return static_cast<unsigned int>(((start_edge_ | end_edge_) ^
((reinterpret_cast<unsigned long int>(dawg_)))) ^
((reinterpret_cast<uintptr_t>(dawg_)))) ^
((unsigned int)edge_mask_) ^
class_id_);
}
Expand Down
2 changes: 1 addition & 1 deletion tesseract.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name: @PACKAGE_NAME@
Description: An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.
URL: https://code.google.com/p/tesseract-ocr
Version: @VERSION@
# Requires.private: lept
Requires.private: lept
Libs: -L${libdir} -ltesseract
Libs.private: -lpthread -llept @OPENCL_LIB@
Cflags: -I${includedir}
41 changes: 11 additions & 30 deletions training/fileio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ bool File::ReadFileToString(const string& filename, string* out) {
return false;
InputBuffer in(stream);
*out = "";
string temp;
while (in.ReadLine(&temp)) {
*out += temp;
*out += '\n';
}
in.Read(out);
return in.CloseFile();
}

Expand Down Expand Up @@ -156,32 +152,17 @@ InputBuffer::~InputBuffer() {
}
}

bool InputBuffer::ReadLine(string* out) {
ASSERT_HOST(stream_ != NULL);
char* line = NULL;
int len = -1;
#ifndef HAVE_GETLINE
char line_buf[BUFSIZ];
if ((line = fgets(line_buf, BUFSIZ, stream_)) != NULL) {
len = strlen(line);
if (line_buf[0] != '\0' && line_buf[len - 1] == '\n')
line_buf[len - 1] = '\0';
} else {
return false;
}
*out = string(line);
#else
size_t line_size;
len = getline(&line, &line_size, stream_);
if (len < 0) {
return false;
bool InputBuffer::Read(string *out) {
char buf[BUFSIZ+1];
int l;
while((l = fread(buf, 1, BUFSIZ, stream_)) > 0) {
if(ferror(stream_)) {
clearerr(stream_);
return false;
}
buf[l] = 0;
out->append(buf);
}

if (len >= 1 && line[len - 1] == '\n')
line[len - 1] = '\0';
*out = string(line);
free(line);
#endif // HAVE_GETLINE
return true;
}

Expand Down
5 changes: 5 additions & 0 deletions training/fileio.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ class InputBuffer {
// Return false if an error occurs or at end-of-file, true otherwise.
bool ReadLine(string* out);

// Read data until end-of-file.
// The data is stored in '*out'.
// Return false if an error occurs, true otherwise.
bool Read(string* out);

// Close the FILE* used by InputBuffer.
// Return false if an error occurs, true otherwise.
bool CloseFile();
Expand Down

0 comments on commit 7bc6d3e

Please sign in to comment.