Increase EpubHtmlParserSlim file buffer to 1024 bytes

This commit is contained in:
Dave Allie 2025-12-06 20:23:47 +11:00
parent a33ac25dca
commit 74f7ea9650
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F
2 changed files with 4 additions and 4 deletions

View File

@ -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");

View File

@ -1,6 +1,6 @@
#pragma once
#include <expat_external.h>
#include <expat.h>
#include <limits.h>
#include <functional>
@ -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;