mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 07:37:41 +03:00
Revert "Fix: Footnotes - validate data integrity before render"
This reverts commit ad7e9bd267.
This commit is contained in:
parent
c591c2e033
commit
a29ff93f9c
@ -324,46 +324,6 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
Serial.printf("[%lu] [ERS] Page loaded: %d elements, %d footnotes\n",
|
Serial.printf("[%lu] [ERS] Page loaded: %d elements, %d footnotes\n",
|
||||||
millis(), p->elementCount, p->footnoteCount);
|
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
|
// Copy footnotes from page to currentPageFootnotes
|
||||||
currentPageFootnotes.clear();
|
currentPageFootnotes.clear();
|
||||||
int maxFootnotes = (p->footnoteCount < 8) ? p->footnoteCount : 8;
|
int maxFootnotes = (p->footnoteCount < 8) ? p->footnoteCount : 8;
|
||||||
@ -374,7 +334,7 @@ void EpubReaderActivity::renderScreen() {
|
|||||||
currentPageFootnotes.addFootnote(footnote->number, footnote->href);
|
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();
|
const auto start = millis();
|
||||||
renderContents(std::move(p));
|
renderContents(std::move(p));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user