VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_set_name.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/libzip/zip_set_name.c')
-rw-r--r--src/Common/libzip/zip_set_name.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Common/libzip/zip_set_name.c b/src/Common/libzip/zip_set_name.c
index 34b76154..33fb4bc8 100644
--- a/src/Common/libzip/zip_set_name.c
+++ b/src/Common/libzip/zip_set_name.c
@@ -17,7 +17,7 @@
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -39,8 +39,7 @@
int
-_zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags)
-{
+_zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags) {
zip_entry_t *e;
zip_string_t *str;
bool same_as_orig;
@@ -59,8 +58,8 @@ _zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags)
}
if (name && name[0] != '\0') {
- /* TODO: check for string too long */
- if ((str=_zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL)
+ /* TODO: check for string too long */
+ if ((str = _zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)) == NULL)
return -1;
if ((flags & ZIP_FL_ENCODING_ALL) == ZIP_FL_ENC_GUESS && _zip_guess_encoding(str, ZIP_ENCODING_UNKNOWN) == ZIP_ENCODING_UTF8_GUESSED)
str->encoding = ZIP_ENCODING_UTF8_KNOWN;
@@ -69,19 +68,19 @@ _zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags)
str = NULL;
/* TODO: encoding flags needed for CP437? */
- if ((i=_zip_name_locate(za, name, 0, NULL)) >= 0 && (zip_uint64_t)i != idx) {
+ if ((i = _zip_name_locate(za, name, 0, NULL)) >= 0 && (zip_uint64_t)i != idx) {
_zip_string_free(str);
zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
return -1;
}
/* no effective name change */
- if (i>=0 && (zip_uint64_t)i == idx) {
+ if (i >= 0 && (zip_uint64_t)i == idx) {
_zip_string_free(str);
return 0;
}
- e = za->entry+idx;
+ e = za->entry + idx;
if (e->orig)
same_as_orig = _zip_string_equal(e->orig->filename, str);
@@ -89,7 +88,7 @@ _zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags)
same_as_orig = false;
if (!same_as_orig && e->changes == NULL) {
- if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) {
+ if ((e->changes = _zip_dirent_clone(e->orig)) == NULL) {
zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
_zip_string_free(str);
return -1;
@@ -110,7 +109,7 @@ _zip_set_name(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags)
else {
old_str = NULL;
}
-
+
if (old_str) {
if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) {
_zip_string_free(str);