Rizin
unix-like reverse engineering framework and cli tools
zip_stat_init.c File Reference
#include <string.h>
#include "zipint.h"

Go to the source code of this file.

Functions

ZIP_EXTERN void zip_stat_init (zip_stat_t *st)
 
int _zip_stat_merge (zip_stat_t *dst, const zip_stat_t *src, zip_error_t *error)
 

Function Documentation

◆ _zip_stat_merge()

int _zip_stat_merge ( zip_stat_t dst,
const zip_stat_t src,
zip_error_t error 
)

Definition at line 54 of file zip_stat_init.c.

54  {
55  /* name is not merged, since zip_stat_t doesn't own it, and src may not be valid as long as dst */
56  if (src->valid & ZIP_STAT_INDEX) {
57  dst->index = src->index;
58  }
59  if (src->valid & ZIP_STAT_SIZE) {
60  dst->size = src->size;
61  }
62  if (src->valid & ZIP_STAT_COMP_SIZE) {
63  dst->comp_size = src->comp_size;
64  }
65  if (src->valid & ZIP_STAT_MTIME) {
66  dst->mtime = src->mtime;
67  }
68  if (src->valid & ZIP_STAT_CRC) {
69  dst->crc = src->crc;
70  }
71  if (src->valid & ZIP_STAT_COMP_METHOD) {
72  dst->comp_method = src->comp_method;
73  }
74  if (src->valid & ZIP_STAT_ENCRYPTION_METHOD) {
75  dst->encryption_method = src->encryption_method;
76  }
77  if (src->valid & ZIP_STAT_FLAGS) {
78  dst->flags = src->flags;
79  }
80  dst->valid |= src->valid;
81 
82  return 0;
83 }
lzma_index * src
Definition: index.h:567
#define ZIP_STAT_SIZE
Definition: zip.h:292
#define ZIP_STAT_COMP_METHOD
Definition: zip.h:296
#define ZIP_STAT_ENCRYPTION_METHOD
Definition: zip.h:297
#define ZIP_STAT_COMP_SIZE
Definition: zip.h:293
#define ZIP_STAT_MTIME
Definition: zip.h:294
#define ZIP_STAT_INDEX
Definition: zip.h:291
#define ZIP_STAT_CRC
Definition: zip.h:295
#define ZIP_STAT_FLAGS
Definition: zip.h:298
char * dst
Definition: lz4.h:724

References dst, src, ZIP_STAT_COMP_METHOD, ZIP_STAT_COMP_SIZE, ZIP_STAT_CRC, ZIP_STAT_ENCRYPTION_METHOD, ZIP_STAT_FLAGS, ZIP_STAT_INDEX, ZIP_STAT_MTIME, and ZIP_STAT_SIZE.

Referenced by _zip_source_window_new(), and window_read().

◆ zip_stat_init()

ZIP_EXTERN void zip_stat_init ( zip_stat_t st)

Definition at line 40 of file zip_stat_init.c.

40  {
41  st->valid = 0;
42  st->name = NULL;
43  st->index = ZIP_UINT64_MAX;
44  st->crc = 0;
45  st->mtime = (time_t)-1;
46  st->size = 0;
47  st->comp_size = 0;
50 }
#define NULL
Definition: cris-opc.c:27
#define ZIP_CM_STORE
Definition: zip.h:149
#define ZIP_EM_NONE
Definition: zip.h:177
int time_t
Definition: sftypes.h:66
time_t mtime
Definition: zip.h:306
zip_uint16_t encryption_method
Definition: zip.h:309
zip_uint64_t index
Definition: zip.h:303
const char *_Nullable name
Definition: zip.h:302
zip_uint64_t valid
Definition: zip.h:301
zip_uint16_t comp_method
Definition: zip.h:308
zip_uint64_t comp_size
Definition: zip.h:305
zip_uint32_t crc
Definition: zip.h:307
zip_uint64_t size
Definition: zip.h:304
#define ZIP_UINT64_MAX
Definition: zipconf.h:55

References zip_stat::comp_method, zip_stat::comp_size, zip_stat::crc, zip_stat::encryption_method, zip_stat::index, zip_stat::mtime, zip_stat::name, NULL, zip_stat::size, zip_stat::valid, ZIP_CM_STORE, ZIP_EM_NONE, and ZIP_UINT64_MAX.

Referenced by _zip_file_exists(), _zip_open(), _zip_source_window_new(), add_data(), read_data(), rz_io_zip_alloc_zipfileobj(), rz_io_zip_get_by_file_idx(), rz_io_zip_get_files(), rz_io_zip_slurp_file(), zip_source_file_common_new(), zip_source_stat(), and zip_stat_index().