summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_dirent.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_dirent.c')
-rw-r--r--ext/zip/lib/zip_dirent.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c
index f4f2deb6fc..5c5792c3e9 100644
--- a/ext/zip/lib/zip_dirent.c
+++ b/ext/zip/lib/zip_dirent.c
@@ -81,7 +81,7 @@ _zip_cdir_grow(struct zip_cdir *cd, zip_uint64_t nentry, struct zip_error *error
return 0;
if ((entry=((struct zip_entry *)
- realloc(cd->entry, sizeof(*(cd->entry))*nentry))) == NULL) {
+ realloc(cd->entry, sizeof(*(cd->entry))*(size_t)nentry))) == NULL) {
_zip_error_set(error, ZIP_ER_MEMORY, 0);
return -1;
}
@@ -110,7 +110,7 @@ _zip_cdir_new(zip_uint64_t nentry, struct zip_error *error)
if (nentry == 0)
cd->entry = NULL;
- else if ((cd->entry=(struct zip_entry *)malloc(sizeof(*(cd->entry))*nentry)) == NULL) {
+ else if ((cd->entry=(struct zip_entry *)malloc(sizeof(*(cd->entry))*(size_t)nentry)) == NULL) {
_zip_error_set(error, ZIP_ER_MEMORY, 0);
free(cd);
return NULL;
@@ -260,7 +260,7 @@ _zip_dirent_init(struct zip_dirent *de)
de->local_extra_fields_read = 0;
de->cloned = 0;
- de->version_madeby = 20;
+ de->version_madeby = 20 | (ZIP_OPSYS_DEFAULT << 8);
de->version_needed = 20; /* 2.0 */
de->bitflags = 0;
de->comp_method = ZIP_CM_DEFAULT;
@@ -273,7 +273,7 @@ _zip_dirent_init(struct zip_dirent *de)
de->comment = NULL;
de->disk_number = 0;
de->int_attrib = 0;
- de->ext_attrib = 0;
+ de->ext_attrib = ZIP_EXT_ATTRIB_DEFAULT;
de->offset = 0;
}
@@ -320,7 +320,7 @@ _zip_dirent_new(void)
Returns 0 if successful. On error, error is filled in and -1 is
returned.
- XXX: leftp and file position undefined on error.
+ TODO: leftp and file position undefined on error.
*/
int
@@ -460,7 +460,7 @@ _zip_dirent_read(struct zip_dirent *zde, FILE *fp,
if (zde->uncomp_size == ZIP_UINT32_MAX || zde->comp_size == ZIP_UINT32_MAX || zde->offset == ZIP_UINT32_MAX) {
zip_uint16_t got_len, needed_len;
const zip_uint8_t *ef = _zip_ef_get_by_id(zde->extra_fields, &got_len, ZIP_EF_ZIP64, 0, local ? ZIP_EF_LOCAL : ZIP_EF_CENTRAL, error);
- /* XXX: if got_len == 0 && !ZIP64_EOCD: no error, 0xffffffff is valid value */
+ /* TODO: if got_len == 0 && !ZIP64_EOCD: no error, 0xffffffff is valid value */
if (ef == NULL)
return -1;
@@ -676,8 +676,8 @@ _zip_dirent_write(struct zip_dirent *de, FILE *fp, zip_flags_t flags, struct zip
ef_zip64_p = ef_zip64;
if (flags & ZIP_FL_LOCAL) {
if ((flags & ZIP_FL_FORCE_ZIP64) || de->comp_size > ZIP_UINT32_MAX || de->uncomp_size > ZIP_UINT32_MAX) {
- _zip_poke8(de->comp_size, &ef_zip64_p);
_zip_poke8(de->uncomp_size, &ef_zip64_p);
+ _zip_poke8(de->comp_size, &ef_zip64_p);
}
}
else {
@@ -707,7 +707,7 @@ _zip_dirent_write(struct zip_dirent *de, FILE *fp, zip_flags_t flags, struct zip
_zip_write2(is_really_zip64 ? 45 : de->version_madeby, fp);
_zip_write2(is_really_zip64 ? 45 : de->version_needed, fp);
_zip_write2(de->bitflags&0xfff9, fp); /* clear compression method specific flags */
- _zip_write2((zip_uint16_t)de->comp_method, fp); /* XXX: can it be ZIP_CM_DEFAULT? */
+ _zip_write2((zip_uint16_t)de->comp_method, fp); /* TODO: can it be ZIP_CM_DEFAULT? */
_zip_u2d_time(de->last_mod, &dostime, &dosdate);
_zip_write2(dostime, fp);
@@ -796,7 +796,7 @@ _zip_ef_utf8(zip_uint16_t id, struct zip_string *str, struct zip_error *error)
raw = _zip_string_get(str, &len, ZIP_FL_ENC_RAW, NULL);
if (len+5 > ZIP_UINT16_MAX) {
- /* XXX: error */
+ /* TODO: error */
}
if ((data=(zip_uint8_t *)malloc(len+5)) == NULL) {