From a73ef23f6e0a820d2f86b7bbb6b7790fd3188998 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 16 Oct 2018 19:43:34 +0200 Subject: [PATCH] Keep the book size in byte in memory (instead of in kb) We keep the size in kb in library.xml for compatibility. --- src/book.cpp | 2 +- src/library.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/book.cpp b/src/book.cpp index 52e2d50cc..93a75f837 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -120,7 +120,7 @@ void Book::updateFromXml(const pugi::xml_node& node, const std::string& baseDir) m_origId = ATTR("origId"); m_articleCount = strtoull(ATTR("articleCount"), 0, 0); m_mediaCount = strtoull(ATTR("mediaCount"), 0, 0); - m_size = strtoull(ATTR("size"), 0, 0); + m_size = strtoull(ATTR("size"), 0, 0) << 10; m_favicon = base64_decode(ATTR("favicon")); m_faviconMimeType = ATTR("faviconMimeType"); try { diff --git a/src/library.cpp b/src/library.cpp index 28abb90bf..9a4ec60d6 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -152,8 +152,8 @@ bool Library::writeToFile(const std::string& path) { if (!book.getMediaCount()) bookNode.append_attribute("mediaCount") = to_string(book.getMediaCount()).c_str(); - if (!book.getSize()) { - bookNode.append_attribute("size") = to_string(book.getSize()).c_str(); + if (book.getSize()) { + bookNode.append_attribute("size") = to_string(book.getSize()>>10).c_str(); } if (!book.getDownloadId().empty()) {