ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
epub_entry_reader_t Struct Reference

Forward streaming cursor over one ZIP entry – inflate in bounded RAM (#231). More...

#include <epub_entry.h>

Collaboration diagram for epub_entry_reader_t:

Data Fields

void * iter
 Opaque mz_zip_reader_extract_iter_state*; NULL when closed.
epub_book_tbook
 Owning book (archive + allocator); borrowed.
uint64_t total
 Entry uncompressed size, bytes.
uint64_t consumed
 Bytes delivered to the caller so far.
uint8_t done
 1 once EOF has been reached / reported.
uint8_t reserved [k_epub_entry_reader_reserved_bytes]
 Padding; keep zero.

Detailed Description

Forward streaming cursor over one ZIP entry – inflate in bounded RAM (#231).

epub_get_resource() (and the cover / chapter / font accessors) extract a whole entry via mz_zip_reader_extract_to_mem into a caller buffer sized to the entry's uncompressed size. That is fine for the small text/CSS/font entries, but a full-page manga scan in an all-image EPUB inflates to 20-50 MB – too big to hold whole on a device with a ~10 MB working-set budget.

This cursor drives miniz's iterator (mz_zip_reader_extract_iter_*) so the caller pulls one entry in fixed-size chunks: the resident inflate state is bounded (a 32 KiB LZ dictionary + a bounded compressed-read buffer + the inflator), independent of the entry's uncompressed size. Works for both a resident book (epub_open()) and a streamed book (epub_open_streamed()); in the streamed case each compressed block is fetched on demand through the book's seek+read backing, so the whole archive is never resident either.

Treat every field as private; zero-initialise (= {}) before epub_entry_open().

Invariant
iter != NULL between a successful open and the matching close.
See also
epub_entry_open()
epub_entry_read()
epub_entry_close()
Since
0.1.0

Definition at line 93 of file epub_entry.h.

Field Documentation

◆ book

epub_book_t* epub_entry_reader_t::book

Owning book (archive + allocator); borrowed.

Definition at line 95 of file epub_entry.h.

Referenced by epub_entry_open().

◆ consumed

uint64_t epub_entry_reader_t::consumed

Bytes delivered to the caller so far.

Definition at line 97 of file epub_entry.h.

Referenced by epub_entry_close(), and epub_entry_read().

◆ done

uint8_t epub_entry_reader_t::done

1 once EOF has been reached / reported.

Definition at line 98 of file epub_entry.h.

Referenced by epub_entry_open(), and epub_entry_read().

◆ iter

void* epub_entry_reader_t::iter

Opaque mz_zip_reader_extract_iter_state*; NULL when closed.

Definition at line 94 of file epub_entry.h.

Referenced by epub_entry_close(), epub_entry_open(), and epub_entry_read().

◆ reserved

uint8_t epub_entry_reader_t::reserved[k_epub_entry_reader_reserved_bytes]

Padding; keep zero.

Definition at line 100 of file epub_entry.h.

◆ total

uint64_t epub_entry_reader_t::total

Entry uncompressed size, bytes.

Definition at line 96 of file epub_entry.h.

Referenced by epub_entry_close(), epub_entry_open(), and epub_entry_read().


The documentation for this struct was generated from the following file: