Task #132908 - added.err

back to task #132908
download
Error: COMPILER_WARNING (CWE-195):
tesseract-5.5.3/src/ccutil/unicharcompress.cpp: scope_hint: In member function ‘bool tesseract::UnicharCompress::ComputeEncoding(const tesseract::UNICHARSET&, int, std::string*)’
tesseract-5.5.3/src/ccutil/unicharcompress.cpp:212:26: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’
#  212 |       if (code->length() <= i) {
#      |           ~~~~~~~~~~~~~~~^~~~
#  210|       for (unsigned u = 0; u < unicharset.size(); ++u) {
#  211|         RecodedCharID *code = &encoder_[u];
#  212|->       if (code->length() <= i) {
#  213|           continue;
#  214|         }

Error: COMPILER_WARNING (CWE-195):
tesseract-5.5.3/src/ccutil/unicharcompress.cpp: scope_hint: In member function ‘void tesseract::UnicharCompress::DefragmentCodeValues(int)’
tesseract-5.5.3/src/ccutil/unicharcompress.cpp:285:23: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’}
#  285 |     for (int i = 0; i < code->length(); ++i) {
#      |                     ~~^~~~~~~~~~~~~~~~
#  283|     for (auto &c : encoder_) {
#  284|       RecodedCharID *code = &c;
#  285|->     for (int i = 0; i < code->length(); ++i) {
#  286|         int value = (*code)(i);
#  287|         code->Set(i, value + offsets[value]);

Error: COMPILER_WARNING (CWE-1023):
tesseract-5.5.3/src/classify/cluster.cpp: scope_hint: In function ‘float tesseract::StandardDeviation(PROTOTYPE*, uint16_t)’
tesseract-5.5.3/src/classify/cluster.cpp:1688:5: warning[-Wswitch]: case value ‘-2’ not in enumerated type ‘tesseract::PROTOSTYLE’
# 1688 |     case PROTOSTYLE::mixed:
#      |     ^~~~
# 1686|       case PROTOSTYLE::elliptical:
# 1687|         return std::sqrt(Proto->Variance.Elliptical[Dimension]);
# 1688|->     case PROTOSTYLE::mixed:
# 1689|         switch (Proto->Distrib[Dimension]) {
# 1690|           case DISTRIBUTION::normal:

Error: CPPCHECK_WARNING (CWE-457):
tesseract-5.5.3/src/classify/cluster.cpp:2688: error[legacyUninitvar]: Uninitialized variable: DensityFunction
# 2686|   
# 2687|       Probability = 0.0;
# 2688|->     LastProbDensity = (*DensityFunction[static_cast<int>(Distribution)])(BUCKETTABLESIZE / 2);
# 2689|       for (i = BUCKETTABLESIZE / 2; i < BUCKETTABLESIZE; i++) {
# 2690|         ProbDensity = (*DensityFunction[static_cast<int>(Distribution)])(i + 1);

Error: COMPILER_WARNING (CWE-1023):
tesseract-5.5.3/src/classify/clusttool.cpp:284:10: warning[-Wswitch]: enumeration value ‘automatic’ not handled in switch
#  282|     fprintf(File, "\t");
#  283|   
#  284|->   switch (Proto->Style) {
#  285|       case PROTOSTYLE::spherical:
#  286|         WriteNFloats(File, 1, &(Proto->Variance.Spherical));

Error: COMPILER_WARNING (CWE-1023):
tesseract-5.5.3/src/classify/clusttool.cpp: scope_hint: In function ‘void tesseract::WritePrototype(FILE*, uint16_t, PROTOTYPE*)’
tesseract-5.5.3/src/classify/clusttool.cpp:284:10: warning[-Wswitch]: enumeration value ‘mixed’ not handled in switch
#  284 |   switch (Proto->Style) {
#      |          ^
#  282|     fprintf(File, "\t");
#  283|   
#  284|->   switch (Proto->Style) {
#  285|       case PROTOSTYLE::spherical:
#  286|         WriteNFloats(File, 1, &(Proto->Variance.Spherical));

Error: COMPILER_WARNING (CWE-1023):
tesseract-5.5.3/src/classify/clusttool.cpp:291:5: warning[-Wswitch]: case value ‘-1’ not in enumerated type ‘tesseract::PROTOSTYLE’
#  291 |     case PROTOSTYLE::automatic:
#      |     ^~~~
#  289|         WriteNFloats(File, N, Proto->Variance.Elliptical);
#  290|         break;
#  291|->     case PROTOSTYLE::automatic:
#  292|         break;
#  293|       case PROTOSTYLE::mixed:

Error: COMPILER_WARNING (CWE-1023):
tesseract-5.5.3/src/classify/clusttool.cpp:293:5: warning[-Wswitch]: case value ‘-2’ not in enumerated type ‘tesseract::PROTOSTYLE’
#  293 |     case PROTOSTYLE::mixed:
#      |     ^~~~
#  291|       case PROTOSTYLE::automatic:
#  292|         break;
#  293|->     case PROTOSTYLE::mixed:
#  294|         for (i = 0; i < N; i++) {
#  295|           switch (Proto->Distrib[i]) {

Error: COMPILER_WARNING (CWE-195):
tesseract-5.5.3/src/classify/intproto.cpp: scope_hint: In function ‘void tesseract::AddIntClass(INT_TEMPLATES_STRUCT*, CLASS_ID, INT_CLASS_STRUCT*)’
tesseract-5.5.3/src/classify/intproto.cpp:235:29: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’
#  235 |   if (Templates->NumClasses > MaxNumClassesIn(Templates)) {
#      |       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  233|     Templates->NumClasses++;
#  234|   
#  235|->   if (Templates->NumClasses > MaxNumClassesIn(Templates)) {
#  236|       Pruner = Templates->NumClassPruners++;
#  237|       Templates->ClassPruners[Pruner] = new CLASS_PRUNER_STRUCT;

Error: COMPILER_WARNING (CWE-195):
tesseract-5.5.3/src/classify/intproto.cpp: scope_hint: In member function ‘tesseract::INT_TEMPLATES_STRUCT* tesseract::Classify::ReadIntTemplates(tesseract::TFile*)’
tesseract-5.5.3/src/classify/intproto.cpp:791:89: warning[-Wsign-compare]: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’
#  791 |       if (fp->FRead(&Class->ProtoLengths[0], sizeof(uint8_t), MaxNumIntProtosIn(Class)) !=
#      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
#  792 |           MaxNumIntProtosIn(Class)) {
#      |           ~~~~~~~~~~~~~~~~~~~~~~~~                                                       
#  789|       if (MaxNumIntProtosIn(Class) > 0) {
#  790|         Class->ProtoLengths.resize(MaxNumIntProtosIn(Class));
#  791|->       if (fp->FRead(&Class->ProtoLengths[0], sizeof(uint8_t), MaxNumIntProtosIn(Class)) !=
#  792|             MaxNumIntProtosIn(Class)) {
#  793|           tprintf("Bad read of inttemp!\n");