Support large opds result listings without an OOM
This commit is contained in:
@@ -146,7 +146,6 @@ void OpdsParser::flush() {
|
||||
bool OpdsParser::error() const { return errorOccured; }
|
||||
|
||||
void OpdsParser::clear() {
|
||||
entries.clear();
|
||||
searchTemplate.clear();
|
||||
osdUrl.clear();
|
||||
nextPageUrl.clear();
|
||||
@@ -156,14 +155,6 @@ void OpdsParser::clear() {
|
||||
inEntry = inTitle = inAuthor = inAuthorName = inId = false;
|
||||
}
|
||||
|
||||
std::vector<OpdsEntry> OpdsParser::getBooks() const {
|
||||
std::vector<OpdsEntry> books;
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.type == OpdsEntryType::BOOK) books.push_back(entry);
|
||||
}
|
||||
return books;
|
||||
}
|
||||
|
||||
const char* OpdsParser::findAttribute(const XML_Char** atts, const char* name) {
|
||||
for (int i = 0; atts[i]; i += 2) {
|
||||
if (strcmp(atts[i], name) == 0) return atts[i + 1];
|
||||
@@ -243,7 +234,7 @@ void XMLCALL OpdsParser::endElement(void* userData, const XML_Char* name) {
|
||||
|
||||
if (strcmp(name, "entry") == 0 || strstr(name, ":entry") != nullptr) {
|
||||
if (!self->currentEntry.title.empty() && !self->currentEntry.href.empty()) {
|
||||
self->entries.push_back(self->currentEntry);
|
||||
if (self->onEntryParsed) self->onEntryParsed(self->currentEntry);
|
||||
}
|
||||
self->inEntry = false;
|
||||
} else if (self->inEntry) {
|
||||
|
||||
Reference in New Issue
Block a user