提交 7a116ce8 编写于 作者: R Ray Smith

More formatting fixes from clang tidy

上级 77015526
......@@ -1998,8 +1998,7 @@ bool TessBaseAPI::AdaptToWordStr(PageSegMode mode, const char* wordstr) {
for (t = 0; text[t] != '\0'; ++t) {
if (text[t] == '\n' || text[t] == ' ')
continue;
while (wordstr[w] == ' ')
++w;
while (wordstr[w] == ' ') ++w;
if (text[t] != wordstr[w])
break;
++w;
......
......@@ -20,17 +20,17 @@
#undef X86_BUILD
#if defined(__x86_64__) || defined(__i386__) || defined(_WIN32)
# if !defined(ANDROID_BUILD)
# define X86_BUILD 1
# endif // !ANDROID_BUILD
#endif // x86 target
#if !defined(ANDROID_BUILD)
#define X86_BUILD 1
#endif // !ANDROID_BUILD
#endif // x86 target
#if defined(X86_BUILD)
# if defined(__GNUC__)
# include <cpuid.h>
# elif defined(_WIN32)
# include <intrin.h>
# endif
#if defined(__GNUC__)
#include <cpuid.h>
#elif defined(_WIN32)
#include <intrin.h>
#endif
#endif
SIMDDetect SIMDDetect::detector;
......@@ -43,16 +43,17 @@ bool SIMDDetect::sse_available_;
// Constructor.
// Tests the architecture in a system-dependent way to detect AVX, SSE and
// any other available SIMD equipment.
// __GNUC__ is also defined by compilers that include GNU extensions such as clang.
// __GNUC__ is also defined by compilers that include GNU extensions such as
// clang.
SIMDDetect::SIMDDetect() {
#if defined(X86_BUILD)
# if defined(__GNUC__)
#if defined(__GNUC__)
unsigned int eax, ebx, ecx, edx;
if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) != 0) {
sse_available_ = (ecx & 0x00080000) != 0;
avx_available_ = (ecx & 0x10000000) != 0;
}
# elif defined(_WIN32)
#elif defined(_WIN32)
int cpuInfo[4];
__cpuid(cpuInfo, 0);
if (cpuInfo[0] >= 1) {
......@@ -60,8 +61,8 @@ SIMDDetect::SIMDDetect() {
sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
}
# else
# error "I don't know how to test for SIMD with this compiler"
# endif
#endif // X86_BUILD
#else
#error "I don't know how to test for SIMD with this compiler"
#endif
#endif // X86_BUILD
}
......@@ -23,13 +23,9 @@
class SIMDDetect {
public:
// Returns true if AVX is available on this system.
static inline bool IsAVXAvailable() {
return detector.avx_available_;
}
static inline bool IsAVXAvailable() { return detector.avx_available_; }
// Returns true if SSE4.1 is available on this system.
static inline bool IsSSEAvailable() {
return detector.sse_available_;
}
static inline bool IsSSEAvailable() { return detector.sse_available_; }
private:
// Constructor, must set all static member variables.
......
......@@ -203,8 +203,8 @@ class Tesseract : public Wordrec {
pix_original_ = original_pix;
// Clone to sublangs as well.
for (int i = 0; i < sub_langs_.size(); ++i)
sub_langs_[i]->set_pix_original(
original_pix ? pixClone(original_pix) : nullptr);
sub_langs_[i]->set_pix_original(original_pix ? pixClone(original_pix)
: nullptr);
}
// Returns a pointer to a Pix representing the best available (original) image
// of the page. Can be of any bit depth, but never color-mapped, as that has
......
......@@ -44,7 +44,7 @@ class DebugPixa {
// The collection of images to put in the PDF.
Pixa* pixa_;
// The fonts used to draw text captions.
L_BMF* fonts_;
L_Bmf* fonts_;
};
} // namespace tesseract
......
......@@ -235,7 +235,7 @@ enum PageIteratorLevel {
*
* JUSTIFICATION_RIGHT
* Each line, except possibly the first, is flush to the same right tab stop.
*/
*/
enum ParagraphJustification {
JUSTIFICATION_UNKNOWN,
JUSTIFICATION_LEFT,
......
......@@ -363,28 +363,28 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
case 'p': // Pointer
rank = RANK_PTR;
base = 0;
goto scan_int;
goto scan_int;
case 'i': // Base-independent integer
base = 0;
goto scan_int;
goto scan_int;
case 'd': // Decimal integer
base = 10;
goto scan_int;
goto scan_int;
case 'o': // Octal integer
base = 8;
goto scan_int;
goto scan_int;
case 'u': // Unsigned decimal integer
base = 10;
goto scan_int;
goto scan_int;
case 'x': // Hexadecimal integer
case 'X':
base = 16;
goto scan_int;
goto scan_int;
case 'n': // Number of characters consumed
val = ftell(stream) - start_off;
......
此差异已折叠。
......@@ -65,8 +65,7 @@ const int kMinRampSize = 1000;
// corresponding to darkening on the copier and <0 lighter and 0 not copied.
// Exposures in [-2,2] are most useful, with -3 and 3 being extreme.
// If rotation is nullptr, rotation is skipped. If *rotation is non-zero, the
// pix
// is rotated by *rotation else it is randomly rotated and *rotation is
// pix is rotated by *rotation else it is randomly rotated and *rotation is
// modified.
//
// HOW IT WORKS:
......
......@@ -84,17 +84,16 @@ void SVMutex::Unlock() {
}
// Create new thread.
void SVSync::StartThread(void *(*func)(void*), void* arg) {
void SVSync::StartThread(void* (*func)(void*), void* arg) {
#ifdef _WIN32
LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE)func;
DWORD threadid;
HANDLE newthread = CreateThread(
NULL, // default security attributes
0, // use default stack size
f, // thread function
arg, // argument to thread function
0, // use default creation flags
&threadid); // returns the thread identifier
HANDLE newthread = CreateThread(NULL, // default security attributes
0, // use default stack size
f, // thread function
arg, // argument to thread function
0, // use default creation flags
&threadid); // returns the thread identifier
#else
pthread_t helper;
pthread_attr_t attr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册