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

Go to the source code of this file.

Functions

ZIP_EXTERN int zip_source_commit_write (zip_source_t *src)
 

Function Documentation

◆ zip_source_commit_write()

ZIP_EXTERN int zip_source_commit_write ( zip_source_t src)

Definition at line 39 of file zip_source_commit_write.c.

39  {
41  zip_error_set(&src->error, ZIP_ER_INVAL, 0);
42  return -1;
43  }
44 
45  if (src->open_count > 1) {
46  zip_error_set(&src->error, ZIP_ER_INUSE, 0);
47  return -1;
48  }
49  else if (ZIP_SOURCE_IS_OPEN_READING(src)) {
50  if (zip_source_close(src) < 0) {
51  return -1;
52  }
53  }
54 
56  src->write_state = ZIP_SOURCE_WRITE_FAILED;
57  return -1;
58  }
59 
60  src->write_state = ZIP_SOURCE_WRITE_CLOSED;
61 
62  return 0;
63 }
lzma_index * src
Definition: index.h:567
#define NULL
Definition: cris-opc.c:27
ZIP_EXTERN int zip_source_close(zip_source_t *_Nonnull)
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
Definition: zip_error.c:126
@ ZIP_SOURCE_COMMIT_WRITE
Definition: zip.h:229
#define ZIP_ER_INUSE
Definition: zip.h:134
#define ZIP_ER_INVAL
Definition: zip.h:123
zip_int64_t _zip_source_call(zip_source_t *src, void *data, zip_uint64_t length, zip_source_cmd_t command)
@ ZIP_SOURCE_WRITE_CLOSED
Definition: zipint.h:376
@ ZIP_SOURCE_WRITE_FAILED
Definition: zipint.h:378
#define ZIP_SOURCE_IS_OPEN_WRITING(src)
Definition: zipint.h:403
#define ZIP_SOURCE_IS_OPEN_READING(src)
Definition: zipint.h:402

References _zip_source_call(), NULL, src, ZIP_ER_INUSE, ZIP_ER_INVAL, zip_error_set(), zip_source_close(), ZIP_SOURCE_COMMIT_WRITE, ZIP_SOURCE_IS_OPEN_READING, ZIP_SOURCE_IS_OPEN_WRITING, ZIP_SOURCE_WRITE_CLOSED, and ZIP_SOURCE_WRITE_FAILED.

Referenced by copy_source(), and zip_close().