}
/* }}} */
-static int php_zip_parse_options(zval *options, long *remove_all_path, char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */
+static int php_zip_parse_options(zval *options, php_int_t *remove_all_path, char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */
{
zval *option;
if ((option = zend_hash_str_find(HASH_OF(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) {
- long opt;
+ php_int_t opt;
if (Z_TYPE_P(option) != IS_INT) {
zval tmp;
ZVAL_DUP(&tmp, option);
#endif /* }}} */
-int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value TSRMLS_DC) /* {{{ */
+int php_zip_glob(char *pattern, int pattern_len, php_int_t flags, zval *return_value TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_GLOB
char cwd[MAXPATHLEN];
* able to filter directories out.
*/
if (flags & GLOB_ONLYDIR) {
- struct stat s;
+ zend_stat_t s;
if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) {
continue;
/* only the files, directories are ignored */
for (i = 0; i < files_cnt; i++) {
- struct stat s;
+ zend_stat_t s;
char fullpath[MAXPATHLEN];
int ovector[3];
int matches;
static PHP_NAMED_FUNCTION(zif_zip_entry_read)
{
zval * zip_entry;
- long len = 0;
+ php_int_t len = 0;
zip_read_rsrc * zr_rsrc;
zend_string *buffer;
int n = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zip_entry, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zip_entry, &len) == FAILURE) {
return;
}
RETURN_STRING((char *)zr_rsrc->sb.name);
break;
case 1:
- RETURN_INT((long) (zr_rsrc->sb.comp_size));
+ RETURN_INT((php_int_t) (zr_rsrc->sb.comp_size));
break;
case 2:
- RETURN_INT((long) (zr_rsrc->sb.size));
+ RETURN_INT((php_int_t) (zr_rsrc->sb.size));
break;
case 3:
switch (zr_rsrc->sb.comp_method) {
default:
RETURN_FALSE;
}
- RETURN_INT((long) (zr_rsrc->sb.comp_method));
+ RETURN_INT((php_int_t) (zr_rsrc->sb.comp_method));
break;
}
{
struct zip *intern;
int err = 0;
- long flags = 0;
+ php_int_t flags = 0;
char *resolved_path;
zend_string *filename;
zval *self = getThis();
ze_zip_object *ze_obj = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &filename, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &filename, &flags) == FAILURE) {
return;
}
intern = zip_open(resolved_path, flags, &err);
if (!intern || err) {
efree(resolved_path);
- RETURN_INT((long)err);
+ RETURN_INT((php_int_t)err);
}
ze_obj->filename = resolved_path;
ze_obj->filename_len = strlen(resolved_path);
char *remove_path = NULL;
char *add_path = NULL;
int add_path_len, remove_path_len = 0, path_len = 0;
- long remove_all_path = 0;
- long flags = 0;
+ php_int_t remove_all_path = 0;
+ php_int_t flags = 0;
zval *options = NULL;
int found;
zend_string *pattern;
ZIP_FROM_OBJECT(intern, self);
/* 1 == glob, 2 == pcre */
if (type == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|la",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ia",
&pattern, &flags, &options) == FAILURE) {
return;
}
if (add_path) {
if ((add_path_len + file_stripped_len) > MAXPATHLEN) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Entry name too long (max: %d, %ld given)",
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Entry name too long (max: %d, %pd given)",
MAXPATHLEN - 1, (add_path_len + file_stripped_len));
zval_ptr_dtor(return_value);
RETURN_FALSE;
zval *self = getThis();
char *entry_name = NULL;
int entry_name_len = 0;
- long offset_start = 0, offset_len = 0;
+ php_int_t offset_start = 0, offset_len = 0;
zend_string *filename;
if (!self) {
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|sll",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|sii",
&filename, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis();
- char *buffer, *name;
- int buffer_len, name_len;
+ zend_string *buffer;
+ char *name;
+ int name_len;
ze_zip_object *ze_obj;
struct zip_source *zs;
int pos = 0;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
- &name, &name_len, &buffer, &buffer_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sS",
+ &name, &name_len, &buffer) == FAILURE) {
return;
}
ze_obj->buffers_cnt++;
pos = 0;
}
- ze_obj->buffers[pos] = (char *)emalloc(buffer_len + 1);
- memcpy(ze_obj->buffers[pos], buffer, buffer_len + 1);
+ ze_obj->buffers[pos] = (char *)emalloc(buffer->len + 1);
+ memcpy(ze_obj->buffers[pos], buffer->val, buffer->len + 1);
- zs = zip_source_buffer(intern, ze_obj->buffers[pos], buffer_len, 0);
+ zs = zip_source_buffer(intern, ze_obj->buffers[pos], buffer->len, 0);
if (zs == NULL) {
RETURN_FALSE;
{
struct zip *intern;
zval *self = getThis();
- long flags = 0;
+ php_int_t flags = 0;
struct zip_stat sb;
zend_string *name;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &name, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &name, &flags) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis();
- long index, flags = 0;
+ php_int_t index, flags = 0;
struct zip_stat sb;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i",
&index, &flags) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis();
- long flags = 0;
- long idx = -1;
+ php_int_t flags = 0;
+ php_int_t idx = -1;
zend_string *name;
if (!self) {
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|l", &name, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|i", &name, &flags) == FAILURE) {
return;
}
RETURN_FALSE;
}
- idx = (long)zip_name_locate(intern, (const char *)name->val, flags);
+ idx = (php_int_t)zip_name_locate(intern, (const char *)name->val, flags);
if (idx >= 0) {
RETURN_INT(idx);
struct zip *intern;
zval *self = getThis();
const char *name;
- long flags = 0, index = 0;
+ php_int_t flags = 0, index = 0;
if (!self) {
RETURN_FALSE;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i",
&index, &flags) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis();
- long flags = 0;
+ php_int_t flags = 0;
const char * comment;
int comment_len = 0;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) {
return;
}
if(comment==NULL) {
RETURN_FALSE;
}
- RETURN_STRINGL((char *)comment, (long)comment_len);
+ RETURN_STRINGL((char *)comment, (php_int_t)comment_len);
}
/* }}} */
{
struct zip *intern;
zval *self = getThis();
- long index;
+ php_int_t index;
int comment_len;
char * comment;
struct zip_stat sb;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is",
&index, &comment, &comment_len) == FAILURE) {
return;
}
zval *self = getThis();
int name_len;
char *name;
- long flags=0, opsys, attr;
+ php_int_t flags=0, opsys, attr;
zip_int64_t idx;
if (!self) {
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|i",
&name, &name_len, &opsys, &attr, &flags) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis();
- long index, flags=0, opsys, attr;
+ php_int_t index, flags=0, opsys, attr;
struct zip_stat sb;
if (!self) {
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii|i",
&index, &opsys, &attr, &flags) == FAILURE) {
return;
}
zval *self = getThis(), *z_opsys, *z_attr;
int name_len;
char *name;
- long flags=0;
+ php_int_t flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
zip_int64_t idx;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z/|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z/|i",
&name, &name_len, &z_opsys, &z_attr, &flags) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
- long index, flags=0;
+ php_int_t index, flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
struct zip_stat sb;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/z/|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz/z/|i",
&index, &z_opsys, &z_attr, &flags) == FAILURE) {
return;
}
struct zip *intern;
zval *self = getThis();
int name_len, idx;
- long flags = 0;
+ php_int_t flags = 0;
int comment_len = 0;
const char * comment;
char *name;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i",
&name, &name_len, &flags) == FAILURE) {
return;
}
}
comment = zip_get_file_comment(intern, idx, &comment_len, (int)flags);
- RETURN_STRINGL((char *)comment, (long)comment_len);
+ RETURN_STRINGL((char *)comment, (php_int_t)comment_len);
}
/* }}} */
{
struct zip *intern;
zval *self = getThis();
- long index, flags = 0;
+ php_int_t index, flags = 0;
const char * comment;
int comment_len = 0;
struct zip_stat sb;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i",
&index, &flags) == FAILURE) {
return;
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
comment = zip_get_file_comment(intern, index, &comment_len, (int)flags);
- RETURN_STRINGL((char *)comment, (long)comment_len);
+ RETURN_STRINGL((char *)comment, (php_int_t)comment_len);
}
/* }}} */
{
struct zip *intern;
zval *self = getThis();
- long index;
+ php_int_t index;
if (!self) {
RETURN_FALSE;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &index) == FAILURE) {
return;
}
char *new_name;
int new_name_len;
- long index;
+ php_int_t index;
if (!self) {
RETURN_FALSE;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &index, &new_name, &new_name_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &index, &new_name, &new_name_len) == FAILURE) {
return;
}
{
struct zip *intern;
zval *self = getThis();
- long index;
+ php_int_t index;
if (!self) {
RETURN_FALSE;
ZIP_FROM_OBJECT(intern, self);
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &index) == FAILURE) {
return;
}
struct zip_stat sb;
struct zip_file *zf;
- long index = -1;
- long flags = 0;
- long len = 0;
+ php_int_t index = -1;
+ php_int_t flags = 0;
+ php_int_t len = 0;
zend_string *filename;
zend_string *buffer;
ZIP_FROM_OBJECT(intern, self);
if (type == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ll", &filename, &len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "P|ii", &filename, &len, &flags) == FAILURE) {
return;
}
PHP_ZIP_STAT_PATH(intern, filename->val, filename->len, flags, sb);
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &index, &len, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &index, &len, &flags) == FAILURE) {
return;
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);