And more...
This commit is contained in:
@@ -260,9 +260,9 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
|
|||||||
if (strcmp(metaName, "cover") == 0) {
|
if (strcmp(metaName, "cover") == 0) {
|
||||||
self->coverItemId = metaContent;
|
self->coverItemId = metaContent;
|
||||||
} else if (strcmp(metaName, "calibre:series") == 0 && self->series.empty()) {
|
} else if (strcmp(metaName, "calibre:series") == 0 && self->series.empty()) {
|
||||||
self->series = std::string(metaContent).substr(0, MAX_DESCRIPTION_LENGTH);
|
self->series = trim(std::string(metaContent)).substr(0, MAX_DESCRIPTION_LENGTH);
|
||||||
} else if (strcmp(metaName, "calibre:series_index") == 0 && self->seriesIndex.empty()) {
|
} else if (strcmp(metaName, "calibre:series_index") == 0 && self->seriesIndex.empty()) {
|
||||||
self->seriesIndex = std::string(metaContent).substr(0, MAX_DESCRIPTION_LENGTH);
|
self->seriesIndex = trim(std::string(metaContent)).substr(0, MAX_DESCRIPTION_LENGTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
|
|||||||
if (metaProperty) {
|
if (metaProperty) {
|
||||||
if (strcmp(metaProperty, "belongs-to-collection") == 0 && self->series.empty()) {
|
if (strcmp(metaProperty, "belongs-to-collection") == 0 && self->series.empty()) {
|
||||||
if (metaContent) {
|
if (metaContent) {
|
||||||
self->series = std::string(metaContent).substr(0, MAX_DESCRIPTION_LENGTH);
|
self->series = trim(std::string(metaContent)).substr(0, MAX_DESCRIPTION_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
self->state = IN_BOOK_SERIES;
|
self->state = IN_BOOK_SERIES;
|
||||||
return;
|
return;
|
||||||
@@ -281,7 +281,7 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name
|
|||||||
}
|
}
|
||||||
if (strcmp(metaProperty, "group-position") == 0 && self->seriesIndex.empty()) {
|
if (strcmp(metaProperty, "group-position") == 0 && self->seriesIndex.empty()) {
|
||||||
if (metaContent) {
|
if (metaContent) {
|
||||||
self->seriesIndex = std::string(metaContent).substr(0, MAX_DESCRIPTION_LENGTH);
|
self->seriesIndex = trim(std::string(metaContent)).substr(0, MAX_DESCRIPTION_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
self->state = IN_BOOK_SERIES_INDEX;
|
self->state = IN_BOOK_SERIES_INDEX;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ static bool readString(FsFile& file, std::string& s) {
|
|||||||
uint32_t len;
|
uint32_t len;
|
||||||
readPod(file, len);
|
readPod(file, len);
|
||||||
if (len > MAX_STRING_LENGTH) {
|
if (len > MAX_STRING_LENGTH) {
|
||||||
file.seekCur(len); // skip payload to keep file position aligned
|
if (!file.seekCur(static_cast<int64_t>(len))) { // skip payload to keep file position aligned
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
s.resize(len);
|
s.resize(len);
|
||||||
|
|||||||
@@ -142,8 +142,10 @@ bool RecentBooksStore::loadFromBinaryFile() {
|
|||||||
inputFile.close();
|
inputFile.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tmpRecentBooks.push_back({path, title, author, "", ""});
|
if (!title.empty()) {
|
||||||
} else {
|
tmpRecentBooks.push_back({path, title, author, "", ""});
|
||||||
|
}
|
||||||
|
} else if (!book.title.empty()) {
|
||||||
tmpRecentBooks.push_back(book);
|
tmpRecentBooks.push_back(book);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user