VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_io_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/libzip/zip_io_util.c')
-rw-r--r--src/Common/libzip/zip_io_util.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/src/Common/libzip/zip_io_util.c b/src/Common/libzip/zip_io_util.c
index 53a5dd26..77be8f06 100644
--- a/src/Common/libzip/zip_io_util.c
+++ b/src/Common/libzip/zip_io_util.c
@@ -3,6 +3,6 @@
Copyright (C) 1999-2016 Dieter Baron and Thomas Klausner
-
+
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
-
+
Redistribution and use in source and binary forms, with or without
@@ -19,3 +19,3 @@
written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
@@ -39,4 +39,3 @@
int
-_zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *error)
-{
+_zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *error) {
zip_int64_t n;
@@ -63,6 +62,5 @@ _zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *e
zip_uint8_t *
-_zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error)
-{
+_zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error) {
zip_uint8_t *r;
-
+
if (length == 0 && !nulp) {
@@ -78,9 +76,9 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp
if (buffer) {
- zip_uint8_t *data = _zip_buffer_get(buffer, length);
-
- if (data == NULL) {
- zip_error_set(error, ZIP_ER_MEMORY, 0);
- free(r);
- return NULL;
- }
+ zip_uint8_t *data = _zip_buffer_get(buffer, length);
+
+ if (data == NULL) {
+ zip_error_set(error, ZIP_ER_MEMORY, 0);
+ free(r);
+ return NULL;
+ }
memcpy(r, data, length);
@@ -98,3 +96,3 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp
r[length] = 0;
- for (o=r; o<r+length; o++)
+ for (o = r; o < r + length; o++)
if (*o == '\0')
@@ -108,4 +106,3 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp
zip_string_t *
-_zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool nulp, zip_error_t *error)
-{
+_zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool nulp, zip_error_t *error) {
zip_uint8_t *raw;
@@ -113,3 +110,3 @@ _zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool
- if ((raw=_zip_read_data(buffer, src, len, nulp, error)) == NULL)
+ if ((raw = _zip_read_data(buffer, src, len, nulp, error)) == NULL)
return NULL;
@@ -123,15 +120,14 @@ _zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool
int
-_zip_write(zip_t *za, const void *data, zip_uint64_t length)
-{
+_zip_write(zip_t *za, const void *data, zip_uint64_t length) {
zip_int64_t n;
-
+
if ((n = zip_source_write(za->src, data, length)) < 0) {
- _zip_error_set_from_source(&za->error, za->src);
- return -1;
+ _zip_error_set_from_source(&za->error, za->src);
+ return -1;
}
if ((zip_uint64_t)n != length) {
- zip_error_set(&za->error, ZIP_ER_WRITE, EINTR);
- return -1;
+ zip_error_set(&za->error, ZIP_ER_WRITE, EINTR);
+ return -1;
}
-
+
return 0;