Skip to content

Commit

Permalink
More formatting fixes from clang tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
theraysmith committed Apr 28, 2017
1 parent 7701552 commit 7a116ce
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 192 deletions.
3 changes: 1 addition & 2 deletions api/baseapi.cpp
Expand Up @@ -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;
Expand Down
33 changes: 17 additions & 16 deletions arch/simddetect.cpp
Expand Up @@ -20,17 +20,17 @@

#undef X86_BUILD
#if defined(__x86_64__) || defined(__i386__) || defined(_WIN32)
# if !defined(ANDROID_BUILD)

This comment has been minimized.

Copy link
@stweil

stweil Apr 30, 2017

Contributor

According to the Google C++ Style Guide, this and the following code was perfect. Why was it changed?

This comment has been minimized.

Copy link
@amitdo

amitdo Jan 1, 2018

Collaborator

@stweil,

https://clang.llvm.org/docs/ClangFormatStyleOptions.html
He probably uses IndentPPDirectives: None

# 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;
Expand All @@ -43,25 +43,26 @@ 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) {
__cpuid(cpuInfo, 1);
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
}
8 changes: 2 additions & 6 deletions arch/simddetect.h
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions ccmain/tesseractclass.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ccstruct/debugpixa.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ccstruct/publictypes.h
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions ccutil/scanutils.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 7a116ce

Please sign in to comment.