39 #ifndef WRITE_FRAGMENT_SIZE
40 #define WRITE_FRAGMENT_SIZE (64 * 1024)
69 #define buffer_capacity(buffer) ((buffer)->fragment_offsets[(buffer)->nfragments])
70 #define buffer_size(buffer) ((buffer)->size)
143 if (fragments ==
NULL && nfragments > 0) {
194 ctx->
out->current_fragment = 0;
224 if (
len <
sizeof(
ctx->attributes)) {
229 memcpy(data, &
ctx->attributes,
sizeof(
ctx->attributes));
231 return sizeof(
ctx->attributes);
236 ctx->
in->current_fragment = 0;
271 if (
len <
sizeof(*st)) {
290 return zip_source_make_command_bitmap(
ZIP_SOURCE_GET_FILE_ATTRIBUTES,
ZIP_SOURCE_OPEN,
ZIP_SOURCE_READ,
ZIP_SOURCE_CLOSE,
ZIP_SOURCE_STAT,
ZIP_SOURCE_ERROR,
ZIP_SOURCE_FREE,
ZIP_SOURCE_SEEK,
ZIP_SOURCE_TELL,
ZIP_SOURCE_BEGIN_WRITE,
ZIP_SOURCE_BEGIN_WRITE_CLONING,
ZIP_SOURCE_COMMIT_WRITE,
ZIP_SOURCE_REMOVE,
ZIP_SOURCE_ROLLBACK_WRITE,
ZIP_SOURCE_SEEK_WRITE,
ZIP_SOURCE_TELL_WRITE,
ZIP_SOURCE_WRITE, -1);
342 if (fragment_offset == 0) {
357 #ifndef __clang_analyzer__
387 mid = (high - low) / 2 + low;
432 if (capacity < buffer->fragments_capacity) {
470 if (nfragments == 0) {
488 for (
i = 0, j = 0;
i < nfragments;
i++) {
489 if (fragments[
i].
length == 0) {
492 if (fragments[
i].data ==
NULL) {
550 if (new_offset < 0) {
577 if (new_capacity == 0) {
580 while (new_capacity < needed_fragments) {
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
ZIP_EXTERN void zip_file_attributes_init(zip_file_attributes_t *_Nonnull)
ZIP_EXTERN zip_int64_t zip_source_seek_compute_offset(zip_uint64_t, zip_uint64_t, void *_Nonnull, zip_uint64_t, zip_error_t *_Nullable)
#define ZIP_STAT_COMP_METHOD
ZIP_EXTERN void zip_stat_init(zip_stat_t *_Nonnull)
ZIP_EXTERN void zip_error_init(zip_error_t *_Nonnull)
enum zip_source_cmd zip_source_cmd_t
#define ZIP_STAT_ENCRYPTION_METHOD
#define ZIP_STAT_COMP_SIZE
@ ZIP_SOURCE_GET_FILE_ATTRIBUTES
@ ZIP_SOURCE_BEGIN_WRITE_CLONING
@ ZIP_SOURCE_ROLLBACK_WRITE
@ ZIP_SOURCE_COMMIT_WRITE
ZIP_EXTERN zip_source_t *_Nullable zip_source_function_create(zip_source_callback _Nonnull, void *_Nullable, zip_error_t *_Nullable)
ZIP_EXTERN zip_int64_t zip_source_make_command_bitmap(zip_source_cmd_t,...)
ZIP_EXTERN zip_int64_t zip_error_to_data(const zip_error_t *_Nonnull, void *_Nonnull, zip_uint64_t)
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time
zip_uint64_t first_owned_fragment
zip_uint64_t current_fragment
struct buffer * shared_buffer
zip_uint64_t * fragment_offsets
zip_uint64_t fragments_capacity
zip_buffer_fragment_t * fragments
zip_uint64_t shared_fragments
zip_file_attributes_t attributes
zip_uint8_t *_Nonnull data
zip_uint16_t encryption_method
void error(const char *msg)
static buffer_t * buffer_new(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int free_data, zip_error_t *error)
static zip_uint64_t buffer_find_fragment(const buffer_t *buffer, zip_uint64_t offset)
static zip_int64_t read_data(void *, void *, zip_uint64_t, zip_source_cmd_t)
static buffer_t * buffer_clone(buffer_t *buffer, zip_uint64_t length, zip_error_t *error)
static bool buffer_grow_fragments(buffer_t *buffer, zip_uint64_t capacity, zip_error_t *error)
ZIP_EXTERN zip_source_t * zip_source_buffer(zip_t *za, const void *data, zip_uint64_t len, int freep)
static zip_int64_t buffer_write(buffer_t *buffer, const zip_uint8_t *data, zip_uint64_t length, zip_error_t *)
static void buffer_free(buffer_t *buffer)
zip_source_t * zip_source_buffer_with_attributes(zip_t *za, const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes)
ZIP_EXTERN zip_source_t * zip_source_buffer_create(const void *data, zip_uint64_t len, int freep, zip_error_t *error)
ZIP_EXTERN zip_source_t * zip_source_buffer_fragment(zip_t *za, const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep)
#define buffer_capacity(buffer)
#define WRITE_FRAGMENT_SIZE
static int buffer_seek(buffer_t *buffer, void *data, zip_uint64_t len, zip_error_t *error)
zip_source_t * zip_source_buffer_with_attributes_create(const void *data, zip_uint64_t len, int freep, zip_file_attributes_t *attributes, zip_error_t *error)
zip_source_t * zip_source_buffer_fragment_with_attributes_create(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep, zip_file_attributes_t *attributes, zip_error_t *error)
static zip_int64_t buffer_read(buffer_t *buffer, zip_uint8_t *data, zip_uint64_t length)
ZIP_EXTERN zip_source_t * zip_source_buffer_fragment_create(const zip_buffer_fragment_t *fragments, zip_uint64_t nfragments, int freep, zip_error_t *error)