summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_extra_field.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_extra_field.c')
-rw-r--r--ext/zip/lib/zip_extra_field.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/ext/zip/lib/zip_extra_field.c b/ext/zip/lib/zip_extra_field.c
index 670a4c833f..76ec3ae12b 100644
--- a/ext/zip/lib/zip_extra_field.c
+++ b/ext/zip/lib/zip_extra_field.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
@@ -31,7 +31,7 @@
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
+
#include "zipint.h"
@@ -39,22 +39,22 @@
#include <stdlib.h>
#include <string.h>
-
+
struct zip_extra_field *
_zip_ef_clone(const struct zip_extra_field *ef, struct zip_error *error)
{
struct zip_extra_field *head, *prev, *def;
-
+
head = prev = NULL;
-
+
while (ef) {
if ((def=_zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) {
_zip_error_set(error, ZIP_ER_MEMORY, 0);
_zip_ef_free(head);
return NULL;
}
-
+
if (head == NULL)
head = def;
if (prev)
@@ -63,7 +63,7 @@ _zip_ef_clone(const struct zip_extra_field *ef, struct zip_error *error)
ef = ef->next;
}
-
+
return head;
}
@@ -93,7 +93,7 @@ _zip_ef_delete_by_id(struct zip_extra_field *ef, zip_uint16_t id, zip_uint16_t i
continue;
}
}
-
+
i++;
if (i > id_idx)
break;
@@ -105,7 +105,7 @@ _zip_ef_delete_by_id(struct zip_extra_field *ef, zip_uint16_t id, zip_uint16_t i
}
-
+
void
_zip_ef_free(struct zip_extra_field *ef)
@@ -120,13 +120,13 @@ _zip_ef_free(struct zip_extra_field *ef)
}
}
-
+
const zip_uint8_t *
_zip_ef_get_by_id(const struct zip_extra_field *ef, zip_uint16_t *lenp, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags, struct zip_error *error)
{
static const zip_uint8_t empty[1] = { '\0' };
-
+
int i;
i = 0;
@@ -150,7 +150,7 @@ _zip_ef_get_by_id(const struct zip_extra_field *ef, zip_uint16_t *lenp, zip_uint
return NULL;
}
-
+
struct zip_extra_field *
_zip_ef_merge(struct zip_extra_field *to, struct zip_extra_field *from)
@@ -186,7 +186,7 @@ _zip_ef_merge(struct zip_extra_field *to, struct zip_extra_field *from)
return to;
}
-
+
struct zip_extra_field *
_zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_flags_t flags)
@@ -212,7 +212,7 @@ _zip_ef_new(zip_uint16_t id, zip_uint16_t size, const zip_uint8_t *data, zip_fla
return ef;
}
-
+
struct zip_extra_field *
_zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, struct zip_error *error)
@@ -255,17 +255,17 @@ _zip_ef_parse(const zip_uint8_t *data, zip_uint16_t len, zip_flags_t flags, stru
return ef_head;
}
-
+
struct zip_extra_field *
_zip_ef_remove_internal(struct zip_extra_field *ef)
{
struct zip_extra_field *ef_head;
struct zip_extra_field *prev, *next;
-
+
ef_head = ef;
prev = NULL;
-
+
while (ef) {
if (ZIP_EF_IS_INTERNAL(ef->id)) {
next = ef->next;
@@ -282,7 +282,7 @@ _zip_ef_remove_internal(struct zip_extra_field *ef)
ef = ef->next;
}
}
-
+
return ef_head;
}
@@ -301,7 +301,7 @@ _zip_ef_size(const struct zip_extra_field *ef, zip_flags_t flags)
return size;
}
-
+
void
_zip_ef_write(const struct zip_extra_field *ef, zip_flags_t flags, FILE *f)
@@ -316,7 +316,7 @@ _zip_ef_write(const struct zip_extra_field *ef, zip_flags_t flags, FILE *f)
}
}
-
+
int
_zip_read_local_ef(struct zip *za, zip_uint64_t idx)
@@ -370,13 +370,13 @@ _zip_read_local_ef(struct zip *za, zip_uint64_t idx)
return -1;
}
free(ef_raw);
-
+
ef = _zip_ef_remove_internal(ef);
e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef);
}
e->orig->local_extra_fields_read = 1;
-
+
if (e->changes && e->changes->local_extra_fields_read == 0) {
e->changes->extra_fields = e->orig->extra_fields;
e->changes->local_extra_fields_read = 1;