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

Go to the source code of this file.

Functions

ZIP_EXTERN int zip_source_seek_write (zip_source_t *src, zip_int64_t offset, int whence)
 

Function Documentation

◆ zip_source_seek_write()

ZIP_EXTERN int zip_source_seek_write ( zip_source_t src,
zip_int64_t  offset,
int  whence 
)

Definition at line 39 of file zip_source_seek_write.c.

39  {
41 
42  if (!ZIP_SOURCE_IS_OPEN_WRITING(src) || (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END)) {
43  zip_error_set(&src->error, ZIP_ER_INVAL, 0);
44  return -1;
45  }
46 
47  args.offset = offset;
48  args.whence = whence;
49 
50  return (_zip_source_call(src, &args, sizeof(args), ZIP_SOURCE_SEEK_WRITE) < 0 ? -1 : 0);
51 }
lzma_index * src
Definition: index.h:567
voidpf uLong offset
Definition: ioapi.h:144
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
Definition: zip_error.c:126
@ ZIP_SOURCE_SEEK_WRITE
Definition: zip.h:232
#define ZIP_ER_INVAL
Definition: zip.h:123
int args
Definition: mipsasm.c:18
#define SEEK_SET
Definition: zip.c:88
#define SEEK_CUR
Definition: zip.c:80
#define SEEK_END
Definition: zip.c:84
zip_int64_t _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command)
#define ZIP_SOURCE_IS_OPEN_WRITING(src)
Definition: zipint.h:403

References _zip_source_call(), args, SEEK_CUR, SEEK_END, SEEK_SET, src, ZIP_ER_INVAL, zip_error_set(), ZIP_SOURCE_IS_OPEN_WRITING, and ZIP_SOURCE_SEEK_WRITE.

Referenced by add_data().