Fix compiler warnings [-Wunreachable-code-return]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2024-05-12 18:31:00 +02:00
parent 36d44a1497
commit 24dd72603b
4 changed files with 1 additions and 8 deletions

View File

@ -114,7 +114,6 @@ Network *NetworkBuilder::BuildFromString(const StaticShape &input_shape, const c
return ParseOutput(input_shape, str); return ParseOutput(input_shape, str);
default: default:
tprintf("Invalid network spec:%s\n", *str); tprintf("Invalid network spec:%s\n", *str);
return nullptr;
} }
return nullptr; return nullptr;
} }

View File

@ -344,7 +344,7 @@ SEAM *Wordrec::improve_one_blob(const std::vector<BLOB_CHOICE *> &blob_choices,
// TODO(rays) it may eventually help to allow italic_blob to be true, // TODO(rays) it may eventually help to allow italic_blob to be true,
seam = chop_numbered_blob(word->chopped_word, *blob_number, italic_blob, word->seam_array); seam = chop_numbered_blob(word->chopped_word, *blob_number, italic_blob, word->seam_array);
if (seam != nullptr) { if (seam != nullptr) {
return seam; // Success! break; // Success!
} }
if (blob_choices[*blob_number] == nullptr) { if (blob_choices[*blob_number] == nullptr) {
return nullptr; return nullptr;

View File

@ -64,7 +64,6 @@ protected:
if (!SetImage(imagefile)) { if (!SetImage(imagefile)) {
// eng.traineddata not found or other problem during Init. // eng.traineddata not found or other problem during Init.
GTEST_SKIP(); GTEST_SKIP();
return;
} }
if (line_mode) { if (line_mode) {
api_.SetVariable("tessedit_resegment_from_line_boxes", "1"); api_.SetVariable("tessedit_resegment_from_line_boxes", "1");

View File

@ -124,7 +124,6 @@ TEST_F(TesseractTest, HOCRWorksWithoutSetInputName) {
if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_TESSERACT_ONLY) == -1) { if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_TESSERACT_ONLY) == -1) {
// eng.traineddata not found. // eng.traineddata not found.
GTEST_SKIP(); GTEST_SKIP();
return;
} }
Image src_pix = pixRead(TestDataNameToPath("HelloGoogle.tif").c_str()); Image src_pix = pixRead(TestDataNameToPath("HelloGoogle.tif").c_str());
CHECK(src_pix); CHECK(src_pix);
@ -143,7 +142,6 @@ TEST_F(TesseractTest, HOCRContainsBaseline) {
if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_TESSERACT_ONLY) == -1) { if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_TESSERACT_ONLY) == -1) {
// eng.traineddata not found. // eng.traineddata not found.
GTEST_SKIP(); GTEST_SKIP();
return;
} }
Image src_pix = pixRead(TestDataNameToPath("HelloGoogle.tif").c_str()); Image src_pix = pixRead(TestDataNameToPath("HelloGoogle.tif").c_str());
CHECK(src_pix); CHECK(src_pix);
@ -179,7 +177,6 @@ TEST_F(TesseractTest, AdaptToWordStrTest) {
if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_TESSERACT_ONLY) == -1) { if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_TESSERACT_ONLY) == -1) {
// eng.traineddata not found. // eng.traineddata not found.
GTEST_SKIP(); GTEST_SKIP();
return;
} }
api.SetVariable("matcher_sufficient_examples_for_prototyping", "1"); api.SetVariable("matcher_sufficient_examples_for_prototyping", "1");
api.SetVariable("classify_class_pruner_threshold", "220"); api.SetVariable("classify_class_pruner_threshold", "220");
@ -215,7 +212,6 @@ TEST_F(TesseractTest, BasicLSTMTest) {
if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_LSTM_ONLY) == -1) { if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_LSTM_ONLY) == -1) {
// eng.traineddata not found. // eng.traineddata not found.
GTEST_SKIP(); GTEST_SKIP();
return;
} }
Image src_pix = pixRead(TestDataNameToPath("phototest_2.tif").c_str()); Image src_pix = pixRead(TestDataNameToPath("phototest_2.tif").c_str());
CHECK(src_pix); CHECK(src_pix);
@ -239,7 +235,6 @@ TEST_F(TesseractTest, LSTMGeometryTest) {
if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_LSTM_ONLY) == -1) { if (api.Init(TessdataPath().c_str(), "eng", tesseract::OEM_LSTM_ONLY) == -1) {
// eng.traineddata not found. // eng.traineddata not found.
GTEST_SKIP(); GTEST_SKIP();
return;
} }
api.SetImage(src_pix); api.SetImage(src_pix);
ASSERT_EQ(api.Recognize(nullptr), 0); ASSERT_EQ(api.Recognize(nullptr), 0);