summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_file_set_external_attributes.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_file_set_external_attributes.c')
-rw-r--r--ext/zip/lib/zip_file_set_external_attributes.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/zip/lib/zip_file_set_external_attributes.c b/ext/zip/lib/zip_file_set_external_attributes.c
index 3f2817807f..b772c31e07 100644
--- a/ext/zip/lib/zip_file_set_external_attributes.c
+++ b/ext/zip/lib/zip_file_set_external_attributes.c
@@ -1,6 +1,6 @@
/*
zip_file_set_external_attributes.c -- set external attributes for entry
- Copyright (C) 2013 Dieter Baron and Thomas Klausner
+ Copyright (C) 2013-2014 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>
@@ -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
@@ -33,10 +33,10 @@
#include "zipint.h"
-int
-zip_file_set_external_attributes(struct zip *za, zip_uint64_t idx, zip_flags_t flags, zip_uint8_t opsys, zip_uint32_t attributes)
+ZIP_EXTERN int
+zip_file_set_external_attributes(zip_t *za, zip_uint64_t idx, zip_flags_t flags, zip_uint8_t opsys, zip_uint32_t attributes)
{
- struct zip_entry *e;
+ zip_entry_t *e;
int changed;
zip_uint8_t unchanged_opsys;
zip_uint32_t unchanged_attributes;
@@ -45,13 +45,13 @@ zip_file_set_external_attributes(struct zip *za, zip_uint64_t idx, zip_flags_t f
return -1;
if (ZIP_IS_RDONLY(za)) {
- _zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+ zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
return -1;
}
e = za->entry+idx;
- unchanged_opsys = e->orig ? e->orig->version_madeby>>8 : ZIP_OPSYS_DEFAULT;
+ unchanged_opsys = (e->orig ? (zip_uint8_t)(e->orig->version_madeby>>8) : (zip_uint8_t)ZIP_OPSYS_DEFAULT);
unchanged_attributes = e->orig ? e->orig->ext_attrib : ZIP_EXT_ATTRIB_DEFAULT;
changed = (opsys != unchanged_opsys || attributes != unchanged_attributes);
@@ -59,11 +59,11 @@ zip_file_set_external_attributes(struct zip *za, zip_uint64_t idx, zip_flags_t f
if (changed) {
if (e->changes == NULL) {
if ((e->changes=_zip_dirent_clone(e->orig)) == NULL) {
- _zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return -1;
}
}
- e->changes->version_madeby = (opsys << 8) | (e->changes->version_madeby & 0xff);
+ e->changes->version_madeby = (zip_uint16_t)((opsys << 8) | (e->changes->version_madeby & 0xff));
e->changes->ext_attrib = attributes;
e->changes->changed |= ZIP_DIRENT_ATTRIBUTES;
}
@@ -74,7 +74,7 @@ zip_file_set_external_attributes(struct zip *za, zip_uint64_t idx, zip_flags_t f
e->changes = NULL;
}
else {
- e->changes->version_madeby = (unchanged_opsys << 8) | (e->changes->version_madeby & 0xff);
+ e->changes->version_madeby = (zip_uint16_t)((unchanged_opsys << 8) | (e->changes->version_madeby & 0xff));
e->changes->ext_attrib = unchanged_attributes;
}
}