4
0
mirror of https://github.com/QuasarApp/zip.git synced 2025-04-29 22:04:35 +00:00

clang-format

This commit is contained in:
Kuba Podgórski 2021-03-06 18:13:11 +01:00
parent bfcfd1aa4e
commit a631ce45f7
4 changed files with 17 additions and 13 deletions

@ -6,3 +6,4 @@ for file in $(git ls-files | \grep -E '\.(c|h)$' | \grep -v -- '#')
do do
clang-format -i $file clang-format -i $file
done done
```

@ -1078,7 +1078,8 @@ struct entry_mark {
mz_uint64 lf_length; mz_uint64 lf_length;
}; };
struct zip_t *zip_open_stream(const char *stream, size_t size, int level, char mode) { struct zip_t *zip_open_stream(const char *stream, size_t size, int level,
char mode) {
struct zip_t *zip = NULL; struct zip_t *zip = NULL;
zip = (struct zip_t *)calloc((size_t)1, sizeof(struct zip_t)); zip = (struct zip_t *)calloc((size_t)1, sizeof(struct zip_t));
if (!zip) { if (!zip) {
@ -1119,7 +1120,8 @@ static inline void zip_write_end(struct zip_t *zip){
} }
ssize_t zip_copy_stream(struct zip_t *zip, void **buf, ssize_t *bufsize) { ssize_t zip_copy_stream(struct zip_t *zip, void **buf, ssize_t *bufsize) {
if(zip == NULL) return -1; if (zip == NULL)
return -1;
zip_write_end(zip); zip_write_end(zip);
if (bufsize != NULL) if (bufsize != NULL)
*bufsize = zip->archive.m_archive_size; *bufsize = zip->archive.m_archive_size;

@ -331,8 +331,8 @@ extern int zip_extract_stream(const char *stream, size_t size, const char *dir,
* *
* @return the zip archive handler or NULL on error * @return the zip archive handler or NULL on error
*/ */
extern struct zip_t *zip_open_stream(const char *stream, size_t size, extern struct zip_t *zip_open_stream(const char *stream, size_t size, int level,
int level, char mode); char mode);
/** /**
* Copy zip archive stream output buffer. * Copy zip archive stream output buffer.

@ -548,7 +548,8 @@ static void test_open_stream(void) {
#else #else
remove(ZIPNAME); remove(ZIPNAME);
/* COMPRESS MEM TO MEM */ /* COMPRESS MEM TO MEM */
struct zip_t *zip = zip_open_stream(NULL, 0, ZIP_DEFAULT_COMPRESSION_LEVEL, 'w'); struct zip_t *zip =
zip_open_stream(NULL, 0, ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
assert(zip != NULL); assert(zip != NULL);
assert(0 == zip_entry_open(zip, "test/test-1.txt")); assert(0 == zip_entry_open(zip, "test/test-1.txt"));