port: upstream PR #1342 - Book Info screen, richer metadata, safer controls

Ports upstream PR #1342 (feat: Add Book Info screen, richer metadata,
and safer file-browser controls) with mod-specific adaptations:

- Parse and cache series, seriesIndex, description from EPUB OPF
- Bump book.bin cache version to 6 for new metadata fields
- Add BookInfoActivity (new screen) accessible via Right button in FileBrowser
- Add ManageBook menu via Left button in FileBrowser (replaces upstream hidden delete)
- Guard all delete/archive actions with ConfirmationActivity (10 call sites)
- Add inputArmed gating to ConfirmationActivity to prevent accidental confirmation
- Safe deserialization: readString now returns bool with MAX_STRING_LENGTH guard
- Add series field to RecentBooksStore with JSON and binary serialization
- Add i18n keys: STR_BOOK_INFO, STR_AUTHOR, STR_SERIES, STR_FILE_SIZE, etc.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-09 00:39:32 -04:00
parent 255b98bda0
commit 4cf395aee9
129 changed files with 244823 additions and 248138 deletions

View File

@@ -30,8 +30,8 @@
They may be altered/distinct from the originals used in PuTTY source
code. */
void outbits(struct uzlib_comp *ctx, unsigned long bits, int nbits);
void zlib_start_block(struct uzlib_comp *ctx);
void zlib_finish_block(struct uzlib_comp *ctx);
void zlib_literal(struct uzlib_comp *ctx, unsigned char c);
void zlib_match(struct uzlib_comp *ctx, int distance, int len);
void outbits(struct uzlib_comp* ctx, unsigned long bits, int nbits);
void zlib_start_block(struct uzlib_comp* ctx);
void zlib_finish_block(struct uzlib_comp* ctx);
void zlib_literal(struct uzlib_comp* ctx, unsigned char c);
void zlib_match(struct uzlib_comp* ctx, int distance, int len);

View File

@@ -35,9 +35,9 @@
#ifndef UZLIB_H_INCLUDED
#define UZLIB_H_INCLUDED
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
@@ -50,25 +50,25 @@ extern "C" {
/* calling convention */
#ifndef TINFCC
#ifdef __WATCOMC__
#define TINFCC __cdecl
#else
#define TINFCC
#endif
#ifdef __WATCOMC__
#define TINFCC __cdecl
#else
#define TINFCC
#endif
#endif
/* ok status, more data produced */
#define TINF_OK 0
#define TINF_OK 0
/* end of compressed stream reached */
#define TINF_DONE 1
#define TINF_DATA_ERROR (-3)
#define TINF_CHKSUM_ERROR (-4)
#define TINF_DICT_ERROR (-5)
#define TINF_DONE 1
#define TINF_DATA_ERROR (-3)
#define TINF_CHKSUM_ERROR (-4)
#define TINF_DICT_ERROR (-5)
/* checksum types */
#define TINF_CHKSUM_NONE 0
#define TINF_CHKSUM_NONE 0
#define TINF_CHKSUM_ADLER 1
#define TINF_CHKSUM_CRC 2
#define TINF_CHKSUM_CRC 2
/* helper macros */
#define TINF_ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr)))
@@ -76,95 +76,98 @@ extern "C" {
/* data structures */
typedef struct {
unsigned short table[16]; /* table of code length counts */
unsigned short trans[288]; /* code -> symbol translation table */
unsigned short table[16]; /* table of code length counts */
unsigned short trans[288]; /* code -> symbol translation table */
} TINF_TREE;
struct uzlib_uncomp {
/* Pointer to the next byte in the input buffer */
const unsigned char *source;
/* Pointer to the next byte past the input buffer (source_limit = source + len) */
const unsigned char *source_limit;
/* If source_limit == NULL, or source >= source_limit, this function
will be used to read next byte from source stream. The function may
also return -1 in case of EOF (or irrecoverable error). Note that
besides returning the next byte, it may also update source and
source_limit fields, thus allowing for buffered operation. */
int (*source_read_cb)(struct uzlib_uncomp *uncomp);
/* Pointer to the next byte in the input buffer */
const unsigned char* source;
/* Pointer to the next byte past the input buffer (source_limit = source + len) */
const unsigned char* source_limit;
/* If source_limit == NULL, or source >= source_limit, this function
will be used to read next byte from source stream. The function may
also return -1 in case of EOF (or irrecoverable error). Note that
besides returning the next byte, it may also update source and
source_limit fields, thus allowing for buffered operation. */
int (*source_read_cb)(struct uzlib_uncomp* uncomp);
unsigned int tag;
unsigned int bitcount;
unsigned int tag;
unsigned int bitcount;
/* Destination (output) buffer start */
unsigned char *dest_start;
/* Current pointer in dest buffer */
unsigned char *dest;
/* Pointer past the end of the dest buffer, similar to source_limit */
unsigned char *dest_limit;
/* Destination (output) buffer start */
unsigned char* dest_start;
/* Current pointer in dest buffer */
unsigned char* dest;
/* Pointer past the end of the dest buffer, similar to source_limit */
unsigned char* dest_limit;
/* Accumulating checksum */
unsigned int checksum;
char checksum_type;
bool eof;
/* Accumulating checksum */
unsigned int checksum;
char checksum_type;
bool eof;
int btype;
int bfinal;
unsigned int curlen;
int lzOff;
unsigned char *dict_ring;
unsigned int dict_size;
unsigned int dict_idx;
int btype;
int bfinal;
unsigned int curlen;
int lzOff;
unsigned char* dict_ring;
unsigned int dict_size;
unsigned int dict_idx;
TINF_TREE ltree; /* dynamic length/symbol tree */
TINF_TREE dtree; /* dynamic distance tree */
TINF_TREE ltree; /* dynamic length/symbol tree */
TINF_TREE dtree; /* dynamic distance tree */
};
#include "tinf_compat.h"
#define TINF_PUT(d, c) \
{ \
*d->dest++ = c; \
if (d->dict_ring) { d->dict_ring[d->dict_idx++] = c; if (d->dict_idx == d->dict_size) d->dict_idx = 0; } \
}
#define TINF_PUT(d, c) \
{ \
*d->dest++ = c; \
if (d->dict_ring) { \
d->dict_ring[d->dict_idx++] = c; \
if (d->dict_idx == d->dict_size) d->dict_idx = 0; \
} \
}
unsigned char TINFCC uzlib_get_byte(TINF_DATA *d);
unsigned char TINFCC uzlib_get_byte(TINF_DATA* d);
/* Decompression API */
void TINFCC uzlib_init(void);
void TINFCC uzlib_uncompress_init(TINF_DATA *d, void *dict, unsigned int dictLen);
int TINFCC uzlib_uncompress(TINF_DATA *d);
int TINFCC uzlib_uncompress_chksum(TINF_DATA *d);
void TINFCC uzlib_uncompress_init(TINF_DATA* d, void* dict, unsigned int dictLen);
int TINFCC uzlib_uncompress(TINF_DATA* d);
int TINFCC uzlib_uncompress_chksum(TINF_DATA* d);
int TINFCC uzlib_zlib_parse_header(TINF_DATA *d);
int TINFCC uzlib_gzip_parse_header(TINF_DATA *d);
int TINFCC uzlib_zlib_parse_header(TINF_DATA* d);
int TINFCC uzlib_gzip_parse_header(TINF_DATA* d);
/* Compression API */
typedef const uint8_t *uzlib_hash_entry_t;
typedef const uint8_t* uzlib_hash_entry_t;
struct uzlib_comp {
unsigned char *outbuf;
int outlen, outsize;
unsigned long outbits;
int noutbits;
int comp_disabled;
unsigned char* outbuf;
int outlen, outsize;
unsigned long outbits;
int noutbits;
int comp_disabled;
uzlib_hash_entry_t *hash_table;
unsigned int hash_bits;
unsigned int dict_size;
uzlib_hash_entry_t* hash_table;
unsigned int hash_bits;
unsigned int dict_size;
};
void TINFCC uzlib_compress(struct uzlib_comp *c, const uint8_t *src, unsigned slen);
void TINFCC uzlib_compress(struct uzlib_comp* c, const uint8_t* src, unsigned slen);
#include "defl_static.h"
/* Checksum API */
/* prev_sum is previous value for incremental computation, 1 initially */
uint32_t TINFCC uzlib_adler32(const void *data, unsigned int length, uint32_t prev_sum);
uint32_t TINFCC uzlib_adler32(const void* data, unsigned int length, uint32_t prev_sum);
/* crc is previous value for incremental computation, 0xffffffff initially */
uint32_t TINFCC uzlib_crc32(const void *data, unsigned int length, uint32_t crc);
uint32_t TINFCC uzlib_crc32(const void* data, unsigned int length, uint32_t crc);
#ifdef __cplusplus
} /* extern "C" */