| 404 | } |
| 405 | |
| 406 | BookMetadataCache::SpineEntry BookMetadataCache::getSpineEntry(const int index) { |
| 407 | if (!loaded) { |
| 408 | LOG_ERR("BMC", "getSpineEntry called but cache not loaded"); |
| 409 | return {}; |
| 410 | } |
| 411 | |
| 412 | if (index < 0 || index >= static_cast<int>(spineCount)) { |
| 413 | LOG_ERR("BMC", "getSpineEntry index %d out of range", index); |
| 414 | return {}; |
| 415 | } |
| 416 | |
| 417 | // Seek to spine LUT item, read from LUT and get out data |
| 418 | bookFile.seek(lutOffset + sizeof(uint32_t) * index); |
| 419 | uint32_t spineEntryPos; |
| 420 | serialization::readPod(bookFile, spineEntryPos); |
| 421 | bookFile.seek(spineEntryPos); |
| 422 | return readSpineEntry(bookFile); |
| 423 | } |
| 424 | |
| 425 | BookMetadataCache::TocEntry BookMetadataCache::getTocEntry(const int index) { |
| 426 | if (!loaded) { |
no test coverage detected