提交 26f8f580 编写于 作者: Z zdenop

fix android issues

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@990 d0cd1f9f-072b-0410-8dd7-cf729c803f20
上级 244731fd
......@@ -911,7 +911,7 @@ int GenericVector<T>::choose_nth_item(int target_index, int start, int end,
}
}
// Place the pivot at start.
#ifdef _MSC_VER // TODO(zdenop): check this
#if defined(_MSC_VER) || defined(ANDROID) // TODO(zdenop): check this
srand(*seed);
#define rand_r(seed) rand()
#endif // _MSC_VER
......
......@@ -33,7 +33,11 @@ Pix* global_crash_pixes[kMaxNumThreadPixes];
void SavePixForCrash(int resolution, Pix* pix) {
#ifdef __linux__
#ifndef ANDROID
int thread_id = syscall(SYS_gettid) % kMaxNumThreadPixes;
#else
int thread_id = gettid() % kMaxNumThreadPixes;
#endif
pixDestroy(&global_crash_pixes[thread_id]);
if (pix != NULL) {
Pix* clone = pixClone(pix);
......@@ -47,8 +51,12 @@ void SavePixForCrash(int resolution, Pix* pix) {
// CALL ONLY from a signal handler! Writes a crash image to stderr.
void signal_exit(int signal_code) {
tprintf("Received signal %d!\n", signal_code);
#ifdef __linux__
#ifdef __linux__
#ifndef ANDROID
int thread_id = syscall(SYS_gettid) % kMaxNumThreadPixes;
#else
int thread_id = gettid() % kMaxNumThreadPixes;
#endif
if (global_crash_pixes[thread_id] != NULL) {
fprintf(stderr, "Crash caused by image with resolution %d\n",
pixGetYRes(global_crash_pixes[thread_id]));
......
#include <stdio.h>
#include "allheaders.h"
#include "pix.h"
#ifdef USE_OPENCL
#include "tiff.h"
#include "tiffio.h"
#endif
#include "tprintf.h"
// including CL/cl.h doesn't occur until USE_OPENCL defined below
......
......@@ -32,7 +32,7 @@
#include "params.h"
#include "params_training_featdef.h"
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(ANDROID)
double log2(double n) {
return log(n) / log(2.0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册