From 74f7ea9650d4f934a99a57075b4a00aea5b4ba1b Mon Sep 17 00:00:00 2001 From: Dave Allie Date: Sat, 6 Dec 2025 20:23:47 +1100 Subject: [PATCH] Increase EpubHtmlParserSlim file buffer to 1024 bytes --- lib/Epub/Epub/EpubHtmlParserSlim.cpp | 4 ++-- lib/Epub/Epub/EpubHtmlParserSlim.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Epub/Epub/EpubHtmlParserSlim.cpp b/lib/Epub/Epub/EpubHtmlParserSlim.cpp index a8951da..783384d 100644 --- a/lib/Epub/Epub/EpubHtmlParserSlim.cpp +++ b/lib/Epub/Epub/EpubHtmlParserSlim.cpp @@ -188,7 +188,7 @@ bool EpubHtmlParserSlim::parseAndBuildPages() { FILE* file = fopen(filepath, "r"); do { - void* const buf = XML_GetBuffer(parser, BUFSIZ); + void* const buf = XML_GetBuffer(parser, 1024); if (!buf) { Serial.println("Couldn't allocate memory for buffer"); XML_ParserFree(parser); @@ -196,7 +196,7 @@ bool EpubHtmlParserSlim::parseAndBuildPages() { return false; } - const size_t len = fread(buf, 1, BUFSIZ, file); + const size_t len = fread(buf, 1, 1024, file); if (ferror(file)) { Serial.println("Read error"); diff --git a/lib/Epub/Epub/EpubHtmlParserSlim.h b/lib/Epub/Epub/EpubHtmlParserSlim.h index d6a7f71..ae42f3e 100644 --- a/lib/Epub/Epub/EpubHtmlParserSlim.h +++ b/lib/Epub/Epub/EpubHtmlParserSlim.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include @@ -21,7 +21,7 @@ class EpubHtmlParserSlim { int boldUntilDepth = INT_MAX; int italicUntilDepth = INT_MAX; // If we encounter words longer than this, but this is pretty large - char partWordBuffer[PART_WORD_BUFFER_SIZE]; + char partWordBuffer[PART_WORD_BUFFER_SIZE] = {}; int partWordBufferIndex = 0; TextBlock* currentTextBlock = nullptr; Page* currentPage = nullptr;