summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_stat_index.c
diff options
context:
space:
mode:
authorAnatoliy Belsky <ab@php.net>2012-06-04 21:30:04 +0200
committerAnatoliy Belsky <ab@php.net>2012-06-07 21:01:31 +0200
commit335a11b14b35e261c484d44a0e1b5ea9cc758e19 (patch)
tree515f54cede9e42804b4da1e1ef60d1d9f55bb633 /ext/zip/lib/zip_stat_index.c
parent7cae4ff02c593ed212a363d65c83c38a67a27f0d (diff)
downloadphp-git-335a11b14b35e261c484d44a0e1b5ea9cc758e19.tar.gz
initial libzip upgrade patch to 0.10.1
Diffstat (limited to 'ext/zip/lib/zip_stat_index.c')
-rw-r--r--ext/zip/lib/zip_stat_index.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ext/zip/lib/zip_stat_index.c b/ext/zip/lib/zip_stat_index.c
index 26425206ca..8faa8cc394 100644
--- a/ext/zip/lib/zip_stat_index.c
+++ b/ext/zip/lib/zip_stat_index.c
@@ -1,6 +1,6 @@
/*
zip_stat_index.c -- get information about file by index
- Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2009 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>
@@ -38,11 +38,12 @@
ZIP_EXTERN(int)
-zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
+zip_stat_index(struct zip *za, zip_uint64_t index, int flags,
+ struct zip_stat *st)
{
const char *name;
- if (index < 0 || index >= za->nentry) {
+ if (index >= za->nentry) {
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
@@ -53,8 +54,7 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
if ((flags & ZIP_FL_UNCHANGED) == 0
&& ZIP_ENTRY_DATA_CHANGED(za->entry+index)) {
- if (za->entry[index].source->f(za->entry[index].source->ud,
- st, sizeof(*st), ZIP_SOURCE_STAT) < 0) {
+ if (zip_source_stat(za->entry[index].source, st) < 0) {
_zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
return -1;
}
@@ -64,7 +64,9 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return -1;
}
-
+
+ zip_stat_init(st);
+
st->crc = za->cdir->entry[index].crc;
st->size = za->cdir->entry[index].uncomp_size;
st->mtime = za->cdir->entry[index].last_mod;
@@ -80,11 +82,13 @@ zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
}
else
st->encryption_method = ZIP_EM_NONE;
- /* st->bitflags = za->cdir->entry[index].bitflags; */
+ st->valid = ZIP_STAT_CRC|ZIP_STAT_SIZE|ZIP_STAT_MTIME
+ |ZIP_STAT_COMP_SIZE|ZIP_STAT_COMP_METHOD|ZIP_STAT_ENCRYPTION_METHOD;
}
st->index = index;
st->name = name;
+ st->valid |= ZIP_STAT_INDEX|ZIP_STAT_NAME;
return 0;
}