95typedef size_t (*
comic_read_fn)(
void* ctx, uint64_t offset,
void* buf,
size_t len);
104typedef enum : uint8_t {
116typedef enum : uint16_t {
331 uint16_t* out_name_len,
332 uint64_t* out_raw_size,
333 uint8_t* out_extractable);
399typedef enum : uint8_t {
464 uint32_t xz_scratch_len);
ra8_err_t comic_page_read(comic_t *c, uint32_t page, uint8_t *buf, size_t cap, size_t *got)
Extract one page's encoded image bytes for the decoder.
comic_wrap_dims_t
Alignment of the unwrap arena a wrapped open consumes.
@ k_comic_wrap_align
Required unwrap-arena alignment, bytes.
size_t(* comic_read_fn)(void *ctx, uint64_t offset, void *buf, size_t len)
Seek+read backing over the comic-archive bytes.
ra8_err_t comic_open_wrapped(comic_t *c, comic_read_fn read, void *ctx, uint64_t size, comic_page_t *pages, uint32_t page_cap, char *names, uint32_t names_cap, uint8_t *arena, size_t arena_cap, void *xz_scratch, uint32_t xz_scratch_len)
Open a comic that may be gzip- or XZ-wrapped (.cbt.gz, .tar.xz).
ra8_err_t comic_close(comic_t *c)
Release an open comic's backend resources.
comic_kind_t
Which container an opened comic is.
@ k_comic_kind_cbz
ZIP of images (.cbz).
@ k_comic_kind_cbt
tar of images (.cbt).
@ k_comic_kind_cbr
RAR of images (.cbr).
@ k_comic_kind_none
Not opened / unrecognised.
ra8_err_t comic_open(comic_t *c, comic_read_fn read, void *ctx, uint64_t size, comic_page_t *pages, uint32_t page_cap, char *names, uint32_t names_cap)
Open a comic archive (CBZ or CBR) and build its sorted page index.
static comic_kind_t comic_kind(const comic_t *c)
The detected container kind of an open comic.
ra8_err_t comic_page_info(const comic_t *c, uint32_t page, char *name_buf, uint16_t name_cap, uint16_t *out_name_len, uint64_t *out_raw_size, uint8_t *out_extractable)
Read one page's manifest entry: name, encoded length, decodability.
static uint32_t comic_page_count(const comic_t *c)
Number of pages in an open comic.
comic_limits_t
Fixed sizes for magic detection and the inline ZIP-reader storage.
@ k_comic_magic_len
Bytes read to detect the container magic.
@ k_comic_zip_bytes
Inline storage for miniz's mz_zip_archive.
Caller-owned bounded-arena allocator for miniz.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Clean-room RAR 5.0 ("method 50") decompressor – LZ + Huffman + filters.
Clean-room, read-only RAR archive walker (RAR4 + RAR5 headers, STORE data).
One entry in the resident, sorted page index.
uint64_t raw_size
Encoded image length in bytes (decoder input).
uint64_t data_off
CBR: absolute offset of the member data area.
uint64_t pack_size
CBR: packed member size in bytes.
uint8_t extractable
1 if this reader can decode the page's bytes.
uint32_t zip_index
CBZ: miniz central-directory index.
uint16_t name_len
Page name length in bytes.
uint32_t name_off
Offset of the page name in the name arena.
uint8_t rar_method
CBR: ra8_rar_method_t (0 = store); 0 for CBZ.
Stable seek+read descriptor bound to the CBZ backend's miniz reader.
uint64_t size
Archive length in bytes.
void * ctx
Backing context.
comic_read_fn read
Backing reader (mirrors comic_t::read).
One open comic archive: backing, kind, page index, and backend state.
unarch_tar_t tar
CBT tar walker state.
epub_miniz_arena_t miniz_arena
Per-comic allocator descriptor bound through miniz's opaque pointer.
uint32_t page_count
Populated page count.
uint8_t zip_active
1 = miniz reader is initialised (CBZ).
uint32_t names_len
Bytes used in names.
comic_read_fn read
Byte reader over the archive.
void * ctx
Context for read.
comic_kind_t kind
Detected container kind.
comic_stream_t stream
CBZ miniz I/O descriptor (stable addr).
uint8_t zip_storage[k_comic_zip_bytes]
Inline storage for miniz's mz_zip_archive (CBZ; no heap).
char * names
Caller name arena.
ra8_rar_t rar
CBR walker state.
uint32_t page_cap
Capacity of pages in entries.
ra8_rar5_state_t rar5_state
CBR RAR5 decompressor scratch (no heap).
uint64_t size
Archive length in bytes.
comic_page_t * pages
Caller page-index array.
uint32_t names_cap
Capacity of names in bytes.
epub_miniz_workspace_t miniz_workspace
Per-comic bounded allocator workspace (used only for CBZ).
Descriptor for one caller-owned miniz allocation arena.
Exactly-sized, maximally-aligned storage for one miniz arena.
Caller-owned zero-heap scratch for one ra8_rar5_decompress call.
One open RAR archive: the backing plus the detected generation.
One open tar archive: the backing plus the walk's running budget.
Clean-room gzip member decoder (RFC 1952) over the miniz DEFLATE core.
Clean-room, read-only streaming tar walker (POSIX ustar + pax + GNU).
Bounded, fail-closed XZ/LZMA2 decoding over the vendored xz-embedded.