| 752 | } |
| 753 | |
| 754 | uint8_t* Epub::readItemContentsToBytes(const std::string& itemHref, size_t* size, const bool trailingNullByte) const { |
| 755 | if (itemHref.empty()) { |
| 756 | LOG_DBG("EBP", "Failed to read item, empty href"); |
| 757 | return nullptr; |
| 758 | } |
| 759 | |
| 760 | const std::string path = FsHelpers::normalisePath(itemHref); |
| 761 | |
| 762 | const auto content = ZipFile(filepath).readFileToMemory(path.c_str(), size, trailingNullByte); |
| 763 | if (!content) { |
| 764 | LOG_DBG("EBP", "Failed to read item %s", path.c_str()); |
| 765 | return nullptr; |
| 766 | } |
| 767 | |
| 768 | return content; |
| 769 | } |
| 770 | |
| 771 | bool Epub::readItemContentsToStream(const std::string& itemHref, Print& out, const size_t chunkSize) const { |
| 772 | if (itemHref.empty()) { |
nothing calls this directly
no test coverage detected