MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / readItemContentsToBytes

Method readItemContentsToBytes

lib/Epub/Epub.cpp:754–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

752}
753
754uint8_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
771bool Epub::readItemContentsToStream(const std::string& itemHref, Print& out, const size_t chunkSize) const {
772 if (itemHref.empty()) {

Callers

nothing calls this directly

Calls 4

normalisePathFunction · 0.85
readFileToMemoryMethod · 0.80
ZipFileClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected