Rizin
unix-like reverse engineering framework and cli tools
zip_source_call.c File Reference
#include "zipint.h"

Go to the source code of this file.

Functions

zip_int64_t _zip_source_call (zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command)
 

Function Documentation

◆ _zip_source_call()

zip_int64_t _zip_source_call ( zip_source_t src,
void *  data,
zip_uint64_t  length,
zip_source_cmd_t  command 
)

Definition at line 39 of file zip_source_call.c.

39  {
40  zip_int64_t ret;
41 
42  if ((src->supports & ZIP_SOURCE_MAKE_COMMAND_BITMASK(command)) == 0) {
43  zip_error_set(&src->error, ZIP_ER_OPNOTSUPP, 0);
44  return -1;
45  }
46 
47  if (src->src == NULL) {
48  ret = src->cb.f(src->ud, data, length, command);
49  }
50  else {
51  ret = src->cb.l(src->src, src->ud, data, length, command);
52  }
53 
54  if (ret < 0) {
56  int e[2];
57 
58  if (_zip_source_call(src, e, sizeof(e), ZIP_SOURCE_ERROR) < 0) {
59  zip_error_set(&src->error, ZIP_ER_INTERNAL, 0);
60  }
61  else {
62  zip_error_set(&src->error, e[0], e[1]);
63  }
64  }
65  }
66 
67  return ret;
68 }
#define e(frag)
lzma_index * src
Definition: index.h:567
#define NULL
Definition: cris-opc.c:27
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
Definition: sflib.h:133
#define ZIP_ER_INTERNAL
Definition: zip.h:125
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
Definition: zip_error.c:126
#define ZIP_SOURCE_MAKE_COMMAND_BITMASK(cmd)
Definition: zip.h:243
@ ZIP_SOURCE_SUPPORTS
Definition: zip.h:234
@ ZIP_SOURCE_ERROR
Definition: zip.h:224
#define ZIP_ER_OPNOTSUPP
Definition: zip.h:133
const char * command
Definition: main.c:7
zip_int64_t _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command)
int64_t zip_int64_t
Definition: zipconf.h:38

References command, e, length, NULL, src, ZIP_ER_INTERNAL, ZIP_ER_OPNOTSUPP, zip_error_set(), ZIP_SOURCE_ERROR, ZIP_SOURCE_MAKE_COMMAND_BITMASK, and ZIP_SOURCE_SUPPORTS.

Referenced by zip_source_accept_empty(), zip_source_begin_write(), zip_source_begin_write_cloning(), zip_source_close(), zip_source_commit_write(), zip_source_free(), zip_source_get_file_attributes(), zip_source_open(), zip_source_read(), zip_source_remove(), zip_source_rollback_write(), zip_source_seek(), zip_source_seek_write(), zip_source_stat(), zip_source_tell(), zip_source_tell_write(), and zip_source_write().