Revert "Fix: Footnotes - validate data integrity before render"

This reverts commit ad7e9bd267.
This commit is contained in:
Jérôme Launay 2025-12-18 00:28:21 +01:00
parent c591c2e033
commit a29ff93f9c

View File

@ -324,46 +324,6 @@ void EpubReaderActivity::renderScreen() {
Serial.printf("[%lu] [ERS] Page loaded: %d elements, %d footnotes\n",
millis(), p->elementCount, p->footnoteCount);
// Check footnote before copy
bool hasCorruptedFootnotes = false;
for (int i = 0; i < p->footnoteCount && i < 8; i++) { // Changé de 16 à 8
FootnoteEntry* fn = p->getFootnote(i);
if (fn) {
bool numberValid = false;
bool hrefValid = false;
// Search null terminator in number (3 bytes)
for (int j = 0; j < 3; j++) {
if (fn->number[j] == '\0') {
numberValid = true;
break;
}
}
// Search null terminator in href (64 bytes)
for (int j = 0; j < 64; j++) {
if (fn->href[j] == '\0') {
hrefValid = true;
break;
}
}
if (!numberValid || !hrefValid) {
Serial.printf("[%lu] [ERS] CORRUPTION DETECTED in footnote %d: number=%d, href=%d\n",
millis(), i, numberValid, hrefValid);
hasCorruptedFootnotes = true;
break;
}
}
}
if (hasCorruptedFootnotes) {
Serial.printf("[%lu] [ERS] Page has corrupted footnotes - clearing cache\n", millis());
section->clearCache();
section.reset();
return renderScreen();
}
// Copy footnotes from page to currentPageFootnotes
currentPageFootnotes.clear();
int maxFootnotes = (p->footnoteCount < 8) ? p->footnoteCount : 8;
@ -374,7 +334,7 @@ void EpubReaderActivity::renderScreen() {
currentPageFootnotes.addFootnote(footnote->number, footnote->href);
}
}
Serial.printf("[%lu] [ERS] Loaded %d footnotes for current page\n", millis(), maxFootnotes);
Serial.printf("[%lu] [ERS] Loaded %d footnotes for current page\n", millis(), p->footnoteCount);
const auto start = millis();
renderContents(std::move(p));