Revert "fix read wrong tiff page."

This reverts commit 75d230a7ac.

That commit introduced new problems (memory leak, potential endless loop)
and style issues.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-07-04 15:42:48 +02:00
parent fd001c3ab9
commit f1c6564cd7

View File

@ -1034,22 +1034,11 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data,
int page = (tessedit_page_number >= 0) ? tessedit_page_number : 0;
size_t offset = 0;
for (; ; ++page) {
if (tessedit_page_number >= 0) {
if (tessedit_page_number >= 0)
page = tessedit_page_number;
int pages_read = 0;
do {
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
: pixReadFromMultipageTiff(filename, &offset);
pages_read++;
} while (pix != nullptr && pages_read < (page + 1));
}
else {
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
: pixReadFromMultipageTiff(filename, &offset);
}
if (pix == nullptr) {
break;
}
pix = (data) ? pixReadMemFromMultipageTiff(data, size, &offset)
: pixReadFromMultipageTiff(filename, &offset);
if (pix == nullptr) break;
tprintf("Page %d\n", page + 1);
char page_str[kMaxIntSize];
snprintf(page_str, kMaxIntSize - 1, "%d", page);