34 const char *
input,
const char *base,
55 self->buf_size = 4096;
88 file->available -= bytes_read;
97 if (bytes_written > 0)
100 return bytes_written;
112 unsigned int block_max, target_size;
116 unsigned int window_bits;
148 buf = sys->
alloc(sys, self->buf_size);
164 while (target_size) {
165 unsigned int blk_csize, blk_dsize, blk_crc, blk_flags;
176 if (blk_dsize > block_max || blk_dsize > target_size || blk_flags > 1) {
183 if (blk_dsize != blk_csize) {
187 ret =
copy_fh(sys, infh, outfh, blk_dsize,
buf, self->buf_size);
193 while (window_bits < 25 && (1U << window_bits) < blk_dsize)
197 out_ofh.
crc = 0xffffffff;
199 lzx =
lzxd_init(&oabd_sys, (
void *)&in_ofh, (
void *)&out_ofh, window_bits,
200 0, self->buf_size, blk_dsize, 1);
214 ret =
copy_fh(sys, infh,
NULL, in_ofh.available,
buf, self->buf_size);
217 if (out_ofh.crc != blk_crc) {
222 target_size -= blk_dsize;
227 if (outfh) sys->
close(outfh);
228 if (infh) sys->
close(infh);
235 const char *
input,
const char *base,
245 unsigned int block_max, target_size;
249 unsigned int window_bits, window_size;
291 buf = sys->
alloc(sys, self->buf_size);
307 while (target_size) {
308 unsigned int blk_csize, blk_dsize, blk_ssize, blk_crc;
319 if (blk_dsize > block_max || blk_dsize > target_size ||
320 blk_ssize > block_max) {
326 window_size = (blk_ssize + 32767) & ~32767;
327 window_size += blk_dsize;
330 while (window_bits < 25 && (1U << window_bits) < window_size)
334 out_ofh.
crc = 0xffffffff;
336 lzx =
lzxd_init(&oabd_sys, (
void *)&in_ofh, (
void *)&out_ofh, window_bits,
337 0, 4096, blk_dsize, 1);
354 ret =
copy_fh(sys, infh,
NULL, in_ofh.available,
buf, self->buf_size);
357 if (out_ofh.crc != blk_crc) {
362 target_size -= blk_dsize;
367 if (outfh) sys->
close(outfh);
368 if (basefh) sys->
close(basefh);
369 if (infh) sys->
close(infh);
379 while (bytes_to_copy) {
381 if ((
size_t)
run > bytes_to_copy) {
382 run = (
int) bytes_to_copy;
390 bytes_to_copy -=
run;
399 self->buf_size =
value;
const lzma_allocator const uint8_t size_t uint8_t * out
#define patchhead_VersionHi
#define oabhead_TargetSize
#define oabhead_VersionHi
#define oabhead_VersionLo
#define patchhead_TargetSize
#define patchblk_SourceSize
#define patchblk_PatchSize
#define patchblk_TargetSize
#define patchhead_BlockMax
#define oabblk_UncompSize
#define patchhead_VersionLo
struct msoab_decompressor * mspack_create_oab_decompressor(struct mspack_system *sys)
static int oabd_decompress_incremental(struct msoab_decompressor *self, const char *input, const char *base, const char *output)
static int oabd_sys_write(struct mspack_file *base_file, void *buf, int size)
static int oabd_decompress(struct msoab_decompressor *self, const char *input, const char *output)
static int oabd_param(struct msoab_decompressor *base, int param, int value)
static int oabd_sys_read(struct mspack_file *base_file, void *buf, int size)
static int copy_fh(struct mspack_system *sys, struct mspack_file *infh, struct mspack_file *outfh, size_t bytes_to_copy, unsigned char *buf, int buf_size)
void mspack_destroy_oab_decompressor(struct msoab_decompressor *base)
static int run(int i, const char *arg)
struct msoab_decompressor base
void(* close)(struct mspack_file *file)
struct mspack_file *(* open)(struct mspack_system *self, const char *filename, int mode)
int(* read)(struct mspack_file *file, void *buffer, int bytes)
int(* write)(struct mspack_file *file, void *buffer, int bytes)
void *(* alloc)(struct mspack_system *self, size_t bytes)
struct mspack_system * orig_sys
struct mspack_file * orig_file
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)