summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-29 13:46:58 +0100
committerAnatol Belski <ab@php.net>2014-10-29 15:30:12 +0100
commit110cf649b7d156f97f98cc8e894fb2d4ed8c67ff (patch)
treef8c3de9cd4ca30744940a32e80b60a4b301ca88e
parent9d21ff6b9e6fbc16807640c1e7e471cebaff21c4 (diff)
downloadphp-git-110cf649b7d156f97f98cc8e894fb2d4ed8c67ff.tar.gz
fix datatype mismatches
especially spl_dual_it_object current.pos should have the same datatype as limit.offset, also this doesn't increase the struct size.
-rw-r--r--ext/spl/spl_iterators.c15
-rw-r--r--ext/spl/spl_iterators.h2
2 files changed, 10 insertions, 7 deletions
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 8b09e3ef37..c129115eeb 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -540,7 +540,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
intern->iterators = emalloc(sizeof(spl_sub_iterator));
intern->level = 0;
intern->mode = mode;
- intern->flags = flags;
+ intern->flags = (int)flags;
intern->max_depth = -1;
intern->in_iteration = 0;
intern->ce = Z_OBJCE_P(object);
@@ -854,8 +854,11 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
if (max_depth < -1) {
zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0 TSRMLS_CC);
return;
+ } else if (max_depth > INT_MAX) {
+ max_depth = INT_MAX;
}
- object->max_depth = max_depth;
+
+ object->max_depth = (int)max_depth;
} /* }}} */
/* {{{ proto int|false RecursiveIteratorIterator::getMaxDepth()
@@ -1423,9 +1426,9 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more TSRMLS_DC);
-static inline int spl_cit_check_flags(int flags)
+static inline int spl_cit_check_flags(zend_long flags)
{
- int cnt = 0;
+ zend_long cnt = 0;
cnt += (flags & CIT_CALL_TOSTRING) ? 1 : 0;
cnt += (flags & CIT_TOSTRING_USE_KEY) ? 1 : 0;
@@ -2051,10 +2054,10 @@ SPL_METHOD(RegexIterator, accept)
use_copy = zend_make_printable_zval(subject_ptr, &subject_copy TSRMLS_CC);
if (use_copy) {
subject = Z_STRVAL(subject_copy);
- subject_len = Z_STRLEN(subject_copy);
+ subject_len = (int)Z_STRLEN(subject_copy);
} else {
subject = Z_STRVAL_P(subject_ptr);
- subject_len = Z_STRLEN_P(subject_ptr);
+ subject_len = (int)Z_STRLEN_P(subject_ptr);
}
use_copy = 0;
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index f0740275dc..76f0b45e57 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -134,7 +134,7 @@ typedef struct _spl_dual_it_object {
struct {
zval data;
zval key;
- int pos;
+ zend_long pos;
} current;
dual_it_type dit_type;
union {