Run clang-format.
diff --git a/developer-xcode/config.h b/developer-xcode/config.h
index 0079859..0de2e90 100644
--- a/developer-xcode/config.h
+++ b/developer-xcode/config.h
@@ -81,15 +81,15 @@
 #define VERSION "1.5.2a"
 
 #ifndef HAVE_SSIZE_T_LIBZIP
-#  if SIZE_T_LIBZIP == INT_LIBZIP
+#if SIZE_T_LIBZIP == INT_LIBZIP
 typedef int ssize_t;
-#  elif SIZE_T_LIBZIP == LONG_LIBZIP
+#elif SIZE_T_LIBZIP == LONG_LIBZIP
 typedef long ssize_t;
-#  elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP
+#elif SIZE_T_LIBZIP == LONG_LONG_LIBZIP
 typedef long long ssize_t;
-#  else
+#else
 #error no suitable type for ssize_t found
-#  endif
+#endif
 #endif
 
 #endif /* HAD_CONFIG_H */
diff --git a/developer-xcode/zipconf.h b/developer-xcode/zipconf.h
index 2452acf..99b3f07 100644
--- a/developer-xcode/zipconf.h
+++ b/developer-xcode/zipconf.h
@@ -16,7 +16,6 @@
 /* #undef ZIP_STATIC */
 
 
-
 #define __STDC_FORMAT_MACROS 1
 #include <inttypes.h>
 
@@ -29,20 +28,20 @@
 typedef int64_t zip_int64_t;
 typedef uint64_t zip_uint64_t;
 
-#define ZIP_INT8_MIN	 (-ZIP_INT8_MAX-1)
-#define ZIP_INT8_MAX	 0x7f
-#define ZIP_UINT8_MAX	 0xff
+#define ZIP_INT8_MIN (-ZIP_INT8_MAX - 1)
+#define ZIP_INT8_MAX 0x7f
+#define ZIP_UINT8_MAX 0xff
 
-#define ZIP_INT16_MIN	 (-ZIP_INT16_MAX-1)
-#define ZIP_INT16_MAX	 0x7fff
-#define ZIP_UINT16_MAX	 0xffff
+#define ZIP_INT16_MIN (-ZIP_INT16_MAX - 1)
+#define ZIP_INT16_MAX 0x7fff
+#define ZIP_UINT16_MAX 0xffff
 
-#define ZIP_INT32_MIN	 (-ZIP_INT32_MAX-1L)
-#define ZIP_INT32_MAX	 0x7fffffffL
-#define ZIP_UINT32_MAX	 0xffffffffLU
+#define ZIP_INT32_MIN (-ZIP_INT32_MAX - 1L)
+#define ZIP_INT32_MAX 0x7fffffffL
+#define ZIP_UINT32_MAX 0xffffffffLU
 
-#define ZIP_INT64_MIN	 (-ZIP_INT64_MAX-1LL)
-#define ZIP_INT64_MAX	 0x7fffffffffffffffLL
-#define ZIP_UINT64_MAX	 0xffffffffffffffffULL
+#define ZIP_INT64_MIN (-ZIP_INT64_MAX - 1LL)
+#define ZIP_INT64_MAX 0x7fffffffffffffffLL
+#define ZIP_UINT64_MAX 0xffffffffffffffffULL
 
 #endif /* zipconf.h */
diff --git a/lib/zip_algorithm_bzip2.c b/lib/zip_algorithm_bzip2.c
index c114987..f846ac3 100644
--- a/lib/zip_algorithm_bzip2.c
+++ b/lib/zip_algorithm_bzip2.c
@@ -46,11 +46,12 @@
 };
 
 
-static zip_uint64_t maximum_compressed_size(zip_uint64_t uncompressed_size) {
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
     zip_uint64_t compressed_size = (zip_uint64_t)((double)uncompressed_size * 1.006);
 
     if (compressed_size < uncompressed_size) {
-        return ZIP_UINT64_MAX;
+	return ZIP_UINT64_MAX;
     }
     return compressed_size;
 }
diff --git a/lib/zip_algorithm_deflate.c b/lib/zip_algorithm_deflate.c
index 27b4d06..061a170 100644
--- a/lib/zip_algorithm_deflate.c
+++ b/lib/zip_algorithm_deflate.c
@@ -46,13 +46,14 @@
 };
 
 
-static zip_uint64_t maximum_compressed_size(zip_uint64_t uncompressed_size) {
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
     /* max deflate size increase: size + ceil(size/16k)*5+6 */
 
     zip_uint64_t compressed_size = uncompressed_size + (uncompressed_size + 16383) / 16384 * 5 + 6;
 
     if (compressed_size < uncompressed_size) {
-        return ZIP_UINT64_MAX;
+	return ZIP_UINT64_MAX;
     }
     return compressed_size;
 }
diff --git a/lib/zip_algorithm_xz.c b/lib/zip_algorithm_xz.c
index 1920566..7b7317c 100644
--- a/lib/zip_algorithm_xz.c
+++ b/lib/zip_algorithm_xz.c
@@ -49,7 +49,8 @@
 };
 
 
-static zip_uint64_t maximum_compressed_size(zip_uint64_t uncompressed_size) {
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
     /*
      According to https://sourceforge.net/p/sevenzip/discussion/45797/thread/b6bd62f8/
 
@@ -62,7 +63,7 @@
     zip_uint64_t compressed_size = (zip_uint64_t)((double)uncompressed_size * 1.1) + 64 * 1024;
 
     if (compressed_size < uncompressed_size) {
-        return ZIP_UINT64_MAX;
+	return ZIP_UINT64_MAX;
     }
     return compressed_size;
 }
diff --git a/lib/zip_algorithm_zstd.c b/lib/zip_algorithm_zstd.c
index 3b7ac79..b92a07b 100644
--- a/lib/zip_algorithm_zstd.c
+++ b/lib/zip_algorithm_zstd.c
@@ -49,7 +49,8 @@
     ZSTD_inBuffer in;
 };
 
-static zip_uint64_t maximum_compressed_size(zip_uint64_t uncompressed_size) {
+static zip_uint64_t
+maximum_compressed_size(zip_uint64_t uncompressed_size) {
     return ZSTD_compressBound(uncompressed_size);
 }
 
diff --git a/lib/zip_close.c b/lib/zip_close.c
index fb47f0a..cb640ce 100644
--- a/lib/zip_close.c
+++ b/lib/zip_close.c
@@ -196,7 +196,7 @@
 	}
 
 	if ((off = zip_source_tell_write(za->src)) < 0) {
-            _zip_error_set_from_source(&za->error, za->src);
+	    _zip_error_set_from_source(&za->error, za->src);
 	    error = 1;
 	    break;
 	}
@@ -241,11 +241,11 @@
 	    }
 	    if (zip_source_seek(za->src, (zip_int64_t)offset, SEEK_SET) < 0) {
 		_zip_error_set_from_source(&za->error, za->src);
-                error = 1;
+		error = 1;
 		break;
 	    }
 	    if (copy_data(za, de->comp_size) < 0) {
- 		error = 1;
+		error = 1;
 		break;
 	    }
 
@@ -334,22 +334,22 @@
 
 	if ((st.valid & ZIP_STAT_COMP_SIZE) == 0) {
 	    zip_uint64_t max_compressed_size;
-            zip_uint16_t compression_method = ZIP_CM_ACTUAL(de->comp_method);
+	    zip_uint16_t compression_method = ZIP_CM_ACTUAL(de->comp_method);
 
-            if (compression_method == ZIP_CM_STORE) {
-                max_compressed_size = st.size;
-            }
-            else {
-                zip_compression_algorithm_t *algorithm = _zip_get_compression_algorithm(compression_method, true);
-                if (algorithm == NULL) {
-                    max_compressed_size = ZIP_UINT64_MAX;
-                }
-                else {
-                    max_compressed_size = algorithm->maximum_compressed_size(st.size);
-                }
-            }
+	    if (compression_method == ZIP_CM_STORE) {
+		max_compressed_size = st.size;
+	    }
+	    else {
+		zip_compression_algorithm_t *algorithm = _zip_get_compression_algorithm(compression_method, true);
+		if (algorithm == NULL) {
+		    max_compressed_size = ZIP_UINT64_MAX;
+		}
+		else {
+		    max_compressed_size = algorithm->maximum_compressed_size(st.size);
+		}
+	    }
 
-            if (max_compressed_size > 0xffffffffu) {
+	    if (max_compressed_size > 0xffffffffu) {
 		flags |= ZIP_FL_FORCE_ZIP64;
 	    }
 	}
diff --git a/lib/zip_crypto_openssl.c b/lib/zip_crypto_openssl.c
index 60f9275..55c9d9d 100644
--- a/lib/zip_crypto_openssl.c
+++ b/lib/zip_crypto_openssl.c
@@ -37,8 +37,8 @@
 
 #include "zip_crypto.h"
 
-#include <openssl/rand.h>
 #include <limits.h>
+#include <openssl/rand.h>
 
 #if OPENSSL_VERSION_NUMBER < 0x1010000fL || defined(LIBRESSL_VERSION_NUMBER)
 #define USE_OPENSSL_1_0_API
diff --git a/lib/zip_source_file_common.c b/lib/zip_source_file_common.c
index 74e2100..be9bd94 100644
--- a/lib/zip_source_file_common.c
+++ b/lib/zip_source_file_common.c
@@ -134,24 +134,24 @@
 
     zip_source_file_stat_init(&sb);
     if (!ops->stat(ctx, &sb)) {
-        _zip_error_copy(error, &ctx->error);
-        free(ctx->fname);
-        free(ctx);
-        return NULL;
+	_zip_error_copy(error, &ctx->error);
+	free(ctx->fname);
+	free(ctx);
+	return NULL;
     }
 
     if (!sb.exists) {
-        if (ctx->fname && ctx->start == 0 && ctx->len == 0 && ops->write != NULL) {
-            ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE;
-            /* zip_open_from_source checks for this to detect non-existing files */
-            zip_error_set(&ctx->stat_error, ZIP_ER_READ, ENOENT);
-        }
-        else {
-            zip_error_set(&ctx->stat_error, ZIP_ER_READ, ENOENT);
-            free(ctx->fname);
-            free(ctx);
-            return NULL;
-        }
+	if (ctx->fname && ctx->start == 0 && ctx->len == 0 && ops->write != NULL) {
+	    ctx->supports = ZIP_SOURCE_SUPPORTS_WRITABLE;
+	    /* zip_open_from_source checks for this to detect non-existing files */
+	    zip_error_set(&ctx->stat_error, ZIP_ER_READ, ENOENT);
+	}
+	else {
+	    zip_error_set(&ctx->stat_error, ZIP_ER_READ, ENOENT);
+	    free(ctx->fname);
+	    free(ctx);
+	    return NULL;
+	}
     }
     else {
 	if ((ctx->st.valid & ZIP_STAT_MTIME) == 0) {
diff --git a/lib/zip_source_file_stdio.c b/lib/zip_source_file_stdio.c
index 4a22f78..20cecf9 100644
--- a/lib/zip_source_file_stdio.c
+++ b/lib/zip_source_file_stdio.c
@@ -142,10 +142,10 @@
     }
 
     if (ret < 0) {
-        if (errno == ENOENT) {
-            st->exists = false;
-            return true;
-        }
+	if (errno == ENOENT) {
+	    st->exists = false;
+	    return true;
+	}
 	zip_error_set(&ctx->error, ZIP_ER_READ, errno);
 	return false;
     }
diff --git a/lib/zip_source_file_win32.c b/lib/zip_source_file_win32.c
index 0ccb9f1..e0ae76d 100644
--- a/lib/zip_source_file_win32.c
+++ b/lib/zip_source_file_win32.c
@@ -60,9 +60,9 @@
 ZIP_EXTERN zip_source_t *
 zip_source_win32handle(zip_t *za, HANDLE h, zip_uint64_t start, zip_int64_t len) {
     if (za == NULL) {
-        return NULL;
+	return NULL;
     }
-    
+
     return zip_source_win32handle_create(h, start, len, &za->error);
 }
 
@@ -70,8 +70,8 @@
 ZIP_EXTERN zip_source_t *
 zip_source_win32handle_create(HANDLE h, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
     if (h == INVALID_HANDLE_VALUE || length < -1) {
-        zip_error_set(error, ZIP_ER_INVAL, 0);
-        return NULL;
+	zip_error_set(error, ZIP_ER_INVAL, 0);
+	return NULL;
     }
 
     return zip_source_file_common_new(NULL, h, start, length, NULL, &ops_win32_read, NULL, error);
@@ -90,10 +90,10 @@
 
     /* TODO: cap len to "DWORD_MAX" */
     if (!ReadFile((HANDLE)ctx->f, buf, (DWORD)len, &i, NULL)) {
-        zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
-    
+
     return (zip_int64_t)i;
 }
 
@@ -105,23 +105,23 @@
 
     switch (whence) {
     case SEEK_SET:
-        method = FILE_BEGIN;
-        break;
+	method = FILE_BEGIN;
+	break;
     case SEEK_END:
-        method = FILE_END;
-        break;
+	method = FILE_END;
+	break;
     case SEEK_CUR:
-        method = FILE_CURRENT;
-        break;
+	method = FILE_CURRENT;
+	break;
     default:
-        zip_error_set(&ctx->error, ZIP_ER_SEEK, EINVAL);
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_SEEK, EINVAL);
+	return -1;
     }
 
     li.QuadPart = (LONGLONG)offset;
     if (!SetFilePointerEx((HANDLE)f, li, NULL, method)) {
-        zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError()));
-        return false;
+	zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError()));
+	return false;
     }
 
     return true;
@@ -138,13 +138,13 @@
 _zip_win32_op_tell(zip_source_file_context_t *ctx, void *f) {
     LARGE_INTEGER zero;
     LARGE_INTEGER new_offset;
-    
+
     zero.QuadPart = 0;
     if (!SetFilePointerEx((HANDLE)f, zero, &new_offset, FILE_CURRENT)) {
-        zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_SEEK, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
-    
+
     return (zip_int64_t)new_offset.QuadPart;
 }
 
@@ -154,21 +154,21 @@
     /* Note: This list isn't exhaustive, but should cover common cases. */
     switch (win32err) {
     case ERROR_INVALID_PARAMETER:
-        return EINVAL;
+	return EINVAL;
     case ERROR_FILE_NOT_FOUND:
-        return ENOENT;
+	return ENOENT;
     case ERROR_INVALID_HANDLE:
-        return EBADF;
+	return EBADF;
     case ERROR_ACCESS_DENIED:
-        return EACCES;
+	return EACCES;
     case ERROR_FILE_EXISTS:
-        return EEXIST;
+	return EEXIST;
     case ERROR_TOO_MANY_OPEN_FILES:
-        return EMFILE;
+	return EMFILE;
     case ERROR_DISK_FULL:
-        return ENOSPC;
+	return ENOSPC;
     default:
-        return 10000 + win32err;
+	return 10000 + win32err;
     }
 }
 
@@ -180,28 +180,28 @@
     LARGE_INTEGER size;
 
     if (!GetFileTime(h, NULL, NULL, &mtimeft)) {
-        zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
-        return false;
+	zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
+	return false;
     }
     if (_zip_filetime_to_time_t(mtimeft, &mtime) < 0) {
-        zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
-        return false;
+	zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
+	return false;
     }
-    
+
     st->exists = true;
     st->mtime = mtime;
 
     if (GetFileType(h) == FILE_TYPE_DISK) {
-        st->regular_file = 1;
+	st->regular_file = 1;
 
-        if (!GetFileSizeEx(h, &size)) {
-            zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
-            return false;
-        }
+	if (!GetFileSizeEx(h, &size)) {
+	    zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(GetLastError()));
+	    return false;
+	}
 
-        st->size = (zip_uint64_t)size.QuadPart;
+	st->size = (zip_uint64_t)size.QuadPart;
     }
-    
+
     /* TODO: fill in ctx->attributes */
 
     return true;
@@ -225,7 +225,7 @@
 
     temp = (time_t)secs;
     if (secs != (zip_int64_t)temp) {
-        return false;
+	return false;
     }
 
     *t = temp;
diff --git a/lib/zip_source_file_win32.h b/lib/zip_source_file_win32.h
index 5092e63..23172a1 100644
--- a/lib/zip_source_file_win32.h
+++ b/lib/zip_source_file_win32.h
@@ -49,13 +49,13 @@
 
 struct zip_win32_file_operations {
     char *(*allocate_tempname)(const char *name, size_t extra_chars, size_t *lengthp);
-    HANDLE (__stdcall *create_file)(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
-    BOOL (__stdcall *delete_file)(const void *name);
-    DWORD (__stdcall *get_file_attributes)(const void *name);
-    BOOL (__stdcall *get_file_attributes_ex)(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
+    HANDLE(__stdcall *create_file)(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+    BOOL(__stdcall *delete_file)(const void *name);
+    DWORD(__stdcall *get_file_attributes)(const void *name);
+    BOOL(__stdcall *get_file_attributes_ex)(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
     void (*make_tempname)(char *buf, size_t len, const char *name, zip_uint32_t i);
-    BOOL (__stdcall *move_file)(const void *from, const void *to, DWORD flags);
-    BOOL (__stdcall *set_file_attributes)(const void *name, DWORD attributes);
+    BOOL(__stdcall *move_file)(const void *from, const void *to, DWORD flags);
+    BOOL(__stdcall *set_file_attributes)(const void *name, DWORD attributes);
     char *(*string_duplicate)(const char *string);
 };
 
diff --git a/lib/zip_source_file_win32_ansi.c b/lib/zip_source_file_win32_ansi.c
index 9201515..5785d2e 100644
--- a/lib/zip_source_file_win32_ansi.c
+++ b/lib/zip_source_file_win32_ansi.c
@@ -55,7 +55,7 @@
 ZIP_EXTERN zip_source_t *
 zip_source_win32a(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) {
     if (za == NULL)
-    return NULL;
+	return NULL;
 
     return zip_source_win32a_create(fname, start, len, &za->error);
 }
@@ -64,8 +64,8 @@
 ZIP_EXTERN zip_source_t *
 zip_source_win32a_create(const char *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
     if (fname == NULL || length < -1) {
-    zip_error_set(error, ZIP_ER_INVAL, 0);
-    return NULL;
+	zip_error_set(error, ZIP_ER_INVAL, 0);
+	return NULL;
     }
 
     return zip_source_file_common_new(fname, NULL, start, length, NULL, &_zip_source_file_win32_named_ops, &ops_ansi, error);
diff --git a/lib/zip_source_file_win32_named.c b/lib/zip_source_file_win32_named.c
index 9591b26..d76cc36 100644
--- a/lib/zip_source_file_win32_named.c
+++ b/lib/zip_source_file_win32_named.c
@@ -65,28 +65,28 @@
 static zip_int64_t
 _zip_win32_named_op_commit_write(zip_source_file_context_t *ctx) {
     zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata;
-    
+
     if (!CloseHandle((HANDLE)ctx->fout)) {
-        zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
-    
+
     DWORD attributes = file_ops->get_file_attributes(ctx->tmpname);
     if (attributes == INVALID_FILE_ATTRIBUTES) {
-        zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
 
     if (attributes & FILE_ATTRIBUTE_TEMPORARY) {
-        if (!file_ops->set_file_attributes(ctx->tmpname, attributes & ~FILE_ATTRIBUTE_TEMPORARY)) {
-            zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
-            return -1;
-        }
+	if (!file_ops->set_file_attributes(ctx->tmpname, attributes & ~FILE_ATTRIBUTE_TEMPORARY)) {
+	    zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
+	    return -1;
+	}
     }
 
     if (!file_ops->move_file(ctx->tmpname, ctx->fname, MOVEFILE_REPLACE_EXISTING)) {
-        zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_RENAME, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
 
     return 0;
@@ -108,47 +108,47 @@
     char *tempname = NULL;
     size_t tempname_size = 0;
 
-     if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) {
-         si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION;
-         success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd);
-         if (success == ERROR_SUCCESS) {
-             sa.nLength = sizeof(SECURITY_ATTRIBUTES);
-             sa.bInheritHandle = FALSE;
-             sa.lpSecurityDescriptor = psd;
-             psa = &sa;
-         }
-     }
+    if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) {
+	si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION;
+	success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd);
+	if (success == ERROR_SUCCESS) {
+	    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+	    sa.bInheritHandle = FALSE;
+	    sa.lpSecurityDescriptor = psd;
+	    psa = &sa;
+	}
+    }
 
- #ifndef MS_UWP
+#ifndef MS_UWP
     value = GetTickCount();
 #else
     value = (zip_uint32_t)(GetTickCount64() & 0xffffffff);
 #endif
-    
+
     if ((tempname = file_ops->allocate_tempname(ctx->fname, 10, &tempname_size)) == NULL) {
-        zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
+	return -1;
     }
-        
+
     for (i = 0; i < 1024 && th == INVALID_HANDLE_VALUE; i++) {
-        file_ops->make_tempname(tempname, tempname_size, ctx->fname, value + i);
-        
-        th = win32_named_open(ctx, tempname, true, psa);
-        if (th == INVALID_HANDLE_VALUE && GetLastError() != ERROR_FILE_EXISTS)
-            break;
+	file_ops->make_tempname(tempname, tempname_size, ctx->fname, value + i);
+
+	th = win32_named_open(ctx, tempname, true, psa);
+	if (th == INVALID_HANDLE_VALUE && GetLastError() != ERROR_FILE_EXISTS)
+	    break;
     }
-    
+
     if (th == INVALID_HANDLE_VALUE) {
-        free(tempname);
-        LocalFree(psd);
-        zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	free(tempname);
+	LocalFree(psd);
+	zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
-    
+
     LocalFree(psd);
     ctx->fout = th;
     ctx->tmpname = tempname;
-    
+
     return 0;
 }
 
@@ -156,11 +156,11 @@
 static bool
 _zip_win32_named_op_open(zip_source_file_context_t *ctx) {
     HANDLE h = win32_named_open(ctx, ctx->fname, false, NULL);
-    
+
     if (h == INVALID_HANDLE_VALUE) {
-        return false;
+	return false;
     }
-    
+
     ctx->f = h;
     return true;
 }
@@ -171,8 +171,8 @@
     zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata;
 
     if (!file_ops->delete_file(ctx->fname)) {
-        zip_error_set(&ctx->error, ZIP_ER_REMOVE, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_REMOVE, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
 
     return 0;
@@ -184,7 +184,7 @@
     zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata;
 
     if (ctx->fout) {
-        CloseHandle((HANDLE)ctx->fout);
+	CloseHandle((HANDLE)ctx->fout);
     }
     file_ops->delete_file(ctx->tmpname);
 }
@@ -193,24 +193,24 @@
 static bool
 _zip_win32_named_op_stat(zip_source_file_context_t *ctx, zip_source_file_stat_t *st) {
     zip_win32_file_operations_t *file_ops = (zip_win32_file_operations_t *)ctx->ops_userdata;
-    
+
     WIN32_FILE_ATTRIBUTE_DATA file_attributes;
 
     if (!file_ops->get_file_attributes_ex(ctx->fname, GetFileExInfoStandard, &file_attributes)) {
-        DWORD error = GetLastError();
-        if (error == ERROR_FILE_NOT_FOUND) {
-            st->exists = false;
-            return true;
-        }
-        zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(error));
-        return false;
+	DWORD error = GetLastError();
+	if (error == ERROR_FILE_NOT_FOUND) {
+	    st->exists = false;
+	    return true;
+	}
+	zip_error_set(&ctx->error, ZIP_ER_READ, _zip_win32_error_to_errno(error));
+	return false;
     }
-    
+
     st->exists = true;
     st->regular_file = true; /* TODO: Is this always right? How to determine without a HANDLE? */
     if (!_zip_filetime_to_time_t(file_attributes.ftLastWriteTime, &st->mtime)) {
-        zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
-        return false;
+	zip_error_set(&ctx->error, ZIP_ER_READ, ERANGE);
+	return false;
     }
     st->size = ((zip_uint64_t)file_attributes.nFileSizeHigh << 32) | file_attributes.nFileSizeLow;
 
@@ -232,10 +232,10 @@
 _zip_win32_named_op_write(zip_source_file_context_t *ctx, const void *data, zip_uint64_t len) {
     DWORD ret;
     if (!WriteFile((HANDLE)ctx->fout, data, (DWORD)len, &ret, NULL) || ret != len) {
-        zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError()));
-        return -1;
+	zip_error_set(&ctx->error, ZIP_ER_WRITE, _zip_win32_error_to_errno(GetLastError()));
+	return -1;
     }
-    
+
     return (zip_int64_t)ret;
 }
 
@@ -248,18 +248,18 @@
     DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
     DWORD creation_disposition = OPEN_EXISTING;
     DWORD file_attributes = FILE_ATTRIBUTE_NORMAL;
-    
+
     if (temporary) {
-        access = GENERIC_READ | GENERIC_WRITE;
-        share_mode = FILE_SHARE_READ;
-        creation_disposition = CREATE_NEW;
-        file_attributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY;
+	access = GENERIC_READ | GENERIC_WRITE;
+	share_mode = FILE_SHARE_READ;
+	creation_disposition = CREATE_NEW;
+	file_attributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY;
     }
 
     HANDLE h = file_ops->create_file(name, access, share_mode, security_attributes, creation_disposition, file_attributes, NULL);
-    
+
     if (h == INVALID_HANDLE_VALUE) {
-        zip_error_set(&ctx->error, ZIP_ER_OPEN, _zip_win32_error_to_errno(GetLastError()));
+	zip_error_set(&ctx->error, ZIP_ER_OPEN, _zip_win32_error_to_errno(GetLastError()));
     }
 
     return h;
diff --git a/lib/zip_source_file_win32_utf16.c b/lib/zip_source_file_win32_utf16.c
index 993b154..939d197 100644
--- a/lib/zip_source_file_win32_utf16.c
+++ b/lib/zip_source_file_win32_utf16.c
@@ -57,7 +57,7 @@
 ZIP_EXTERN zip_source_t *
 zip_source_win32w(zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64_t len) {
     if (za == NULL)
-    return NULL;
+	return NULL;
 
     return zip_source_win32w_create(fname, start, len, &za->error);
 }
@@ -66,8 +66,8 @@
 ZIP_EXTERN zip_source_t *
 zip_source_win32w_create(const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) {
     if (fname == NULL || length < -1) {
-    zip_error_set(error, ZIP_ER_INVAL, 0);
-    return NULL;
+	zip_error_set(error, ZIP_ER_INVAL, 0);
+	return NULL;
     }
 
 
@@ -82,8 +82,7 @@
 }
 
 
-static HANDLE __stdcall
-utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
+static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
 #ifdef MS_UWP
     CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
     extParams.dwFileAttributes = file_attributes;
@@ -92,7 +91,7 @@
     extParams.dwSize = sizeof(extParams);
     extParams.hTemplateFile = template_file;
     extParams.lpSecurityAttributes = security_attributes;
-    
+
     return CreateFile2((const wchar_t *)name, access, share_mode, creation_disposition, &extParams);
 #else
     return CreateFileW((const wchar_t *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file);
diff --git a/lib/zip_source_file_win32_utf8.c b/lib/zip_source_file_win32_utf8.c
index 4f258bc..b6ecad1 100644
--- a/lib/zip_source_file_win32_utf8.c
+++ b/lib/zip_source_file_win32_utf8.c
@@ -36,9 +36,9 @@
 ZIP_EXTERN zip_source_t *
 zip_source_file(zip_t *za, const char *fname, zip_uint64_t start, zip_int64_t len) {
     if (za == NULL) {
-        return NULL;
+	return NULL;
     }
-    
+
     return zip_source_file_create(fname, start, len, &za->error);
 }
 
@@ -50,24 +50,24 @@
     zip_source_t *source;
 
     if (fname == NULL || length < -1) {
-        zip_error_set(error, ZIP_ER_INVAL, 0);
-        return NULL;
+	zip_error_set(error, ZIP_ER_INVAL, 0);
+	return NULL;
     }
 
     /* Convert fname from UTF-8 to Windows-friendly UTF-16. */
     size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, NULL, 0);
     if (size == 0) {
-        zip_error_set(error, ZIP_ER_INVAL, 0);
-        return NULL;
+	zip_error_set(error, ZIP_ER_INVAL, 0);
+	return NULL;
     }
     if ((wfname = (wchar_t *)malloc(sizeof(wchar_t) * size)) == NULL) {
-        zip_error_set(error, ZIP_ER_MEMORY, 0);
-        return NULL;
+	zip_error_set(error, ZIP_ER_MEMORY, 0);
+	return NULL;
     }
     MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, fname, -1, wfname, size);
 
     source = zip_source_win32w_create(wfname, start, length, error);
-    
+
     free(wfname);
     return source;
 }
diff --git a/lib/zip_source_read.c b/lib/zip_source_read.c
index 7179784..5da6008 100644
--- a/lib/zip_source_read.c
+++ b/lib/zip_source_read.c
@@ -81,10 +81,10 @@
     }
 
     if (src->bytes_read + bytes_read < src->bytes_read) {
-        src->bytes_read = ZIP_UINT64_MAX;
+	src->bytes_read = ZIP_UINT64_MAX;
     }
     else {
-        src->bytes_read += bytes_read;
+	src->bytes_read += bytes_read;
     }
     return (zip_int64_t)bytes_read;
 }
diff --git a/lib/zip_source_tell.c b/lib/zip_source_tell.c
index 8c5465f..3187d8e 100644
--- a/lib/zip_source_tell.c
+++ b/lib/zip_source_tell.c
@@ -46,11 +46,11 @@
     }
 
     if ((src->supports & (ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_TELL) | ZIP_SOURCE_MAKE_COMMAND_BITMASK(ZIP_SOURCE_SEEK))) == 0) {
-        if (src->bytes_read > ZIP_INT64_MAX) {
-            zip_error_set(&src->error, ZIP_ER_TELL, EOVERFLOW);
-            return -1;
-        }
-        return (zip_int64_t)src->bytes_read;
+	if (src->bytes_read > ZIP_INT64_MAX) {
+	    zip_error_set(&src->error, ZIP_ER_TELL, EOVERFLOW);
+	    return -1;
+	}
+	return (zip_int64_t)src->bytes_read;
     }
 
     return _zip_source_call(src, NULL, 0, ZIP_SOURCE_TELL);
diff --git a/lib/zipint.h b/lib/zipint.h
index b37beba..703e1b7 100644
--- a/lib/zipint.h
+++ b/lib/zipint.h
@@ -352,8 +352,8 @@
     bool source_closed;                   /* set if source archive is closed */
     zip_t *source_archive;                /* zip archive we're reading from, NULL if not from archive */
     unsigned int refcount;
-    bool eof;            /* EOF reached */
-    bool had_read_error; /* a previous ZIP_SOURCE_READ reported an error */
+    bool eof;                /* EOF reached */
+    bool had_read_error;     /* a previous ZIP_SOURCE_READ reported an error */
     zip_uint64_t bytes_read; /* for sources that don't support ZIP_SOURCE_TELL. */
 };
 
diff --git a/regress/can_clone_file.c b/regress/can_clone_file.c
index 33cc1a9..b0b375a 100644
--- a/regress/can_clone_file.c
+++ b/regress/can_clone_file.c
@@ -36,19 +36,19 @@
 #include "config.h"
 
 #ifdef HAVE_CLONEFILE
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
 #include <sys/attr.h>
 #include <sys/mount.h>
 #include <sys/param.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 #elif defined(HAVE_FICLONERANGE)
-#include <linux/fs.h>
-#include <sys/ioctl.h>
 #include <errno.h>
+#include <linux/fs.h>
 #include <stdio.h>
 #include <string.h>
+#include <sys/ioctl.h>
 #include <unistd.h>
 #endif
 
diff --git a/regress/fuzz_main.c b/regress/fuzz_main.c
index a0859e0..4a12745 100644
--- a/regress/fuzz_main.c
+++ b/regress/fuzz_main.c
@@ -4,21 +4,21 @@
 
 /* fuzz target entry point, works without libFuzzer */
 
-int main(int argc, char **argv)
-{
+int
+main(int argc, char **argv) {
     FILE *f;
     char *buf = NULL;
     long siz_buf;
 
     if (argc < 2) {
-        fprintf(stderr, "no input file\n");
-        goto err;
+	fprintf(stderr, "no input file\n");
+	goto err;
     }
 
     f = fopen(argv[1], "rb");
     if (f == NULL) {
-        fprintf(stderr, "error opening input file %s\n", argv[1]);
-        goto err;
+	fprintf(stderr, "error opening input file %s\n", argv[1]);
+	goto err;
     }
 
     fseek(f, 0, SEEK_END);
@@ -30,18 +30,18 @@
 	goto err;
     }
 
-    buf = (char*)malloc(siz_buf);
+    buf = (char *)malloc(siz_buf);
     if (buf == NULL) {
-        fprintf(stderr, "malloc() failed\n");
-        goto err;
+	fprintf(stderr, "malloc() failed\n");
+	goto err;
     }
 
     if (fread(buf, siz_buf, 1, f) != 1) {
-        fprintf(stderr, "fread() failed\n");
-        goto err;
+	fprintf(stderr, "fread() failed\n");
+	goto err;
     }
 
-    (void)LLVMFuzzerTestOneInput((uint8_t*)buf, siz_buf);
+    (void)LLVMFuzzerTestOneInput((uint8_t *)buf, siz_buf);
 
 err:
     free(buf);
diff --git a/regress/tryopen.c b/regress/tryopen.c
index d143b0a..cc5de1e 100644
--- a/regress/tryopen.c
+++ b/regress/tryopen.c
@@ -41,11 +41,12 @@
 #endif
 
 #include "zip.h"
-#define TRYOPEN_USAGE "usage: %s [-cent] file\n\n" \
-		      "\t-c\tcheck consistency\n" \
-		      "\t-e\texclusively open archive\n" \
-		      "\t-n\tcreate new file\n" \
-		      "\t-t\ttruncate file to size 0\n"
+#define TRYOPEN_USAGE                  \
+    "usage: %s [-cent] file\n\n"       \
+    "\t-c\tcheck consistency\n"        \
+    "\t-e\texclusively open archive\n" \
+    "\t-n\tcreate new file\n"          \
+    "\t-t\ttruncate file to size 0\n"
 
 
 int
diff --git a/regress/ziptool_regress.c b/regress/ziptool_regress.c
index 713b44e..e98c053 100644
--- a/regress/ziptool_regress.c
+++ b/regress/ziptool_regress.c
@@ -99,7 +99,7 @@
 	fprintf(stderr, "invalid percentage '%" PRId64 "' for cancel (valid: 0 <= x <= 100)\n", percent);
 	return -1;
     }
-    progress_userdata.limit = ((double)percent)/100;
+    progress_userdata.limit = ((double)percent) / 100;
 
     zip_register_cancel_callback_with_state(za, cancel_callback, NULL, NULL);
 
@@ -206,10 +206,10 @@
 		left = ZIP_MIN(fragment_size, (size_t)st.st_size - i * fragment_size);
 		if ((fragments[i].data = malloc(left)) == NULL) {
 #ifndef __clang_analyzer__
-                    /* fragments is initialized up to i - 1*/
+		    /* fragments is initialized up to i - 1*/
 		    while (--i > 0) {
 			free(fragments[i].data);
-                    }
+		    }
 #endif
 		    free(fragments);
 		    fclose(fp);
@@ -219,7 +219,7 @@
 		fragments[i].length = left;
 		if (fread(fragments[i].data, left, 1, fp) < 1) {
 #ifndef __clang_analyzer__
-                    /* fragments is initialized up to i - 1*/
+		    /* fragments is initialized up to i - 1*/
 		    while (--i > 0) {
 			free(fragments[i].data);
 		    }
@@ -239,7 +239,7 @@
 		fclose(fp);
 		return NULL;
 	    }
-            free(fragments);
+	    free(fragments);
 	}
 	fclose(fp);
     }
diff --git a/src/ziptool.c b/src/ziptool.c
index 125c1a7..c946987 100644
--- a/src/ziptool.c
+++ b/src/ziptool.c
@@ -388,8 +388,8 @@
 }
 
 struct progress_userdata_s {
-  double percentage;
-  double limit;
+    double percentage;
+    double limit;
 };
 
 struct progress_userdata_s progress_userdata;
@@ -594,7 +594,8 @@
 #endif
 	if (tpm == NULL) {
 	    printf("mtime: <not valid>\n");
-	} else {
+	}
+	else {
 	    strftime(buf, sizeof(buf), "%a %b %d %Y %H:%M:%S", tpm);
 	    printf("mtime: '%s'\n", buf);
 	}
@@ -641,21 +642,21 @@
 	return ZIP_CM_BZIP2;
 #endif
 #if defined(HAVE_LIBLZMA)
-/*  Disabled - because 7z isn't able to unpack ZIP+LZMA ZIP+LZMA2
-    archives made this way - and vice versa.
+    /*  Disabled - because 7z isn't able to unpack ZIP+LZMA ZIP+LZMA2
+	archives made this way - and vice versa.
 
-    else if (strcasecmp(arg, "lzma") == 0)
-      return ZIP_CM_LZMA;
-    else if (strcasecmp(arg, "lzma2") == 0)
-      return ZIP_CM_LZMA2;
-*/
+	else if (strcasecmp(arg, "lzma") == 0)
+	  return ZIP_CM_LZMA;
+	else if (strcasecmp(arg, "lzma2") == 0)
+	  return ZIP_CM_LZMA2;
+    */
     else if (strcasecmp(arg, "xz") == 0)
-      return ZIP_CM_XZ;
+	return ZIP_CM_XZ;
 
 #endif
 #if defined(HAVE_LIBZSTD)
     else if (strcasecmp(arg, "zstd") == 0)
-      return ZIP_CM_ZSTD;
+	return ZIP_CM_ZSTD;
 
 #endif
     else if (strcasecmp(arg, "unknown") == 0)
@@ -825,19 +826,19 @@
 	fprintf(out, "\t%s %s\n\t    %s\n\n", dispatch_table[i].cmdline_name, dispatch_table[i].arg_names, dispatch_table[i].description);
     }
     fprintf(out, "\nSupported flags are:\n"
-	    "\t0\t(no flags)\n"
-	    "\tC\tZIP_FL_NOCASE\n"
-	    "\tc\tZIP_FL_CENTRAL\n"
-	    "\td\tZIP_FL_NODIR\n"
-	    "\tl\tZIP_FL_LOCAL\n"
-	    "\tu\tZIP_FL_UNCHANGED\n");
+		 "\t0\t(no flags)\n"
+		 "\tC\tZIP_FL_NOCASE\n"
+		 "\tc\tZIP_FL_CENTRAL\n"
+		 "\td\tZIP_FL_NODIR\n"
+		 "\tl\tZIP_FL_LOCAL\n"
+		 "\tu\tZIP_FL_UNCHANGED\n");
     fprintf(out, "\nSupported compression methods are:\n"
-	    "\tdefault\n");
+		 "\tdefault\n");
     if (zip_compression_method_supported(ZIP_CM_BZIP2, 1)) {
 	fprintf(out, "\tbzip2\n");
     }
     fprintf(out, "\tdeflate\n"
-	    "\tstore\n");
+		 "\tstore\n");
     if (zip_compression_method_supported(ZIP_CM_XZ, 1)) {
 	fprintf(out, "\txz\n");
     }
@@ -845,7 +846,7 @@
 	fprintf(out, "\tzstd\n");
     }
     fprintf(out, "\nSupported encryption methods are:\n"
-	    "\tnone\n");
+		 "\tnone\n");
     if (zip_encryption_method_supported(ZIP_EM_AES_128, 1)) {
 	fprintf(out, "\tAES-128\n");
     }