}
/* }}} */
-static filter_list_entry php_find_filter(long id) /* {{{ */
+static filter_list_entry php_find_filter(php_int_t id) /* {{{ */
{
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
return SUCCESS;
}
-static void php_zval_filter(zval *value, long filter, long flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */
+static void php_zval_filter(zval *value, php_int_t filter, php_int_t flags, zval *options, char* charset, zend_bool copy TSRMLS_DC) /* {{{ */
{
filter_list_entry filter_func;
}
/* }}} */
-static void php_zval_filter_recursive(zval *value, long filter, long flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */
+static void php_zval_filter_recursive(zval *value, php_int_t filter, php_int_t flags, zval *options, char *charset, zend_bool copy TSRMLS_DC) /* {{{ */
{
if (Z_TYPE_P(value) == IS_ARRAY) {
zval *element;
}
/* }}} */
-static zval *php_filter_get_storage(long arg TSRMLS_DC)/* {{{ */
+static zval *php_filter_get_storage(php_int_t arg TSRMLS_DC)/* {{{ */
{
zval *array_ptr = NULL;
*/
PHP_FUNCTION(filter_has_var)
{
- long arg;
+ php_int_t arg;
zend_string *var;
zval *array_ptr = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS", &arg, &var) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS", &arg, &var) == FAILURE) {
RETURN_FALSE;
}
}
/* }}} */
-static void php_filter_call(zval *filtered, long filter, zval *filter_args, const int copy, long filter_flags TSRMLS_DC) /* {{{ */
+static void php_filter_call(zval *filtered, php_int_t filter, zval *filter_args, const int copy, php_int_t filter_flags TSRMLS_DC) /* {{{ */
{
zval *options = NULL;
zval *option;
char *charset = NULL;
if (filter_args && Z_TYPE_P(filter_args) != IS_ARRAY) {
- long lval;
+ php_int_t lval;
PHP_FILTER_GET_LONG_OPT(filter_args, lval);
static void php_filter_array_handler(zval *input, zval *op, zval *return_value, zend_bool add_empty TSRMLS_DC) /* {{{ */
{
- ulong index;
+ php_uint_t index;
zend_string *arg_key;
zval *tmp, *arg_elm;
*/
PHP_FUNCTION(filter_input)
{
- long fetch_from, filter = FILTER_DEFAULT;
+ php_int_t fetch_from, filter = FILTER_DEFAULT;
zval *filter_args = NULL, *tmp;
zval *input = NULL;
zend_string *var;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lS|lz", &fetch_from, &var, &filter, &filter_args) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iS|iz", &fetch_from, &var, &filter, &filter_args) == FAILURE) {
return;
}
input = php_filter_get_storage(fetch_from TSRMLS_CC);
if (!input || !HASH_OF(input) || (tmp = zend_hash_find(HASH_OF(input), var)) == NULL) {
- long filter_flags = 0;
+ php_int_t filter_flags = 0;
zval *option, *opt, *def;
if (filter_args) {
if (Z_TYPE_P(filter_args) == IS_INT) {
*/
PHP_FUNCTION(filter_var)
{
- long filter = FILTER_DEFAULT;
+ php_int_t filter = FILTER_DEFAULT;
zval *filter_args = NULL, *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|lz", &data, &filter, &filter_args) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|iz", &data, &filter, &filter_args) == FAILURE) {
return;
}
*/
PHP_FUNCTION(filter_input_array)
{
- long fetch_from;
+ php_int_t fetch_from;
zval *array_input = NULL, *op = NULL;
zend_bool add_empty = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|zb", &fetch_from, &op, &add_empty) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|zb", &fetch_from, &op, &add_empty) == FAILURE) {
return;
}
array_input = php_filter_get_storage(fetch_from TSRMLS_CC);
if (!array_input || !HASH_OF(array_input)) {
- long filter_flags = 0;
+ php_int_t filter_flags = 0;
zval *option;
if (op) {
if (Z_TYPE_P(op) == IS_INT) {
#define FORMAT_IPV4 4
#define FORMAT_IPV6 6
-static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* {{{ */
- long ctx_value;
+static int php_filter_parse_int(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */
+ php_int_t ctx_value;
int sign = 0, digit = 0;
const char *end = str + str_len;
while (str < end) {
if (*str >= '0' && *str <= '9') {
digit = (*(str++) - '0');
- if ( (!sign) && ctx_value <= (LONG_MAX-digit)/10 ) {
+ if ( (!sign) && ctx_value <= (PHP_INT_MAX-digit)/10 ) {
ctx_value = (ctx_value * 10) + digit;
- } else if ( sign && ctx_value >= (LONG_MIN+digit)/10) {
+ } else if ( sign && ctx_value >= (PHP_INT_MIN+digit)/10) {
ctx_value = (ctx_value * 10) - digit;
} else {
return -1;
}
/* }}} */
-static int php_filter_parse_octal(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* {{{ */
- unsigned long ctx_value = 0;
+static int php_filter_parse_octal(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */
+ php_uint_t ctx_value = 0;
const char *end = str + str_len;
while (str < end) {
if (*str >= '0' && *str <= '7') {
- unsigned long n = ((*(str++)) - '0');
+ php_uint_t n = ((*(str++)) - '0');
- if ((ctx_value > ((unsigned long)(~(long)0)) / 8) ||
- ((ctx_value = ctx_value * 8) > ((unsigned long)(~(long)0)) - n)) {
+ if ((ctx_value > ((php_uint_t)(~(php_int_t)0)) / 8) ||
+ ((ctx_value = ctx_value * 8) > ((php_uint_t)(~(php_int_t)0)) - n)) {
return -1;
}
ctx_value += n;
}
}
- *ret = (long)ctx_value;
+ *ret = (php_int_t)ctx_value;
return 1;
}
/* }}} */
-static int php_filter_parse_hex(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* {{{ */
- unsigned long ctx_value = 0;
+static int php_filter_parse_hex(const char *str, unsigned int str_len, php_int_t *ret TSRMLS_DC) { /* {{{ */
+ php_uint_t ctx_value = 0;
const char *end = str + str_len;
- unsigned long n;
+ php_uint_t n;
while (str < end) {
if (*str >= '0' && *str <= '9') {
} else {
return -1;
}
- if ((ctx_value > ((unsigned long)(~(long)0)) / 16) ||
- ((ctx_value = ctx_value * 16) > ((unsigned long)(~(long)0)) - n)) {
+ if ((ctx_value > ((php_uint_t)(~(php_int_t)0)) / 16) ||
+ ((ctx_value = ctx_value * 16) > ((php_uint_t)(~(php_int_t)0)) - n)) {
return -1;
}
ctx_value += n;
}
- *ret = (long)ctx_value;
+ *ret = (php_int_t)ctx_value;
return 1;
}
/* }}} */
void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
{
zval *option_val;
- long min_range, max_range, option_flags;
+ php_int_t min_range, max_range, option_flags;
int min_range_set, max_range_set;
int allow_octal = 0, allow_hex = 0;
int len, error = 0;
- long ctx_value;
+ php_int_t ctx_value;
char *p;
/* Parse options */
char dec_sep = '.';
char tsd_sep[3] = "',.";
- long lval;
+ php_int_t lval;
double dval;
int first, n;
{
zval *option_val;
zend_string *regexp;
- long option_flags;
+ php_int_t option_flags;
int regexp_set, option_flags_set;
pcre *re = NULL;
pcre_extra *pcre_extra = NULL;
int tokens, length, i, offset, exp_separator_set, exp_separator_len;
char separator;
char *exp_separator;
- long ret = 0;
+ php_int_t ret = 0;
zval *option_val;
FETCH_STRING_OPTION(exp_separator, "separator");
zval env_array;
zval server_array;
zval session_array;
- long default_filter;
- long default_filter_flags;
+ php_int_t default_filter;
+ php_int_t default_filter_flags;
ZEND_END_MODULE_GLOBALS(filter)
#ifdef ZTS
#endif
-#define PHP_INPUT_FILTER_PARAM_DECL zval *value, long flags, zval *option_array, char *charset TSRMLS_DC
+#define PHP_INPUT_FILTER_PARAM_DECL zval *value, php_int_t flags, zval *option_array, char *charset TSRMLS_DC
void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL);
while (s < e) {
if (chars[*s]) {
smart_str_appendl(&str, "&#", 2);
- smart_str_append_unsigned(&str, (unsigned long)*s);
+ smart_str_append_unsigned(&str, (php_uint_t)*s);
smart_str_appendc(&str, ';');
} else {
/* XXX: this needs to be optimized to work with blocks of 'safe' chars */
ZVAL_STR(value, str);
}
-static void php_filter_strip(zval *value, long flags)
+static void php_filter_strip(zval *value, php_int_t flags)
{
unsigned char *str;
int i, c;