diff options
Diffstat (limited to 'ext')
402 files changed, 9149 insertions, 9266 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 4b8c7c5f18..b45a738a04 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -206,12 +206,12 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC) PHP_FUNCTION(bcadd) { char *left, *right; - long scale_param = 0; + php_int_t scale_param = 0; bc_num first, second, result; int left_len, right_len; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -244,11 +244,11 @@ PHP_FUNCTION(bcsub) { char *left, *right; int left_len, right_len; - long scale_param = 0; + php_int_t scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -281,11 +281,11 @@ PHP_FUNCTION(bcmul) { char *left, *right; int left_len, right_len; - long scale_param = 0; + php_int_t scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -318,11 +318,11 @@ PHP_FUNCTION(bcdiv) { char *left, *right; int left_len, right_len; - long scale_param = 0; + php_int_t scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -396,10 +396,10 @@ PHP_FUNCTION(bcpowmod) char *left, *right, *modulous; int left_len, right_len, modulous_len; bc_num first, second, mod, result; - long scale = BCG(bc_precision); + php_int_t scale = BCG(bc_precision); int scale_int; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) { return; } @@ -436,11 +436,11 @@ PHP_FUNCTION(bcpow) { char *left, *right; int left_len, right_len; - long scale_param = 0; + php_int_t scale_param = 0; bc_num first, second, result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -473,11 +473,11 @@ PHP_FUNCTION(bcsqrt) { char *left; int left_len; - long scale_param = 0; + php_int_t scale_param = 0; bc_num result; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|i", &left, &left_len, &scale_param) == FAILURE) { return; } @@ -508,11 +508,11 @@ PHP_FUNCTION(bccomp) { char *left, *right; int left_len, right_len; - long scale_param = 0; + php_int_t scale_param = 0; bc_num first, second; int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ss|i", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) { return; } @@ -525,7 +525,7 @@ PHP_FUNCTION(bccomp) bc_str2num(&first, left, scale TSRMLS_CC); bc_str2num(&second, right, scale TSRMLS_CC); - RETVAL_LONG(bc_compare(first, second)); + RETVAL_INT(bc_compare(first, second)); bc_free_num(&first); bc_free_num(&second); @@ -537,9 +537,9 @@ PHP_FUNCTION(bccomp) Sets default scale parameter for all bc math functions */ PHP_FUNCTION(bcscale) { - long new_scale; + php_int_t new_scale; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &new_scale) == FAILURE) { return; } diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h index a18e5287e6..96f0baf189 100644 --- a/ext/bcmath/php_bcmath.h +++ b/ext/bcmath/php_bcmath.h @@ -45,7 +45,7 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath) bc_num _zero_; bc_num _one_; bc_num _two_; - long bc_precision; + php_int_t bc_precision; ZEND_END_MODULE_GLOBALS(bcmath) #ifdef ZTS diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index db4e834a20..c6a03935d9 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -343,11 +343,11 @@ static PHP_MINFO_FUNCTION(bz2) static PHP_FUNCTION(bzread) { zval *bz; - long len = 1024; + php_int_t len = 1024; php_stream *stream; zend_string *data; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &bz, &len)) { RETURN_FALSE; } @@ -393,7 +393,7 @@ static PHP_FUNCTION(bzopen) /* If it's not a resource its a string containing the filename to open */ if (Z_TYPE_P(file) == IS_STRING) { - if (Z_STRLEN_P(file) == 0) { + if (Z_STRSIZE_P(file) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty"); RETURN_FALSE; } @@ -406,7 +406,7 @@ static PHP_FUNCTION(bzopen) } else if (Z_TYPE_P(file) == IS_RESOURCE) { /* If it is a resource, than its a stream resource */ php_socket_t fd; - int stream_mode_len; + php_size_t stream_mode_len; php_stream_from_zval(stream, file); stream_mode_len = strlen(stream->mode); @@ -490,8 +490,8 @@ static PHP_FUNCTION(bzerror) static PHP_FUNCTION(bzcompress) { char *source; /* Source data to compress */ - long zblock_size = 0; /* Optional block size to use */ - long zwork_factor = 0;/* Optional work factor to use */ + php_int_t zblock_size = 0; /* Optional block size to use */ + php_int_t zwork_factor = 0;/* Optional work factor to use */ zend_string *dest = NULL; /* Destination to place the compressed data into */ int error, /* Error Container */ block_size = 4, /* Block size for compression algorithm */ @@ -502,7 +502,7 @@ static PHP_FUNCTION(bzcompress) argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) { return; } @@ -527,7 +527,7 @@ static PHP_FUNCTION(bzcompress) error = BZ2_bzBuffToBuffCompress(dest->val, &dest_len, source, source_len, block_size, 0, work_factor); if (error != BZ_OK) { STR_FREE(dest); - RETURN_LONG(error); + RETURN_INT(error); } else { /* Copy the buffer, we have perhaps allocate a lot more than we need, so we erealloc() the buffer to the proper size */ @@ -544,7 +544,7 @@ static PHP_FUNCTION(bzdecompress) { char *source, *dest; int source_len, error; - long small = 0; + php_int_t small = 0; #if defined(PHP_WIN32) unsigned __int64 size = 0; #else @@ -552,7 +552,7 @@ static PHP_FUNCTION(bzdecompress) #endif bz_stream bzs; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &small)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &small)) { RETURN_FALSE; } @@ -586,7 +586,7 @@ static PHP_FUNCTION(bzdecompress) efree(dest); } else { /* real error */ efree(dest); - RETVAL_LONG(error); + RETVAL_INT(error); } BZ2_bzDecompressEnd(&bzs); @@ -621,7 +621,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) /* Determine what to return */ switch (opt) { case PHP_BZ_ERRNO: - RETURN_LONG(errnum); + RETURN_INT(errnum); break; case PHP_BZ_ERRSTR: RETURN_STRING((char*)errstr); @@ -629,7 +629,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt) case PHP_BZ_ERRBOTH: array_init(return_value); - add_assoc_long (return_value, "errno", errnum); + add_assoc_int (return_value, "errno", errnum); add_assoc_string(return_value, "errstr", (char*)errstr); break; } diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index ea3b0de692..f32226bc84 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -380,11 +380,11 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi zval tmp; ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); - if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_LVAL_P(tmpzval)); + convert_to_int(&tmp); + if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > 9) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_IVAL_P(tmpzval)); } else { - blockSize100k = Z_LVAL(tmp); + blockSize100k = Z_IVAL(tmp); } } @@ -393,12 +393,12 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi zval tmp; ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); + convert_to_int(&tmp); - if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < 0 || Z_IVAL(tmp) > 250) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", Z_IVAL(tmp)); } else { - workFactor = Z_LVAL(tmp); + workFactor = Z_IVAL(tmp); } } } diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index 99adfd3563..6149a0c054 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -31,7 +31,7 @@ PHP_FUNCTION(unixtojd) time_t ts = 0; struct tm *ta, tmbuf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &ts) == FAILURE) { return; } @@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd) RETURN_FALSE; } - RETURN_LONG(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); + RETURN_INT(GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday)); } /* }}} */ @@ -64,7 +64,7 @@ PHP_FUNCTION(jdtounix) RETURN_FALSE; } - RETURN_LONG(uday * 24 * 3600); + RETURN_INT(uday * 24 * 3600); } /* }}} */ diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 6590eee903..35652a9ce6 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -178,8 +178,8 @@ enum cal_name_type_t { CAL_NUM_CALS }; -typedef long int (*cal_to_jd_func_t) (int month, int day, int year); -typedef void (*cal_from_jd_func_t) (long int jd, int *year, int *month, int *day); +typedef php_int_t (*cal_to_jd_func_t) (int month, int day, int year); +typedef void (*cal_from_jd_func_t) (php_int_t jd, int *year, int *month, int *day); typedef char *(*cal_as_string_func_t) (int year, int month, int day); struct cal_entry_t { @@ -225,31 +225,31 @@ static char alef_bet[25] = "0àáâãäåæçèéëìîðñòôö÷øùú"; PHP_MINIT_FUNCTION(calendar) { - REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT); /* constants for jddayofweek */ - REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT); /* constants for jdmonthname */ - REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT); /* constants for easter calculation */ - REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT); /* constants for Jewish date formatting */ - REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -279,7 +279,7 @@ static void _php_cal_info(int cal, zval *ret) add_assoc_zval(ret, "months", &months); add_assoc_zval(ret, "abbrevmonths", &smonths); - add_assoc_long(ret, "maxdaysinmonth", calendar->max_days_in_month); + add_assoc_int(ret, "maxdaysinmonth", calendar->max_days_in_month); add_assoc_string(ret, "calname", calendar->name); add_assoc_string(ret, "calsymbol", calendar->symbol); @@ -289,10 +289,10 @@ static void _php_cal_info(int cal, zval *ret) Returns information about a particular calendar */ PHP_FUNCTION(cal_info) { - long cal = -1; + php_int_t cal = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &cal) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &cal) == FAILURE) { RETURN_FALSE; } @@ -324,16 +324,16 @@ PHP_FUNCTION(cal_info) Returns the number of days in a month for a given year and calendar */ PHP_FUNCTION(cal_days_in_month) { - long cal, month, year; + php_int_t cal, month, year; struct cal_entry_t *calendar; - long sdn_start, sdn_next; + php_int_t sdn_start, sdn_next; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &cal, &month, &year) == FAILURE) { RETURN_FALSE; } if (cal < 0 || cal >= CAL_NUM_CALS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd.", cal); RETURN_FALSE; } @@ -360,7 +360,7 @@ PHP_FUNCTION(cal_days_in_month) } } - RETURN_LONG(sdn_next - sdn_start); + RETURN_INT(sdn_next - sdn_start); } /* }}} */ @@ -368,18 +368,18 @@ PHP_FUNCTION(cal_days_in_month) Converts from a supported calendar to Julian Day Count */ PHP_FUNCTION(cal_to_jd) { - long cal, month, day, year; + php_int_t cal, month, day, year; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiii", &cal, &month, &day, &year) != SUCCESS) { RETURN_FALSE; } if (cal < 0 || cal >= CAL_NUM_CALS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd.", cal); RETURN_FALSE; } - RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day)); + RETURN_INT(cal_conversion_table[cal].to_jd(year, month, day)); } /* }}} */ @@ -387,17 +387,17 @@ PHP_FUNCTION(cal_to_jd) Converts from Julian Day Count to a supported calendar and return extended information */ PHP_FUNCTION(cal_from_jd) { - long jd, cal; + php_int_t jd, cal; int month, day, year, dow; char date[16]; struct cal_entry_t *calendar; - if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ii", &jd, &cal) == FAILURE) { RETURN_FALSE; } if (cal < 0 || cal >= CAL_NUM_CALS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld", cal); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %pd", cal); RETURN_FALSE; } calendar = &cal_conversion_table[cal]; @@ -409,13 +409,13 @@ PHP_FUNCTION(cal_from_jd) snprintf(date, sizeof(date), "%i/%i/%i", month, day, year); add_assoc_string(return_value, "date", date); - add_assoc_long(return_value, "month", month); - add_assoc_long(return_value, "day", day); - add_assoc_long(return_value, "year", year); + add_assoc_int(return_value, "month", month); + add_assoc_int(return_value, "day", day); + add_assoc_int(return_value, "year", year); /* day of week */ dow = DayOfWeek(jd); - add_assoc_long(return_value, "dow", dow); + add_assoc_int(return_value, "dow", dow); add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow]); add_assoc_string(return_value, "dayname", DayNameLong[dow]); /* month name */ @@ -434,11 +434,11 @@ PHP_FUNCTION(cal_from_jd) Converts a julian day count to a gregorian calendar date */ PHP_FUNCTION(jdtogregorian) { - long julday; + php_int_t julday; int year, month, day; char date[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) { RETURN_FALSE; } @@ -453,13 +453,13 @@ PHP_FUNCTION(jdtogregorian) Converts a gregorian calendar date to julian day count */ PHP_FUNCTION(gregoriantojd) { - long year, month, day; + php_int_t year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_LONG(GregorianToSdn(year, month, day)); + RETURN_INT(GregorianToSdn(year, month, day)); } /* }}} */ @@ -467,11 +467,11 @@ PHP_FUNCTION(gregoriantojd) Convert a julian day count to a julian calendar date */ PHP_FUNCTION(jdtojulian) { - long julday; + php_int_t julday; int year, month, day; char date[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) { RETURN_FALSE; } @@ -486,13 +486,13 @@ PHP_FUNCTION(jdtojulian) Converts a julian calendar date to julian day count */ PHP_FUNCTION(juliantojd) { - long year, month, day; + php_int_t year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_LONG(JulianToSdn(year, month, day)); + RETURN_INT(JulianToSdn(year, month, day)); } /* }}} */ @@ -595,13 +595,13 @@ static char *heb_number_to_chars(int n, int fl, char **ret) Converts a julian day count to a jewish calendar date */ PHP_FUNCTION(jdtojewish) { - long julday, fl = 0; + php_int_t julday, fl = 0; zend_bool heb = 0; int year, month, day; char date[16], hebdate[32]; char *dayp, *yearp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|bi", &julday, &heb, &fl) == FAILURE) { RETURN_FALSE; } @@ -634,13 +634,13 @@ PHP_FUNCTION(jdtojewish) Converts a jewish calendar date to a julian day count */ PHP_FUNCTION(jewishtojd) { - long year, month, day; + php_int_t year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_LONG(JewishToSdn(year, month, day)); + RETURN_INT(JewishToSdn(year, month, day)); } /* }}} */ @@ -648,11 +648,11 @@ PHP_FUNCTION(jewishtojd) Converts a julian day count to a french republic calendar date */ PHP_FUNCTION(jdtofrench) { - long julday; + php_int_t julday; int year, month, day; char date[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &julday) == FAILURE) { RETURN_FALSE; } @@ -667,13 +667,13 @@ PHP_FUNCTION(jdtofrench) Converts a french republic calendar date to julian day count */ PHP_FUNCTION(frenchtojd) { - long year, month, day; + php_int_t year, month, day; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &month, &day, &year) == FAILURE) { RETURN_FALSE; } - RETURN_LONG(FrenchToSdn(year, month, day)); + RETURN_INT(FrenchToSdn(year, month, day)); } /* }}} */ @@ -681,11 +681,11 @@ PHP_FUNCTION(frenchtojd) Returns name or number of day of week from julian day count */ PHP_FUNCTION(jddayofweek) { - long julday, mode = CAL_DOW_DAYNO; + php_int_t julday, mode = CAL_DOW_DAYNO; int day; char *daynamel, *daynames; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &julday, &mode) == FAILURE) { RETURN_FALSE; } @@ -702,7 +702,7 @@ PHP_FUNCTION(jddayofweek) break; case CAL_DOW_DAYNO: default: - RETURN_LONG(day); + RETURN_INT(day); break; } } @@ -712,11 +712,11 @@ PHP_FUNCTION(jddayofweek) Returns name of month for julian day count */ PHP_FUNCTION(jdmonthname) { - long julday, mode; + php_int_t julday, mode; char *monthname = NULL; int month, day, year; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &julday, &mode) == FAILURE) { RETURN_FALSE; } diff --git a/ext/calendar/dow.c b/ext/calendar/dow.c index 64ae008f77..1e9b99694c 100644 --- a/ext/calendar/dow.c +++ b/ext/calendar/dow.c @@ -32,7 +32,7 @@ #include "sdncal.h" int DayOfWeek( - long int sdn) + php_int_t sdn) { int dow; diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c index 82c0aa633c..a61a970461 100644 --- a/ext/calendar/easter.c +++ b/ext/calendar/easter.c @@ -24,14 +24,14 @@ #include "sdncal.h" #include <time.h> -static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm) +static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, php_int_t gm) { /* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */ struct tm te; - long year, golden, solar, lunar, pfm, dom, tmp, easter, result; - long method = CAL_EASTER_DEFAULT; + php_int_t year, golden, solar, lunar, pfm, dom, tmp, easter, result; + php_int_t method = CAL_EASTER_DEFAULT; /* Default to the current year if year parameter is not given */ { @@ -47,7 +47,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm) } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "|ll", &year, &method) == FAILURE) { + "|ii", &year, &method) == FAILURE) { return; } @@ -115,7 +115,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm) } else { /* return the days after March 21 */ result = easter; } - ZVAL_LONG(return_value, result); + ZVAL_INT(return_value, result); } /* {{{ proto int easter_date([int year]) diff --git a/ext/calendar/french.c b/ext/calendar/french.c index 5b4dd53750..c6584695e9 100644 --- a/ext/calendar/french.c +++ b/ext/calendar/french.c @@ -93,12 +93,12 @@ #define LAST_VALID 2380952 void SdnToFrench( - long int sdn, + php_int_t sdn, int *pYear, int *pMonth, int *pDay) { - long int temp; + php_int_t temp; int dayOfYear; if (sdn < FIRST_VALID || sdn > LAST_VALID) { @@ -114,7 +114,7 @@ void SdnToFrench( *pDay = dayOfYear % DAYS_PER_MONTH + 1; } -long int FrenchToSdn( +php_int_t FrenchToSdn( int year, int month, int day) diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c index ebb743fddc..b67de5fcc8 100644 --- a/ext/calendar/gregor.c +++ b/ext/calendar/gregor.c @@ -135,7 +135,7 @@ #define DAYS_PER_400_YEARS 146097 void SdnToGregorian( - long int sdn, + php_int_t sdn, int *pYear, int *pMonth, int *pDay) @@ -144,7 +144,7 @@ void SdnToGregorian( int year; int month; int day; - long int temp; + php_int_t temp; int dayOfYear; if (sdn <= 0 || @@ -190,7 +190,7 @@ fail: *pDay = 0; } -long int GregorianToSdn( +php_int_t GregorianToSdn( int inputYear, int inputMonth, int inputDay) diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index ddc8aaaf86..83efb9949f 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -382,12 +382,12 @@ char *JewishMonthHebName[14] = * (called dehiyyot) delays it. These 4 rules can delay the start of the * year by as much as 2 days. */ -static long int Tishri1( +static php_int_t Tishri1( int metonicYear, - long int moladDay, - long int moladHalakim) + php_int_t moladDay, + php_int_t moladHalakim) { - long int tishri1; + php_int_t tishri1; int dow; int leapYear; int lastWasLeapYear; @@ -429,10 +429,10 @@ static long int Tishri1( */ static void MoladOfMetonicCycle( int metonicCycle, - long int *pMoladDay, - long int *pMoladHalakim) + php_int_t *pMoladDay, + php_int_t *pMoladHalakim) { - register unsigned long int r1, r2, d1, d2; + register php_uint_t r1, r2, d1, d2; /* Start with the time of the first molad after creation. */ r1 = NEW_MOON_OF_CREATION; @@ -468,14 +468,14 @@ static void MoladOfMetonicCycle( * us to avoid calculating the length of the year in most cases. */ static void FindTishriMolad( - long int inputDay, + php_int_t inputDay, int *pMetonicCycle, int *pMetonicYear, - long int *pMoladDay, - long int *pMoladHalakim) + php_int_t *pMoladDay, + php_int_t *pMoladHalakim) { - long int moladDay; - long int moladHalakim; + php_int_t moladDay; + php_int_t moladHalakim; int metonicCycle; int metonicYear; @@ -523,8 +523,8 @@ static void FindStartOfYear( int year, int *pMetonicCycle, int *pMetonicYear, - long int *pMoladDay, - long int *pMoladHalakim, + php_int_t *pMoladDay, + php_int_t *pMoladHalakim, int *pTishri1) { *pMetonicCycle = (year - 1) / 19; @@ -546,14 +546,14 @@ static void FindStartOfYear( * range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive. */ void SdnToJewish( - long int sdn, + php_int_t sdn, int *pYear, int *pMonth, int *pDay) { - long int inputDay; - long int day; - long int halakim; + php_int_t inputDay; + php_int_t day; + php_int_t halakim; int metonicCycle; int metonicYear; int tishri1; @@ -684,18 +684,18 @@ void SdnToJewish( * value. To verify that a date is valid, convert it to SDN and then back * and compare with the original. */ -long int JewishToSdn( +php_int_t JewishToSdn( int year, int month, int day) { - long int sdn; + php_int_t sdn; int metonicCycle; int metonicYear; int tishri1; int tishri1After; - long int moladDay; - long int moladHalakim; + php_int_t moladDay; + php_int_t moladHalakim; int yearLength; int lengthOfAdarIAndII; diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c index 17e7bcb597..3527627c2f 100644 --- a/ext/calendar/julian.c +++ b/ext/calendar/julian.c @@ -11,7 +11,7 @@ * * void * SdnToJulian( - * long int sdn, + * php_int_t sdn, * int *pYear, * int *pMonth, * int *pDay); @@ -21,7 +21,7 @@ * will be >= -4713 and != 0; *pMonth will be in the range 1 to 12 * inclusive; *pDay will be in the range 1 to 31 inclusive. * - * long int + * php_int_t * JulianToSdn( * int inputYear, * int inputMonth, @@ -153,7 +153,7 @@ #define DAYS_PER_4_YEARS 1461 void SdnToJulian( - long int sdn, + php_int_t sdn, int *pYear, int *pMonth, int *pDay) @@ -161,7 +161,7 @@ void SdnToJulian( int year; int month; int day; - long int temp; + php_int_t temp; int dayOfYear; if (sdn <= 0) { @@ -212,7 +212,7 @@ fail: *pDay = 0; } -long int JulianToSdn( +php_int_t JulianToSdn( int inputYear, int inputMonth, int inputDay) diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h index c0463c80d4..47d7748c4c 100644 --- a/ext/calendar/sdncal.h +++ b/ext/calendar/sdncal.h @@ -53,7 +53,7 @@ * * int y1, m1, d1; * int y2, m2, d2; - * long int sdn; + * php_int_t sdn; * ... * sdn = GregorianToSdn(y1, m1, d1); * if (sdn > 0) { @@ -65,19 +65,21 @@ * **************************************************************************/ +#include "php.h" + /* Gregorian calendar conversions. */ -void SdnToGregorian(long int sdn, int *pYear, int *pMonth, int *pDay); -long int GregorianToSdn(int year, int month, int day); +void SdnToGregorian(php_int_t sdn, int *pYear, int *pMonth, int *pDay); +php_int_t GregorianToSdn(int year, int month, int day); extern char *MonthNameShort[13]; extern char *MonthNameLong[13]; /* Julian calendar conversions. */ -void SdnToJulian(long int sdn, int *pYear, int *pMonth, int *pDay); -long int JulianToSdn(int year, int month, int day); +void SdnToJulian(php_int_t sdn, int *pYear, int *pMonth, int *pDay); +php_int_t JulianToSdn(int year, int month, int day); /* Jewish calendar conversions. */ -void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay); -long int JewishToSdn(int year, int month, int day); +void SdnToJewish(php_int_t sdn, int *pYear, int *pMonth, int *pDay); +php_int_t JewishToSdn(int year, int month, int day); extern char *JewishMonthName[14]; extern char *JewishMonthNameLeap[14]; extern char *JewishMonthHebName[14]; @@ -85,15 +87,15 @@ extern char *JewishMonthHebNameLeap[14]; extern int monthsPerYear[19]; /* French republic calendar conversions. */ -void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay); -long int FrenchToSdn(int inputYear, int inputMonth, int inputDay); +void SdnToFrench(php_int_t sdn, int *pYear, int *pMonth, int *pDay); +php_int_t FrenchToSdn(int inputYear, int inputMonth, int inputDay); extern char *FrenchMonthName[14]; /* Islamic calendar conversions. */ /* Not implemented yet. */ /* Day of week conversion. 0=Sunday, 6=Saturday */ -int DayOfWeek(long int sdn); +int DayOfWeek(php_int_t sdn); extern char *DayNameShort[7]; extern char *DayNameLong[7]; diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 6d3b15876f..00b62bb2d2 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -57,11 +57,11 @@ PHP_FUNCTION(com_create_instance) obj = CDNO_FETCH(object); if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "s|s!ls", + ZEND_NUM_ARGS() TSRMLS_CC, "s|s!is", &module_name, &module_name_len, &server_name, &server_name_len, &obj->code_page, &typelib_name, &typelib_name_len) && FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "sa|ls", + ZEND_NUM_ARGS() TSRMLS_CC, "sa|is", &module_name, &module_name_len, &server_params, &obj->code_page, &typelib_name, &typelib_name_len)) { @@ -81,7 +81,7 @@ PHP_FUNCTION(com_create_instance) "Server", sizeof("Server")-1))) { convert_to_string_ex(tmp); server_name = Z_STRVAL_P(tmp); - server_name_len = Z_STRLEN_P(tmp); + server_name_len = Z_STRSIZE_P(tmp); ctx = CLSCTX_REMOTE_SERVER; } @@ -89,27 +89,27 @@ PHP_FUNCTION(com_create_instance) "Username", sizeof("Username")-1))) { convert_to_string_ex(tmp); user_name = Z_STRVAL_P(tmp); - user_name_len = Z_STRLEN_P(tmp); + user_name_len = Z_STRSIZE_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Password", sizeof("Password")-1))) { convert_to_string_ex(tmp); password = Z_STRVAL_P(tmp); - password_len = Z_STRLEN_P(tmp); + password_len = Z_STRSIZE_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Domain", sizeof("Domain")-1))) { convert_to_string_ex(tmp); domain_name = Z_STRVAL_P(tmp); - domain_name_len = Z_STRLEN_P(tmp); + domain_name_len = Z_STRSIZE_P(tmp); } if (NULL != (tmp = zend_hash_str_find(HASH_OF(server_params), "Flags", sizeof("Flags")-1))) { - convert_to_long_ex(tmp); - ctx = (CLSCTX)Z_LVAL_P(tmp); + convert_to_int_ex(tmp); + ctx = (CLSCTX)Z_IVAL_P(tmp); } } @@ -289,14 +289,14 @@ PHP_FUNCTION(com_get_active_object) CLSID clsid; char *module_name; int module_name_len; - long code_page = COMG(code_page); + php_int_t code_page = COMG(code_page); IUnknown *unk = NULL; IDispatch *obj = NULL; HRESULT res; OLECHAR *module = NULL; php_com_initialize(TSRMLS_C); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &module_name, &module_name_len, &code_page)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments!" TSRMLS_CC); return; @@ -427,7 +427,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, } if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) { - *dispid = Z_LVAL_P(tmp); + *dispid = Z_IVAL_P(tmp); return S_OK; } @@ -456,7 +456,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, ALLOC_HASHTABLE(obj->id_of_name_cache); zend_hash_init(obj->id_of_name_cache, 2, NULL, NULL, 0); } - ZVAL_LONG(&tmp, *dispid); + ZVAL_INT(&tmp, *dispid); zend_hash_str_update(obj->id_of_name_cache, name, namelen, &tmp); } @@ -784,11 +784,11 @@ PHP_FUNCTION(com_print_typeinfo) Process COM messages, sleeping for up to timeoutms milliseconds */ PHP_FUNCTION(com_message_pump) { - long timeoutms = 0; + php_int_t timeoutms = 0; MSG msg; DWORD result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &timeoutms) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &timeoutms) == FAILURE) RETURN_FALSE; php_com_initialize(TSRMLS_C); diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index 9698fb3419..c742fd30fc 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -243,7 +243,7 @@ PHP_FUNCTION(com_dotnet_create_instance) obj = CDNO_FETCH(object); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &assembly_name, &assembly_name_len, &datatype_name, &datatype_name_len, &obj->code_page)) { diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 0ba33a9b1a..db9f5b21f9 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -22,6 +22,8 @@ #include "config.h" #endif +#include <intsafe.h> + #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" @@ -381,7 +383,13 @@ PHP_MINIT_FUNCTION(com_dotnet) REGISTER_INI_ENTRIES(); -#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) +#define COM_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT) + +#define COM_ERR_CONST(x) { \ + php_int_t __tmp; \ + ULongToUIntPtr(x, &__tmp); \ + REGISTER_INT_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \ +} COM_CONST(CLSCTX_INPROC_SERVER); COM_CONST(CLSCTX_INPROC_HANDLER); @@ -441,10 +449,10 @@ PHP_MINIT_FUNCTION(com_dotnet) #ifdef NORM_IGNOREKASHIDA COM_CONST(NORM_IGNOREKASHIDA); #endif - COM_CONST(DISP_E_DIVBYZERO); - COM_CONST(DISP_E_OVERFLOW); - COM_CONST(DISP_E_BADINDEX); - COM_CONST(MK_E_UNAVAILABLE); + COM_ERR_CONST(DISP_E_DIVBYZERO); + COM_ERR_CONST(DISP_E_OVERFLOW); + COM_ERR_CONST(DISP_E_BADINDEX); + COM_ERR_CONST(MK_E_UNAVAILABLE); return SUCCESS; } diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 0d83a86648..791aaeb5cc 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -44,7 +44,7 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc convert_to_string_ex(member); - res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), + res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC); if (res == SUCCESS) { @@ -71,7 +71,7 @@ static void com_property_write(zval *object, zval *member, zval *value, void **c VariantInit(&v); convert_to_string_ex(member); - if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), + if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -98,10 +98,10 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv T VariantClear(&v); } } else if (V_ISARRAY(&obj->v)) { - convert_to_long(offset); + convert_to_int(offset); if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { - if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) { + if (php_com_safearray_get_elem(&obj->v, &v, Z_IVAL_P(offset) TSRMLS_CC)) { php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC); VariantClear(&v); } @@ -144,8 +144,8 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D vt = V_VT(&obj->v) & ~VT_ARRAY; } - convert_to_long(offset); - indices = Z_LVAL_P(offset); + convert_to_int(offset); + indices = Z_IVAL_P(offset); VariantInit(&v); php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC); @@ -197,7 +197,7 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void if (V_VT(&obj->v) == VT_DISPATCH) { convert_to_string_ex(member); - if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid TSRMLS_CC))) { + if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRSIZE_P(member), &dispid TSRMLS_CC))) { /* TODO: distinguish between property and method! */ return 1; } @@ -491,7 +491,7 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC) } switch(type) { - case IS_LONG: + case IS_INT: vt = VT_INT; break; case IS_DOUBLE: diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index 7da10f1b66..d22bf1efde 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -32,7 +32,7 @@ struct php_com_iterator { zend_object_iterator iter; IEnumVARIANT *ev; - ulong key; + php_uint_t key; VARIANT v; /* cached element */ int code_page; VARIANT safe_array; @@ -75,10 +75,10 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data); - if (I->key == (ulong)-1) { + if (I->key == (php_uint_t)-1) { ZVAL_NULL(key); } else { - ZVAL_LONG(key, I->key); + ZVAL_INT(key, I->key); } } diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index 5cd6808b36..294ff26fe7 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -36,7 +36,7 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC) message = php_win32_error_to_msg(code); free_msg = 1; } - zend_throw_exception(php_com_exception_class_entry, message, (long)code TSRMLS_CC); + zend_throw_exception(php_com_exception_class_entry, message, (php_int_t)code TSRMLS_CC); if (free_msg) { LocalFree(message); } diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 66e3dec640..2a2657ae3c 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -439,7 +439,7 @@ CPH_METHOD(LoadFromFile) HRESULT res; char *filename, *fullpath; int filename_len; - long flags = 0; + php_int_t flags = 0; OLECHAR *olefilename; CPH_FETCH(); @@ -448,7 +448,7 @@ CPH_METHOD(LoadFromFile) res = get_persist_file(helper); if (helper->ipf) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &flags)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); return; @@ -506,7 +506,7 @@ CPH_METHOD(GetMaxStreamSize) php_com_throw_exception(res, NULL TSRMLS_CC); } else { /* TODO: handle 64 bit properly */ - RETURN_LONG((LONG)size.QuadPart); + RETURN_INT((php_int_t)size.QuadPart); } } /* }}} */ diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 9b3716f43a..886bd808f9 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -113,7 +113,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * VariantInit(&v); res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, + Z_STRSIZE(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, proxy->dimensions, args, 0 TSRMLS_CC); if (res == SUCCESS) { @@ -134,7 +134,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* the SafeArray case */ /* offset/index must be an integer */ - convert_to_long(offset); + convert_to_int(offset); sa = V_ARRAY(&proxy->obj->v); dims = SafeArrayGetDim(sa); @@ -149,7 +149,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * SafeArrayGetLBound(sa, proxy->dimensions, &lbound); SafeArrayGetUBound(sa, proxy->dimensions, &ubound); - if (Z_LVAL_P(offset) < lbound || Z_LVAL_P(offset) > ubound) { + if (Z_IVAL_P(offset) < lbound || Z_IVAL_P(offset) > ubound) { php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC); return rv; } @@ -166,12 +166,12 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* copy indices from proxy */ for (i = 0; i < dims; i++) { - convert_to_long(&proxy->indices[i]); - indices[i] = Z_LVAL(proxy->indices[i]); + convert_to_int(&proxy->indices[i]); + indices[i] = Z_IVAL(proxy->indices[i]); } /* add user-supplied index */ - indices[dims-1] = Z_LVAL_P(offset); + indices[dims-1] = Z_IVAL_P(offset); /* now fetch the value */ if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) { @@ -225,7 +225,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM convert_to_string(&proxy->indices[0]); VariantInit(&v); if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, + Z_STRSIZE(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, args, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -240,13 +240,13 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM indices = safe_emalloc(dims, sizeof(LONG), 0); /* copy indices from proxy */ for (i = 0; i < dims; i++) { - convert_to_long(&proxy->indices[i]); - indices[i] = Z_LVAL(proxy->indices[i]); + convert_to_int(&proxy->indices[i]); + indices[i] = Z_IVAL(proxy->indices[i]); } /* add user-supplied index */ - convert_to_long(offset); - indices[dims-1] = Z_LVAL_P(offset); + convert_to_int(offset); + indices[dims-1] = Z_IVAL_P(offset); if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) { vt = V_VT(&proxy->obj->v) & ~VT_ARRAY; @@ -353,7 +353,7 @@ static int saproxy_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC return FAILURE; } -static int saproxy_count_elements(zval *object, long *count TSRMLS_DC) +static int saproxy_count_elements(zval *object, php_int_t *count TSRMLS_DC) { php_com_saproxy *proxy = SA_FETCH(object); LONG ubound, lbound; @@ -516,7 +516,7 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC if (I->key == -1) { ZVAL_NULL(key); } else { - ZVAL_LONG(key, I->key); + ZVAL_INT(key, I->key); } } @@ -560,8 +560,8 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0); for (i = 0; i < proxy->dimensions; i++) { - convert_to_long(&proxy->indices[i]); - I->indices[i] = Z_LVAL(proxy->indices[i]); + convert_to_int(&proxy->indices[i]); + I->indices[i] = Z_IVAL(proxy->indices[i]); } SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin); diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index 46a3cbd5a1..0cb8c4de28 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -208,9 +208,9 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa /* register the constant */ php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage TSRMLS_CC); - if (Z_TYPE(value) == IS_LONG) { + if (Z_TYPE(value) == IS_INT) { c.flags = mode; - ZVAL_LONG(&c.value, Z_LVAL(value)); + ZVAL_INT(&c.value, Z_IVAL(value)); c.module_number = 0; zend_register_constant(&c TSRMLS_CC); } diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index f7dbdd5efa..27583e5dc9 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -39,8 +39,8 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC) HashPosition pos; int keytype; zend_string *strindex; - long intindex = -1; - long max_index = 0; + php_int_t intindex = -1; + php_int_t max_index = 0; VARIANT *va; zval *item; @@ -145,9 +145,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep safe_array_from_zval(v, z, codepage TSRMLS_CC); break; - case IS_LONG: + case IS_INT: V_VT(v) = VT_I4; - V_I4(v) = Z_LVAL_P(z); + V_I4(v) = Z_IVAL_P(z); break; case IS_DOUBLE: @@ -157,11 +157,11 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep case IS_STRING: V_VT(v) = VT_BSTR; - olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC); + olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRSIZE_P(z), codepage TSRMLS_CC); if (CP_UTF8 == codepage) { V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR)); } else { - V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR)); + V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRSIZE_P(z) * sizeof(OLECHAR)); } efree(olestring); break; @@ -187,28 +187,28 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa ZVAL_NULL(z); break; case VT_UI1: - ZVAL_LONG(z, (long)V_UI1(v)); + ZVAL_INT(z, (php_int_t)V_UI1(v)); break; case VT_I1: - ZVAL_LONG(z, (long)V_I1(v)); + ZVAL_INT(z, (php_int_t)V_I1(v)); break; case VT_UI2: - ZVAL_LONG(z, (long)V_UI2(v)); + ZVAL_INT(z, (php_int_t)V_UI2(v)); break; case VT_I2: - ZVAL_LONG(z, (long)V_I2(v)); + ZVAL_INT(z, (php_int_t)V_I2(v)); break; case VT_UI4: /* TODO: promote to double if large? */ - ZVAL_LONG(z, (long)V_UI4(v)); + ZVAL_INT(z, (php_int_t)V_UI4(v)); break; case VT_I4: - ZVAL_LONG(z, (long)V_I4(v)); + ZVAL_INT(z, (php_int_t)V_I4(v)); break; case VT_INT: - ZVAL_LONG(z, V_INT(v)); + ZVAL_INT(z, V_INT(v)); break; case VT_UINT: /* TODO: promote to double if large? */ - ZVAL_LONG(z, (long)V_UINT(v)); + ZVAL_INT(z, (php_int_t)V_UINT(v)); break; case VT_R4: ZVAL_DOUBLE(z, (double)V_R4(v)); @@ -406,8 +406,8 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSR /* {{{ com_variant_create_instance - ctor for new VARIANT() */ PHP_FUNCTION(com_variant_create_instance) { - /* VARTYPE == unsigned short */ long vt = VT_EMPTY; - long codepage = CP_ACP; + /* VARTYPE == unsigned short */ php_int_t vt = VT_EMPTY; + php_int_t codepage = CP_ACP; zval *object = getThis(); php_com_dotnet_object *obj; zval *zvalue = NULL; @@ -421,7 +421,7 @@ PHP_FUNCTION(com_variant_create_instance) obj = CDNO_FETCH(object); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "z!|ll", &zvalue, &vt, &codepage)) { + "z!|ii", &zvalue, &vt, &codepage)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments" TSRMLS_CC); return; } @@ -444,7 +444,7 @@ PHP_FUNCTION(com_variant_create_instance) but will probably fail (original behavior) */ if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) { - long orig_vt = vt; + php_int_t orig_vt = vt; vt &= ~VT_ARRAY; if (vt) { @@ -832,7 +832,7 @@ PHP_FUNCTION(variant_round) zval *zleft = NULL; php_com_dotnet_object *obj; int codepage = CP_ACP; - long decimals = 0; + php_int_t decimals = 0; VariantInit(&left_val); VariantInit(&vres); @@ -867,8 +867,8 @@ PHP_FUNCTION(variant_cmp) zval *zleft = NULL, *zright = NULL; php_com_dotnet_object *obj; int codepage = CP_ACP; - long lcid = LOCALE_SYSTEM_DEFAULT; - long flags = 0; + php_int_t lcid = LOCALE_SYSTEM_DEFAULT; + php_int_t flags = 0; /* it is safe to ignore the warning for this line; see the comments in com_handlers.c */ STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags); @@ -876,28 +876,28 @@ PHP_FUNCTION(variant_cmp) VariantInit(&right_val); if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "OO|ll", &zleft, php_com_variant_class_entry, + ZEND_NUM_ARGS() TSRMLS_CC, "OO|ii", &zleft, php_com_variant_class_entry, &zright, php_com_variant_class_entry, &lcid, &flags)) { obj = CDNO_FETCH(zleft); vleft = &obj->v; obj = CDNO_FETCH(zright); vright = &obj->v; } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ll", &zleft, php_com_variant_class_entry, + ZEND_NUM_ARGS() TSRMLS_CC, "Oz!|ii", &zleft, php_com_variant_class_entry, &zright, &lcid, &flags)) { obj = CDNO_FETCH(zleft); vleft = &obj->v; vright = &right_val; php_com_variant_from_zval(vright, zright, codepage TSRMLS_CC); } else if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, - ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ll", &zleft, &zright, php_com_variant_class_entry, + ZEND_NUM_ARGS() TSRMLS_CC, "z!O|ii", &zleft, &zright, php_com_variant_class_entry, &lcid, &flags)) { obj = CDNO_FETCH(zright); vright = &obj->v; vleft = &left_val; php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC); } else if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "z!z!|ll", &zleft, &zright, &lcid, &flags)) { + "z!z!|ii", &zleft, &zright, &lcid, &flags)) { vleft = &left_val; php_com_variant_from_zval(vleft, zleft, codepage TSRMLS_CC); @@ -909,7 +909,7 @@ PHP_FUNCTION(variant_cmp) return; } - ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags)); + ZVAL_INT(return_value, VarCmp(vleft, vright, lcid, flags)); VariantClear(&left_val); VariantClear(&right_val); @@ -948,7 +948,7 @@ PHP_FUNCTION(variant_date_to_timestamp) tmv.tm_isdst = -1; tzset(); - RETVAL_LONG(mktime(&tmv)); + RETVAL_INT(mktime(&tmv)); } VariantClear(&vres); @@ -959,13 +959,13 @@ PHP_FUNCTION(variant_date_to_timestamp) Returns a variant date representation of a unix timestamp */ PHP_FUNCTION(variant_date_from_timestamp) { - long timestamp; + php_int_t timestamp; time_t ttstamp; SYSTEMTIME systime; struct tm *tmv; VARIANT res; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", ×tamp)) { return; } @@ -1010,7 +1010,7 @@ PHP_FUNCTION(variant_get_type) } obj = CDNO_FETCH(zobj); - RETURN_LONG(V_VT(&obj->v)); + RETURN_INT(V_VT(&obj->v)); } /* }}} */ @@ -1020,11 +1020,11 @@ PHP_FUNCTION(variant_set_type) { zval *zobj; php_com_dotnet_object *obj; - /* VARTYPE == unsigned short */ long vt; + /* VARTYPE == unsigned short */ php_int_t vt; HRESULT res; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "Ol", &zobj, php_com_variant_class_entry, &vt)) { + "Oi", &zobj, php_com_variant_class_entry, &vt)) { return; } obj = CDNO_FETCH(zobj); @@ -1055,12 +1055,12 @@ PHP_FUNCTION(variant_cast) { zval *zobj; php_com_dotnet_object *obj; - /* VARTYPE == unsigned short */ long vt; + /* VARTYPE == unsigned short */ php_int_t vt; VARIANT vres; HRESULT res; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "Ol", &zobj, php_com_variant_class_entry, &vt)) { + "Oi", &zobj, php_com_variant_class_entry, &vt)) { return; } obj = CDNO_FETCH(zobj); diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index a55c767423..27ea773748 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames( ret = DISP_E_UNKNOWNNAME; rgDispId[i] = 0; } else { - rgDispId[i] = Z_LVAL_P(tmp); + rgDispId[i] = Z_IVAL_P(tmp); } efree(name); @@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid( /* Lookup the name in the hash */ if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) { trace("found it\n"); - *pid = Z_LVAL_P(tmp); + *pid = Z_IVAL_P(tmp); ret = S_OK; } @@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { /* TODO: add support for overloaded objects */ - trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRLEN_P(name), wFlags, pdp->cArgs); + trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRSIZE_P(name), wFlags, pdp->cArgs); /* convert args into zvals. * Args are in reverse order */ @@ -283,9 +283,9 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( * and expose it as a COM exception */ if (wFlags & DISPATCH_PROPERTYGET) { - retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, 1 TSRMLS_CC); + retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name)+1, 1 TSRMLS_CC); } else if (wFlags & DISPATCH_PROPERTYPUT) { - zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name), ¶ms[0] TSRMLS_CC); + zend_update_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRSIZE_P(name), ¶ms[0] TSRMLS_CC); } else if (wFlags & DISPATCH_METHOD) { zend_try { retval = &rv; @@ -385,7 +385,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername( FETCH_DISP("GetMemberName"); if (NULL != (name = zend_hash_index_find(disp->dispid_to_name, id))) { - OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRLEN_P(name), COMG(code_page) TSRMLS_CC); + OLECHAR *olestr = php_com_string_to_olestring(Z_STRVAL_P(name), Z_STRSIZE_P(name), COMG(code_page) TSRMLS_CC); *pbstrName = SysAllocString(olestr); efree(olestr); return S_OK; @@ -450,7 +450,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) zend_string *name = NULL; zval *tmp, tmp2; int keytype; - ulong pid; + php_uint_t pid; if (disp->dispid_to_name == NULL) { ALLOC_HASHTABLE(disp->dispid_to_name); @@ -466,8 +466,8 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) zend_hash_get_current_key_ex(Z_OBJPROP(disp->object), &name, &pid, 0, &pos))) { char namebuf[32]; - if (keytype == HASH_KEY_IS_LONG) { - snprintf(namebuf, sizeof(namebuf), "%d", pid); + if (keytype == HASH_KEY_IS_INT) { + snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid); name = STR_INIT(namebuf, strlen(namebuf), 0); } else { STR_ADDREF(name); @@ -486,7 +486,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - ZVAL_LONG(&tmp2, pid); + ZVAL_INT(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); STR_RELEASE(name); @@ -501,7 +501,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) &name, &pid, 0, &pos))) { char namebuf[32]; - if (keytype == HASH_KEY_IS_LONG) { + if (keytype == HASH_KEY_IS_INT) { snprintf(namebuf, sizeof(namebuf), "%d", pid); name = STR_INIT(namebuf, strlen(namebuf), 0); } else { @@ -521,7 +521,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - ZVAL_LONG(&tmp2, pid); + ZVAL_INT(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); STR_RELEASE(name); @@ -590,7 +590,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si zend_string *name = NULL; zval tmp, *ntmp; int keytype; - ulong pid; + php_uint_t pid; disp->dispid_to_name = id_to_name; @@ -604,11 +604,11 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si while (HASH_KEY_NON_EXISTENT != (keytype = zend_hash_get_current_key_ex(id_to_name, &name, &pid, 0, &pos))) { - if (keytype == HASH_KEY_IS_LONG) { + if (keytype == HASH_KEY_IS_INT) { ntmp = zend_hash_get_current_data_ex(id_to_name, &pos); - ZVAL_LONG(&tmp, pid); + ZVAL_INT(&tmp, pid); zend_hash_update(disp->name_to_dispid, Z_STR_P(ntmp), &tmp); } diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index d093e3c37b..5d4e75b3f8 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -38,7 +38,7 @@ typedef struct _php_com_dotnet_object { int modified; ITypeInfo *typeinfo; - long code_page; + php_int_t code_page; zend_class_entry *ce; diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c index 8f116b86d3..e9ccc9f3de 100644 --- a/ext/ctype/ctype.c +++ b/ext/ctype/ctype.c @@ -146,11 +146,11 @@ static PHP_MINFO_FUNCTION(ctype) zval *c, tmp; \ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \ return; \ - if (Z_TYPE_P(c) == IS_LONG) { \ - if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \ - RETURN_BOOL(iswhat(Z_LVAL_P(c))); \ - } else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \ - RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \ + if (Z_TYPE_P(c) == IS_INT) { \ + if (Z_IVAL_P(c) <= 255 && Z_IVAL_P(c) >= 0) { \ + RETURN_BOOL(iswhat(Z_IVAL_P(c))); \ + } else if (Z_IVAL_P(c) >= -128 && Z_IVAL_P(c) < 0) { \ + RETURN_BOOL(iswhat(Z_IVAL_P(c) + 256)); \ } \ tmp = *c; \ zval_copy_ctor(&tmp); \ @@ -159,18 +159,18 @@ static PHP_MINFO_FUNCTION(ctype) tmp = *c; \ } \ if (Z_TYPE(tmp) == IS_STRING) { \ - char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \ + char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRSIZE(tmp); \ if (e == p) { \ - if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ RETURN_FALSE; \ } \ while (p < e) { \ if(!iswhat((int)*(unsigned char *)(p++))) { \ - if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ RETURN_FALSE; \ } \ } \ - if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \ + if (Z_TYPE_P(c) == IS_INT) zval_dtor(&tmp); \ RETURN_TRUE; \ } else { \ RETURN_FALSE; \ diff --git a/ext/curl/interface.c b/ext/curl/interface.c index b45e7efc83..2f493e2686 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -154,7 +154,7 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC); #define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err; -#define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (long) v); +#define CAAL(s, v) add_assoc_int_ex(return_value, s, sizeof(s) - 1, (php_int_t) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v); #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : "")); #define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : STR_EMPTY_ALLOC()); @@ -166,7 +166,7 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC); # define php_curl_ret(__ret) RETVAL_FALSE; return; #endif -static int php_curl_option_str(php_curl *ch, long option, const char *str, const int len, zend_bool make_copy TSRMLS_DC) +static int php_curl_option_str(php_curl *ch, php_int_t option, const char *str, const int len, zend_bool make_copy TSRMLS_DC) { CURLcode error = CURLE_OK; @@ -612,7 +612,7 @@ PHP_MINFO_FUNCTION(curl) } /* }}} */ -#define REGISTER_CURL_CONSTANT(__c) REGISTER_LONG_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT) +#define REGISTER_CURL_CONSTANT(__c) REGISTER_INT_CONSTANT(#__c, __c, CONST_CS | CONST_PERSISTENT) /* {{{ PHP_MINIT_FUNCTION */ @@ -1318,10 +1318,10 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - length = Z_LVAL(retval); + length = Z_IVAL(retval); } zval_ptr_dtor(&argv[0]); @@ -1371,10 +1371,10 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string) if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_FNMATCH_FUNCTION"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - rval = Z_LVAL(retval); + rval = Z_IVAL(retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); @@ -1410,10 +1410,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); - ZVAL_LONG(&argv[1], (long)dltotal); - ZVAL_LONG(&argv[2], (long)dlnow); - ZVAL_LONG(&argv[3], (long)ultotal); - ZVAL_LONG(&argv[4], (long)ulnow); + ZVAL_INT(&argv[1], (long)dltotal); + ZVAL_INT(&argv[2], (long)dlnow); + ZVAL_INT(&argv[3], (long)ultotal); + ZVAL_INT(&argv[4], (long)ulnow); fci.size = sizeof(fci); fci.function_table = EG(function_table); @@ -1431,10 +1431,10 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - if (0 != Z_LVAL(retval)) { + if (0 != Z_IVAL(retval)) { rval = 1; } } @@ -1475,7 +1475,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) Z_ADDREF(argv[0]); ZVAL_RES(&argv[1], t->res); Z_ADDREF(argv[1]); - ZVAL_LONG(&argv[2], (int)size * nmemb); + ZVAL_INT(&argv[2], (int)size * nmemb); fci.size = sizeof(fci); fci.function_table = EG(function_table); @@ -1497,7 +1497,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) #endif } else if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) == IS_STRING) { - length = MIN((int) (size * nmemb), Z_STRLEN(retval)); + length = MIN((int) (size * nmemb), Z_STRSIZE(retval)); memcpy(data, Z_STRVAL(retval), length); } zval_ptr_dtor(&retval); @@ -1562,10 +1562,10 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION"); length = -1; } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } - length = Z_LVAL(retval); + length = Z_IVAL(retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); @@ -1616,16 +1616,16 @@ static size_t curl_passwd(void *ctx, char *prompt, char *buf, int buflen) ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_STRING(&argv[1], prompt); - ZVAL_LONG(&argv[2], buflen); + ZVAL_INT(&argv[2], buflen); error = call_user_function(EG(function_table), NULL, func, &retval, 2, argv TSRMLS_CC); if (error == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_PASSWDFUNCTION"); } else if (Z_TYPE(retval) == IS_STRING) { - if (Z_STRLEN(retval) > buflen) { + if (Z_STRSIZE(retval) > buflen) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Returned password is too long for libcurl to handle"); } else { - memcpy(buf, Z_STRVAL(retval), Z_STRLEN(retval) + 1); + memcpy(buf, Z_STRVAL(retval), Z_STRSIZE(retval) + 1); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "User handler '%s' did not return a string", Z_STRVAL_P(func)); @@ -1670,9 +1670,9 @@ static void curl_free_slist(zval *el) PHP_FUNCTION(curl_version) { curl_version_info_data *d; - long uversion = CURLVERSION_NOW; + php_int_t uversion = CURLVERSION_NOW; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uversion) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &uversion) == FAILURE) { return; } @@ -1986,15 +1986,15 @@ PHP_FUNCTION(curl_copy_handle) } /* }}} */ -static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) /* {{{ */ +static int _php_curl_setopt(php_curl *ch, php_int_t option, zval *zvalue TSRMLS_DC) /* {{{ */ { CURLcode error = CURLE_OK; switch (option) { /* Long options */ case CURLOPT_SSL_VERIFYHOST: - convert_to_long(zvalue); - if (Z_LVAL_P(zvalue) == 1) { + convert_to_int(zvalue); + if (Z_IVAL_P(zvalue) == 1) { #if LIBCURL_VERSION_NUM <= 0x071c00 /* 7.28.0 */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead"); #else @@ -2148,19 +2148,19 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #if CURLOPT_MUTE != 0 case CURLOPT_MUTE: #endif - convert_to_long_ex(zvalue); + convert_to_int_ex(zvalue); #if LIBCURL_VERSION_NUM >= 0x71304 if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) && - (PG(open_basedir) && *PG(open_basedir)) && (Z_LVAL_P(zvalue) & CURLPROTO_FILE)) { + (PG(open_basedir) && *PG(open_basedir)) && (Z_IVAL_P(zvalue) & CURLPROTO_FILE)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set"); return 1; } #endif - error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); break; case CURLOPT_SAFE_UPLOAD: - convert_to_long_ex(zvalue); - ch->safe_upload = (Z_LVAL_P(zvalue) != 0); + convert_to_int_ex(zvalue); + ch->safe_upload = (Z_IVAL_P(zvalue) != 0); break; /* String options */ @@ -2222,7 +2222,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #endif { convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); } /* Curl nullable string options */ @@ -2245,7 +2245,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / error = curl_easy_setopt(ch->cp, option, NULL); } else { convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); } break; } @@ -2253,12 +2253,12 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / /* Curl private option */ case CURLOPT_PRIVATE: convert_to_string_ex(zvalue); - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 1 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 1 TSRMLS_CC); /* Curl url option */ case CURLOPT_URL: convert_to_string_ex(zvalue); - return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue) TSRMLS_CC); + return php_curl_option_url(ch, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue) TSRMLS_CC); /* Curl file handle options */ case CURLOPT_FILE: @@ -2436,16 +2436,16 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / break; case CURLOPT_FOLLOWLOCATION: - convert_to_long_ex(zvalue); + convert_to_int_ex(zvalue); #if LIBCURL_VERSION_NUM < 0x071304 if (PG(open_basedir) && *PG(open_basedir)) { - if (Z_LVAL_P(zvalue) != 0) { + if (Z_IVAL_P(zvalue) != 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set"); return FAILURE; } } #endif - error = curl_easy_setopt(ch->cp, option, Z_LVAL_P(zvalue)); + error = curl_easy_setopt(ch->cp, option, Z_IVAL_P(zvalue)); break; case CURLOPT_HEADERFUNCTION: @@ -2476,7 +2476,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / char *postval; /* Pretend we have a string_key here */ if (!string_key) { - string_key = zend_long_to_str(num_key); + string_key = zend_int_to_str(num_key); } else { STR_ADDREF(string_key); } @@ -2498,11 +2498,11 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / } prop = zend_read_property(curl_CURLFile_class, current, "mime", sizeof("mime")-1, 0 TSRMLS_CC); - if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) { + if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) { type = Z_STRVAL_P(prop); } prop = zend_read_property(curl_CURLFile_class, current, "postname", sizeof("postname")-1, 0 TSRMLS_CC); - if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) { + if (Z_TYPE_P(prop) == IS_STRING && Z_STRSIZE_P(prop) > 0) { filename = Z_STRVAL_P(prop); } error = curl_formadd(&first, &last, @@ -2533,13 +2533,13 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / php_error_docref("curl.curlfile" TSRMLS_CC, E_DEPRECATED, "The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead"); - name = estrndup(postval, Z_STRLEN_P(current)); + name = estrndup(postval, Z_STRSIZE_P(current)); if ((type = php_memnstr(name, ";type=", sizeof(";type=") - 1, - name + Z_STRLEN_P(current)))) { + name + Z_STRSIZE_P(current)))) { *type = '\0'; } if ((filename = php_memnstr(name, ";filename=", sizeof(";filename=") - 1, - name + Z_STRLEN_P(current)))) { + name + Z_STRSIZE_P(current)))) { *filename = '\0'; } /* open_basedir check */ @@ -2560,7 +2560,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / CURLFORM_COPYNAME, string_key->val, CURLFORM_NAMELENGTH, (long)string_key->len, CURLFORM_COPYCONTENTS, postval, - CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_P(current), + CURLFORM_CONTENTSLENGTH, (long)Z_STRSIZE_P(current), CURLFORM_END); } @@ -2581,17 +2581,17 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #if LIBCURL_VERSION_NUM >= 0x071101 convert_to_string_ex(zvalue); /* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */ - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue)); error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, Z_STRVAL_P(zvalue)); #else char *post = NULL; convert_to_string_ex(zvalue); - post = estrndup(Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue)); + post = estrndup(Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue)); zend_llist_add_element(&ch->to_free->str, &post); curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_P(zvalue)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRSIZE_P(zvalue)); #endif } break; @@ -2619,8 +2619,8 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / break; case CURLOPT_RETURNTRANSFER: - convert_to_long_ex(zvalue); - if (Z_LVAL_P(zvalue)) { + convert_to_int_ex(zvalue); + if (Z_IVAL_P(zvalue)) { ch->handlers->write->method = PHP_CURL_RETURN; } else { ch->handlers->write->method = PHP_CURL_STDOUT; @@ -2639,15 +2639,15 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / #if LIBCURL_VERSION_NUM >= 0x070f05 /* Available since 7.15.5 */ case CURLOPT_MAX_RECV_SPEED_LARGE: case CURLOPT_MAX_SEND_SPEED_LARGE: - convert_to_long_ex(zvalue); - error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_LVAL_P(zvalue)); + convert_to_int_ex(zvalue); + error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_IVAL_P(zvalue)); break; #endif #if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */ case CURLOPT_POSTREDIR: - convert_to_long_ex(zvalue); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_LVAL_P(zvalue) & CURL_REDIR_POST_ALL); + convert_to_int_ex(zvalue); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, Z_IVAL_P(zvalue) & CURL_REDIR_POST_ALL); break; #endif @@ -2684,16 +2684,16 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / { convert_to_string_ex(zvalue); - if (Z_STRLEN_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) { + if (Z_STRSIZE_P(zvalue) && php_check_open_basedir(Z_STRVAL_P(zvalue) TSRMLS_CC)) { return FAILURE; } - return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), 0 TSRMLS_CC); + return php_curl_option_str(ch, option, Z_STRVAL_P(zvalue), Z_STRSIZE_P(zvalue), 0 TSRMLS_CC); } case CURLINFO_HEADER_OUT: - convert_to_long_ex(zvalue); - if (Z_LVAL_P(zvalue) == 1) { + convert_to_int_ex(zvalue); + if (Z_IVAL_P(zvalue) == 1) { curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug); curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch); curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1); @@ -2744,10 +2744,10 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) / PHP_FUNCTION(curl_setopt) { zval *zid, *zvalue; - long options; + php_int_t options; php_curl *ch; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zid, &options, &zvalue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &zid, &options, &zvalue) == FAILURE) { return; } @@ -2772,7 +2772,7 @@ PHP_FUNCTION(curl_setopt_array) { zval *zid, *arr, *entry; php_curl *ch; - ulong option; + php_uint_t option; zend_string *string_key; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) { @@ -2787,7 +2787,7 @@ PHP_FUNCTION(curl_setopt_array) "Array keys must be CURLOPT constants or equivalent integer values"); RETURN_FALSE; } - if (_php_curl_setopt(ch, (long) option, entry TSRMLS_CC) == FAILURE) { + if (_php_curl_setopt(ch, (php_int_t) option, entry TSRMLS_CC) == FAILURE) { RETURN_FALSE; } } ZEND_HASH_FOREACH_END(); @@ -2872,9 +2872,9 @@ PHP_FUNCTION(curl_getinfo) { zval *zid; php_curl *ch; - long option = 0; + php_int_t option = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zid, &option) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zid, &option) == FAILURE) { return; } @@ -2882,7 +2882,7 @@ PHP_FUNCTION(curl_getinfo) if (ZEND_NUM_ARGS() < 2) { char *s_code; - long l_code; + php_int_t l_code; double d_code; #if LIBCURL_VERSION_NUM > 0x071301 struct curl_certinfo *ci = NULL; @@ -3026,10 +3026,10 @@ PHP_FUNCTION(curl_getinfo) } case CURLINFO_LONG: { - long code = 0; + php_int_t code = 0; if (curl_easy_getinfo(ch->cp, option, &code) == CURLE_OK) { - RETURN_LONG(code); + RETURN_INT(code); } else { RETURN_FALSE; } @@ -3103,7 +3103,7 @@ PHP_FUNCTION(curl_errno) ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); - RETURN_LONG(ch->err.no); + RETURN_INT(ch->err.no); } /* }}} */ @@ -3217,10 +3217,10 @@ static void _php_curl_close(zend_resource *rsrc TSRMLS_DC) return string describing error code */ PHP_FUNCTION(curl_strerror) { - long code; + php_int_t code; const char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) { return; } @@ -3363,17 +3363,17 @@ PHP_FUNCTION(curl_unescape) pause and unpause a connection */ PHP_FUNCTION(curl_pause) { - long bitmask; + php_int_t bitmask; zval *zid; php_curl *ch; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zid, &bitmask) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zid, &bitmask) == FAILURE) { return; } ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl); - RETURN_LONG(curl_easy_pause(ch->cp, bitmask)); + RETURN_INT(curl_easy_pause(ch->cp, bitmask)); } /* }}} */ #endif diff --git a/ext/curl/multi.c b/ext/curl/multi.c index 5550972bba..a3441bda78 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -92,7 +92,7 @@ PHP_FUNCTION(curl_multi_add_handle) zend_llist_add_element(&mh->easyh, &tmp_val); - RETURN_LONG((long)curl_multi_add_handle(mh->multi, ch->cp)); + RETURN_INT((php_int_t)curl_multi_add_handle(mh->multi, ch->cp)); } /* }}} */ @@ -140,7 +140,7 @@ PHP_FUNCTION(curl_multi_remove_handle) ZEND_FETCH_RESOURCE(mh, php_curlm *, z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle); ZEND_FETCH_RESOURCE(ch, php_curl *, z_ch, -1, le_curl_name, le_curl); - RETVAL_LONG((long)curl_multi_remove_handle(mh->multi, ch->cp)); + RETVAL_INT((php_int_t)curl_multi_remove_handle(mh->multi, ch->cp)); zend_llist_del_element(&mh->easyh, &z_ch, (int (*)(void *, void *))curl_compare_resources); } @@ -183,9 +183,9 @@ PHP_FUNCTION(curl_multi_select) curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd); if (maxfd == -1) { - RETURN_LONG(-1); + RETURN_INT(-1); } - RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); + RETURN_INT(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); } /* }}} */ @@ -218,12 +218,12 @@ PHP_FUNCTION(curl_multi_exec) } } - convert_to_long_ex(z_still_running); - still_running = Z_LVAL_P(z_still_running); + convert_to_int_ex(z_still_running); + still_running = Z_IVAL_P(z_still_running); result = curl_multi_perform(mh->multi, &still_running); - ZVAL_LONG(z_still_running, still_running); + ZVAL_INT(z_still_running, still_running); - RETURN_LONG(result); + RETURN_INT(result); } /* }}} */ @@ -271,12 +271,12 @@ PHP_FUNCTION(curl_multi_info_read) } if (zmsgs_in_queue) { zval_dtor(zmsgs_in_queue); - ZVAL_LONG(zmsgs_in_queue, queued_msgs); + ZVAL_INT(zmsgs_in_queue, queued_msgs); } array_init(return_value); - add_assoc_long(return_value, "msg", tmp_msg->msg); - add_assoc_long(return_value, "result", tmp_msg->data.result); + add_assoc_int(return_value, "msg", tmp_msg->msg); + add_assoc_int(return_value, "result", tmp_msg->data.result); /* find the original easy curl handle */ { @@ -357,10 +357,10 @@ void _php_curl_multi_close(zend_resource *rsrc TSRMLS_DC) /* {{{ */ return string describing error code */ PHP_FUNCTION(curl_multi_strerror) { - long code; + php_int_t code; const char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) { return; } @@ -375,7 +375,7 @@ PHP_FUNCTION(curl_multi_strerror) #endif #if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */ -static int _php_curl_multi_setopt(php_curlm *mh, long option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ +static int _php_curl_multi_setopt(php_curlm *mh, php_int_t option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ { CURLMcode error = CURLM_OK; @@ -386,8 +386,8 @@ static int _php_curl_multi_setopt(php_curlm *mh, long option, zval *zvalue, zval #if LIBCURL_VERSION_NUM >= 0x071003 /* 7.16.3 */ case CURLMOPT_MAXCONNECTS: #endif - convert_to_long_ex(zvalue); - error = curl_multi_setopt(mh->multi, option, Z_LVAL_P(zvalue)); + convert_to_int_ex(zvalue); + error = curl_multi_setopt(mh->multi, option, Z_IVAL_P(zvalue)); break; default: @@ -409,10 +409,10 @@ static int _php_curl_multi_setopt(php_curlm *mh, long option, zval *zvalue, zval PHP_FUNCTION(curl_multi_setopt) { zval *z_mh, *zvalue; - long options; + php_int_t options; php_curlm *mh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_mh, &options, &zvalue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &z_mh, &options, &zvalue) == FAILURE) { return; } diff --git a/ext/curl/share.c b/ext/curl/share.c index 5983579f08..a0d5b006d0 100644 --- a/ext/curl/share.c +++ b/ext/curl/share.c @@ -66,15 +66,15 @@ PHP_FUNCTION(curl_share_close) } /* }}} */ -static int _php_curl_share_setopt(php_curlsh *sh, long option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ +static int _php_curl_share_setopt(php_curlsh *sh, php_int_t option, zval *zvalue, zval *return_value TSRMLS_DC) /* {{{ */ { CURLSHcode error = CURLSHE_OK; switch (option) { case CURLSHOPT_SHARE: case CURLSHOPT_UNSHARE: - convert_to_long_ex(zvalue); - error = curl_share_setopt(sh->share, option, Z_LVAL_P(zvalue)); + convert_to_int_ex(zvalue); + error = curl_share_setopt(sh->share, option, Z_IVAL_P(zvalue)); break; default: @@ -96,10 +96,10 @@ static int _php_curl_share_setopt(php_curlsh *sh, long option, zval *zvalue, zva PHP_FUNCTION(curl_share_setopt) { zval *zid, *zvalue; - long options; + php_int_t options; php_curlsh *sh; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zid, &options, &zvalue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &zid, &options, &zvalue) == FAILURE) { return; } diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index fbc76402ab..ad9727d197 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Mon Aug 18 18:28:27 2014 */ +/* Generated by re2c 0.13.5 on Tue Aug 19 08:27:07 2014 */ #line 1 "ext/date/lib/parse_date.re" /* +----------------------------------------------------------------------+ diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index bf7c55a735..ad25f8b5c6 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -176,13 +176,13 @@ void timelib_error_container_dtor(timelib_error_container *errors) free(errors); } -signed long timelib_date_to_int(timelib_time *d, int *error) +php_int_t timelib_date_to_int(timelib_time *d, int *error) { timelib_sll ts; ts = d->sse; - if (ts < LONG_MIN || ts > LONG_MAX) { + if (ts < PHP_INT_MIN || ts > PHP_INT_MAX) { if (error) { *error = 1; } @@ -191,7 +191,7 @@ signed long timelib_date_to_int(timelib_time *d, int *error) if (error) { *error = 0; } - return (signed long) d->sse; + return (php_int_t) d->sse; } void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec) diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h index 08484fbec1..45160ae238 100644 --- a/ext/date/lib/timelib.h +++ b/ext/date/lib/timelib.h @@ -21,6 +21,7 @@ #ifndef __TIMELIB_H__ #define __TIMELIB_H__ +#include "php.h" /* for php_int_t */ #include "timelib_structs.h" #if HAVE_LIMITS_H #include <limits.h> @@ -128,7 +129,7 @@ void timelib_time_offset_dtor(timelib_time_offset* t); void timelib_error_container_dtor(timelib_error_container *errors); -signed long timelib_date_to_int(timelib_time *d, int *error); +php_int_t timelib_date_to_int(timelib_time *d, int *error); void timelib_dump_date(timelib_time *d, int options); void timelib_dump_rel_time(timelib_rel_time *d); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index b611a911b0..813f8663f0 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -39,24 +39,6 @@ static __inline __int64_t php_date_llabs( __int64_t i ) { return i >= 0 ? i : -i static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; } #endif -#ifdef PHP_WIN32 -#define DATE_I64_BUF_LEN 65 -# define DATE_I64A(i, s, len) _i64toa_s(i, s, len, 10) -# define DATE_A64I(i, s) i = _atoi64(s) -#else -#define DATE_I64_BUF_LEN 65 -# define DATE_I64A(i, s, len) \ - do { \ - int st = snprintf(s, len, "%lld", i); \ - s[st] = '\0'; \ - } while (0); -#ifdef HAVE_ATOLL -# define DATE_A64I(i, s) i = atoll(s) -#else -# define DATE_A64I(i, s) i = strtoll(s, NULL, 10) -#endif -#endif - /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1) ZEND_ARG_INFO(0, format) @@ -860,9 +842,9 @@ PHP_MINIT_FUNCTION(date) REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); php_date_global_timezone_db = NULL; php_date_global_timezone_db_enabled = 0; @@ -962,7 +944,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) zval ztz; if (SUCCESS == zend_get_configuration_directive("date.timezone", sizeof("date.timezone"), &ztz) - && Z_TYPE(ztz) == IS_STRING && Z_STRLEN(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { + && Z_TYPE(ztz) == IS_STRING && Z_STRSIZE(ztz) > 0 && timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } } else if (*DATEG(default_timezone)) { @@ -1217,9 +1199,9 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) { char *format; int format_len; - long ts; + php_int_t ts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() == 1) { @@ -1373,10 +1355,10 @@ PHP_FUNCTION(idate) { char *format; int format_len; - long ts = 0; + php_int_t ts = 0; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } @@ -1394,7 +1376,7 @@ PHP_FUNCTION(idate) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token."); RETURN_FALSE; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1411,12 +1393,12 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb) /* }}} */ /* {{{ php_parse_date: Backwards compatibility function */ -PHPAPI signed long php_parse_date(char *string, signed long *now) +PHPAPI php_int_t php_parse_date(char *string, php_int_t *now) { timelib_time *parsed_time; timelib_error_container *error = NULL; int error2; - signed long retval; + php_int_t retval; parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); if (error->error_count) { @@ -1442,14 +1424,14 @@ PHP_FUNCTION(strtotime) char *times, *initial_ts; int time_len, error1, error2; struct timelib_error_container *error; - long preset_ts = 0, ts; + php_int_t preset_ts = 0, ts; timelib_time *t, *now; timelib_tzinfo *tzi; tzi = get_timezone_info(TSRMLS_C); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sl", ×, &time_len, &preset_ts) != FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "si", ×, &time_len, &preset_ts) != FAILURE) { /* We have an initial timestamp */ now = timelib_time_ctor(); @@ -1462,7 +1444,7 @@ PHP_FUNCTION(strtotime) timelib_unixtime2local(now, t->sse); timelib_time_dtor(t); efree(initial_ts); - } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ×, &time_len, &preset_ts) != FAILURE) { + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", ×, &time_len, &preset_ts) != FAILURE) { /* We have no initial timestamp */ now = timelib_time_ctor(); now->tz_info = tzi; @@ -1490,7 +1472,7 @@ PHP_FUNCTION(strtotime) if (error1 || error2) { RETURN_FALSE; } else { - RETURN_LONG(ts); + RETURN_INT(ts); } } /* }}} */ @@ -1498,13 +1480,13 @@ PHP_FUNCTION(strtotime) /* {{{ php_mktime - (gm)mktime helper */ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { - long hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1; + php_int_t hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1; timelib_time *now; timelib_tzinfo *tzi = NULL; - long ts, adjust_seconds = 0; + php_int_t ts, adjust_seconds = 0; int error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lllllll", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iiiiiii", &hou, &min, &sec, &mon, &day, &yea, &dst) == FAILURE) { RETURN_FALSE; } /* Initialize structure with current time */ @@ -1582,7 +1564,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) if (error) { RETURN_FALSE; } else { - RETURN_LONG(ts); + RETURN_INT(ts); } } /* }}} */ @@ -1607,9 +1589,9 @@ PHP_FUNCTION(gmmktime) Returns true(1) if it is a valid date in gregorian calendar */ PHP_FUNCTION(checkdate) { - long m, d, y; + php_int_t m, d, y; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &m, &d, &y) == FAILURE) { RETURN_FALSE; } @@ -1626,7 +1608,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { char *format; int format_len; - long timestamp = 0; + php_int_t timestamp = 0; struct tm ta; int max_reallocs = 5; size_t buf_len = 256, real_len; @@ -1635,9 +1617,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) timelib_time_offset *offset = NULL; zend_string *buf; - timestamp = (long) time(NULL); + timestamp = (php_int_t) time(NULL); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, ×tamp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &format, &format_len, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -1737,7 +1719,7 @@ PHP_FUNCTION(gmstrftime) Return current UNIX timestamp */ PHP_FUNCTION(time) { - RETURN_LONG((long)time(NULL)); + RETURN_INT((php_int_t)time(NULL)); } /* }}} */ @@ -1745,12 +1727,12 @@ PHP_FUNCTION(time) Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */ PHP_FUNCTION(localtime) { - long timestamp = (long)time(NULL); + php_int_t timestamp = (php_int_t)time(NULL); zend_bool associative = 0; timelib_tzinfo *tzi; timelib_time *ts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lb", ×tamp, &associative) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ib", ×tamp, &associative) == FAILURE) { RETURN_FALSE; } @@ -1763,25 +1745,25 @@ PHP_FUNCTION(localtime) array_init(return_value); if (associative) { - add_assoc_long(return_value, "tm_sec", ts->s); - add_assoc_long(return_value, "tm_min", ts->i); - add_assoc_long(return_value, "tm_hour", ts->h); - add_assoc_long(return_value, "tm_mday", ts->d); - add_assoc_long(return_value, "tm_mon", ts->m - 1); - add_assoc_long(return_value, "tm_year", ts->y - 1900); - add_assoc_long(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d)); - add_assoc_long(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d)); - add_assoc_long(return_value, "tm_isdst", ts->dst); + add_assoc_int(return_value, "tm_sec", ts->s); + add_assoc_int(return_value, "tm_min", ts->i); + add_assoc_int(return_value, "tm_hour", ts->h); + add_assoc_int(return_value, "tm_mday", ts->d); + add_assoc_int(return_value, "tm_mon", ts->m - 1); + add_assoc_int(return_value, "tm_year", ts->y - 1900); + add_assoc_int(return_value, "tm_wday", timelib_day_of_week(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "tm_yday", timelib_day_of_year(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "tm_isdst", ts->dst); } else { - add_next_index_long(return_value, ts->s); - add_next_index_long(return_value, ts->i); - add_next_index_long(return_value, ts->h); - add_next_index_long(return_value, ts->d); - add_next_index_long(return_value, ts->m - 1); - add_next_index_long(return_value, ts->y- 1900); - add_next_index_long(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); - add_next_index_long(return_value, timelib_day_of_year(ts->y, ts->m, ts->d)); - add_next_index_long(return_value, ts->dst); + add_next_index_int(return_value, ts->s); + add_next_index_int(return_value, ts->i); + add_next_index_int(return_value, ts->h); + add_next_index_int(return_value, ts->d); + add_next_index_int(return_value, ts->m - 1); + add_next_index_int(return_value, ts->y- 1900); + add_next_index_int(return_value, timelib_day_of_week(ts->y, ts->m, ts->d)); + add_next_index_int(return_value, timelib_day_of_year(ts->y, ts->m, ts->d)); + add_next_index_int(return_value, ts->dst); } timelib_time_dtor(ts); @@ -1792,11 +1774,11 @@ PHP_FUNCTION(localtime) Get date/time information */ PHP_FUNCTION(getdate) { - long timestamp = (long)time(NULL); + php_int_t timestamp = (php_int_t)time(NULL); timelib_tzinfo *tzi; timelib_time *ts; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", ×tamp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", ×tamp) == FAILURE) { RETURN_FALSE; } @@ -1808,17 +1790,17 @@ PHP_FUNCTION(getdate) array_init(return_value); - add_assoc_long(return_value, "seconds", ts->s); - add_assoc_long(return_value, "minutes", ts->i); - add_assoc_long(return_value, "hours", ts->h); - add_assoc_long(return_value, "mday", ts->d); - add_assoc_long(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); - add_assoc_long(return_value, "mon", ts->m); - add_assoc_long(return_value, "year", ts->y); - add_assoc_long(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "seconds", ts->s); + add_assoc_int(return_value, "minutes", ts->i); + add_assoc_int(return_value, "hours", ts->h); + add_assoc_int(return_value, "mday", ts->d); + add_assoc_int(return_value, "wday", timelib_day_of_week(ts->y, ts->m, ts->d)); + add_assoc_int(return_value, "mon", ts->m); + add_assoc_int(return_value, "year", ts->y); + add_assoc_int(return_value, "yday", timelib_day_of_year(ts->y, ts->m, ts->d)); add_assoc_string(return_value, "weekday", php_date_full_day_name(ts->y, ts->m, ts->d)); add_assoc_string(return_value, "month", mon_full_names[ts->m - 1]); - add_index_long(return_value, 0, timestamp); + add_index_int(return_value, 0, timestamp); timelib_time_dtor(ts); } @@ -1925,7 +1907,7 @@ static zval *date_period_it_current_data(zend_object_iterator *iter TSRMLS_DC) static void date_period_it_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { date_period_it *iterator = (date_period_it *)iter; - ZVAL_LONG(key, iterator->current_index); + ZVAL_INT(key, iterator->current_index); } /* }}} */ @@ -2049,7 +2031,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */ date_object_handlers_timezone.get_gc = date_object_get_gc_timezone; #define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); + zend_declare_class_constant_int(date_ce_timezone, const_name, sizeof(const_name)-1, value TSRMLS_CC); REGISTER_TIMEZONE_CLASS_CONST_STRING("AFRICA", PHP_DATE_TIMEZONE_GROUP_AFRICA); REGISTER_TIMEZONE_CLASS_CONST_STRING("AMERICA", PHP_DATE_TIMEZONE_GROUP_AMERICA); @@ -2096,7 +2078,7 @@ static void date_register_classes(TSRMLS_D) /* {{{ */ date_object_handlers_period.write_property = date_period_write_property; #define REGISTER_PERIOD_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_long(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); + zend_declare_class_constant_int(date_ce_period, const_name, sizeof(const_name)-1, value TSRMLS_CC); REGISTER_PERIOD_CLASS_CONST_STRING("EXCLUDE_START_DATE", PHP_DATE_PERIOD_EXCLUDE_START_DATE); } /* }}} */ @@ -2203,7 +2185,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC) /* {{{ */ /* then we add the timezone name (or similar) */ if (dateobj->time->is_localtime) { - ZVAL_LONG(&zv, dateobj->time->zone_type); + ZVAL_INT(&zv, dateobj->time->zone_type); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); switch (dateobj->time->zone_type) { @@ -2296,7 +2278,7 @@ static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC) /* return props; } - ZVAL_LONG(&zv, tzobj->type); + ZVAL_INT(&zv, tzobj->type); zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv); switch (tzobj->type) { @@ -2377,7 +2359,7 @@ static HashTable *date_object_get_properties_interval(zval *object TSRMLS_DC) /* } #define PHP_DATE_INTERVAL_ADD_PROPERTY(n,f) \ - ZVAL_LONG(&zv, (long)intervalobj->diff->f); \ + ZVAL_INT(&zv, (php_int_t)intervalobj->diff->f); \ zend_hash_str_update(props, n, sizeof(n)-1, &zv); PHP_DATE_INTERVAL_ADD_PROPERTY("y", y); @@ -2760,18 +2742,18 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht convert_to_string(z_date); z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1); if (z_timezone_type) { - convert_to_long(z_timezone_type); + convert_to_int(z_timezone_type); z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1); if (z_timezone) { convert_to_string(z_timezone); - switch (Z_LVAL_P(z_timezone_type)) { + switch (Z_IVAL_P(z_timezone_type)) { case TIMELIB_ZONETYPE_OFFSET: case TIMELIB_ZONETYPE_ABBR: { - char *tmp = emalloc(Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2); + char *tmp = emalloc(Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2); int ret; - snprintf(tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone)); - ret = php_date_initialize(*dateobj, tmp, Z_STRLEN_P(z_date) + Z_STRLEN_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); + snprintf(tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 2, "%s %s", Z_STRVAL_P(z_date), Z_STRVAL_P(z_timezone)); + ret = php_date_initialize(*dateobj, tmp, Z_STRSIZE_P(z_date) + Z_STRSIZE_P(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC); efree(tmp); return 1 == ret; } @@ -2791,7 +2773,7 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht tzobj->tzi.tz = tzi; tzobj->initialized = 1; - ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRLEN_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC); + ret = php_date_initialize(*dateobj, Z_STRVAL_P(z_date), Z_STRSIZE_P(z_date), NULL, &tmp_obj, 0 TSRMLS_CC); zval_ptr_dtor(&tmp_obj); return 1 == ret; } @@ -2870,14 +2852,14 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) / int i; zval element; - add_assoc_long(z, "warning_count", error->warning_count); + add_assoc_int(z, "warning_count", error->warning_count); array_init(&element); for (i = 0; i < error->warning_count; i++) { add_index_string(&element, error->warning_messages[i].position, error->warning_messages[i].message); } add_assoc_zval(z, "warnings", &element); - add_assoc_long(z, "error_count", error->error_count); + add_assoc_int(z, "error_count", error->error_count); array_init(&element); for (i = 0; i < error->error_count; i++) { add_index_string(&element, error->error_messages[i].position, error->error_messages[i].message); @@ -2908,7 +2890,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * if (parsed_time->elem == -99999) { \ add_assoc_bool(return_value, #name, 0); \ } else { \ - add_assoc_long(return_value, #name, parsed_time->elem); \ + add_assoc_int(return_value, #name, parsed_time->elem); \ } PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y); PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m); @@ -2953,17 +2935,17 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time * } if (parsed_time->have_relative) { array_init(&element); - add_assoc_long(&element, "year", parsed_time->relative.y); - add_assoc_long(&element, "month", parsed_time->relative.m); - add_assoc_long(&element, "day", parsed_time->relative.d); - add_assoc_long(&element, "hour", parsed_time->relative.h); - add_assoc_long(&element, "minute", parsed_time->relative.i); - add_assoc_long(&element, "second", parsed_time->relative.s); + add_assoc_int(&element, "year", parsed_time->relative.y); + add_assoc_int(&element, "month", parsed_time->relative.m); + add_assoc_int(&element, "day", parsed_time->relative.d); + add_assoc_int(&element, "hour", parsed_time->relative.h); + add_assoc_int(&element, "minute", parsed_time->relative.i); + add_assoc_int(&element, "second", parsed_time->relative.s); if (parsed_time->relative.have_weekday_relative) { - add_assoc_long(&element, "weekday", parsed_time->relative.weekday); + add_assoc_int(&element, "weekday", parsed_time->relative.weekday); } if (parsed_time->relative.have_special_relative && (parsed_time->relative.special.type == TIMELIB_SPECIAL_WEEKDAY)) { - add_assoc_long(&element, "weekdays", parsed_time->relative.special.amount); + add_assoc_int(&element, "weekdays", parsed_time->relative.special.amount); } if (parsed_time->relative.first_last_day_of) { add_assoc_bool(&element, parsed_time->relative.first_last_day_of == 1 ? "first_day_of_month" : "last_day_of_month", 1); @@ -3360,24 +3342,24 @@ PHP_FUNCTION(date_offset_get) switch (dateobj->time->zone_type) { case TIMELIB_ZONETYPE_ID: offset = timelib_get_time_zone_info(dateobj->time->sse, dateobj->time->tz_info); - RETVAL_LONG(offset->offset); + RETVAL_INT(offset->offset); timelib_time_offset_dtor(offset); break; case TIMELIB_ZONETYPE_OFFSET: - RETVAL_LONG(dateobj->time->z * -60); + RETVAL_INT(dateobj->time->z * -60); break; case TIMELIB_ZONETYPE_ABBR: - RETVAL_LONG((dateobj->time->z - (60 * dateobj->time->dst)) * -60); + RETVAL_INT((dateobj->time->z - (60 * dateobj->time->dst)) * -60); break; } return; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ -static void php_date_time_set(zval *object, long h, long i, long s, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_time_set(zval *object, php_int_t h, php_int_t i, php_int_t s, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3395,9 +3377,9 @@ static void php_date_time_set(zval *object, long h, long i, long s, zval *return PHP_FUNCTION(date_time_set) { zval *object; - long h, i, s = 0; + php_int_t h, i, s = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &h, &i, &s) == FAILURE) { RETURN_FALSE; } @@ -3412,9 +3394,9 @@ PHP_FUNCTION(date_time_set) PHP_METHOD(DateTimeImmutable, setTime) { zval *object, new_object; - long h, i, s = 0; + php_int_t h, i, s = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &h, &i, &s) == FAILURE) { RETURN_FALSE; } @@ -3425,7 +3407,7 @@ PHP_METHOD(DateTimeImmutable, setTime) } /* }}} */ -static void php_date_date_set(zval *object, long y, long m, long d, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_date_set(zval *object, php_int_t y, php_int_t m, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3443,9 +3425,9 @@ static void php_date_date_set(zval *object, long y, long m, long d, zval *return PHP_FUNCTION(date_date_set) { zval *object; - long y, m, d; + php_int_t y, m, d; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_date, &y, &m, &d) == FAILURE) { RETURN_FALSE; } @@ -3460,9 +3442,9 @@ PHP_FUNCTION(date_date_set) PHP_METHOD(DateTimeImmutable, setDate) { zval *object, new_object; - long y, m, d; + php_int_t y, m, d; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiii", &object, date_ce_immutable, &y, &m, &d) == FAILURE) { RETURN_FALSE; } @@ -3473,7 +3455,7 @@ PHP_METHOD(DateTimeImmutable, setDate) } /* }}} */ -static void php_date_isodate_set(zval *object, long y, long w, long d, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_isodate_set(zval *object, php_int_t y, php_int_t w, php_int_t d, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3495,9 +3477,9 @@ static void php_date_isodate_set(zval *object, long y, long w, long d, zval *ret PHP_FUNCTION(date_isodate_set) { zval *object; - long y, w, d = 1; + php_int_t y, w, d = 1; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_date, &y, &w, &d) == FAILURE) { RETURN_FALSE; } @@ -3512,9 +3494,9 @@ PHP_FUNCTION(date_isodate_set) PHP_METHOD(DateTimeImmutable, setISODate) { zval *object, new_object; - long y, w, d = 1; + php_int_t y, w, d = 1; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii|i", &object, date_ce_immutable, &y, &w, &d) == FAILURE) { RETURN_FALSE; } @@ -3525,7 +3507,7 @@ PHP_METHOD(DateTimeImmutable, setISODate) } /* }}} */ -static void php_date_timestamp_set(zval *object, long timestamp, zval *return_value TSRMLS_DC) /* {{{ */ +static void php_date_timestamp_set(zval *object, php_int_t timestamp, zval *return_value TSRMLS_DC) /* {{{ */ { php_date_obj *dateobj; @@ -3541,9 +3523,9 @@ static void php_date_timestamp_set(zval *object, long timestamp, zval *return_va PHP_FUNCTION(date_timestamp_set) { zval *object; - long timestamp; + php_int_t timestamp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, ×tamp) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_date, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -3558,9 +3540,9 @@ PHP_FUNCTION(date_timestamp_set) PHP_METHOD(DateTimeImmutable, setTimestamp) { zval *object, new_object; - long timestamp; + php_int_t timestamp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, ×tamp) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, date_ce_immutable, ×tamp) == FAILURE) { RETURN_FALSE; } @@ -3578,7 +3560,7 @@ PHP_FUNCTION(date_timestamp_get) { zval *object; php_date_obj *dateobj; - long timestamp; + php_int_t timestamp; int error; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) { @@ -3592,7 +3574,7 @@ PHP_FUNCTION(date_timestamp_get) if (error) { RETURN_FALSE; } else { - RETVAL_LONG(timestamp); + RETVAL_INT(timestamp); } } /* }}} */ @@ -3605,9 +3587,9 @@ PHP_FUNCTION(date_diff) zval *object1, *object2; php_date_obj *dateobj1, *dateobj2; php_interval_obj *interval; - long absolute = 0; + php_int_t absolute = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) { RETURN_FALSE; } dateobj1 = Z_PHPDATE_P(object1); @@ -3692,7 +3674,7 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez if ((z_timezone_type = zend_hash_str_find(myht, "timezone_type", sizeof("timezone_type")-1)) != NULL) { if ((z_timezone = zend_hash_str_find(myht, "timezone", sizeof("timezone")-1)) != NULL) { - convert_to_long(z_timezone_type); + convert_to_int(z_timezone_type); if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone) TSRMLS_CC)) { return SUCCESS; } @@ -3782,10 +3764,10 @@ PHP_FUNCTION(timezone_name_from_abbr) char *abbr; char *tzid; int abbr_len; - long gmtoffset = -1; - long isdst = -1; + php_int_t gmtoffset = -1; + php_int_t isdst = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) { RETURN_FALSE; } tzid = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst); @@ -3819,14 +3801,14 @@ PHP_FUNCTION(timezone_offset_get) switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: offset = timelib_get_time_zone_info(dateobj->time->sse, tzobj->tzi.tz); - RETVAL_LONG(offset->offset); + RETVAL_INT(offset->offset); timelib_time_offset_dtor(offset); break; case TIMELIB_ZONETYPE_OFFSET: - RETURN_LONG(tzobj->tzi.utc_offset * -60); + RETURN_INT(tzobj->tzi.utc_offset * -60); break; case TIMELIB_ZONETYPE_ABBR: - RETURN_LONG((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); + RETURN_INT((tzobj->tzi.z.utc_offset - (tzobj->tzi.z.dst*60)) * -60); break; } } @@ -3840,9 +3822,9 @@ PHP_FUNCTION(timezone_transitions_get) zval *object, element; php_timezone_obj *tzobj; unsigned int i, begin = 0, found; - long timestamp_begin = LONG_MIN, timestamp_end = LONG_MAX; + php_int_t timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ii", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { RETURN_FALSE; } tzobj = Z_PHPTIMEZONE_P(object); @@ -3853,18 +3835,18 @@ PHP_FUNCTION(timezone_transitions_get) #define add_nominal() \ array_init(&element); \ - add_assoc_long(&element, "ts", timestamp_begin); \ + add_assoc_int(&element, "ts", timestamp_begin); \ add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, timestamp_begin, 0 TSRMLS_CC)); \ - add_assoc_long(&element, "offset", tzobj->tzi.tz->type[0].offset); \ + add_assoc_int(&element, "offset", tzobj->tzi.tz->type[0].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[0].isdst); \ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[0].abbr_idx]); \ add_next_index_zval(return_value, &element); #define add(i,ts) \ array_init(&element); \ - add_assoc_long(&element, "ts", ts); \ + add_assoc_int(&element, "ts", ts); \ add_assoc_str(&element, "time", php_format_date(DATE_FORMAT_ISO8601, 13, ts, 0 TSRMLS_CC)); \ - add_assoc_long(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ + add_assoc_int(&element, "offset", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].offset); \ add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].isdst); \ add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[tzobj->tzi.tz->trans_idx[i]].abbr_idx]); \ add_next_index_zval(return_value, &element); @@ -3873,7 +3855,7 @@ PHP_FUNCTION(timezone_transitions_get) array_init(return_value); - if (timestamp_begin == LONG_MIN) { + if (timestamp_begin == PHP_INT_MIN) { add_nominal(); begin = 0; found = 1; @@ -4023,7 +4005,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c retval = rv; if (value != -99999) { - ZVAL_LONG(retval, value); + ZVAL_INT(retval, value); } else { ZVAL_FALSE(retval); } @@ -4062,7 +4044,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ - obj->diff->n = zval_get_long(value); \ + obj->diff->n = zval_get_int(value); \ break; \ } @@ -4119,7 +4101,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter do { \ zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \ if (z_arg) { \ - (*intobj)->diff->member = (itype)zval_get_long(z_arg); \ + (*intobj)->diff->member = (itype)zval_get_int(z_arg); \ } else { \ (*intobj)->diff->member = (itype)def; \ } \ @@ -4130,7 +4112,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter zval *z_arg = zend_hash_str_find(myht, element, sizeof(element) - 1); \ if (z_arg) { \ zend_string *str = zval_get_string(z_arg); \ - DATE_A64I((*intobj)->diff->member, str->val); \ + ZEND_ATOI((*intobj)->diff->member, str->val); \ STR_RELEASE(str); \ } else { \ (*intobj)->diff->member = -1LL; \ @@ -4248,8 +4230,8 @@ static zend_string *date_interval_format(char *format, int format_len, timelib_r case 'I': length = slprintf(buffer, 32, "%02d", (int) t->i); break; case 'i': length = slprintf(buffer, 32, "%d", (int) t->i); break; - case 'S': length = slprintf(buffer, 32, "%02ld", (long) t->s); break; - case 's': length = slprintf(buffer, 32, "%ld", (long) t->s); break; + case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (php_int_t) t->s); break; + case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (php_int_t) t->s); break; case 'a': { if ((int) t->days != -99999) { @@ -4301,7 +4283,7 @@ PHP_FUNCTION(date_interval_format) } /* }}} */ -static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */ +static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, php_int_t *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */ { timelib_time *b = NULL, *e = NULL; timelib_rel_time *p = NULL; @@ -4334,16 +4316,16 @@ PHP_METHOD(DatePeriod, __construct) php_date_obj *dateobj; php_interval_obj *intobj; zval *start, *end = NULL, *interval; - long recurrences = 0, options = 0; + php_int_t recurrences = 0, options = 0; char *isostr = NULL; int isostr_len = 0; timelib_time *clone; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) { - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOi|i", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|i", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &isostr, &isostr_len, &options) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments."); zend_restore_error_handling(&error_handling TSRMLS_CC); return; @@ -4413,7 +4395,7 @@ PHP_METHOD(DatePeriod, __construct) } /* }}} */ -static int check_id_allowed(char *id, long what) /* {{{ */ +static int check_id_allowed(char *id, php_int_t what) /* {{{ */ { if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1; if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 0) return 1; @@ -4437,11 +4419,11 @@ PHP_FUNCTION(timezone_identifiers_list) const timelib_tzdb *tzdb; const timelib_tzdb_index_entry *table; int i, item_count; - long what = PHP_DATE_TIMEZONE_GROUP_ALL; + php_int_t what = PHP_DATE_TIMEZONE_GROUP_ALL; char *option = NULL; int option_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|is", &what, &option, &option_len) == FAILURE) { RETURN_FALSE; } @@ -4496,7 +4478,7 @@ PHP_FUNCTION(timezone_abbreviations_list) do { array_init(&element); add_assoc_bool(&element, "dst", entry->type); - add_assoc_long(&element, "offset", entry->gmtoffset); + add_assoc_int(&element, "offset", entry->gmtoffset); if (entry->full_tz_name) { add_assoc_string(&element, "timezone_id", entry->full_tz_name); } else { @@ -4558,13 +4540,13 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su double latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude; double h_rise, h_set, N; timelib_sll rise, set, transit; - long time, retformat = 0; + php_int_t time, retformat = 0; int rs; timelib_time *t; timelib_tzinfo *tzi; zend_string *retstr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|idddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) { RETURN_FALSE; } @@ -4617,7 +4599,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su } if (retformat == SUNFUNCS_RET_TIMESTAMP) { - RETURN_LONG(calc_sunset ? set : rise); + RETURN_INT(calc_sunset ? set : rise); } N = (calc_sunset ? h_set : h_rise) + gmt_offset; @@ -4657,7 +4639,7 @@ PHP_FUNCTION(date_sunset) Returns an array with information about sun set/rise and twilight begin/end */ PHP_FUNCTION(date_sun_info) { - long time; + php_int_t time; double latitude, longitude; timelib_time *t, *t2; timelib_tzinfo *tzi; @@ -4666,7 +4648,7 @@ PHP_FUNCTION(date_sun_info) int dummy; double ddummy; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "idd", &time, &latitude, &longitude) == FAILURE) { RETURN_FALSE; } /* Initialize time struct */ @@ -4693,12 +4675,12 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "sunrise", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "sunrise", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "sunset", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "sunset", timelib_date_to_int(t2, &dummy)); } t2->sse = transit; - add_assoc_long(return_value, "transit", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "transit", timelib_date_to_int(t2, &dummy)); /* Get civil twilight */ rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -6.0, 0, &ddummy, &ddummy, &rise, &set, &transit); @@ -4713,9 +4695,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "civil_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "civil_twilight_end", timelib_date_to_int(t2, &dummy)); } /* Get nautical twilight */ @@ -4731,9 +4713,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "nautical_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "nautical_twilight_end", timelib_date_to_int(t2, &dummy)); } /* Get astronomical twilight */ @@ -4749,9 +4731,9 @@ PHP_FUNCTION(date_sun_info) break; default: t2->sse = rise; - add_assoc_long(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "astronomical_twilight_begin", timelib_date_to_int(t2, &dummy)); t2->sse = set; - add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy)); + add_assoc_int(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy)); } timelib_time_dtor(t); timelib_time_dtor(t2); @@ -4821,7 +4803,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC) /* { zend_hash_str_update(props, "interval", sizeof("interval")-1, &zv); /* converted to larger type (int->long); must check when unserializing */ - ZVAL_LONG(&zv, (long) period_obj->recurrences); + ZVAL_INT(&zv, (long) period_obj->recurrences); zend_hash_str_update(props, "recurrences", sizeof("recurrences")-1, &zv); ZVAL_BOOL(&zv, period_obj->include_start_date); @@ -4891,8 +4873,8 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash ht_entry = zend_hash_str_find(myht, "recurrences", sizeof("recurrences")-1); if (ht_entry && - Z_TYPE_P(ht_entry) == IS_LONG && Z_LVAL_P(ht_entry) >= 0 && Z_LVAL_P(ht_entry) <= INT_MAX) { - period_obj->recurrences = Z_LVAL_P(ht_entry); + Z_TYPE_P(ht_entry) == IS_INT && Z_IVAL_P(ht_entry) >= 0 && Z_IVAL_P(ht_entry) <= INT_MAX) { + period_obj->recurrences = Z_IVAL_P(ht_entry); } else { return 0; } diff --git a/ext/date/php_date.h b/ext/date/php_date.h index ff26c0fba3..cc71246d94 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -203,7 +203,7 @@ ZEND_END_MODULE_GLOBALS(date) #endif /* Backwards compatibility wrapper */ -PHPAPI signed long php_parse_date(char *string, signed long *now); +PHPAPI php_int_t php_parse_date(char *string, php_int_t *now); PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt); PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC); #if HAVE_STRFTIME diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 7b675ac6ac..8e0da59654 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -217,10 +217,10 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); convert_to_string_ex(group); convert_to_string_ex(name); - if (Z_STRLEN_P(group) == 0) { + if (Z_STRSIZE_P(group) == 0) { *key_str = Z_STRVAL_P(name); *key_free = NULL; - return Z_STRLEN_P(name); + return Z_STRSIZE_P(name); } len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name)); *key_free = *key_str; @@ -232,8 +232,8 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS ZVAL_COPY(&tmp, key); convert_to_string(&tmp); - *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); - len = Z_STRLEN(tmp); + *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + len = Z_STRSIZE(tmp); zval_ptr_dtor(&tmp); return len; @@ -256,7 +256,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS zval *key; \ char *key_str, *key_free; \ size_t key_len; \ - long skip = 0; \ + php_int_t skip = 0; \ switch(ac) { \ case 2: \ if (zend_parse_parameters(ac TSRMLS_CC, "zr", &key, &id) == FAILURE) { \ @@ -264,7 +264,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS } \ break; \ case 3: \ - if (zend_parse_parameters(ac TSRMLS_CC, "zlr", &key, &skip, &id) == FAILURE) { \ + if (zend_parse_parameters(ac TSRMLS_CC, "zir", &key, &skip, &id) == FAILURE) { \ return; \ } \ break; \ @@ -646,7 +646,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else if (Z_REFCOUNTED(args[i])) { Z_ADDREF(args[i]); } - keylen += Z_STRLEN(args[i]); + keylen += Z_STRSIZE(args[i]); } if (persistent) { @@ -658,8 +658,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) keylen = 0; for(i = 0; i < ac; i++) { - memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRLEN(args[i])); - keylen += Z_STRLEN(args[i]); + memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); + keylen += Z_STRSIZE(args[i]); } /* try to find if we already have this link in our persistent list */ @@ -1243,7 +1243,7 @@ PHP_FUNCTION(dba_handlers) List opened databases */ PHP_FUNCTION(dba_list) { - ulong numitems, i; + php_uint_t numitems, i; zend_resource *le; dba_info *info; diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c index 8ee5d95f22..9f16cb4cd2 100644 --- a/ext/dba/dba_db1.c +++ b/ext/dba/dba_db1.c @@ -51,8 +51,8 @@ DBA_OPEN_FUNC(db1) int filemode = 0644; if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } gmode = 0; diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c index 60aa37f93a..c4c17a1661 100644 --- a/ext/dba/dba_db2.c +++ b/ext/dba/dba_db2.c @@ -72,8 +72,8 @@ DBA_OPEN_FUNC(db2) } if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) { diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c index 95a1e51fe0..5ed6f502cc 100644 --- a/ext/dba/dba_db3.c +++ b/ext/dba/dba_db3.c @@ -81,8 +81,8 @@ DBA_OPEN_FUNC(db3) } if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } #ifdef DB_FCNTL_LOCKING diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c index 94a6c95e81..a927c49ee5 100644 --- a/ext/dba/dba_db4.c +++ b/ext/dba/dba_db4.c @@ -118,8 +118,8 @@ DBA_OPEN_FUNC(db4) } if (info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } if ((err=db_create(&dbp, NULL, 0)) == 0) { diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c index f65a79bcc7..5d5a234670 100644 --- a/ext/dba/dba_dbm.c +++ b/ext/dba/dba_dbm.c @@ -60,8 +60,8 @@ DBA_OPEN_FUNC(dbm) int filemode = 0644; if(info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } if(info->mode == DBA_TRUNC) { diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c index d2c4a2f367..c5a2bccee0 100644 --- a/ext/dba/dba_gdbm.c +++ b/ext/dba/dba_gdbm.c @@ -54,8 +54,8 @@ DBA_OPEN_FUNC(gdbm) return FAILURE; /* not possible */ if(info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } dbf = gdbm_open(info->path, 0, gmode, filemode, NULL); diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c index 417446759c..6805c45d9f 100644 --- a/ext/dba/dba_ndbm.c +++ b/ext/dba/dba_ndbm.c @@ -59,8 +59,8 @@ DBA_OPEN_FUNC(ndbm) } if(info->argc > 0) { - convert_to_long_ex(&info->argv[0]); - filemode = Z_LVAL(info->argv[0]); + convert_to_int_ex(&info->argv[0]); + filemode = Z_IVAL(info->argv[0]); } dbf = dbm_open(info->path, gmode, filemode); diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h index d4d4c62c4a..7276ba6942 100644 --- a/ext/dba/php_dba.h +++ b/ext/dba/php_dba.h @@ -126,7 +126,7 @@ typedef struct dba_handler { DBA_SYNC_FUNC(x); \ DBA_INFO_FUNC(x) -#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p) +#define VALLEN(p) Z_STRVAL_PP(p), Z_STRSIZE_PP(p) PHP_FUNCTION(dba_open); PHP_FUNCTION(dba_popen); diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index 2ef6352f20..390e4e032b 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -139,7 +139,7 @@ int dom_characterdata_length_read(dom_object *obj, zval *retval TSRMLS_DC) xmlFree(content); } - ZVAL_LONG(retval, length); + ZVAL_INT(retval, length); return SUCCESS; } @@ -156,11 +156,11 @@ PHP_FUNCTION(dom_characterdata_substring_data) xmlChar *cur; xmlChar *substring; xmlNodePtr node; - long offset, count; + php_int_t offset, count; int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { return; } @@ -239,11 +239,11 @@ PHP_FUNCTION(dom_characterdata_insert_data) xmlChar *cur, *first, *second; xmlNodePtr node; char *arg; - long offset; + php_int_t offset; int length, arg_len; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) { return; } @@ -286,11 +286,11 @@ PHP_FUNCTION(dom_characterdata_delete_data) zval *id; xmlChar *cur, *substring, *second; xmlNodePtr node; - long offset, count; + php_int_t offset, count; int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &id, dom_characterdata_class_entry, &offset, &count) == FAILURE) { return; } @@ -342,11 +342,11 @@ PHP_FUNCTION(dom_characterdata_replace_data) xmlChar *cur, *substring, *second = NULL; xmlNodePtr node; char *arg; - long offset, count; + php_int_t offset, count; int length, arg_len; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiis", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == FAILURE) { return; } diff --git a/ext/dom/document.c b/ext/dom/document.c index b2c3274063..abe0c55f06 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -388,7 +388,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC) return FAILURE; } - standalone = zval_get_long(newval); + standalone = zval_get_int(newval); docp->standalone = ZEND_NORMALIZE_BOOL(standalone); return SUCCESS; @@ -970,9 +970,9 @@ PHP_FUNCTION(dom_document_import_node) xmlNodePtr nodep, retnodep; dom_object *intern, *nodeobj; int ret; - long recursive = 0; + php_int_t recursive = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|i", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) { return; } @@ -1465,14 +1465,14 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) { dom_object *intern; char *source; int source_len, refcount, ret; - long options = 0; + php_int_t options = 0; id = getThis(); if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { id = NULL; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &options) == FAILURE) { return; } @@ -1547,9 +1547,9 @@ PHP_FUNCTION(dom_document_save) dom_object *intern; dom_doc_propsptr doc_props; char *file; - long options = 0; + php_int_t options = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) { return; } @@ -1575,7 +1575,7 @@ PHP_FUNCTION(dom_document_save) if (bytes == -1) { RETURN_FALSE; } - RETURN_LONG(bytes); + RETURN_INT(bytes); } /* }}} end dom_document_save */ @@ -1593,9 +1593,9 @@ PHP_FUNCTION(dom_document_savexml) dom_object *intern, *nodeobj; dom_doc_propsptr doc_props; int size, format, saveempty = 0; - long options = 0; + php_int_t options = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!l", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O!i", &id, dom_document_class_entry, &nodep, dom_node_class_entry, &options) == FAILURE) { return; } @@ -1698,11 +1698,11 @@ PHP_FUNCTION(dom_document_xinclude) zval *id; xmlDoc *docp; xmlNodePtr root; - long flags = 0; + php_int_t flags = 0; int err; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_document_class_entry, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &id, dom_document_class_entry, &flags) == FAILURE) { return; } @@ -1723,7 +1723,7 @@ PHP_FUNCTION(dom_document_xinclude) } if (err) { - RETVAL_LONG(err); + RETVAL_INT(err); } else { RETVAL_FALSE; } @@ -1772,14 +1772,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type dom_object *intern; char *source = NULL, *valid_file = NULL; int source_len = 0, valid_opts = 0; - long flags = 0; + php_int_t flags = 0; xmlSchemaParserCtxtPtr parser; xmlSchemaPtr sptr; xmlSchemaValidCtxtPtr vptr; int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|i", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { return; } @@ -1963,12 +1963,12 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ dom_doc_propsptr doc_prop; char *source; int source_len, refcount, ret; - long options = 0; + php_int_t options = 0; htmlParserCtxtPtr ctxt; id = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &source, &source_len, &options) == FAILURE) { return; } @@ -2087,7 +2087,7 @@ PHP_FUNCTION(dom_document_save_html_file) if (bytes == -1) { RETURN_FALSE; } - RETURN_LONG(bytes); + RETURN_INT(bytes); } /* }}} end dom_document_save_html_file */ diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 22d0ab0ee3..9abe2c7c20 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -158,7 +158,7 @@ static void php_dom_iterator_current_key(zend_object_iterator *iter, zval *key T zval *object = &iterator->intern.data; if (instanceof_function(Z_OBJCE_P(object), dom_nodelist_class_entry TSRMLS_CC)) { - ZVAL_LONG(key, iter->index); + ZVAL_INT(key, iter->index); } else { dom_object *intern = Z_DOMOBJ_P(&iterator->curobj); diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 13acf5cbce..43c26605bc 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -113,7 +113,7 @@ int dom_namednodemap_length_read(dom_object *obj, zval *retval TSRMLS_DC) } } - ZVAL_LONG(retval, count); + ZVAL_INT(retval, count); return SUCCESS; } @@ -200,7 +200,7 @@ Since: PHP_FUNCTION(dom_namednodemap_item) { zval *id; - long index; + php_int_t index; int ret; dom_object *intern; xmlNodePtr itemnode = NULL; @@ -209,7 +209,7 @@ PHP_FUNCTION(dom_namednodemap_item) xmlNodePtr nodep, curnode; int count; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_namednodemap_class_entry, &index) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &id, dom_namednodemap_class_entry, &index) == FAILURE) { return; } if (index >= 0) { diff --git a/ext/dom/node.c b/ext/dom/node.c index a35139bcad..f34c0347cb 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -375,9 +375,9 @@ int dom_node_node_type_read(dom_object *obj, zval *retval TSRMLS_DC) /* Specs dictate that they are both type XML_DOCUMENT_TYPE_NODE */ if (nodep->type == XML_DTD_NODE) { - ZVAL_LONG(retval, XML_DOCUMENT_TYPE_NODE); + ZVAL_INT(retval, XML_DOCUMENT_TYPE_NODE); } else { - ZVAL_LONG(retval, nodep->type); + ZVAL_INT(retval, nodep->type); } return SUCCESS; @@ -1334,9 +1334,9 @@ PHP_FUNCTION(dom_node_clone_node) xmlNode *n, *node; int ret; dom_object *intern; - long recursive = 0; + php_int_t recursive = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &id, dom_node_class_entry, &recursive) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &id, dom_node_class_entry, &recursive) == FAILURE) { return; } @@ -1815,7 +1815,7 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ bytes = xmlOutputBufferClose(buf); if (mode == 1 && (ret >= 0)) { - RETURN_LONG(bytes); + RETURN_INT(bytes); } } } @@ -1872,7 +1872,7 @@ PHP_METHOD(domnode, getLineNo) DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern); - RETURN_LONG(xmlGetLineNo(nodep)); + RETURN_INT(xmlGetLineNo(nodep)); } /* }}} */ diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 3ef43f2ac7..5d45ad6edd 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -91,7 +91,7 @@ int dom_nodelist_length_read(dom_object *obj, zval *retval TSRMLS_DC) } } - ZVAL_LONG(retval, count); + ZVAL_INT(retval, count); return SUCCESS; } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 8314e5c808..49ac4740a9 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -440,7 +440,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC zend_hash_move_forward_ex(prop_handlers, &pos)) { zval value; zend_string *string_key; - ulong num_key; + php_uint_t num_key; if (entry->read_func(obj, &value TSRMLS_CC) == FAILURE) { continue; @@ -625,7 +625,7 @@ PHP_MINIT_FUNCTION(dom) INIT_CLASS_ENTRY(ce, "DOMException", php_dom_domexception_class_functions); dom_domexception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_int(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry); @@ -860,56 +860,56 @@ PHP_MINIT_FUNCTION(dom) zend_hash_add_ptr(&classes, ce.name, &dom_xpath_prop_handlers); #endif - REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT); #ifdef XML_GLOBAL_NAMESPACE - REGISTER_LONG_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); /* DOMException Codes */ - REGISTER_LONG_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_PHP_ERR", PHP_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INDEX_SIZE_ERR", INDEX_SIZE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOMSTRING_SIZE_ERR", DOMSTRING_SIZE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_HIERARCHY_REQUEST_ERR", HIERARCHY_REQUEST_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_WRONG_DOCUMENT_ERR", WRONG_DOCUMENT_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_CHARACTER_ERR", INVALID_CHARACTER_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NO_DATA_ALLOWED_ERR", NO_DATA_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NO_MODIFICATION_ALLOWED_ERR", NO_MODIFICATION_ALLOWED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NOT_FOUND_ERR", NOT_FOUND_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NOT_SUPPORTED_ERR", NOT_SUPPORTED_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INUSE_ATTRIBUTE_ERR", INUSE_ATTRIBUTE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_STATE_ERR", INVALID_STATE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_SYNTAX_ERR", SYNTAX_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_MODIFICATION_ERR", INVALID_MODIFICATION_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_NAMESPACE_ERR", NAMESPACE_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_INVALID_ACCESS_ERR", INVALID_ACCESS_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DOM_VALIDATION_ERR", VALIDATION_ERR, CONST_CS | CONST_PERSISTENT); php_libxml_register_export(dom_node_class_entry, php_dom_export_node); diff --git a/ext/dom/text.c b/ext/dom/text.c index cccc44b311..66bdcec0e4 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -149,11 +149,11 @@ PHP_FUNCTION(dom_text_split_text) xmlChar *second; xmlNodePtr node; xmlNodePtr nnode; - long offset; + php_int_t offset; int length; dom_object *intern; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &id, dom_text_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &id, dom_text_class_entry, &offset) == FAILURE) { return; } DOM_GET_OBJ(node, id, xmlNodePtr, intern); diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 93a38614ce..8351946038 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -524,7 +524,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions) zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while ((entry = zend_hash_get_current_data(Z_ARRVAL_P(array_value)))) { zend_string *str = zval_get_string(entry); - ZVAL_LONG(&new_string,1); + ZVAL_INT(&new_string,1); zend_hash_update(intern->registered_phpfunctions, str, &new_string); zend_hash_move_forward(Z_ARRVAL_P(array_value)); STR_RELEASE(str); @@ -535,7 +535,7 @@ PHP_FUNCTION(dom_xpath_register_php_functions) } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) { intern = Z_XPATHOBJ_P(id); - ZVAL_LONG(&new_string, 1); + ZVAL_INT(&new_string, 1); zend_hash_update(intern->registered_phpfunctions, name, &new_string); intern->registerPhpFunctions = 2; } else { diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index e1449560f5..e8c9555152 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -289,8 +289,8 @@ PHP_MINIT_FUNCTION(enchant) { le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant_broker", module_number); le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant_dict", module_number); - REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -422,11 +422,11 @@ PHP_FUNCTION(enchant_broker_set_dict_path) { zval *broker; enchant_broker *pbroker; - long dict_type; + php_int_t dict_type; char *value; int value_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &broker, &dict_type, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris", &broker, &dict_type, &value, &value_len) == FAILURE) { RETURN_FALSE; } @@ -462,10 +462,10 @@ PHP_FUNCTION(enchant_broker_get_dict_path) { zval *broker; enchant_broker *pbroker; - long dict_type; + php_int_t dict_type; char *value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &broker, &dict_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &broker, &dict_type) == FAILURE) { RETURN_FALSE; } diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 79bee9b79f..3a4cbbbb85 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -323,7 +323,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) } else { /* we convert numbers to integers and treat them as a string */ if (Z_TYPE_P(regex) == IS_DOUBLE) { - convert_to_long_ex(regex); /* get rid of decimal places */ + convert_to_int_ex(regex); /* get rid of decimal places */ } convert_to_string_ex(regex); /* don't bother doing an extended regex with just a number */ @@ -379,7 +379,7 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) } else { if (match_len == 0) match_len = 1; - RETVAL_LONG(match_len); + RETVAL_INT(match_len); } regfree(&re); } @@ -564,28 +564,28 @@ static void php_do_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase) } if (Z_TYPE_P(arg_pattern) == IS_STRING) { - if (Z_STRVAL_P(arg_pattern) && Z_STRLEN_P(arg_pattern)) { + if (Z_STRVAL_P(arg_pattern) && Z_STRSIZE_P(arg_pattern)) { pattern = STR_COPY(Z_STR_P(arg_pattern)); } else { pattern = STR_EMPTY_ALLOC(); } } else { - convert_to_long_ex(arg_pattern); + convert_to_int_ex(arg_pattern); pattern = STR_ALLOC(1, 0); - pattern->val[0] = (char) Z_LVAL_P(arg_pattern); + pattern->val[0] = (char) Z_IVAL_P(arg_pattern); pattern->val[1] = '\0'; } if (Z_TYPE_P(arg_replace) == IS_STRING) { - if (Z_STRVAL_P(arg_replace) && Z_STRLEN_P(arg_replace)) { + if (Z_STRVAL_P(arg_replace) && Z_STRSIZE_P(arg_replace)) { replace = STR_COPY(Z_STR_P(arg_replace)); } else { replace = STR_EMPTY_ALLOC(); } } else { - convert_to_long_ex(arg_replace); + convert_to_int_ex(arg_replace); replace = STR_ALLOC(1, 0); - replace->val[0] = (char) Z_LVAL_P(arg_replace); + replace->val[0] = (char) Z_IVAL_P(arg_replace); replace->val[1] = '\0'; } @@ -630,14 +630,14 @@ PHP_FUNCTION(eregi_replace) */ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) { - long count = -1; + php_int_t count = -1; regex_t re; regmatch_t subs[1]; char *spliton, *str, *strp, *endp; int spliton_len, str_len; int err, size, copts = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &spliton, &spliton_len, &str, &str_len, &count) == FAILURE) { return; } diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 127cb30941..0108a84bc5 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -223,9 +223,9 @@ PHP_MINIT_FUNCTION(exif) { REGISTER_INI_ENTRIES(); if (zend_hash_str_exists(&module_registry, "mbstring", sizeof("mbstring")-1)) { - REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); } else { - REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); } return SUCCESS; } @@ -2020,16 +2020,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im if (l>1) { info_value = &info_data->value; for (b=0;b<l;b++) { - add_index_long(&array, b, (int)(info_value->s[b])); + add_index_int(&array, b, (int)(info_value->s[b])); } break; } case TAG_FMT_USHORT: case TAG_FMT_ULONG: if (l==1) { - add_assoc_long(&tmpi, name, (int)info_value->u); + add_assoc_int(&tmpi, name, (int)info_value->u); } else { - add_index_long(&array, ap, (int)info_value->u); + add_index_int(&array, ap, (int)info_value->u); } break; @@ -2046,16 +2046,16 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im if (l>1) { info_value = &info_data->value; for (b=0;b<l;b++) { - add_index_long(&array, ap, (int)info_value->s[b]); + add_index_int(&array, ap, (int)info_value->s[b]); } break; } case TAG_FMT_SSHORT: case TAG_FMT_SLONG: if (l==1) { - add_assoc_long(&tmpi, name, info_value->i); + add_assoc_int(&tmpi, name, info_value->i); } else { - add_index_long(&array, ap, info_value->i); + add_index_int(&array, ap, info_value->i); } break; @@ -2334,10 +2334,10 @@ static char * exif_get_markername(int marker) Get headername for index or false if not defined */ PHP_FUNCTION(exif_tagname) { - long tag; + php_int_t tag; char *szTemp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &tag) == FAILURE) { return; } @@ -3847,7 +3847,7 @@ static int exif_discard_imageinfo(image_info_type *ImageInfo) static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC) { int ret; - struct stat st; + php_stat_t st; zend_string *base; /* Start with an empty image information structure. */ @@ -4129,12 +4129,12 @@ PHP_FUNCTION(exif_thumbnail) } zval_dtor(p_width); zval_dtor(p_height); - ZVAL_LONG(p_width, ImageInfo.Thumbnail.width); - ZVAL_LONG(p_height, ImageInfo.Thumbnail.height); + ZVAL_INT(p_width, ImageInfo.Thumbnail.width); + ZVAL_INT(p_height, ImageInfo.Thumbnail.height); } if (arg_c >= 4) { zval_dtor(p_imagetype); - ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype); + ZVAL_INT(p_imagetype, ImageInfo.Thumbnail.filetype); } #ifdef EXIF_DEBUG @@ -4175,7 +4175,7 @@ PHP_FUNCTION(exif_imagetype) if (itype == IMAGE_FILETYPE_UNKNOWN) { RETURN_FALSE; } else { - ZVAL_LONG(return_value, itype); + ZVAL_INT(return_value, itype); } } /* }}} */ diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index a612e04280..e2030c621d 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -44,7 +44,7 @@ /* {{{ macros and type definitions */ typedef struct _php_fileinfo { - long options; + php_int_t options; struct magic_set *magic; } php_fileinfo; @@ -226,19 +226,19 @@ PHP_MINIT_FUNCTION(finfo) le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number); - REGISTER_LONG_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); -/* REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ - REGISTER_LONG_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_NONE", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_SYMLINK", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_MIME", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_MIME_TYPE", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); +/* REGISTER_INT_CONSTANT("FILEINFO_COMPRESS", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ + REGISTER_INT_CONSTANT("FILEINFO_DEVICES", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_CONTINUE", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); #ifdef MAGIC_PRESERVE_ATIME - REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_PRESERVE_ATIME", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); #endif #ifdef MAGIC_RAW - REGISTER_LONG_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILEINFO_RAW", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); #endif return SUCCESS; @@ -295,14 +295,14 @@ PHP_MINFO_FUNCTION(fileinfo) Create a new fileinfo resource. */ PHP_FUNCTION(finfo_open) { - long options = MAGIC_NONE; + php_int_t options = MAGIC_NONE; char *file = NULL; int file_len = 0; php_fileinfo *finfo; FILEINFO_DECLARE_INIT_OBJECT(object) char resolved_path[MAXPATHLEN]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lp", &options, &file, &file_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ip", &options, &file, &file_len) == FAILURE) { FILEINFO_DESTROY_OBJECT(object); RETURN_FALSE; } @@ -382,18 +382,18 @@ PHP_FUNCTION(finfo_close) Set libmagic configuration options. */ PHP_FUNCTION(finfo_set_flags) { - long options; + php_int_t options; php_fileinfo *finfo; zval *zfinfo; FILEINFO_DECLARE_INIT_OBJECT(object) if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &options) == FAILURE) { RETURN_FALSE; } FILEINFO_FROM_OBJECT(finfo, object); } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zfinfo, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zfinfo, &options) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(finfo, php_fileinfo *, zfinfo, -1, "file_info", le_fileinfo); @@ -412,7 +412,7 @@ PHP_FUNCTION(finfo_set_flags) static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mimetype_emu) /* {{{ */ { - long options = 0; + php_int_t options = 0; char *ret_val = NULL, *buffer = NULL; int buffer_len; php_fileinfo *finfo = NULL; @@ -433,7 +433,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime switch (Z_TYPE_P(what)) { case IS_STRING: buffer = Z_STRVAL_P(what); - buffer_len = Z_STRLEN_P(what); + buffer_len = Z_STRSIZE_P(what); mode = FILEINFO_MODE_FILE; break; @@ -452,13 +452,13 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime goto common; } } else if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ir", &buffer, &buffer_len, &options, &zcontext) == FAILURE) { RETURN_FALSE; } FILEINFO_FROM_OBJECT(finfo, object); magic = finfo->magic; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ir", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(finfo, php_fileinfo *, zfinfo, -1, "file_info", le_fileinfo); @@ -480,7 +480,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime case FILEINFO_MODE_STREAM: { php_stream *stream; - off_t streampos; + php_off_t streampos; php_stream_from_zval_no_verify(stream, what); if (!stream) { diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index ce747378aa..b3b1f746d4 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -1145,7 +1145,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) uint32_t i, j; size_t files = 0, maxfiles = 0; char **filearr = NULL; - struct stat st; + php_stat_t st; struct magic_map *map; struct magic_entry_set mset[MAGIC_SETS]; php_stream *dir; @@ -1187,7 +1187,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) php_stream_closedir(dir); goto out; } - if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) { + if (zend_stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) { continue; } if (files >= maxfiles) { @@ -2698,7 +2698,7 @@ internal_loaded: if (NULL != fn) { nentries = (uint32_t)(st.sb.st_size / sizeof(struct magic)); entries = (uint32_t)(st.sb.st_size / sizeof(struct magic)); - if ((off_t)(entries * sizeof(struct magic)) != st.sb.st_size) { + if ((php_off_t)(entries * sizeof(struct magic)) != st.sb.st_size) { file_error(ms, 0, "Size of `%s' %llu is not a multiple of %zu", dbname, (unsigned long long)st.sb.st_size, sizeof(struct magic)); @@ -2788,7 +2788,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) assert(nm + sizeof(ar) < m); - if (php_stream_seek(stream,(off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) { + if (php_stream_seek(stream,(php_off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) { file_error(ms, errno, "error seeking `%s'", dbname); goto out; } diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c index c86763faa0..93cc231884 100644 --- a/ext/fileinfo/libmagic/cdf.c +++ b/ext/fileinfo/libmagic/cdf.c @@ -291,11 +291,11 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h, } static ssize_t -cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len) +cdf_read(const cdf_info_t *info, php_off_t off, void *buf, size_t len) { size_t siz = (size_t)off + len; - if ((off_t)(off + len) != (off_t)siz) { + if ((php_off_t)(off + len) != (php_off_t)siz) { errno = EINVAL; return -1; } @@ -308,7 +308,7 @@ cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len) if (info->i_fd == -1) return -1; - if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (off_t)-1) + if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (php_off_t)-1) return -1; if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len) @@ -323,7 +323,7 @@ cdf_read_header(const cdf_info_t *info, cdf_header_t *h) char buf[512]; (void)memcpy(cdf_bo.s, "\01\02\03\04", 4); - if (cdf_read(info, (off_t)0, buf, sizeof(buf)) == -1) + if (cdf_read(info, (php_off_t)0, buf, sizeof(buf)) == -1) return -1; cdf_unpack_header(h, buf); cdf_swap_header(h); @@ -357,7 +357,7 @@ cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len, size_t ss = CDF_SEC_SIZE(h); size_t pos = CDF_SEC_POS(h, id); assert(ss == len); - return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len); + return cdf_read(info, (php_off_t)pos, ((char *)buf) + offs, len); } ssize_t diff --git a/ext/fileinfo/libmagic/compress.c b/ext/fileinfo/libmagic/compress.c index fed7420a6a..613fc6a3d2 100644 --- a/ext/fileinfo/libmagic/compress.c +++ b/ext/fileinfo/libmagic/compress.c @@ -300,7 +300,7 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf, return -1; } (void)close(tfd); - if (FINFO_LSEEK_FUNC(fd, (off_t)0, SEEK_SET) == (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) { file_badseek(ms); return -1; } @@ -406,7 +406,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method, (void) close(0); if (fd != -1) { (void) dup(fd); - (void) FINFO_LSEEK_FUNC(0, (off_t)0, SEEK_SET); + (void) FINFO_LSEEK_FUNC(0, (php_off_t)0, SEEK_SET); } else { (void) dup(fdin[0]); (void) close(fdin[0]); diff --git a/ext/fileinfo/libmagic/elfclass.h b/ext/fileinfo/libmagic/elfclass.h index 010958a429..889ff6263e 100644 --- a/ext/fileinfo/libmagic/elfclass.h +++ b/ext/fileinfo/libmagic/elfclass.h @@ -37,7 +37,7 @@ case ET_CORE: flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), + (php_off_t)elf_getu(swap, elfhdr.e_phoff), elf_getu16(swap, elfhdr.e_phnum), (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) @@ -47,7 +47,7 @@ case ET_EXEC: case ET_DYN: if (dophn_exec(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_phoff), + (php_off_t)elf_getu(swap, elfhdr.e_phoff), elf_getu16(swap, elfhdr.e_phnum), (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) @@ -56,7 +56,7 @@ /*FALLTHROUGH*/ case ET_REL: if (doshn(ms, clazz, swap, fd, - (off_t)elf_getu(swap, elfhdr.e_shoff), + (php_off_t)elf_getu(swap, elfhdr.e_shoff), elf_getu16(swap, elfhdr.e_shnum), (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), diff --git a/ext/fileinfo/libmagic/fsmagic.c b/ext/fileinfo/libmagic/fsmagic.c index 2010b26339..f945d06a8b 100644 --- a/ext/fileinfo/libmagic/fsmagic.c +++ b/ext/fileinfo/libmagic/fsmagic.c @@ -90,7 +90,7 @@ handle_mime(struct magic_set *ms, int mime, const char *str) } protected int -file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb, php_stream *stream) +file_fsmagic(struct magic_set *ms, const char *fn, php_stat_t *sb, php_stream *stream) { int ret, did = 0; int mime = ms->flags & MAGIC_MIME; diff --git a/ext/fileinfo/libmagic/readelf.c b/ext/fileinfo/libmagic/readelf.c index 6f776721b0..ec316b6bbd 100644 --- a/ext/fileinfo/libmagic/readelf.c +++ b/ext/fileinfo/libmagic/readelf.c @@ -42,13 +42,13 @@ FILE_RCSID("@(#)$File: readelf.c,v 1.99 2013/11/05 15:44:01 christos Exp $") #include "magic.h" #ifdef ELFCORE -private int dophn_core(struct magic_set *, int, int, int, off_t, int, size_t, - off_t, int *); +private int dophn_core(struct magic_set *, int, int, int, php_off_t, int, size_t, + php_off_t, int *); #endif private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t, - off_t, int *, int); + php_off_t, int *, int); private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, - off_t, int *, int); + php_off_t, int *, int); private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int, int, size_t, int *); @@ -144,7 +144,7 @@ getu64(int swap, uint64_t value) #define xsh_size (size_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, sh32.sh_size) \ : elf_getu64(swap, sh64.sh_size)) -#define xsh_offset (off_t)(clazz == ELFCLASS32 \ +#define xsh_offset (php_off_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, sh32.sh_offset) \ : elf_getu64(swap, sh64.sh_offset)) #define xsh_type (clazz == ELFCLASS32 \ @@ -162,13 +162,13 @@ getu64(int swap, uint64_t value) #define xph_type (clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_type) \ : elf_getu32(swap, ph64.p_type)) -#define xph_offset (off_t)(clazz == ELFCLASS32 \ +#define xph_offset (php_off_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_offset) \ : elf_getu64(swap, ph64.p_offset)) #define xph_align (size_t)((clazz == ELFCLASS32 \ - ? (off_t) (ph32.p_align ? \ + ? (php_off_t) (ph32.p_align ? \ elf_getu32(swap, ph32.p_align) : 4) \ - : (off_t) (ph64.p_align ? \ + : (php_off_t) (ph64.p_align ? \ elf_getu64(swap, ph64.p_align) : 4))) #define xph_filesz (size_t)((clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_filesz) \ @@ -293,8 +293,8 @@ private const char os_style_names[][8] = { #define FLAGS_IS_CORE 0x10 private int -dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off, - int num, size_t size, off_t fsize, int *flags) +dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, + int num, size_t size, php_off_t fsize, int *flags) { Elf32_Phdr ph32; Elf64_Phdr ph64; @@ -312,7 +312,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off, * Loop through all the program headers. */ for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { file_badseek(ms); return -1; } @@ -334,7 +334,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off, * This is a PT_NOTE section; loop through all the notes * in the section. */ - if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) { file_badseek(ms); return -1; } @@ -917,7 +917,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, Elf64_Shdr sh64; int stripped = 1; void *nbuf; - off_t noff, coff, name_off; + php_off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */ char name[50]; @@ -929,7 +929,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, } for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { file_badseek(ms); return -1; } @@ -959,8 +959,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, switch (xsh_type) { case SHT_NOTE: nbuf = emalloc((size_t)xsh_size); - if ((noff = FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET)) == - (off_t)-1) { + if ((noff = FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET)) == + (php_off_t)-1) { file_badread(ms); efree(nbuf); return -1; @@ -974,7 +974,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, noff = 0; for (;;) { - if (noff >= (off_t)xsh_size) + if (noff >= (php_off_t)xsh_size) break; noff = donote(ms, nbuf, (size_t)noff, (size_t)xsh_size, clazz, swap, 4, @@ -985,8 +985,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, efree(nbuf); break; case SHT_SUNW_cap: - if (FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET) == - (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET) == + (php_off_t)-1) { file_badseek(ms); return -1; } @@ -996,7 +996,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, Elf64_Cap cap64; char cbuf[/*CONSTCOND*/ MAX(sizeof cap32, sizeof cap64)]; - if ((coff += xcap_sizeof) > (off_t)xsh_size) + if ((coff += xcap_sizeof) > (php_off_t)xsh_size) break; if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) != (ssize_t)xcap_sizeof) { @@ -1099,8 +1099,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, * otherwise it's statically linked. */ private int -dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off, - int num, size_t size, off_t fsize, int *flags, int sh_num) +dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, + int num, size_t size, php_off_t fsize, int *flags, int sh_num) { Elf32_Phdr ph32; Elf64_Phdr ph64; @@ -1117,7 +1117,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off, } for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { file_badseek(ms); return -1; } @@ -1161,7 +1161,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off, * This is a PT_NOTE section; loop through all the notes * in the section. */ - if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) { file_badseek(ms); return -1; } @@ -1204,7 +1204,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, int clazz; int swap; struct stat st; - off_t fsize; + php_off_t fsize; int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; @@ -1227,7 +1227,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, /* * If we cannot seek, it must be a pipe, socket or fifo. */ - if((FINFO_LSEEK_FUNC(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE)) + if((FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) && (errno == ESPIPE)) fd = file_pipe2file(ms, fd, buf, nbytes); if (fstat(fd, &st) == -1) { diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c index ef0cbb3891..b0e29c2b91 100644 --- a/ext/fileinfo/libmagic/softmagic.c +++ b/ext/fileinfo/libmagic/softmagic.c @@ -2110,11 +2110,11 @@ magiccheck(struct magic_set *ms, struct magic *m) /* Free haystack */ efree(haystack); - if (Z_LVAL(retval) < 0) { + if (Z_IVAL(retval) < 0) { zval_ptr_dtor(&subpats); zval_ptr_dtor(&pattern); return -1; - } else if ((Z_LVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) { + } else if ((Z_IVAL(retval) > 0) && (Z_TYPE(subpats) == IS_ARRAY)) { /* Need to fetch global match which equals pmatch[0] */ zval *pzval; HashTable *ht = Z_ARRVAL(subpats); @@ -2156,16 +2156,16 @@ magiccheck(struct magic_set *ms, struct magic *m) continue; } ZVAL_DUP(&offsetcopy, offset); - convert_to_long(&offsetcopy); + convert_to_int(&offsetcopy); pattern_offset = &offsetcopy; } ZEND_HASH_FOREACH_END(); zval_dtor(&tmpcopy); if ((pattern_match != NULL) && (pattern_offset != NULL)) { - ms->search.s += Z_LVAL_P(pattern_offset); /* this is where the match starts */ - ms->search.offset += Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */ - ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */; + ms->search.s += Z_IVAL_P(pattern_offset); /* this is where the match starts */ + ms->search.offset += Z_IVAL_P(pattern_offset); /* this is where the match starts as size_t */ + ms->search.rm_len = Z_STRSIZE_P(pattern_match) /* This is the length of the matched pattern */; v = 0; zval_ptr_dtor(pattern_match); diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 6e723638aa..08e01bdabe 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -77,7 +77,7 @@ static const filter_list_entry filter_list[] = { #define PARSE_SESSION 6 #endif -static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC); +static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC); static unsigned int php_sapi_filter_init(TSRMLS_D); /* {{{ arginfo */ @@ -211,72 +211,72 @@ PHP_MINIT_FUNCTION(filter) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_REQUIRE_SCALAR", FILTER_REQUIRE_SCALAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_REQUIRE_ARRAY", FILTER_REQUIRE_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FORCE_ARRAY", FILTER_FORCE_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_URL", FILTER_VALIDATE_URL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_EMAIL", FILTER_VALIDATE_EMAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_IP", FILTER_VALIDATE_IP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_VALIDATE_MAC", FILTER_VALIDATE_MAC, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_DEFAULT", FILTER_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_UNSAFE_RAW", FILTER_UNSAFE_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRING", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_STRIPPED", FILTER_SANITIZE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_ENCODED", FILTER_SANITIZE_ENCODED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_SPECIAL_CHARS", FILTER_SANITIZE_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_FULL_SPECIAL_CHARS", FILTER_SANITIZE_FULL_SPECIAL_CHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_EMAIL", FILTER_SANITIZE_EMAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_OCTAL", FILTER_FLAG_ALLOW_OCTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_HEX", FILTER_FLAG_ALLOW_HEX, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_LOW", FILTER_FLAG_STRIP_LOW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_HIGH", FILTER_FLAG_STRIP_HIGH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_STRIP_BACKTICK", FILTER_FLAG_STRIP_BACKTICK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_LOW", FILTER_FLAG_ENCODE_LOW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_HIGH", FILTER_FLAG_ENCODE_HIGH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ENCODE_AMP", FILTER_FLAG_ENCODE_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_NO_ENCODE_QUOTES", FILTER_FLAG_NO_ENCODE_QUOTES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_EMPTY_STRING_NULL", FILTER_FLAG_EMPTY_STRING_NULL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_FRACTION", FILTER_FLAG_ALLOW_FRACTION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("FILTER_FLAG_IPV4", FILTER_FLAG_IPV4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_IPV6", FILTER_FLAG_IPV6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_NO_RES_RANGE", FILTER_FLAG_NO_RES_RANGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILTER_FLAG_NO_PRIV_RANGE", FILTER_FLAG_NO_PRIV_RANGE, CONST_CS | CONST_PERSISTENT); sapi_register_input_filter(php_sapi_filter, php_sapi_filter_init TSRMLS_CC); @@ -327,7 +327,7 @@ PHP_MINFO_FUNCTION(filter) } /* }}} */ -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); @@ -358,7 +358,7 @@ static unsigned int php_sapi_filter_init(TSRMLS_D) 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; @@ -402,7 +402,7 @@ static void php_zval_filter(zval *value, long filter, long flags, zval *options, } /* }}} */ -static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC) /* {{{ */ +static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC) /* {{{ */ { zval new_var, raw_var; zval *array_ptr = NULL, *orig_array_ptr = NULL; @@ -466,11 +466,11 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int if (retval) { if (new_val_len) { - *new_val_len = Z_STRLEN(new_var); + *new_val_len = Z_STRSIZE(new_var); } efree(*val); - if (Z_STRLEN(new_var)) { - *val = estrndup(Z_STRVAL(new_var), Z_STRLEN(new_var)); + if (Z_STRSIZE(new_var)) { + *val = estrndup(Z_STRVAL(new_var), Z_STRSIZE(new_var)); } else { *val = estrdup(""); } @@ -481,7 +481,7 @@ static unsigned int php_sapi_filter(int arg, char *var, char **val, unsigned int } /* }}} */ -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; @@ -506,7 +506,7 @@ static void php_zval_filter_recursive(zval *value, long filter, long flags, zval } /* }}} */ -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; @@ -556,11 +556,11 @@ static zval *php_filter_get_storage(long arg TSRMLS_DC)/* {{{ */ */ 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; } @@ -574,14 +574,14 @@ PHP_FUNCTION(filter_has_var) } /* }}} */ -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); @@ -661,7 +661,7 @@ static void php_filter_call(zval *filtered, long filter, zval *filter_args, cons 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; @@ -669,10 +669,10 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value, zval_ptr_dtor(return_value); ZVAL_DUP(return_value, input); php_filter_call(return_value, FILTER_DEFAULT, NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); - } else if (Z_TYPE_P(op) == IS_LONG) { + } else if (Z_TYPE_P(op) == IS_INT) { zval_ptr_dtor(return_value); ZVAL_DUP(return_value, input); - php_filter_call(return_value, Z_LVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); + php_filter_call(return_value, Z_IVAL_P(op), NULL, 0, FILTER_REQUIRE_ARRAY TSRMLS_CC); } else if (Z_TYPE_P(op) == IS_ARRAY) { array_init(return_value); @@ -710,12 +710,12 @@ static void php_filter_array_handler(zval *input, zval *op, zval *return_value, */ 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; } @@ -726,11 +726,11 @@ PHP_FUNCTION(filter_input) 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_LONG) { - filter_flags = Z_LVAL_P(filter_args); + if (Z_TYPE_P(filter_args) == IS_INT) { + filter_flags = Z_IVAL_P(filter_args); } else if (Z_TYPE_P(filter_args) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(filter_args), "flags", sizeof("flags") - 1)) != NULL) { PHP_FILTER_GET_LONG_OPT(option, filter_flags); } @@ -766,10 +766,10 @@ PHP_FUNCTION(filter_input) */ 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; } @@ -788,26 +788,26 @@ PHP_FUNCTION(filter_var) */ 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; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) { RETURN_FALSE; } 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_LONG) { - filter_flags = Z_LVAL_P(op); + if (Z_TYPE_P(op) == IS_INT) { + filter_flags = Z_IVAL_P(op); } else if (Z_TYPE_P(op) == IS_ARRAY && (option = zend_hash_str_find(HASH_OF(op), "flags", sizeof("flags") - 1)) != NULL) { PHP_FILTER_GET_LONG_OPT(option, filter_flags); } @@ -841,7 +841,7 @@ PHP_FUNCTION(filter_var_array) return; } - if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_LONG && !PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) { + if (op && (Z_TYPE_P(op) != IS_ARRAY) && (Z_TYPE_P(op) == IS_INT && !PHP_FILTER_ID_EXISTS(Z_IVAL_P(op)))) { RETURN_FALSE; } @@ -880,7 +880,7 @@ PHP_FUNCTION(filter_id) for (i = 0; i < size; ++i) { if (strcmp(filter_list[i].name, filter) == 0) { - RETURN_LONG(filter_list[i].id); + RETURN_INT(filter_list[i].id); } } diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index 4eec7b9119..869b412d4e 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -118,13 +118,13 @@ } #define PHP_FILTER_GET_LONG_OPT(zv, opt) { \ - if (Z_TYPE_P(zv) != IS_LONG) { \ + if (Z_TYPE_P(zv) != IS_INT) { \ zval ___tmp; \ ZVAL_DUP(&___tmp, zv); \ - convert_to_long(&___tmp); \ - opt = Z_LVAL(___tmp); \ + convert_to_int(&___tmp); \ + opt = Z_IVAL(___tmp); \ } else { \ - opt = Z_LVAL_P(zv); \ + opt = Z_IVAL_P(zv); \ } \ } diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index e2c743fd13..5b2333343b 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -56,7 +56,7 @@ if ((option_val = zend_hash_str_find(HASH_OF(option_array), option_name, sizeof(option_name) - 1)) != NULL) { \ if (Z_TYPE_P(option_val) == IS_STRING) { \ var_name = Z_STRVAL_P(option_val); \ - var_name##_len = Z_STRLEN_P(option_val); \ + var_name##_len = Z_STRSIZE_P(option_val); \ var_name##_set = 1; \ } \ } \ @@ -80,8 +80,8 @@ #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; @@ -106,8 +106,8 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret return -1; } - if ((end - str > MAX_LENGTH_OF_LONG - 1) /* number too long */ - || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_LONG - 1) && *str > '2')) { + if ((end - str > MAX_LENGTH_OF_ZEND_INT - 1) /* number too long */ + || (SIZEOF_LONG == 4 && (end - str == MAX_LENGTH_OF_ZEND_INT - 1) && *str > '2')) { /* overflow */ return -1; } @@ -115,9 +115,9 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret 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; @@ -132,16 +132,16 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret } /* }}} */ -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; @@ -150,15 +150,15 @@ static int php_filter_parse_octal(const char *str, unsigned int str_len, long *r } } - *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') { @@ -170,14 +170,14 @@ static int php_filter_parse_hex(const char *str, unsigned int str_len, long *ret } 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; } /* }}} */ @@ -185,11 +185,11 @@ static int php_filter_parse_hex(const char *str, unsigned int str_len, long *ret 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 */ @@ -197,7 +197,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ FETCH_LONG_OPTION(max_range, "max_range"); option_flags = flags; - len = Z_STRLEN_P(value); + len = Z_STRSIZE_P(value); if (len == 0) { RETURN_VALIDATION_FAILED @@ -241,7 +241,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } else { zval_ptr_dtor(value); - ZVAL_LONG(value, ctx_value); + ZVAL_INT(value, ctx_value); return; } } @@ -250,7 +250,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { char *str = Z_STRVAL_P(value); - int len = Z_STRLEN_P(value); + int len = Z_STRSIZE_P(value); int ret; PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0); @@ -327,12 +327,12 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ char dec_sep = '.'; char tsd_sep[3] = "',."; - long lval; + php_int_t lval; double dval; int first, n; - len = Z_STRLEN_P(value); + len = Z_STRSIZE_P(value); str = Z_STRVAL_P(value); PHP_FILTER_TRIM_DEFAULT(str, len); @@ -398,7 +398,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ *p = 0; switch (is_numeric_string(num, p - num, &lval, &dval, 0)) { - case IS_LONG: + case IS_INT: zval_ptr_dtor(value); ZVAL_DOUBLE(value, lval); break; @@ -422,7 +422,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { 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; @@ -443,7 +443,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ if (!re) { RETURN_VALIDATION_FAILED } - matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3); + matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { @@ -455,16 +455,16 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { php_url *url; - int old_len = Z_STRLEN_P(value); + int old_len = Z_STRSIZE_P(value); php_filter_url(value, flags, option_array, charset TSRMLS_CC); - if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) { + if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRSIZE_P(value)) { RETURN_VALIDATION_FAILED } /* Use parse_url - if it returns false, we return NULL */ - url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRLEN_P(value)); + url = php_url_parse_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value)); if (url == NULL) { RETURN_VALIDATION_FAILED @@ -543,7 +543,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ /* The maximum length of an e-mail address is 320 octets, per RFC 2821. */ - if (Z_STRLEN_P(value) > 320) { + if (Z_STRSIZE_P(value) > 320) { RETURN_VALIDATION_FAILED } @@ -554,7 +554,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ RETURN_VALIDATION_FAILED } STR_RELEASE(sregexp); - matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3); + matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRSIZE_P(value), 0, 0, ovector, 3); /* 0 means that the vector is too small to hold all the captured substring offsets */ if (matches < 0) { @@ -688,9 +688,9 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ int ip[4]; int mode; - if (memchr(Z_STRVAL_P(value), ':', Z_STRLEN_P(value))) { + if (memchr(Z_STRVAL_P(value), ':', Z_STRSIZE_P(value))) { mode = FORMAT_IPV6; - } else if (memchr(Z_STRVAL_P(value), '.', Z_STRLEN_P(value))) { + } else if (memchr(Z_STRVAL_P(value), '.', Z_STRSIZE_P(value))) { mode = FORMAT_IPV4; } else { RETURN_VALIDATION_FAILED @@ -706,7 +706,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ switch (mode) { case FORMAT_IPV4: - if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRLEN_P(value), ip)) { + if (!_php_filter_validate_ipv4(Z_STRVAL_P(value), Z_STRSIZE_P(value), ip)) { RETURN_VALIDATION_FAILED } @@ -738,18 +738,18 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ case FORMAT_IPV6: { int res = 0; - res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRLEN_P(value) TSRMLS_CC); + res = _php_filter_validate_ipv6(Z_STRVAL_P(value), Z_STRSIZE_P(value) TSRMLS_CC); if (res < 1) { RETURN_VALIDATION_FAILED } /* Check flags */ if (flags & FILTER_FLAG_NO_PRIV_RANGE) { - if (Z_STRLEN_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) { + if (Z_STRSIZE_P(value) >=2 && (!strncasecmp("FC", Z_STRVAL_P(value), 2) || !strncasecmp("FD", Z_STRVAL_P(value), 2))) { RETURN_VALIDATION_FAILED } } if (flags & FILTER_FLAG_NO_RES_RANGE) { - switch (Z_STRLEN_P(value)) { + switch (Z_STRSIZE_P(value)) { case 1: case 0: break; case 2: @@ -763,7 +763,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } break; default: - if (Z_STRLEN_P(value) >= 5) { + if (Z_STRSIZE_P(value) >= 5) { if ( !strncasecmp("fe8", Z_STRVAL_P(value), 3) || !strncasecmp("fe9", Z_STRVAL_P(value), 3) || @@ -774,10 +774,10 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ } } if ( - (Z_STRLEN_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) || - (Z_STRLEN_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) || - (Z_STRLEN_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) || - (Z_STRLEN_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8)) + (Z_STRSIZE_P(value) >= 9 && !strncasecmp("2001:0db8", Z_STRVAL_P(value), 9)) || + (Z_STRSIZE_P(value) >= 2 && !strncasecmp("5f", Z_STRVAL_P(value), 2)) || + (Z_STRSIZE_P(value) >= 4 && !strncasecmp("3ff3", Z_STRVAL_P(value), 4)) || + (Z_STRSIZE_P(value) >= 8 && !strncasecmp("2001:001", Z_STRVAL_P(value), 8)) ) { RETURN_VALIDATION_FAILED } @@ -792,11 +792,11 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ { char *input = Z_STRVAL_P(value); - int input_len = Z_STRLEN_P(value); + int input_len = Z_STRSIZE_P(value); 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"); diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h index 9ebc18663b..05eb78d885 100644 --- a/ext/filter/php_filter.h +++ b/ext/filter/php_filter.h @@ -59,8 +59,8 @@ ZEND_BEGIN_MODULE_GLOBALS(filter) 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 @@ -70,7 +70,7 @@ ZEND_END_MODULE_GLOBALS(filter) #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); diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c index c93633418f..98c939f686 100644 --- a/ext/filter/sanitizing_filters.c +++ b/ext/filter/sanitizing_filters.c @@ -30,18 +30,18 @@ typedef unsigned long filter_map[256]; static void php_filter_encode_html(zval *value, const unsigned char *chars) { smart_str str = {0}; - int len = Z_STRLEN_P(value); + int len = Z_STRSIZE_P(value); unsigned char *s = (unsigned char *)Z_STRVAL_P(value); unsigned char *e = s + len; - if (Z_STRLEN_P(value) == 0) { + if (Z_STRSIZE_P(value) == 0) { return; } 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 */ @@ -87,10 +87,10 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const memset(tmp, 1, 32); } */ - str = STR_ALLOC(3 * Z_STRLEN_P(value), 0); + str = STR_ALLOC(3 * Z_STRSIZE_P(value), 0); p = str->val; s = Z_STRVAL_P(value); - e = s + Z_STRLEN_P(value); + e = s + Z_STRSIZE_P(value); while (s < e) { if (tmp[*s]) { @@ -108,7 +108,7 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const 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; @@ -120,9 +120,9 @@ static void php_filter_strip(zval *value, long flags) } str = (unsigned char *)Z_STRVAL_P(value); - buf = STR_ALLOC(Z_STRLEN_P(value) + 1, 0); + buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0); c = 0; - for (i = 0; i < Z_STRLEN_P(value); i++) { + for (i = 0; i < Z_STRSIZE_P(value); i++) { if ((str[i] > 127) && (flags & FILTER_FLAG_STRIP_HIGH)) { } else if ((str[i] < 32) && (flags & FILTER_FLAG_STRIP_LOW)) { } else if ((str[i] == '`') && (flags & FILTER_FLAG_STRIP_BACKTICK)) { @@ -162,9 +162,9 @@ static void filter_map_apply(zval *value, filter_map *map) zend_string *buf; str = (unsigned char *)Z_STRVAL_P(value); - buf = STR_ALLOC(Z_STRLEN_P(value) + 1, 0); + buf = STR_ALLOC(Z_STRSIZE_P(value) + 1, 0); c = 0; - for (i = 0; i < Z_STRLEN_P(value); i++) { + for (i = 0; i < Z_STRSIZE_P(value); i++) { if ((*map)[str[i]]) { buf->val[c] = str[i]; ++c; @@ -185,7 +185,7 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL) unsigned char enc[256] = {0}; if (IS_INTERNED(Z_STR_P(value))) { - ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRLEN_P(value)); + ZVAL_STRINGL(value, Z_STRVAL_P(value), Z_STRSIZE_P(value)); } /* strip high/strip low ( see flags )*/ @@ -207,8 +207,8 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL) php_filter_encode_html(value, enc); /* strip tags, implicitly also removes \0 chars */ - new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, NULL, 0, 1); - Z_STRLEN_P(value) = new_len; + new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), NULL, NULL, 0, 1); + Z_STRSIZE_P(value) = new_len; if (new_len == 0) { zval_dtor(value); @@ -264,7 +264,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) } else { quotes = ENT_NOQUOTES; } - buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC); + buf = php_escape_html_entities_ex(Z_STRVAL_P(value), Z_STRSIZE_P(value), 1, quotes, SG(default_charset), 0 TSRMLS_CC); zval_ptr_dtor(value); ZVAL_STR(value, buf); } @@ -274,7 +274,7 @@ void php_filter_full_special_chars(PHP_INPUT_FILTER_PARAM_DECL) void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL) { /* Only if no flags are set (optimization) */ - if (flags != 0 && Z_STRLEN_P(value) > 0) { + if (flags != 0 && Z_STRSIZE_P(value) > 0) { unsigned char enc[256] = {0}; php_filter_strip(value, flags); @@ -290,7 +290,7 @@ void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL) } php_filter_encode_html(value, enc); - } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) { + } else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRSIZE_P(value) == 0) { zval_dtor(value); ZVAL_NULL(value); } @@ -373,7 +373,7 @@ void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL) zend_string *buf; /* just call php_addslashes quotes */ - buf = php_addslashes(Z_STRVAL_P(value), Z_STRLEN_P(value), 0 TSRMLS_CC); + buf = php_addslashes(Z_STRVAL_P(value), Z_STRSIZE_P(value), 0 TSRMLS_CC); zval_ptr_dtor(value); ZVAL_STR(value, buf); diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 30f8e1d1bb..330f6f09e0 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -121,7 +121,7 @@ union ipbox { /* {{{ ftp_open */ ftpbuf_t* -ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC) +ftp_open(const char *host, short port, php_int_t timeout_sec TSRMLS_DC) { ftpbuf_t *ftp; socklen_t size; @@ -248,7 +248,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC) { #if HAVE_OPENSSL_EXT SSL_CTX *ctx = NULL; - long ssl_ctx_options = SSL_OP_ALL; + php_int_t ssl_ctx_options = SSL_OP_ALL; #endif if (ftp == NULL) { return 0; @@ -616,7 +616,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam /* {{{ ftp_alloc */ int -ftp_alloc(ftpbuf_t *ftp, const long size, zend_string **response) +ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response) { char buffer[64]; @@ -791,7 +791,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv) /* {{{ ftp_get */ int -ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC) +ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC) { databuf_t *data = NULL; size_t rcvd; @@ -883,10 +883,10 @@ bail: /* {{{ ftp_put */ int -ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC) +ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC) { databuf_t *data = NULL; - long size; + php_int_t size; char *ptr; int ch; char arg[11]; @@ -960,7 +960,7 @@ bail: /* {{{ ftp_size */ -long +php_int_t ftp_size(ftpbuf_t *ftp, const char *path) { if (ftp == NULL) { @@ -1227,7 +1227,7 @@ ftp_getresp(ftpbuf_t *ftp) int my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) { - long size, sent; + php_int_t size, sent; int n; size = len; @@ -1493,7 +1493,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) #if HAVE_OPENSSL_EXT SSL_CTX *ctx; - long ssl_ctx_options = SSL_OP_ALL; + php_int_t ssl_ctx_options = SSL_OP_ALL; #endif if (data->fd != -1) { @@ -1711,7 +1711,7 @@ bail: /* {{{ ftp_nb_get */ int -ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC) +ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; @@ -1828,7 +1828,7 @@ bail: /* {{{ ftp_nb_put */ int -ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC) +ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h index 6b2b1ae192..9891a14e55 100644 --- a/ext/ftp/ftp.h +++ b/ext/ftp/ftp.h @@ -69,7 +69,7 @@ typedef struct ftpbuf ftptype_t type; /* current transfer type */ int pasv; /* 0=off; 1=pasv; 2=ready */ php_sockaddr_storage pasvaddr; /* passive mode address */ - long timeout_sec; /* User configureable timeout (seconds) */ + php_int_t timeout_sec; /* User configureable timeout (seconds) */ int autoseek; /* User configureable autoseek flag */ int nb; /* "nonblocking" transfer in progress */ @@ -93,7 +93,7 @@ typedef struct ftpbuf /* open a FTP connection, returns ftpbuf (NULL on error) * port is the ftp port in network byte order, or 0 for the default */ -ftpbuf_t* ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC); +ftpbuf_t* ftp_open(const char *host, short port, php_int_t timeout_sec TSRMLS_DC); /* quits from the ftp session (it still needs to be closed) * return true on success, false on error @@ -146,7 +146,7 @@ int ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int fi * however some servers will not accept STOR or APPE until ALLO is confirmed. * If response is passed, it is estrdup()ed from ftp->inbuf and must be freed * or assigned to a zval returned to the user */ -int ftp_alloc(ftpbuf_t *ftp, const long size, zend_string **response); +int ftp_alloc(ftpbuf_t *ftp, const php_int_t size, zend_string **response); /* returns a NULL-terminated array of filenames in the given path * or NULL on error. the return array must be freed (but don't @@ -169,15 +169,15 @@ int ftp_pasv(ftpbuf_t *ftp, int pasv); /* retrieves a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC); +int ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC); +int ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC); /* returns the size of the given file, or -1 on error */ -long ftp_size(ftpbuf_t *ftp, const char *path); +php_int_t ftp_size(ftpbuf_t *ftp, const char *path); /* returns the last modified time of the given file, or -1 on error */ time_t ftp_mdtm(ftpbuf_t *ftp, const char *path); @@ -194,12 +194,12 @@ int ftp_site(ftpbuf_t *ftp, const char *cmd); /* retrieves part of a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, long resumepos TSRMLS_DC); +int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, php_int_t resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, long startpos TSRMLS_DC); +int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, php_int_t startpos TSRMLS_DC); /* continues a previous nb_(f)get command */ diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 1bf485f4ed..cb4cd37a00 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -308,16 +308,16 @@ static void ftp_destructor_ftpbuf(zend_resource *rsrc TSRMLS_DC) PHP_MINIT_FUNCTION(ftp) { le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, le_ftpbuf_name, module_number); - REGISTER_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_ASCII", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_TEXT", FTPTYPE_ASCII, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_AUTORESUME", PHP_FTP_AUTORESUME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_TIMEOUT_SEC", PHP_FTP_OPT_TIMEOUT_SEC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_AUTOSEEK", PHP_FTP_OPT_AUTOSEEK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS); return SUCCESS; } @@ -344,10 +344,10 @@ PHP_FUNCTION(ftp_connect) ftpbuf_t *ftp; char *host; int host_len; - long port = 0; - long timeout_sec = FTP_DEFAULT_TIMEOUT; + php_int_t port = 0; + php_int_t timeout_sec = FTP_DEFAULT_TIMEOUT; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &host, &host_len, &port, &timeout_sec) == FAILURE) { return; } @@ -380,10 +380,10 @@ PHP_FUNCTION(ftp_ssl_connect) ftpbuf_t *ftp; char *host; int host_len; - long port = 0; - long timeout_sec = FTP_DEFAULT_TIMEOUT; + php_int_t port = 0; + php_int_t timeout_sec = FTP_DEFAULT_TIMEOUT; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &host, &host_len, &port, &timeout_sec) == FAILURE) { return; } @@ -606,9 +606,9 @@ PHP_FUNCTION(ftp_chmod) ftpbuf_t *ftp; char *filename; int filename_len; - long mode; + php_int_t mode; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlp", &z_ftp, &mode, &filename, &filename_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rip", &z_ftp, &mode, &filename, &filename_len) == FAILURE) { RETURN_FALSE; } @@ -619,7 +619,7 @@ PHP_FUNCTION(ftp_chmod) RETURN_FALSE; } - RETURN_LONG(mode); + RETURN_INT(mode); } /* }}} */ @@ -629,10 +629,10 @@ PHP_FUNCTION(ftp_alloc) { zval *z_ftp, *zresponse = NULL; ftpbuf_t *ftp; - long size, ret; + php_int_t size, ret; zend_string *response = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &z_ftp, &size, &zresponse) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z/", &z_ftp, &size, &zresponse) == FAILURE) { RETURN_FALSE; } @@ -742,9 +742,9 @@ PHP_FUNCTION(ftp_fget) php_stream *stream; char *file; int file_len; - long mode, resumepos=0; + php_int_t mode, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsi|i", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; } @@ -786,9 +786,9 @@ PHP_FUNCTION(ftp_nb_fget) php_stream *stream; char *file; int file_len; - long mode, resumepos=0, ret; + php_int_t mode, resumepos=0, ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsi|i", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) { return; } @@ -817,10 +817,10 @@ PHP_FUNCTION(ftp_nb_fget) if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_LONG(ret); + RETURN_INT(ret); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -856,9 +856,9 @@ PHP_FUNCTION(ftp_get) php_stream *outstream; char *local, *remote; int local_len, remote_len; - long mode, resumepos=0; + php_int_t mode, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { return; } @@ -919,9 +919,9 @@ PHP_FUNCTION(ftp_nb_get) php_stream *outstream; char *local, *remote; int local_len, remote_len, ret; - long mode, resumepos=0; + php_int_t mode, resumepos=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssi|i", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) { return; } @@ -967,7 +967,7 @@ PHP_FUNCTION(ftp_nb_get) ftp->stream = NULL; VCWD_UNLINK(local); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_LONG(PHP_FTP_FAILED); + RETURN_INT(PHP_FTP_FAILED); } if (ret == PHP_FTP_FINISHED){ @@ -975,7 +975,7 @@ PHP_FUNCTION(ftp_nb_get) ftp->stream = NULL; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -985,7 +985,7 @@ PHP_FUNCTION(ftp_nb_continue) { zval *z_ftp; ftpbuf_t *ftp; - long ret; + php_int_t ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ftp) == FAILURE) { return; @@ -995,7 +995,7 @@ PHP_FUNCTION(ftp_nb_continue) if (!ftp->nb) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "no nbronous transfer to continue."); - RETURN_LONG(PHP_FTP_FAILED); + RETURN_INT(PHP_FTP_FAILED); } if (ftp->direction) { @@ -1013,7 +1013,7 @@ PHP_FUNCTION(ftp_nb_continue) php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1025,11 +1025,11 @@ PHP_FUNCTION(ftp_fput) ftpbuf_t *ftp; ftptype_t xtype; int remote_len; - long mode, startpos=0; + php_int_t mode, startpos=0; php_stream *stream; char *remote; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsri|i", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { return; } @@ -1072,11 +1072,11 @@ PHP_FUNCTION(ftp_nb_fput) ftpbuf_t *ftp; ftptype_t xtype; int remote_len, ret; - long mode, startpos=0; + php_int_t mode, startpos=0; php_stream *stream; char *remote; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrl|l", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsri|i", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) { return; } @@ -1108,10 +1108,10 @@ PHP_FUNCTION(ftp_nb_fput) if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) == PHP_FTP_FAILED)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); - RETURN_LONG(ret); + RETURN_INT(ret); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1124,11 +1124,11 @@ PHP_FUNCTION(ftp_put) ftpbuf_t *ftp; ftptype_t xtype; char *remote, *local; - long remote_len, local_len; - long mode, startpos=0; + php_int_t remote_len, local_len; + php_int_t mode, startpos=0; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { return; } @@ -1178,10 +1178,10 @@ PHP_FUNCTION(ftp_nb_put) ftptype_t xtype; char *remote, *local; int remote_len, local_len; - long mode, startpos=0, ret; + php_int_t mode, startpos=0, ret; php_stream *instream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rppi|i", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) { return; } @@ -1225,7 +1225,7 @@ PHP_FUNCTION(ftp_nb_put) php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1245,7 +1245,7 @@ PHP_FUNCTION(ftp_size) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get file size */ - RETURN_LONG(ftp_size(ftp, file)); + RETURN_INT(ftp_size(ftp, file)); } /* }}} */ @@ -1265,7 +1265,7 @@ PHP_FUNCTION(ftp_mdtm) ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get file mod time */ - RETURN_LONG(ftp_mdtm(ftp, file)); + RETURN_INT(ftp_mdtm(ftp, file)); } /* }}} */ @@ -1368,10 +1368,10 @@ PHP_FUNCTION(ftp_close) PHP_FUNCTION(ftp_set_option) { zval *z_ftp, *z_value; - long option; + php_int_t option; ftpbuf_t *ftp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ftp, &option, &z_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &z_ftp, &option, &z_value) == FAILURE) { return; } @@ -1379,16 +1379,16 @@ PHP_FUNCTION(ftp_set_option) switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: - if (Z_TYPE_P(z_value) != IS_LONG) { + if (Z_TYPE_P(z_value) != IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Option TIMEOUT_SEC expects value of type long, %s given", zend_zval_type_name(z_value)); RETURN_FALSE; } - if (Z_LVAL_P(z_value) <= 0) { + if (Z_IVAL_P(z_value) <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Timeout has to be greater than 0"); RETURN_FALSE; } - ftp->timeout_sec = Z_LVAL_P(z_value); + ftp->timeout_sec = Z_IVAL_P(z_value); RETURN_TRUE; break; case PHP_FTP_OPT_AUTOSEEK: @@ -1413,10 +1413,10 @@ PHP_FUNCTION(ftp_set_option) PHP_FUNCTION(ftp_get_option) { zval *z_ftp; - long option; + php_int_t option; ftpbuf_t *ftp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &z_ftp, &option) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &z_ftp, &option) == FAILURE) { return; } @@ -1424,7 +1424,7 @@ PHP_FUNCTION(ftp_get_option) switch (option) { case PHP_FTP_OPT_TIMEOUT_SEC: - RETURN_LONG(ftp->timeout_sec); + RETURN_INT(ftp->timeout_sec); break; case PHP_FTP_OPT_AUTOSEEK: RETURN_BOOL(ftp->autoseek); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index d7994476f0..b6fff4a12f 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1142,93 +1142,93 @@ PHP_MINIT_FUNCTION(gd) #endif REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT); /* special colours for gd */ - REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT); /* for imagefilledarc */ - REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT); /* GD2 image format types */ - REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FLIP_VERTICAL", GD_FLIP_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FLIP_BOTH", GD_FLIP_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_REPLACE", gdEffectReplace, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_ALPHABLEND", gdEffectAlphaBlend, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("IMG_CROP_DEFAULT", GD_CROP_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_TRANSPARENT", GD_CROP_TRANSPARENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_BLACK", GD_CROP_BLACK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_WHITE", GD_CROP_WHITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BICUBIC", GD_BICUBIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BICUBIC_FIXED", GD_BICUBIC_FIXED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BLACKMAN", GD_BLACKMAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BOX", GD_BOX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_BSPLINE", GD_BSPLINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_CATMULLROM", GD_CATMULLROM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GAUSSIAN", GD_GAUSSIAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_GENERALIZED_CUBIC", GD_GENERALIZED_CUBIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_HERMITE", GD_HERMITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_HAMMING", GD_HAMMING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_HANNING", GD_HANNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_MITCHELL", GD_MITCHELL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_POWER", GD_POWER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_QUADRATIC", GD_QUADRATIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_SINC", GD_SINC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_NEAREST_NEIGHBOUR", GD_NEAREST_NEIGHBOUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_WEIGHTED4", GD_WEIGHTED4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_TRIANGLE", GD_TRIANGLE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("IMG_AFFINE_TRANSLATE", GD_AFFINE_TRANSLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_SCALE", GD_AFFINE_SCALE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_ROTATE", GD_AFFINE_ROTATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_HORIZONTAL", GD_AFFINE_SHEAR_HORIZONTAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_AFFINE_SHEAR_VERTICAL", GD_AFFINE_SHEAR_VERTICAL, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_GD_BUNDLED) - REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT); #endif /* Section Filters */ - REGISTER_LONG_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_BRIGHTNESS", IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_EDGEDETECT", IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_MEAN_REMOVAL", IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMG_FILTER_PIXELATE", IMAGE_FILTER_PIXELATE, CONST_CS | CONST_PERSISTENT); /* End Section Filters */ #ifdef GD_VERSION_STRING @@ -1236,9 +1236,9 @@ PHP_MINIT_FUNCTION(gd) #endif #if defined(GD_MAJOR_VERSION) && defined(GD_MINOR_VERSION) && defined(GD_RELEASE_VERSION) && defined(GD_EXTRA_VERSION) - REGISTER_LONG_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("GD_EXTRA_VERSION", GD_EXTRA_VERSION, CONST_CS | CONST_PERSISTENT); #endif @@ -1250,13 +1250,13 @@ PHP_MINIT_FUNCTION(gd) * /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup. * as error, use the values for now... */ - REGISTER_LONG_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT); #endif return SUCCESS; @@ -1515,7 +1515,7 @@ PHP_FUNCTION(imageloadfont) * that overlap with the old fonts (with indices 1-5). The first * list index given out is always 1. */ - RETURN_LONG(Z_RES_HANDLE_P(ind) + 5); + RETURN_INT(Z_RES_HANDLE_P(ind) + 5); } /* }}} */ @@ -1538,13 +1538,13 @@ PHP_FUNCTION(imagesetstyle) stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0); ZEND_HASH_FOREACH_VAL(HASH_OF(styles), item) { - if (Z_TYPE_P(item) != IS_LONG) { + if (Z_TYPE_P(item) != IS_INT) { zval lval; ZVAL_COPY(&lval, item); - convert_to_long(&lval); - stylearr[index++] = Z_LVAL(lval); + convert_to_int(&lval); + stylearr[index++] = Z_IVAL(lval); } else { - stylearr[index++] = Z_LVAL_P(item); + stylearr[index++] = Z_IVAL_P(item); } } ZEND_HASH_FOREACH_END(); @@ -1560,10 +1560,10 @@ PHP_FUNCTION(imagesetstyle) Create a new true color image */ PHP_FUNCTION(imagecreatetruecolor) { - long x_size, y_size; + php_int_t x_size, y_size; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x_size, &y_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &x_size, &y_size) == FAILURE) { return; } @@ -1605,10 +1605,10 @@ PHP_FUNCTION(imagetruecolortopalette) { zval *IM; zend_bool dither; - long ncolors; + php_int_t ncolors; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rbl", &IM, &dither, &ncolors) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rbi", &IM, &dither, &ncolors) == FAILURE) { return; } @@ -1689,10 +1689,10 @@ PHP_FUNCTION(imagecolormatch) PHP_FUNCTION(imagesetthickness) { zval *IM; - long thick; + php_int_t thick; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &thick) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &thick) == FAILURE) { return; } @@ -1709,10 +1709,10 @@ PHP_FUNCTION(imagesetthickness) PHP_FUNCTION(imagefilledellipse) { zval *IM; - long cx, cy, w, h, color; + php_int_t cx, cy, w, h, color; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { return; } @@ -1729,11 +1729,11 @@ PHP_FUNCTION(imagefilledellipse) PHP_FUNCTION(imagefilledarc) { zval *IM; - long cx, cy, w, h, ST, E, col, style; + php_int_t cx, cy, w, h, ST, E, col, style; gdImagePtr im; int e, st; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiiiiii", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) { return; } @@ -1798,10 +1798,10 @@ PHP_FUNCTION(imagesavealpha) PHP_FUNCTION(imagelayereffect) { zval *IM; - long effect; + php_int_t effect; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &effect) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &effect) == FAILURE) { return; } @@ -1817,11 +1817,11 @@ PHP_FUNCTION(imagelayereffect) PHP_FUNCTION(imagecolorallocatealpha) { zval *IM; - long red, green, blue, alpha; + php_int_t red, green, blue, alpha; gdImagePtr im; int ct = (-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { RETURN_FALSE; } @@ -1830,7 +1830,7 @@ PHP_FUNCTION(imagecolorallocatealpha) if (ct < 0) { RETURN_FALSE; } - RETURN_LONG((long)ct); + RETURN_INT((php_int_t)ct); } /* }}} */ @@ -1839,16 +1839,16 @@ PHP_FUNCTION(imagecolorallocatealpha) PHP_FUNCTION(imagecolorresolvealpha) { zval *IM; - long red, green, blue, alpha; + php_int_t red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorResolveAlpha(im, red, green, blue, alpha)); + RETURN_INT(gdImageColorResolveAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1857,16 +1857,16 @@ PHP_FUNCTION(imagecolorresolvealpha) PHP_FUNCTION(imagecolorclosestalpha) { zval *IM; - long red, green, blue, alpha; + php_int_t red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorClosestAlpha(im, red, green, blue, alpha)); + RETURN_INT(gdImageColorClosestAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1875,16 +1875,16 @@ PHP_FUNCTION(imagecolorclosestalpha) PHP_FUNCTION(imagecolorexactalpha) { zval *IM; - long red, green, blue, alpha; + php_int_t red, green, blue, alpha; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &red, &green, &blue, &alpha) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorExactAlpha(im, red, green, blue, alpha)); + RETURN_INT(gdImageColorExactAlpha(im, red, green, blue, alpha)); } /* }}} */ @@ -1893,11 +1893,11 @@ PHP_FUNCTION(imagecolorexactalpha) PHP_FUNCTION(imagecopyresampled) { zval *SIM, *DIM; - long SX, SY, SW, SH, DX, DY, DW, DH; + php_int_t SX, SY, SW, SH, DX, DY, DW, DH; gdImagePtr im_dst, im_src; int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { return; } @@ -1925,7 +1925,7 @@ PHP_FUNCTION(imagecopyresampled) PHP_FUNCTION(imagegrabwindow) { HWND window; - long client_area = 0; + php_int_t client_area = 0; RECT rc = {0}; RECT rc_win = {0}; int Width, Height; @@ -1934,12 +1934,12 @@ PHP_FUNCTION(imagegrabwindow) HBITMAP memBM; HBITMAP hOld; HINSTANCE handle; - long lwindow_handle; + php_int_t lwindow_handle; typedef BOOL (WINAPI *tPrintWindow)(HWND, HDC,UINT); tPrintWindow pPrintWindow = 0; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &lwindow_handle, &client_area) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &lwindow_handle, &client_area) == FAILURE) { RETURN_FALSE; } @@ -2076,10 +2076,10 @@ PHP_FUNCTION(imagerotate) zval *SIM; gdImagePtr im_dst, im_src; double degrees; - long color; - long ignoretransparent = 0; + php_int_t color; + php_int_t ignoretransparent = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdl|l", &SIM, °rees, &color, &ignoretransparent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdi|i", &SIM, °rees, &color, &ignoretransparent) == FAILURE) { RETURN_FALSE; } @@ -2139,10 +2139,10 @@ PHP_FUNCTION(imagesetbrush) Create a new image */ PHP_FUNCTION(imagecreate) { - long x_size, y_size; + php_int_t x_size, y_size; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x_size, &y_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &x_size, &y_size) == FAILURE) { return; } @@ -2182,7 +2182,7 @@ PHP_FUNCTION(imagetypes) return; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -2251,7 +2251,7 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct gdImagePtr im; gdIOCtx *io_ctx; - io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0); + io_ctx = gdNewDynamicCtxEx(Z_STRSIZE_P(data), Z_STRVAL_P(data), 0); if (!io_ctx) { return NULL; @@ -2284,7 +2284,7 @@ PHP_FUNCTION(imagecreatefromstring) } convert_to_string_ex(data); - if (Z_STRLEN_P(data) < 8) { + if (Z_STRSIZE_P(data) < 8) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string or invalid image"); RETURN_FALSE; } @@ -2344,7 +2344,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, { char *file; int file_len; - long srcx, srcy, width, height; + php_int_t srcx, srcy, width, height; gdImagePtr im = NULL; php_stream *stream; FILE * fp = NULL; @@ -2353,7 +2353,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, #endif if (image_type == PHP_GDIMG_TYPE_GD2PART) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "siiii", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) { return; } if (width < 1 || height < 1) { @@ -2551,7 +2551,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char { zval *imgind; char *file = NULL; - long quality = 0, type = 0; + php_int_t quality = 0, type = 0; gdImagePtr im; char *fn = NULL; FILE *fp; @@ -2562,7 +2562,7 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char /* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */ /* The quality parameter for gd2 stands for chunk size */ - if (zend_parse_parameters(argc TSRMLS_CC, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|pii", &imgind, &file, &file_len, &quality, &type) == FAILURE) { return; } @@ -2794,11 +2794,11 @@ PHP_FUNCTION(imagedestroy) PHP_FUNCTION(imagecolorallocate) { zval *IM; - long red, green, blue; + php_int_t red, green, blue; gdImagePtr im; int ct = (-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { return; } @@ -2808,7 +2808,7 @@ PHP_FUNCTION(imagecolorallocate) if (ct < 0) { RETURN_FALSE; } - RETURN_LONG(ct); + RETURN_INT(ct); } /* }}} */ @@ -2835,10 +2835,10 @@ PHP_FUNCTION(imagepalettecopy) PHP_FUNCTION(imagecolorat) { zval *IM; - long x, y; + php_int_t x, y; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &IM, &x, &y) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &IM, &x, &y) == FAILURE) { return; } @@ -2846,14 +2846,14 @@ PHP_FUNCTION(imagecolorat) if (gdImageTrueColor(im)) { if (im->tpixels && gdImageBoundsSafe(im, x, y)) { - RETURN_LONG(gdImageTrueColorPixel(im, x, y)); + RETURN_INT(gdImageTrueColorPixel(im, x, y)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", x, y); RETURN_FALSE; } } else { if (im->pixels && gdImageBoundsSafe(im, x, y)) { - RETURN_LONG(im->pixels[y][x]); + RETURN_INT(im->pixels[y][x]); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", x, y); RETURN_FALSE; @@ -2867,16 +2867,16 @@ PHP_FUNCTION(imagecolorat) PHP_FUNCTION(imagecolorclosest) { zval *IM; - long red, green, blue; + php_int_t red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorClosest(im, red, green, blue)); + RETURN_INT(gdImageColorClosest(im, red, green, blue)); } /* }}} */ @@ -2885,16 +2885,16 @@ PHP_FUNCTION(imagecolorclosest) PHP_FUNCTION(imagecolorclosesthwb) { zval *IM; - long red, green, blue; + php_int_t red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorClosestHWB(im, red, green, blue)); + RETURN_INT(gdImageColorClosestHWB(im, red, green, blue)); } /* }}} */ @@ -2903,11 +2903,11 @@ PHP_FUNCTION(imagecolorclosesthwb) PHP_FUNCTION(imagecolordeallocate) { zval *IM; - long index; + php_int_t index; int col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &index) == FAILURE) { return; } @@ -2935,16 +2935,16 @@ PHP_FUNCTION(imagecolordeallocate) PHP_FUNCTION(imagecolorresolve) { zval *IM; - long red, green, blue; + php_int_t red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorResolve(im, red, green, blue)); + RETURN_INT(gdImageColorResolve(im, red, green, blue)); } /* }}} */ @@ -2953,16 +2953,16 @@ PHP_FUNCTION(imagecolorresolve) PHP_FUNCTION(imagecolorexact) { zval *IM; - long red, green, blue; + php_int_t red, green, blue; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &red, &green, &blue) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &red, &green, &blue) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorExact(im, red, green, blue)); + RETURN_INT(gdImageColorExact(im, red, green, blue)); } /* }}} */ @@ -2971,11 +2971,11 @@ PHP_FUNCTION(imagecolorexact) PHP_FUNCTION(imagecolorset) { zval *IM; - long color, red, green, blue, alpha = 0; + php_int_t color, red, green, blue, alpha = 0; int col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii|i", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) { return; } @@ -2999,11 +2999,11 @@ PHP_FUNCTION(imagecolorset) PHP_FUNCTION(imagecolorsforindex) { zval *IM; - long index; + php_int_t index; int col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &index) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &index) == FAILURE) { return; } @@ -3014,10 +3014,10 @@ PHP_FUNCTION(imagecolorsforindex) if ((col >= 0 && gdImageTrueColor(im)) || (!gdImageTrueColor(im) && col >= 0 && col < gdImageColorsTotal(im))) { array_init(return_value); - add_assoc_long(return_value,"red", gdImageRed(im,col)); - add_assoc_long(return_value,"green", gdImageGreen(im,col)); - add_assoc_long(return_value,"blue", gdImageBlue(im,col)); - add_assoc_long(return_value,"alpha", gdImageAlpha(im,col)); + add_assoc_int(return_value,"red", gdImageRed(im,col)); + add_assoc_int(return_value,"green", gdImageGreen(im,col)); + add_assoc_int(return_value,"blue", gdImageBlue(im,col)); + add_assoc_int(return_value,"alpha", gdImageAlpha(im,col)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color index %d out of range", col); RETURN_FALSE; @@ -3073,10 +3073,10 @@ PHP_FUNCTION(imagegammacorrect) PHP_FUNCTION(imagesetpixel) { zval *IM; - long x, y, col; + php_int_t x, y, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &x, &y, &col) == FAILURE) { return; } @@ -3091,10 +3091,10 @@ PHP_FUNCTION(imagesetpixel) PHP_FUNCTION(imageline) { zval *IM; - long x1, y1, x2, y2, col; + php_int_t x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3117,10 +3117,10 @@ PHP_FUNCTION(imageline) PHP_FUNCTION(imagedashedline) { zval *IM; - long x1, y1, x2, y2, col; + php_int_t x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3135,10 +3135,10 @@ PHP_FUNCTION(imagedashedline) PHP_FUNCTION(imagerectangle) { zval *IM; - long x1, y1, x2, y2, col; + php_int_t x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3153,10 +3153,10 @@ PHP_FUNCTION(imagerectangle) PHP_FUNCTION(imagefilledrectangle) { zval *IM; - long x1, y1, x2, y2, col; + php_int_t x1, y1, x2, y2, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) { return; } @@ -3171,11 +3171,11 @@ PHP_FUNCTION(imagefilledrectangle) PHP_FUNCTION(imagearc) { zval *IM; - long cx, cy, w, h, ST, E, col; + php_int_t cx, cy, w, h, ST, E, col; gdImagePtr im; int e, st; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiiiii", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) { return; } @@ -3201,10 +3201,10 @@ PHP_FUNCTION(imagearc) PHP_FUNCTION(imageellipse) { zval *IM; - long cx, cy, w, h, color; + php_int_t cx, cy, w, h, color; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiiii", &IM, &cx, &cy, &w, &h, &color) == FAILURE) { return; } @@ -3220,10 +3220,10 @@ PHP_FUNCTION(imageellipse) PHP_FUNCTION(imagefilltoborder) { zval *IM; - long x, y, border, col; + php_int_t x, y, border, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &IM, &x, &y, &border, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii", &IM, &x, &y, &border, &col) == FAILURE) { return; } @@ -3238,10 +3238,10 @@ PHP_FUNCTION(imagefilltoborder) PHP_FUNCTION(imagefill) { zval *IM; - long x, y, col; + php_int_t x, y, col; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &IM, &x, &y, &col) == FAILURE) { return; } @@ -3264,7 +3264,7 @@ PHP_FUNCTION(imagecolorstotal) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageColorsTotal(im)); + RETURN_INT(gdImageColorsTotal(im)); } /* }}} */ @@ -3273,11 +3273,11 @@ PHP_FUNCTION(imagecolorstotal) PHP_FUNCTION(imagecolortransparent) { zval *IM; - long COL = 0; + php_int_t COL = 0; gdImagePtr im; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &IM, &COL) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &IM, &COL) == FAILURE) { return; } @@ -3287,7 +3287,7 @@ PHP_FUNCTION(imagecolortransparent) gdImageColorTransparent(im, COL); } - RETURN_LONG(gdImageGetTransparent(im)); + RETURN_INT(gdImageGetTransparent(im)); } /* }}} */ @@ -3297,10 +3297,10 @@ PHP_FUNCTION(imageinterlace) { zval *IM; int argc = ZEND_NUM_ARGS(); - long INT = 0; + php_int_t INT = 0; gdImagePtr im; - if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &IM, &INT) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &IM, &INT) == FAILURE) { return; } @@ -3310,7 +3310,7 @@ PHP_FUNCTION(imageinterlace) gdImageInterlace(im, INT); } - RETURN_LONG(gdImageGetInterlaced(im)); + RETURN_INT(gdImageGetInterlaced(im)); } /* }}} */ @@ -3321,13 +3321,13 @@ PHP_FUNCTION(imageinterlace) static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) { zval *IM, *POINTS; - long NPOINTS, COL; + php_int_t NPOINTS, COL; zval *var = NULL; gdImagePtr im; gdPointPtr points; int npoints, col, nelem, i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rall", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "raii", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) { return; } @@ -3354,23 +3354,23 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) for (i = 0; i < npoints; i++) { if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2))) != NULL) { - if (Z_TYPE_P(var) != IS_LONG) { + if (Z_TYPE_P(var) != IS_INT) { zval lval; ZVAL_COPY(&lval, var); - convert_to_long(&lval); - points[i].x = Z_LVAL(lval); + convert_to_int(&lval); + points[i].x = Z_IVAL(lval); } else { - points[i].x = Z_LVAL_P(var); + points[i].x = Z_IVAL_P(var); } } if ((var = zend_hash_index_find(Z_ARRVAL_P(POINTS), (i * 2) + 1)) != NULL) { - if (Z_TYPE_P(var) != IS_LONG) { + if (Z_TYPE_P(var) != IS_INT) { zval lval; ZVAL_COPY(&lval, var); - convert_to_long(&lval); - points[i].y = Z_LVAL(lval); + convert_to_int(&lval); + points[i].y = Z_IVAL(lval); } else { - points[i].y = Z_LVAL_P(var); + points[i].y = Z_IVAL_P(var); } } } @@ -3449,15 +3449,15 @@ static gdFontPtr php_find_gd_font(int size TSRMLS_DC) */ static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg) { - long SIZE; + php_int_t SIZE; gdFontPtr font; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &SIZE) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &SIZE) == FAILURE) { return; } font = php_find_gd_font(SIZE TSRMLS_CC); - RETURN_LONG(arg ? font->h : font->w); + RETURN_INT(arg ? font->h : font->w); } /* }}} */ @@ -3512,7 +3512,7 @@ static void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, i static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) { zval *IM; - long SIZE, X, Y, COL; + php_int_t SIZE, X, Y, COL; char *C; int C_len; gdImagePtr im; @@ -3520,7 +3520,7 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) unsigned char *str = NULL; gdFontPtr font; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllsl", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiisi", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) { return; } @@ -3607,11 +3607,11 @@ PHP_FUNCTION(imagestringup) PHP_FUNCTION(imagecopy) { zval *SIM, *DIM; - long SX, SY, SW, SH, DX, DY; + php_int_t SX, SY, SW, SH, DX, DY; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) { return; } @@ -3635,11 +3635,11 @@ PHP_FUNCTION(imagecopy) PHP_FUNCTION(imagecopymerge) { zval *SIM, *DIM; - long SX, SY, SW, SH, DX, DY, PCT; + php_int_t SX, SY, SW, SH, DX, DY, PCT; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX, pct; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { return; } @@ -3664,11 +3664,11 @@ PHP_FUNCTION(imagecopymerge) PHP_FUNCTION(imagecopymergegray) { zval *SIM, *DIM; - long SX, SY, SW, SH, DX, DY, PCT; + php_int_t SX, SY, SW, SH, DX, DY, PCT; gdImagePtr im_dst, im_src; int srcH, srcW, srcY, srcX, dstY, dstX, pct; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) { return; } @@ -3693,11 +3693,11 @@ PHP_FUNCTION(imagecopymergegray) PHP_FUNCTION(imagecopyresized) { zval *SIM, *DIM; - long SX, SY, SW, SH, DX, DY, DW, DH; + php_int_t SX, SY, SW, SH, DX, DY, DW, DH; gdImagePtr im_dst, im_src; int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rriiiiiiii", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) { return; } @@ -3736,7 +3736,7 @@ PHP_FUNCTION(imagesx) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageSX(im)); + RETURN_INT(gdImageSX(im)); } /* }}} */ @@ -3753,7 +3753,7 @@ PHP_FUNCTION(imagesy) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); - RETURN_LONG(gdImageSY(im)); + RETURN_INT(gdImageSY(im)); } /* }}} */ @@ -3804,7 +3804,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int { zval *IM, *EXT = NULL; gdImagePtr im=NULL; - long col = -1, x = -1, y = -1; + php_int_t col = -1, x = -1, y = -1; int str_len, fontname_len, i, brect[8]; double ptsize, angle; char *str = NULL, *fontname = NULL; @@ -3821,7 +3821,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int } else { if (argc < 8 || argc > ((extended) ? 9 : 8)) { ZEND_WRONG_PARAM_COUNT(); - } else if (zend_parse_parameters(argc TSRMLS_CC, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) { + } else if (zend_parse_parameters(argc TSRMLS_CC, "rddiiiss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); @@ -3833,7 +3833,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int if (extended && EXT) { /* parse extended info */ zval *item; zend_string *key; - ulong num_key; + php_uint_t num_key; /* walk the assoc array */ ZEND_HASH_FOREACH_KEY_VAL(HASH_OF(EXT), num_key, key, item) { @@ -3878,7 +3878,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int /* return array with the text's bounding box */ for (i = 0; i < 8; i++) { - add_next_index_long(return_value, brect[i]); + add_next_index_int(return_value, brect[i]); } } /* }}} */ @@ -3994,7 +3994,7 @@ PHP_FUNCTION(imagepscopyfont) nf_ind->extend = 1; l_ind = zend_list_insert(nf_ind, le_ps_font TSRMLS_CC); - RETURN_LONG(l_ind); + RETURN_INT(l_ind); } */ /* }}} */ @@ -4105,7 +4105,7 @@ PHP_FUNCTION(imagepstext) { zval *img, *fnt; int i, j; - long _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0; + php_int_t _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0; int *f_ind; int h_lines, v_lines, c_ind; int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl; @@ -4121,7 +4121,7 @@ PHP_FUNCTION(imagepstext) char *str; int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsrlllll|lldl", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsriiiii|iidi", &img, &str, &str_len, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) { return; } @@ -4231,10 +4231,10 @@ PHP_FUNCTION(imagepstext) array_init(return_value); - add_next_index_long(return_value, str_img->metrics.leftSideBearing); - add_next_index_long(return_value, str_img->metrics.descent); - add_next_index_long(return_value, str_img->metrics.rightSideBearing); - add_next_index_long(return_value, str_img->metrics.ascent); + add_next_index_int(return_value, str_img->metrics.leftSideBearing); + add_next_index_int(return_value, str_img->metrics.descent); + add_next_index_int(return_value, str_img->metrics.rightSideBearing); + add_next_index_int(return_value, str_img->metrics.ascent); } /* }}} */ @@ -4243,7 +4243,7 @@ PHP_FUNCTION(imagepstext) PHP_FUNCTION(imagepsbbox) { zval *fnt; - long sz = 0, sp = 0, wd = 0; + php_int_t sz = 0, sp = 0, wd = 0; char *str; int i, space = 0, add_width = 0, char_width, amount_kern; int cur_x, cur_y, dx, dy; @@ -4258,7 +4258,7 @@ PHP_FUNCTION(imagepsbbox) ZEND_WRONG_PARAM_COUNT(); } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sri|iid", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) { return; } @@ -4330,10 +4330,10 @@ PHP_FUNCTION(imagepsbbox) /* printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury); */ - add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); - add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000)); + add_next_index_int(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000)); } /* }}} */ #endif @@ -4423,7 +4423,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) { char *f_org, *f_dest; int f_org_len, f_dest_len; - long height, width, threshold; + php_int_t height, width, threshold; gdImagePtr im_org, im_dest, im_tmp; char *fn_org = NULL; char *fn_dest = NULL; @@ -4437,10 +4437,10 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) int x, y; float x_ratio, y_ratio; #ifdef HAVE_GD_JPG - long ignore_warning; + php_int_t ignore_warning; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppiii", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { return; } @@ -4635,9 +4635,9 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; - long brightness, tmp; + php_int_t brightness, tmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &SIM, &tmp, &brightness) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zii", &SIM, &tmp, &brightness) == FAILURE) { RETURN_FALSE; } @@ -4658,9 +4658,9 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; - long contrast, tmp; + php_int_t contrast, tmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &SIM, &tmp, &contrast) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &SIM, &tmp, &contrast) == FAILURE) { RETURN_FALSE; } @@ -4681,10 +4681,10 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; - long r,g,b,tmp; - long a = 0; + php_int_t r,g,b,tmp; + php_int_t a = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiii|i", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) { RETURN_FALSE; } @@ -4759,11 +4759,11 @@ static void php_image_filter_mean_removal(INTERNAL_FUNCTION_PARAMETERS) static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; - long tmp; + php_int_t tmp; gdImagePtr im_src; double weight; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rld", &SIM, &tmp, &weight) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rid", &SIM, &tmp, &weight) == FAILURE) { RETURN_FALSE; } @@ -4784,10 +4784,10 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS) { zval *IM; gdImagePtr im; - long tmp, blocksize; + php_int_t tmp, blocksize; zend_bool mode = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll|b", &IM, &tmp, &blocksize, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii|b", &IM, &tmp, &blocksize, &mode) == FAILURE) { RETURN_FALSE; } @@ -4811,7 +4811,7 @@ PHP_FUNCTION(imagefilter) zval *tmp; typedef void (*image_filter)(INTERNAL_FUNCTION_PARAMETERS); - long filtertype; + php_int_t filtertype; image_filter filters[] = { php_image_filter_negate , @@ -4830,7 +4830,7 @@ PHP_FUNCTION(imagefilter) if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > IMAGE_FILTER_MAX_ARGS) { WRONG_PARAM_COUNT; - } else if (zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) { + } else if (zend_parse_parameters(2 TSRMLS_CC, "ri", &tmp, &filtertype) == FAILURE) { return; } @@ -4903,10 +4903,10 @@ PHP_FUNCTION(imageconvolution) PHP_FUNCTION(imageflip) { zval *IM; - long mode; + php_int_t mode; gdImagePtr im; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &IM, &mode) == FAILURE) { return; } @@ -4972,13 +4972,13 @@ PHP_FUNCTION(imagecrop) ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd); if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") -1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.x = Z_LVAL(lval); + convert_to_int(&lval); + rect.x = Z_IVAL(lval); } else { - rect.x = Z_LVAL_P(tmp); + rect.x = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position"); @@ -4986,13 +4986,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.y = Z_LVAL(lval); + convert_to_int(&lval); + rect.y = Z_IVAL(lval); } else { - rect.y = Z_LVAL_P(tmp); + rect.y = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position"); @@ -5000,13 +5000,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.width = Z_LVAL(lval); + convert_to_int(&lval); + rect.width = Z_IVAL(lval); } else { - rect.width = Z_LVAL_P(tmp); + rect.width = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width"); @@ -5014,13 +5014,13 @@ PHP_FUNCTION(imagecrop) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.height = Z_LVAL(lval); + convert_to_int(&lval); + rect.height = Z_IVAL(lval); } else { - rect.height = Z_LVAL_P(tmp); + rect.height = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height"); @@ -5042,13 +5042,13 @@ PHP_FUNCTION(imagecrop) PHP_FUNCTION(imagecropauto) { zval *IM; - long mode = -1; - long color = -1; + php_int_t mode = -1; + php_int_t color = -1; double threshold = 0.5f; gdImagePtr im; gdImagePtr im_crop; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ldl", &IM, &mode, &threshold, &color) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|idi", &IM, &mode, &threshold, &color) == FAILURE) { return; } @@ -5093,10 +5093,10 @@ PHP_FUNCTION(imagescale) gdImagePtr im; gdImagePtr im_scaled = NULL; int new_width, new_height; - long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED; + php_int_t tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED; gdInterpolationMethod method; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|ii", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) { return; } method = tmp_m; @@ -5147,8 +5147,8 @@ PHP_FUNCTION(imageaffine) for (i = 0; i < nelems; i++) { if ((zval_affine_elem = zend_hash_index_find(Z_ARRVAL_P(z_affine), i)) != NULL) { switch (Z_TYPE_P(zval_affine_elem)) { - case IS_LONG: - affine[i] = Z_LVAL_P(zval_affine_elem); + case IS_INT: + affine[i] = Z_IVAL_P(zval_affine_elem); break; case IS_DOUBLE: affine[i] = Z_DVAL_P(zval_affine_elem); @@ -5170,13 +5170,13 @@ PHP_FUNCTION(imageaffine) if (z_rect != NULL) { if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "x", sizeof("x") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.x = Z_LVAL(lval); + convert_to_int(&lval); + rect.x = Z_IVAL(lval); } else { - rect.x = Z_LVAL_P(tmp); + rect.x = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing x position"); @@ -5184,13 +5184,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "y", sizeof("y") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.y = Z_LVAL(lval); + convert_to_int(&lval); + rect.y = Z_IVAL(lval); } else { - rect.y = Z_LVAL_P(tmp); + rect.y = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position"); @@ -5198,13 +5198,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "width", sizeof("width") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.width = Z_LVAL(lval); + convert_to_int(&lval); + rect.width = Z_IVAL(lval); } else { - rect.width = Z_LVAL_P(tmp); + rect.width = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing width"); @@ -5212,13 +5212,13 @@ PHP_FUNCTION(imageaffine) } if ((tmp = zend_hash_str_find(HASH_OF(z_rect), "height", sizeof("height") - 1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { + if (Z_TYPE_P(tmp) != IS_INT) { zval lval; ZVAL_COPY(&lval, tmp); - convert_to_long(&lval); - rect.height = Z_LVAL(lval); + convert_to_int(&lval); + rect.height = Z_IVAL(lval); } else { - rect.height = Z_LVAL_P(tmp); + rect.height = Z_IVAL_P(tmp); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing height"); @@ -5250,12 +5250,12 @@ PHP_FUNCTION(imageaffine) PHP_FUNCTION(imageaffinematrixget) { double affine[6]; - long type; + php_int_t type; zval *options = NULL; zval *tmp; int res = GD_FALSE, i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &type, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|z", &type, &options) == FAILURE) { return; } @@ -5365,8 +5365,8 @@ PHP_FUNCTION(imageaffinematrixconcat) for (i = 0; i < 6; i++) { if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m1), i)) != NULL) { switch (Z_TYPE_P(tmp)) { - case IS_LONG: - m1[i] = Z_LVAL_P(tmp); + case IS_INT: + m1[i] = Z_IVAL_P(tmp); break; case IS_DOUBLE: m1[i] = Z_DVAL_P(tmp); @@ -5386,8 +5386,8 @@ PHP_FUNCTION(imageaffinematrixconcat) } if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) { switch (Z_TYPE_P(tmp)) { - case IS_LONG: - m2[i] = Z_LVAL_P(tmp); + case IS_INT: + m2[i] = Z_IVAL_P(tmp); break; case IS_DOUBLE: m2[i] = Z_DVAL_P(tmp); @@ -5423,9 +5423,9 @@ PHP_FUNCTION(imagesetinterpolation) { zval *IM; gdImagePtr im; - long method = GD_BILINEAR_FIXED; + php_int_t method = GD_BILINEAR_FIXED; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &IM, &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &IM, &method) == FAILURE) { return; } diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index a2e7163415..da6cdef8e3 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -79,7 +79,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, zval *imgind; char *file = NULL; int file_len = 0; - long quality, basefilter; + php_int_t quality, basefilter; gdImagePtr im; int argc = ZEND_NUM_ARGS(); int q = -1, i; @@ -93,7 +93,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, * from imagey<type>(). */ if (image_type == PHP_GDIMG_TYPE_XBM) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ii", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { return; } } else { @@ -103,7 +103,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, * PHP_GDIMG_TYPE_WBM * PHP_GDIMG_TYPE_WEBP * */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ii", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { return; } } diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c index 1e07000c33..59b9661481 100644 --- a/ext/gettext/gettext.c +++ b/ext/gettext/gettext.c @@ -226,9 +226,9 @@ PHP_NAMED_FUNCTION(zif_dcgettext) { char *domain, *msgid, *msgstr; int domain_len, msgid_len; - long category; + php_int_t category; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &domain, &domain_len, &msgid, &msgid_len, &category) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi", &domain, &domain_len, &msgid, &msgid_len, &category) == FAILURE) { return; } @@ -281,9 +281,9 @@ PHP_NAMED_FUNCTION(zif_ngettext) { char *msgid1, *msgid2, *msgstr; int msgid1_len, msgid2_len; - long count; + php_int_t count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) { return; } @@ -305,9 +305,9 @@ PHP_NAMED_FUNCTION(zif_dngettext) { char *domain, *msgid1, *msgid2, *msgstr = NULL; int domain_len, msgid1_len, msgid2_len; - long count; + php_int_t count; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl", &domain, &domain_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi", &domain, &domain_len, &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) { return; } @@ -331,11 +331,11 @@ PHP_NAMED_FUNCTION(zif_dcngettext) { char *domain, *msgid1, *msgid2, *msgstr = NULL; int domain_len, msgid1_len, msgid2_len; - long count, category; + php_int_t count, category; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssll", &domain, &domain_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssii", &domain, &domain_len, &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count, &category) == FAILURE) { return; } diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 17ec39d087..8a89451178 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -298,7 +298,7 @@ if (IS_GMP(zval)) { \ #define INIT_GMP_RETVAL(gmpnumber) \ gmp_create(return_value, &gmpnumber TSRMLS_CC) -static void gmp_strval(zval *result, mpz_t gmpnum, long base); +static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base); static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC); static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC); @@ -311,14 +311,14 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC); typedef void (*gmp_unary_op_t)(mpz_ptr, mpz_srcptr); typedef int (*gmp_unary_opl_t)(mpz_srcptr); -typedef void (*gmp_unary_ui_op_t)(mpz_ptr, unsigned long); +typedef void (*gmp_unary_ui_op_t)(mpz_ptr, php_uint_t); typedef void (*gmp_binary_op_t)(mpz_ptr, mpz_srcptr, mpz_srcptr); typedef int (*gmp_binary_opl_t)(mpz_srcptr, mpz_srcptr); -typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, unsigned long); +typedef void (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, php_uint_t); typedef void (*gmp_binary_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); -typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long); +typedef void (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, php_uint_t); static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int check_b_zero TSRMLS_DC); static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval *b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int check_b_zero TSRMLS_DC); @@ -407,9 +407,9 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type TSRMLS_DC) /* gmpnum = GET_GMP_FROM_ZVAL(readobj); gmp_strval(writeobj, gmpnum, 10); return SUCCESS; - case IS_LONG: + case IS_INT: gmpnum = GET_GMP_FROM_ZVAL(readobj); - ZVAL_LONG(writeobj, mpz_get_si(gmpnum)); + ZVAL_INT(writeobj, mpz_get_si(gmpnum)); return SUCCESS; case IS_DOUBLE: gmpnum = GET_GMP_FROM_ZVAL(readobj); @@ -452,7 +452,7 @@ static zend_object *gmp_clone_obj(zval *obj TSRMLS_DC) /* {{{ */ /* }}} */ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zval *op1, zval *op2 TSRMLS_DC) { - long shift = zval_get_long(op2); + php_int_t shift = zval_get_int(op2); if (shift < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Shift cannot be negative"); @@ -463,7 +463,7 @@ static void shift_operator_helper(gmp_binary_ui_op_t op, zval *return_value, zva FETCH_GMP_ZVAL(gmpnum_op, op1, temp); INIT_GMP_RETVAL(gmpnum_result); - op(gmpnum_result, gmpnum_op, (unsigned long) shift); + op(gmpnum_result, gmpnum_op, (php_uint_t) shift); FREE_GMP_TEMP(temp); } } @@ -523,7 +523,7 @@ static int gmp_compare(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { gmp_cmp(result, op1, op2 TSRMLS_CC); if (Z_TYPE_P(result) == IS_FALSE) { - ZVAL_LONG(result, 1); + ZVAL_INT(result, 1); } return SUCCESS; } @@ -631,9 +631,9 @@ ZEND_MINIT_FUNCTION(gmp) gmp_object_handlers.do_operation = gmp_do_operation; gmp_object_handlers.compare = gmp_compare; - REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT); #ifdef mpir_version REGISTER_STRING_CONSTANT("GMP_MPIR_VERSION", (char *)mpir_version, CONST_CS | CONST_PERSISTENT); #endif @@ -679,10 +679,10 @@ ZEND_MODULE_INFO_D(gmp) static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) { switch (Z_TYPE_P(val)) { - case IS_LONG: + case IS_INT: case IS_FALSE: case IS_TRUE: { - mpz_set_si(gmpnumber, zval_get_long(val)); + mpz_set_si(gmpnumber, zval_get_int(val)); return SUCCESS; } case IS_STRING: { @@ -690,7 +690,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) int skip_lead = 0; int ret; - if (Z_STRLEN_P(val) > 2) { + if (Z_STRSIZE_P(val) > 2) { if (numstr[0] == '0') { if (numstr[1] == 'x' || numstr[1] == 'X') { base = 16; @@ -719,7 +719,7 @@ static int convert_to_gmp(mpz_t gmpnumber, zval *val, int base TSRMLS_DC) } /* }}} */ -static void gmp_strval(zval *result, mpz_t gmpnum, long base) /* {{{ */ +static void gmp_strval(zval *result, mpz_t gmpnum, php_int_t base) /* {{{ */ { int num_len; zend_string *str; @@ -755,11 +755,11 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { mpz_ptr gmpnum_a, gmpnum_b; gmp_temp_t temp_a, temp_b; zend_bool use_si = 0; - long res; + php_int_t res; FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (Z_TYPE_P(b_arg) == IS_LONG) { + if (Z_TYPE_P(b_arg) == IS_INT) { use_si = 1; temp_b.is_used = 0; } else { @@ -767,7 +767,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { } if (use_si) { - res = mpz_cmp_si(gmpnum_a, Z_LVAL_P(b_arg)); + res = mpz_cmp_si(gmpnum_a, Z_IVAL_P(b_arg)); } else { res = mpz_cmp(gmpnum_a, gmpnum_b); } @@ -775,7 +775,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg TSRMLS_DC) /* { FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); - RETURN_LONG(res); + RETURN_INT(res); } /* }}} */ @@ -790,7 +790,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) { + if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) { use_ui = 1; temp_b.is_used = 0; } else { @@ -800,7 +800,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * if (check_b_zero) { int b_is_zero = 0; if (use_ui) { - b_is_zero = (Z_LVAL_P(b_arg) == 0); + b_is_zero = (Z_IVAL_P(b_arg) == 0); } else { b_is_zero = !mpz_cmp_ui(gmpnum_b, 0); } @@ -816,7 +816,7 @@ static inline void gmp_zval_binary_ui_op(zval *return_value, zval *a_arg, zval * INIT_GMP_RETVAL(gmpnum_result); if (use_ui) { - gmp_ui_op(gmpnum_result, gmpnum_a, (unsigned long) Z_LVAL_P(b_arg)); + gmp_ui_op(gmpnum_result, gmpnum_a, (php_uint_t) Z_IVAL_P(b_arg)); } else { gmp_op(gmpnum_result, gmpnum_a, gmpnum_b); } @@ -838,7 +838,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_LONG && Z_LVAL_P(b_arg) >= 0) { + if (gmp_ui_op && Z_TYPE_P(b_arg) == IS_INT && Z_IVAL_P(b_arg) >= 0) { /* use _ui function */ use_ui = 1; temp_b.is_used = 0; @@ -849,7 +849,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval if (check_b_zero) { int b_is_zero = 0; if (use_ui) { - b_is_zero = (Z_LVAL_P(b_arg) == 0); + b_is_zero = (Z_IVAL_P(b_arg) == 0); } else { b_is_zero = !mpz_cmp_ui(gmpnum_b, 0); } @@ -870,7 +870,7 @@ static inline void gmp_zval_binary_ui_op2(zval *return_value, zval *a_arg, zval add_next_index_zval(return_value, &result2); if (use_ui) { - gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (unsigned long) Z_LVAL_P(b_arg)); + gmp_ui_op(gmpnum_result1, gmpnum_result2, gmpnum_a, (php_uint_t) Z_IVAL_P(b_arg)); } else { gmp_op(gmpnum_result1, gmpnum_result2, gmpnum_a, gmpnum_b); } @@ -919,7 +919,7 @@ static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_una mpz_ptr gmpnum_result; INIT_GMP_RETVAL(gmpnum_result); - gmp_op(gmpnum_result, zval_get_long(a_arg)); + gmp_op(gmpnum_result, zval_get_int(a_arg)); } /* }}} */ @@ -965,7 +965,7 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t } FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(gmp_op(gmpnum_a)); + RETVAL_INT(gmp_op(gmpnum_a)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -985,7 +985,7 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_ FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); FETCH_GMP_ZVAL_DEP(gmpnum_b, b_arg, temp_b, temp_a); - RETVAL_LONG(gmp_op(gmpnum_a, gmpnum_b)); + RETVAL_INT(gmp_op(gmpnum_a, gmpnum_b)); FREE_GMP_TEMP(temp_a); FREE_GMP_TEMP(temp_b); @@ -998,9 +998,9 @@ ZEND_FUNCTION(gmp_init) { zval *number_arg; mpz_ptr gmpnumber; - long base = 0; + php_int_t base = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &number_arg, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &number_arg, &base) == FAILURE) { return; } @@ -1028,9 +1028,9 @@ ZEND_FUNCTION(gmp_intval) } if (IS_GMP(gmpnumber_arg)) { - RETVAL_LONG(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg))); + RETVAL_INT(mpz_get_si(GET_GMP_FROM_ZVAL(gmpnumber_arg))); } else { - RETVAL_LONG(zval_get_long(gmpnumber_arg)); + RETVAL_INT(zval_get_int(gmpnumber_arg)); } } /* }}} */ @@ -1040,11 +1040,11 @@ ZEND_FUNCTION(gmp_intval) ZEND_FUNCTION(gmp_strval) { zval *gmpnumber_arg; - long base = 10; + php_int_t base = 10; mpz_ptr gmpnum; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &gmpnumber_arg, &base) == FAILURE) { return; } @@ -1097,9 +1097,9 @@ ZEND_FUNCTION(gmp_mul) ZEND_FUNCTION(gmp_div_qr) { zval *a_arg, *b_arg; - long round = GMP_ROUND_ZERO; + php_int_t round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) { return; } @@ -1125,9 +1125,9 @@ ZEND_FUNCTION(gmp_div_qr) ZEND_FUNCTION(gmp_div_r) { zval *a_arg, *b_arg; - long round = GMP_ROUND_ZERO; + php_int_t round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) { return; } @@ -1153,9 +1153,9 @@ ZEND_FUNCTION(gmp_div_r) ZEND_FUNCTION(gmp_div_q) { zval *a_arg, *b_arg; - long round = GMP_ROUND_ZERO; + php_int_t round = GMP_ROUND_ZERO; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &a_arg, &b_arg, &round) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|i", &a_arg, &b_arg, &round) == FAILURE) { return; } @@ -1226,7 +1226,7 @@ ZEND_FUNCTION(gmp_fact) RETURN_FALSE; } } else { - if (zval_get_long(a_arg) < 0) { + if (zval_get_int(a_arg) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number has to be greater than or equal to 0"); RETURN_FALSE; } @@ -1243,9 +1243,9 @@ ZEND_FUNCTION(gmp_pow) zval *base_arg; mpz_ptr gmpnum_result, gmpnum_base; gmp_temp_t temp_base; - long exp; + php_int_t exp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &base_arg, &exp) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &base_arg, &exp) == FAILURE) { return; } @@ -1255,8 +1255,8 @@ ZEND_FUNCTION(gmp_pow) } INIT_GMP_RETVAL(gmpnum_result); - if (Z_TYPE_P(base_arg) == IS_LONG && Z_LVAL_P(base_arg) >= 0) { - mpz_ui_pow_ui(gmpnum_result, Z_LVAL_P(base_arg), exp); + if (Z_TYPE_P(base_arg) == IS_INT && Z_IVAL_P(base_arg) >= 0) { + mpz_ui_pow_ui(gmpnum_result, Z_IVAL_P(base_arg), exp); } else { FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base); mpz_pow_ui(gmpnum_result, gmpnum_base, exp); @@ -1280,7 +1280,7 @@ ZEND_FUNCTION(gmp_powm) FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base); - if (Z_TYPE_P(exp_arg) == IS_LONG && Z_LVAL_P(exp_arg) >= 0) { + if (Z_TYPE_P(exp_arg) == IS_INT && Z_IVAL_P(exp_arg) >= 0) { use_ui = 1; temp_exp.is_used = 0; } else { @@ -1305,7 +1305,7 @@ ZEND_FUNCTION(gmp_powm) INIT_GMP_RETVAL(gmpnum_result); if (use_ui) { - mpz_powm_ui(gmpnum_result, gmpnum_base, (unsigned long) Z_LVAL_P(exp_arg), gmpnum_mod); + mpz_powm_ui(gmpnum_result, gmpnum_base, (php_uint_t) Z_IVAL_P(exp_arg), gmpnum_mod); } else { mpz_powm(gmpnum_result, gmpnum_base, gmpnum_exp, gmpnum_mod); FREE_GMP_TEMP(temp_exp); @@ -1380,11 +1380,11 @@ ZEND_FUNCTION(gmp_sqrtrem) ZEND_FUNCTION(gmp_root) { zval *a_arg; - long nth; + php_int_t nth; mpz_ptr gmpnum_a, gmpnum_result; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &nth) == FAILURE) { return; } @@ -1412,12 +1412,12 @@ ZEND_FUNCTION(gmp_root) ZEND_FUNCTION(gmp_rootrem) { zval *a_arg; - long nth; + php_int_t nth; mpz_ptr gmpnum_a, gmpnum_result1, gmpnum_result2; gmp_temp_t temp_a; zval result1, result2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &nth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &nth) == FAILURE) { return; } @@ -1479,16 +1479,16 @@ ZEND_FUNCTION(gmp_prob_prime) { zval *gmpnumber_arg; mpz_ptr gmpnum_a; - long reps = 10; + php_int_t reps = 10; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &gmpnumber_arg, &reps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &gmpnumber_arg, &reps) == FAILURE) { return; } FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg, temp_a); - RETVAL_LONG(mpz_probab_prime_p(gmpnum_a, reps)); + RETVAL_INT(mpz_probab_prime_p(gmpnum_a, reps)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1604,7 +1604,7 @@ ZEND_FUNCTION(gmp_sign) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(mpz_sgn(gmpnum_a)); + RETVAL_INT(mpz_sgn(gmpnum_a)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1613,10 +1613,10 @@ ZEND_FUNCTION(gmp_sign) Gets random number */ ZEND_FUNCTION(gmp_random) { - long limiter = 20; + php_int_t limiter = 20; mpz_ptr gmpnum_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &limiter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &limiter) == FAILURE) { return; } @@ -1684,11 +1684,11 @@ ZEND_FUNCTION(gmp_xor) ZEND_FUNCTION(gmp_setbit) { zval *a_arg; - long index; + php_int_t index; zend_bool set = 1; mpz_ptr gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { return; } @@ -1712,10 +1712,10 @@ ZEND_FUNCTION(gmp_setbit) ZEND_FUNCTION(gmp_clrbit) { zval *a_arg; - long index; + php_int_t index; mpz_ptr gmpnum_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &a_arg, gmp_ce, &index) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oi", &a_arg, gmp_ce, &index) == FAILURE){ return; } @@ -1734,11 +1734,11 @@ ZEND_FUNCTION(gmp_clrbit) ZEND_FUNCTION(gmp_testbit) { zval *a_arg; - long index; + php_int_t index; mpz_ptr gmpnum_a; gmp_temp_t temp_a; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &index) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &index) == FAILURE){ return; } @@ -1776,9 +1776,9 @@ ZEND_FUNCTION(gmp_scan0) zval *a_arg; mpz_ptr gmpnum_a; gmp_temp_t temp_a; - long start; + php_int_t start; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &start) == FAILURE){ return; } @@ -1789,7 +1789,7 @@ ZEND_FUNCTION(gmp_scan0) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(mpz_scan0(gmpnum_a, start)); + RETVAL_INT(mpz_scan0(gmpnum_a, start)); FREE_GMP_TEMP(temp_a); } /* }}} */ @@ -1801,9 +1801,9 @@ ZEND_FUNCTION(gmp_scan1) zval *a_arg; mpz_ptr gmpnum_a; gmp_temp_t temp_a; - long start; + php_int_t start; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &a_arg, &start) == FAILURE){ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi", &a_arg, &start) == FAILURE){ return; } @@ -1814,7 +1814,7 @@ ZEND_FUNCTION(gmp_scan1) FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a); - RETVAL_LONG(mpz_scan1(gmpnum_a, start)); + RETVAL_INT(mpz_scan1(gmpnum_a, start)); FREE_GMP_TEMP(temp_a); } /* }}} */ diff --git a/ext/hash/hash.c b/ext/hash/hash.c index fe02cbe83f..07e63d3f65 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -225,7 +225,7 @@ static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops * php_hash_string_xor_char(K, K, 0x36, ops->block_size); } -static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const long data_size) { +static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops *ops, void *context, const unsigned char *key, const unsigned char *data, const php_int_t data_size) { ops->hash_init(context); ops->hash_update(context, key, ops->block_size); ops->hash_update(context, data, data_size); @@ -330,12 +330,12 @@ PHP_FUNCTION(hash_init) { char *algo, *key = NULL; int algo_len, key_len = 0, argc = ZEND_NUM_ARGS(); - long options = 0; + php_int_t options = 0; void *context; const php_hash_ops *ops; php_hash_data *hash; - if (zend_parse_parameters(argc TSRMLS_CC, "s|ls", &algo, &algo_len, &options, &key, &key_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|is", &algo, &algo_len, &options, &key, &key_len) == FAILURE) { return; } @@ -417,9 +417,9 @@ PHP_FUNCTION(hash_update_stream) zval *zhash, *zstream; php_hash_data *hash; php_stream *stream = NULL; - long length = -1, didread = 0; + php_int_t length = -1, didread = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zhash, &zstream, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &zhash, &zstream, &length) == FAILURE) { return; } @@ -428,7 +428,7 @@ PHP_FUNCTION(hash_update_stream) while (length) { char buf[1024]; - long n, toread = 1024; + php_int_t n, toread = 1024; if (length > 0 && toread > length) { toread = length; @@ -436,14 +436,14 @@ PHP_FUNCTION(hash_update_stream) if ((n = php_stream_read(stream, buf, toread)) <= 0) { /* Nada mas */ - RETURN_LONG(didread); + RETURN_INT(didread); } hash->ops->hash_update(hash->context, (unsigned char *) buf, n); length -= n; didread += n; } - RETURN_LONG(didread); + RETURN_INT(didread); } /* }}} */ @@ -602,13 +602,13 @@ PHP_FUNCTION(hash_pbkdf2) zend_string *returnval; char *algo, *salt, *pass = NULL; unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL; - long loops, i, j, algo_len, pass_len, iterations, length = 0, digest_length = 0; + php_int_t loops, i, j, algo_len, pass_len, iterations, length = 0, digest_length = 0; int salt_len = 0; zend_bool raw_output = 0; const php_hash_ops *ops; void *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi|ib", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) { return; } @@ -619,12 +619,12 @@ PHP_FUNCTION(hash_pbkdf2) } if (iterations <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: %ld", iterations); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: " ZEND_INT_FMT, iterations); RETURN_FALSE; } if (length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: %ld", length); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: " ZEND_INT_FMT, length); RETURN_FALSE; } @@ -655,10 +655,10 @@ PHP_FUNCTION(hash_pbkdf2) } digest_length = length; if (!raw_output) { - digest_length = (long) ceil((float) length / 2.0); + digest_length = (php_int_t) ceil((float) length / 2.0); } - loops = (long) ceil((float) digest_length / (float) ops->digest_size); + loops = (php_int_t) ceil((float) digest_length / (float) ops->digest_size); result = safe_emalloc(loops, ops->digest_size, 0); @@ -674,7 +674,7 @@ PHP_FUNCTION(hash_pbkdf2) computed_salt[salt_len + 2] = (unsigned char) ((i & 0xFF00) >> 8); computed_salt[salt_len + 3] = (unsigned char) (i & 0xFF); - php_hash_hmac_round(digest, ops, context, K1, computed_salt, (long) salt_len + 4); + php_hash_hmac_round(digest, ops, context, K1, computed_salt, (php_int_t) salt_len + 4); php_hash_hmac_round(digest, ops, context, K2, digest, ops->digest_size); /* } */ @@ -743,7 +743,7 @@ PHP_FUNCTION(hash_equals) RETURN_FALSE; } - if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) { + if (Z_STRSIZE_P(known_zval) != Z_STRSIZE_P(user_zval)) { RETURN_FALSE; } @@ -751,7 +751,7 @@ PHP_FUNCTION(hash_equals) user_str = Z_STRVAL_P(user_zval); /* This is security sensitive code. Do not optimize this for speed. */ - for (j = 0; j < Z_STRLEN_P(known_zval); j++) { + for (j = 0; j < Z_STRSIZE_P(known_zval); j++) { result |= known_str[j] ^ user_str[j]; } @@ -819,7 +819,7 @@ static void mhash_init(INIT_FUNC_ARGS) } len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name, strlen(algorithm.mhash_name)); - zend_register_long_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); + zend_register_int_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); } zend_register_internal_module(&mhash_module_entry TSRMLS_CC); } @@ -829,15 +829,15 @@ static void mhash_init(INIT_FUNC_ARGS) PHP_FUNCTION(mhash) { zval *z_algorithm; - long algorithm; + php_int_t algorithm; if (zend_parse_parameters(1 TSRMLS_CC, "z", &z_algorithm) == FAILURE) { return; } SEPARATE_ZVAL(z_algorithm); - convert_to_long_ex(z_algorithm); - algorithm = Z_LVAL_P(z_algorithm); + convert_to_int_ex(z_algorithm); + algorithm = Z_IVAL_P(z_algorithm); /* need to convert the first parameter from int constant to string algorithm name */ if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) { @@ -861,9 +861,9 @@ PHP_FUNCTION(mhash) Gets the name of hash */ PHP_FUNCTION(mhash_get_hash_name) { - long algorithm; + php_int_t algorithm; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &algorithm) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &algorithm) == FAILURE) { return; } @@ -884,7 +884,7 @@ PHP_FUNCTION(mhash_count) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(MHASH_NUM_ALGOS - 1); + RETURN_INT(MHASH_NUM_ALGOS - 1); } /* }}} */ @@ -892,9 +892,9 @@ PHP_FUNCTION(mhash_count) Gets the block size of hash */ PHP_FUNCTION(mhash_get_block_size) { - long algorithm; + php_int_t algorithm; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &algorithm) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &algorithm) == FAILURE) { return; } RETVAL_FALSE; @@ -904,7 +904,7 @@ PHP_FUNCTION(mhash_get_block_size) if (algorithm_lookup.mhash_name) { const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name)); if (ops) { - RETVAL_LONG(ops->digest_size); + RETVAL_INT(ops->digest_size); } } } @@ -917,13 +917,13 @@ PHP_FUNCTION(mhash_get_block_size) Generates a key using hash functions */ PHP_FUNCTION(mhash_keygen_s2k) { - long algorithm, l_bytes; + php_int_t algorithm, l_bytes; int bytes; char *password, *salt; int password_len, salt_len; char padded_salt[SALT_SIZE]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "issi", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) { return; } @@ -1044,7 +1044,7 @@ PHP_MINIT_FUNCTION(hash) PHP_HASH_HAVAL_REGISTER(5,224); PHP_HASH_HAVAL_REGISTER(5,256); - REGISTER_LONG_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); #ifdef PHP_MHASH_BC mhash_init(INIT_FUNC_ARGS_PASSTHRU); diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index c75b930936..e8c1543055 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -55,7 +55,7 @@ typedef struct _php_hash_data { const php_hash_ops *ops; void *context; - long options; + php_int_t options; unsigned char *key; } php_hash_data; diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 3b9998ea19..6eb0fc0701 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -60,7 +60,7 @@ #include "ext/standard/quot_print.h" #define _php_iconv_memequal(a, b, c) \ - ((c) == sizeof(unsigned long) ? *((unsigned long *)(a)) == *((unsigned long *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0)) + ((c) == sizeof(php_uint_t) ? *((php_uint_t *)(a)) == *((php_uint_t *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0)) /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1) @@ -196,13 +196,13 @@ static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, const char *in_charset TSRMLS_DC); -static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, size_t nbytes, const char *enc); +static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc); -static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, int offset, int len, const char *enc); +static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, php_int_t offset, php_int_t len, const char *enc); -static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, int offset, const char *enc); +static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, php_int_t offset, const char *enc); -static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, unsigned int max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc); +static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc); static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode); @@ -300,8 +300,8 @@ PHP_MINIT_FUNCTION(miconv) #endif REGISTER_STRING_CONSTANT("ICONV_VERSION", version, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_STRICT", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ICONV_MIME_DECODE_CONTINUE_ON_ERROR", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT); if (php_iconv_stream_filter_register_factory(TSRMLS_C) != PHP_ICONV_ERR_SUCCESS) { return FAILURE; @@ -431,13 +431,13 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c } if (mimetype != NULL && !(output_context->op & PHP_OUTPUT_HANDLER_CLEAN)) { - int len; + php_int_t len; char *p = strstr(get_output_encoding(TSRMLS_C), "//"); if (p) { - len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C)); + len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (php_size_t) strlen(mimetype), mimetype, (php_size_t)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C)); } else { - len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C)); + len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (php_size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C)); } if (content_type && SUCCESS == sapi_add_header(content_type, len, 0)) { SG(sapi_headers).send_default_content_type = 0; @@ -721,7 +721,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, /* }}} */ /* {{{ _php_iconv_strlen() */ -static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, size_t nbytes, const char *enc) +static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc) { char buf[GENERIC_SUPERSET_NBYTES*2]; @@ -735,9 +735,9 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, char *out_p; size_t out_left; - unsigned int cnt; + php_size_t cnt; - *pretval = (unsigned int)-1; + *pretval = (php_size_t)-1; cd = iconv_open(GENERIC_SUPERSET_NAME, enc); @@ -753,7 +753,8 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, #endif } - errno = out_left = 0; + errno = 0; + out_left = 0; for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0; cnt+=2) { size_t prev_in_left; @@ -805,7 +806,7 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, /* {{{ _php_iconv_substr() */ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, - const char *str, size_t nbytes, int offset, int len, const char *enc) + const char *str, size_t nbytes, php_int_t offset, php_int_t len, const char *enc) { char buf[GENERIC_SUPERSET_NBYTES]; @@ -819,8 +820,8 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, char *out_p; size_t out_left; - unsigned int cnt; - int total_len; + php_size_t cnt; + php_int_t total_len; err = _php_iconv_strlen(&total_len, str, nbytes, enc); if (err != PHP_ICONV_ERR_SUCCESS) { @@ -889,7 +890,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, } } - if (cnt >= (unsigned int)offset) { + if ((php_int_t)cnt >= offset) { if (cd2 == (iconv_t)NULL) { cd2 = iconv_open(enc, GENERIC_SUPERSET_NAME); @@ -950,10 +951,10 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, /* }}} */ /* {{{ _php_iconv_strpos() */ -static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, +static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, - int offset, const char *enc) + php_int_t offset, const char *enc) { char buf[GENERIC_SUPERSET_NBYTES]; @@ -967,15 +968,15 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, char *out_p; size_t out_left; - unsigned int cnt; + php_size_t cnt; zend_string *ndl_buf; const char *ndl_buf_p; size_t ndl_buf_left; - unsigned int match_ofs; + php_size_t match_ofs; - *pretval = (unsigned int)-1; + *pretval = (php_size_t)-1; err = php_iconv_string(ndl, ndl_nbytes, &ndl_buf, GENERIC_SUPERSET_NAME, enc); @@ -1005,7 +1006,7 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, ndl_buf_p = ndl_buf->val; ndl_buf_left = ndl_buf->len; - match_ofs = (unsigned int)-1; + match_ofs = (php_size_t)-1; for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) { size_t prev_in_left; @@ -1038,9 +1039,9 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, } } if (offset >= 0) { - if (cnt >= (unsigned int)offset) { + if (cnt >= (php_size_t)offset) { if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) { - if (match_ofs == (unsigned int)-1) { + if (match_ofs == (php_size_t)-1) { match_ofs = cnt; } ndl_buf_p += GENERIC_SUPERSET_NBYTES; @@ -1050,11 +1051,11 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, break; } } else { - unsigned int i, j, lim; + php_size_t i, j, lim; i = 0; j = GENERIC_SUPERSET_NBYTES; - lim = (unsigned int)(ndl_buf_p - ndl_buf->val); + lim = (php_size_t)(ndl_buf_p - ndl_buf->val); while (j < lim) { if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i], @@ -1073,7 +1074,7 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, ndl_buf_p = &ndl_buf->val[i]; ndl_buf_left = ndl_buf->len - i; } else { - match_ofs = (unsigned int)-1; + match_ofs = (php_size_t)-1; ndl_buf_p = ndl_buf->val; ndl_buf_left = ndl_buf->len; } @@ -1081,7 +1082,7 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, } } else { if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) { - if (match_ofs == (unsigned int)-1) { + if (match_ofs == (php_size_t)-1) { match_ofs = cnt; } ndl_buf_p += GENERIC_SUPERSET_NBYTES; @@ -1093,11 +1094,11 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, match_ofs = -1; } } else { - unsigned int i, j, lim; + php_size_t i, j, lim; i = 0; j = GENERIC_SUPERSET_NBYTES; - lim = (unsigned int)(ndl_buf_p - ndl_buf->val); + lim = (php_size_t)(ndl_buf_p - ndl_buf->val); while (j < lim) { if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i], @@ -1116,7 +1117,7 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, ndl_buf_p = &ndl_buf->val[i]; ndl_buf_left = ndl_buf->len - i; } else { - match_ofs = (unsigned int)-1; + match_ofs = (php_size_t)-1; ndl_buf_p = ndl_buf->val; ndl_buf_left = ndl_buf->len; } @@ -1135,11 +1136,11 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, /* }}} */ /* {{{ _php_iconv_mime_encode() */ -static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, unsigned int max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc) +static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc) { php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); - unsigned int char_cnt = 0; + php_size_t char_cnt = 0; size_t out_charset_len; size_t lfchars_len; char *buf = NULL; @@ -1321,7 +1322,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn prev_in_left = in_left; - encoded = php_base64_encode((unsigned char *) buf, (int)(out_size - out_left)); + encoded = php_base64_encode((unsigned char *) buf, (out_size - out_left)); if (char_cnt < encoded->len) { /* something went wrong! */ @@ -1803,11 +1804,11 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st switch (enc_scheme) { case PHP_ICONV_ENC_SCHEME_BASE64: - decoded_text = php_base64_decode((unsigned char*)encoded_text, (int)encoded_text_len); + decoded_text = php_base64_decode((unsigned char*)encoded_text, encoded_text_len); break; case PHP_ICONV_ENC_SCHEME_QPRINT: - decoded_text = php_quot_print_decode((unsigned char*)encoded_text, (int)encoded_text_len, 1); + decoded_text = php_quot_print_decode((unsigned char*)encoded_text, encoded_text_len, 1); break; default: decoded_text = NULL; @@ -2034,15 +2035,14 @@ PHP_FUNCTION(iconv_strlen) { char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - char *str; - int str_len; + zend_string *str; php_iconv_err_t err; - unsigned int retval; + php_size_t retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", - &str, &str_len, &charset, &charset_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|s", + &str, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } @@ -2051,10 +2051,10 @@ PHP_FUNCTION(iconv_strlen) RETURN_FALSE; } - err = _php_iconv_strlen(&retval, str, str_len, charset); + err = _php_iconv_strlen(&retval, str->val, str->len, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { - RETVAL_LONG(retval); + RETVAL_INT(retval); } else { RETVAL_FALSE; } @@ -2067,16 +2067,15 @@ PHP_FUNCTION(iconv_substr) { char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - char *str; - int str_len; - long offset, length = 0; + zend_string *str; + php_int_t offset, length = 0; php_iconv_err_t err; smart_str retval = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", - &str, &str_len, &offset, &length, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|is", + &str, &offset, &length, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } @@ -2087,13 +2086,13 @@ PHP_FUNCTION(iconv_substr) } if (ZEND_NUM_ARGS() < 3) { - length = str_len; + length = str->len; } - err = _php_iconv_substr(&retval, str, str_len, offset, length, charset); + err = _php_iconv_substr(&retval, str->val, str->len, offset, length, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS && str != NULL && retval.s != NULL) { + if (err == PHP_ICONV_ERR_SUCCESS && str->val != NULL && retval.s != NULL) { RETURN_STR(retval.s); } smart_str_free(&retval); @@ -2107,18 +2106,16 @@ PHP_FUNCTION(iconv_strpos) { char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - char *haystk; - int haystk_len; - char *ndl; - int ndl_len; - long offset = 0; + zend_string *haystk; + zend_string *ndl; + php_int_t offset = 0; php_iconv_err_t err; - unsigned int retval; + php_size_t retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", - &haystk, &haystk_len, &ndl, &ndl_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|is", + &haystk, &ndl, &offset, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } @@ -2133,16 +2130,16 @@ PHP_FUNCTION(iconv_strpos) RETURN_FALSE; } - if (ndl_len < 1) { + if (ndl->len < 1) { RETURN_FALSE; } - err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len, + err = _php_iconv_strpos(&retval, haystk->val, haystk->len, ndl->val, ndl->len, offset, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { - RETVAL_LONG((long)retval); + if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) { + RETVAL_INT((php_int_t)retval); } else { RETVAL_FALSE; } @@ -2155,22 +2152,20 @@ PHP_FUNCTION(iconv_strrpos) { char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - char *haystk; - int haystk_len; - char *ndl; - int ndl_len; + zend_string *haystk; + zend_string *ndl; php_iconv_err_t err; - unsigned int retval; + php_size_t retval; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s", - &haystk, &haystk_len, &ndl, &ndl_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|s", + &haystk, &ndl, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } - if (ndl_len < 1) { + if (ndl->len < 1) { RETURN_FALSE; } @@ -2179,12 +2174,12 @@ PHP_FUNCTION(iconv_strrpos) RETURN_FALSE; } - err = _php_iconv_strpos(&retval, haystk, haystk_len, ndl, ndl_len, + err = _php_iconv_strpos(&retval, haystk->val, haystk->len, ndl->val, ndl->len, -1, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { - RETVAL_LONG((long)retval); + if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) { + RETVAL_INT((php_int_t)retval); } else { RETVAL_FALSE; } @@ -2195,10 +2190,8 @@ PHP_FUNCTION(iconv_strrpos) Composes a mime header field with field_name and field_value in a specified scheme */ PHP_FUNCTION(iconv_mime_encode) { - const char *field_name = NULL; - int field_name_len; - const char *field_value = NULL; - int field_value_len; + zend_string *field_name = NULL; + zend_string *field_value = NULL; zval *pref = NULL; zval tmp_zv, *tmp_zv_p = NULL; smart_str retval = {0}; @@ -2206,12 +2199,12 @@ PHP_FUNCTION(iconv_mime_encode) const char *in_charset = get_internal_encoding(TSRMLS_C); const char *out_charset = in_charset; - long line_len = 76; + php_int_t line_len = 76; const char *lfchars = "\r\n"; php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|a", - &field_name, &field_name_len, &field_value, &field_value_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|a", + &field_name, &field_value, &pref) == FAILURE) { RETURN_FALSE; @@ -2221,7 +2214,7 @@ PHP_FUNCTION(iconv_mime_encode) zval *pzval; if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "scheme", sizeof("scheme") - 1)) != NULL) { - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { switch (Z_STRVAL_P(pzval)[0]) { case 'B': case 'b': scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; @@ -2235,24 +2228,24 @@ PHP_FUNCTION(iconv_mime_encode) } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL) { - if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { + if (Z_STRSIZE_P(pzval) >= ICONV_CSNMAXLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { in_charset = Z_STRVAL_P(pzval); } } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL) { - if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { + if (Z_STRSIZE_P(pzval) >= ICONV_CSNMAXLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_TYPE_P(pzval) == IS_STRING && Z_STRSIZE_P(pzval) > 0) { out_charset = Z_STRVAL_P(pzval); } } @@ -2260,13 +2253,13 @@ PHP_FUNCTION(iconv_mime_encode) if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-length", sizeof("line-length") - 1)) != NULL) { zval val; - if (Z_TYPE_P(pzval) != IS_LONG) { + if (Z_TYPE_P(pzval) != IS_INT) { ZVAL_DUP(&val, pzval); - convert_to_long(&val); + convert_to_int(&val); pzval = &val; } - line_len = Z_LVAL_P(pzval); + line_len = Z_IVAL_P(pzval); } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) { @@ -2283,8 +2276,8 @@ PHP_FUNCTION(iconv_mime_encode) } } - err = _php_iconv_mime_encode(&retval, field_name, field_name_len, - field_value, field_value_len, line_len, lfchars, scheme_id, + err = _php_iconv_mime_encode(&retval, field_name->val, field_name->len, + field_value->val, field_value->len, line_len, lfchars, scheme_id, out_charset, in_charset); _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC); @@ -2309,18 +2302,17 @@ PHP_FUNCTION(iconv_mime_encode) Decodes a mime header field */ PHP_FUNCTION(iconv_mime_decode) { - char *encoded_str; - int encoded_str_len; + zend_string *encoded_str; char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - long mode = 0; + php_int_t mode = 0; smart_str retval = {0}; php_iconv_err_t err; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", - &encoded_str, &encoded_str_len, &mode, &charset, &charset_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", + &encoded_str, &mode, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } @@ -2330,7 +2322,7 @@ PHP_FUNCTION(iconv_mime_decode) RETURN_FALSE; } - err = _php_iconv_mime_decode(&retval, encoded_str, encoded_str_len, charset, NULL, mode); + err = _php_iconv_mime_decode(&retval, encoded_str->val, encoded_str->len, charset, NULL, mode); _php_iconv_show_error(err, charset, "???" TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS) { @@ -2350,16 +2342,17 @@ PHP_FUNCTION(iconv_mime_decode) Decodes multiple mime header fields */ PHP_FUNCTION(iconv_mime_decode_headers) { - const char *encoded_str; - int encoded_str_len; + zend_string *encoded_str; char *charset = get_internal_encoding(TSRMLS_C); int charset_len = 0; - long mode = 0; + php_int_t mode = 0; + char *enc_str_tmp; + php_size_t enc_str_len_tmp; php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", - &encoded_str, &encoded_str_len, &mode, &charset, &charset_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", + &encoded_str, &mode, &charset, &charset_len) == FAILURE) { RETURN_FALSE; } @@ -2371,7 +2364,9 @@ PHP_FUNCTION(iconv_mime_decode_headers) array_init(return_value); - while (encoded_str_len > 0) { + enc_str_tmp = encoded_str->val; + enc_str_len_tmp = encoded_str->len; + while (enc_str_len_tmp > 0) { smart_str decoded_header = {0}; char *header_name = NULL; size_t header_name_len = 0; @@ -2380,7 +2375,7 @@ PHP_FUNCTION(iconv_mime_decode_headers) char *p, *limit; const char *next_pos; - if (PHP_ICONV_ERR_SUCCESS != (err = _php_iconv_mime_decode(&decoded_header, encoded_str, encoded_str_len, charset, &next_pos, mode))) { + if (PHP_ICONV_ERR_SUCCESS != (err = _php_iconv_mime_decode(&decoded_header, enc_str_tmp, enc_str_len_tmp, charset, &next_pos, mode))) { smart_str_free(&decoded_header); break; } @@ -2427,8 +2422,8 @@ PHP_FUNCTION(iconv_mime_decode_headers) add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len); } } - encoded_str_len -= next_pos - encoded_str; - encoded_str = next_pos; + enc_str_len_tmp -= next_pos - enc_str_tmp; + enc_str_tmp = next_pos; smart_str_free(&decoded_header); } @@ -2445,13 +2440,14 @@ PHP_FUNCTION(iconv_mime_decode_headers) Returns str converted to the out_charset character set */ PHP_NAMED_FUNCTION(php_if_iconv) { - char *in_charset, *out_charset, *in_buffer; - int in_charset_len = 0, out_charset_len = 0, in_buffer_len; + char *in_charset, *out_charset; + zend_string *in_buffer; + int in_charset_len = 0, out_charset_len = 0; php_iconv_err_t err; zend_string *out_buffer; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", - &in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer, &in_buffer_len) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssS", + &in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer) == FAILURE) return; if (in_charset_len >= ICONV_CSNMAXLEN || out_charset_len >= ICONV_CSNMAXLEN) { @@ -2459,7 +2455,7 @@ PHP_NAMED_FUNCTION(php_if_iconv) RETURN_FALSE; } - err = php_iconv_string(in_buffer, (size_t)in_buffer_len, &out_buffer, out_charset, in_charset); + err = php_iconv_string(in_buffer->val, (size_t)in_buffer->len, &out_buffer, out_charset, in_charset); _php_iconv_show_error(err, out_charset, in_charset TSRMLS_CC); if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) { RETVAL_STR(out_buffer); @@ -2514,7 +2510,7 @@ PHP_FUNCTION(iconv_set_encoding) PHP_FUNCTION(iconv_get_encoding) { char *type = "all"; - int type_len = sizeof("all")-1; + php_size_t type_len = sizeof("all")-1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) == FAILURE) return; diff --git a/ext/iconv/tests/iconv_strpos_variation3_64bit.phpt b/ext/iconv/tests/iconv_strpos_variation3_64bit.phpt index 1cc8a84f73..f1807ccd79 100644 --- a/ext/iconv/tests/iconv_strpos_variation3_64bit.phpt +++ b/ext/iconv/tests/iconv_strpos_variation3_64bit.phpt @@ -130,7 +130,7 @@ Warning: iconv_strpos(): Offset not contained in string. in %s on line %d bool(false) -- Iteration 7 -- -int(8) +bool(false) -- Iteration 8 -- int(8) @@ -196,4 +196,4 @@ int(8) Warning: iconv_strpos() expects parameter 3 to be long, resource given in %s on line %d bool(false) -Done
\ No newline at end of file +Done diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 09295a87f3..6e33e463ae 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -770,12 +770,12 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist) if (strncmp(qlist->name, "STORAGE", 7) == 0) { /* this is to add backwards compatibility */ - add_assoc_long_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage); - add_assoc_long_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit); + add_assoc_int_ex(return_value, "usage", sizeof("usage") - 1, qlist->usage); + add_assoc_int_ex(return_value, "limit", sizeof("limit") - 1, qlist->limit); } - add_assoc_long_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage); - add_assoc_long_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit); + add_assoc_int_ex(&t_map, "usage", sizeof("usage") - 1, qlist->usage); + add_assoc_int_ex(&t_map, "limit", sizeof("limit") - 1, qlist->limit); add_assoc_zval_ex(return_value, qlist->name, strlen(qlist->name), &t_map); } } @@ -864,7 +864,7 @@ PHP_MINIT_FUNCTION(imap) #endif /* lets allow NIL */ - REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); /* plug in our gets */ mail_parameters(NIL, SET_GETS, (void *) NIL); @@ -876,30 +876,30 @@ PHP_MINIT_FUNCTION(imap) mail_parameters(NIL, SET_CLOSETIMEOUT, (void *) FG(default_socket_timeout)); /* timeout constants */ - REGISTER_LONG_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_OPENTIMEOUT", 1, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_READTIMEOUT", 2, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_WRITETIMEOUT", 3, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_CLOSETIMEOUT", 4, CONST_PERSISTENT | CONST_CS); /* Open Options */ - REGISTER_LONG_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS); /* debug protocol negotiations */ - REGISTER_LONG_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS); /* read-only open */ - REGISTER_LONG_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS); /* anonymous open of newsgroup */ - REGISTER_LONG_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS); /* short (elt-only) caching */ - REGISTER_LONG_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS); /* don't pass up events (internal use) */ - REGISTER_LONG_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS); /* return driver prototype */ - REGISTER_LONG_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS); /* half-open (IMAP connect but no select) */ - REGISTER_LONG_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* silently expunge recycle stream */ - REGISTER_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS); /* don't do non-secure authentication */ /* @@ -910,111 +910,111 @@ PHP_MINIT_FUNCTION(imap) options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of this file */ - REGISTER_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS); /* expunge silently */ /* Fetch options */ - REGISTER_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID */ - REGISTER_LONG_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS); /* peek at data */ - REGISTER_LONG_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS); /* NOT flag for header lines fetch */ - REGISTER_LONG_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS); /* text can be internal strings */ - REGISTER_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS); /* IMAP prefetch text when fetching header */ /* Flagging options */ - REGISTER_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID sequence */ - REGISTER_LONG_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS); /* don't return results */ - REGISTER_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS); /* set vs. clear */ /* Copy options */ - REGISTER_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS); /* argument is a UID sequence */ - REGISTER_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS); /* delete from source after copying */ /* Search/sort options */ - REGISTER_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS); /* return UID */ - REGISTER_LONG_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS); /* free search program after finished */ - REGISTER_LONG_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS); /* no search prefetching */ - REGISTER_LONG_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS); /* free sort program after finished */ - REGISTER_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS); /* don't do server-based sort */ /* Status options */ - REGISTER_LONG_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_MESSAGES", SA_MESSAGES , CONST_PERSISTENT | CONST_CS); /* number of messages */ - REGISTER_LONG_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS); /* number of recent messages */ - REGISTER_LONG_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_UNSEEN", SA_UNSEEN , CONST_PERSISTENT | CONST_CS); /* number of unseen messages */ - REGISTER_LONG_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS); /* next UID to be assigned */ - REGISTER_LONG_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_UIDVALIDITY", SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS); /* UID validity value */ - REGISTER_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS); /* get all status information */ /* Bits for mm_list() and mm_lsub() */ - REGISTER_LONG_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_NOINFERIORS", LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_UNMARKED", LATT_UNMARKED , CONST_PERSISTENT | CONST_CS); #ifdef LATT_REFERRAL - REGISTER_LONG_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_REFERRAL", LATT_REFERRAL, CONST_PERSISTENT | CONST_CS); #endif #ifdef LATT_HASCHILDREN - REGISTER_LONG_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_HASCHILDREN", LATT_HASCHILDREN, CONST_PERSISTENT | CONST_CS); #endif #ifdef LATT_HASNOCHILDREN - REGISTER_LONG_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LATT_HASNOCHILDREN", LATT_HASNOCHILDREN, CONST_PERSISTENT | CONST_CS); #endif /* Sort functions */ - REGISTER_LONG_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTDATE", SORTDATE , CONST_PERSISTENT | CONST_CS); /* date */ - REGISTER_LONG_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTARRIVAL", SORTARRIVAL , CONST_PERSISTENT | CONST_CS); /* arrival date */ - REGISTER_LONG_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTFROM", SORTFROM , CONST_PERSISTENT | CONST_CS); /* from */ - REGISTER_LONG_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTSUBJECT", SORTSUBJECT , CONST_PERSISTENT | CONST_CS); /* subject */ - REGISTER_LONG_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTTO", SORTTO , CONST_PERSISTENT | CONST_CS); /* to */ - REGISTER_LONG_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTCC", SORTCC , CONST_PERSISTENT | CONST_CS); /* cc */ - REGISTER_LONG_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SORTSIZE", SORTSIZE , CONST_PERSISTENT | CONST_CS); /* size */ - REGISTER_LONG_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPETEXT", TYPETEXT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEMULTIPART", TYPEMULTIPART , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEMESSAGE", TYPEMESSAGE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEAPPLICATION", TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEAUDIO", TYPEAUDIO , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEIMAGE", TYPEIMAGE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEVIDEO", TYPEVIDEO , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEMODEL", TYPEMODEL , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("TYPEOTHER", TYPEOTHER , CONST_PERSISTENT | CONST_CS); /* TYPETEXT unformatted text TYPEMULTIPART multiple part @@ -1027,12 +1027,12 @@ PHP_MINIT_FUNCTION(imap) TYPEOTHER unknown */ - REGISTER_LONG_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENC7BIT", ENC7BIT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENC8BIT", ENC8BIT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCBINARY", ENCBINARY , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCBASE64", ENCBASE64, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCQUOTEDPRINTABLE", ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("ENCOTHER", ENCOTHER , CONST_PERSISTENT | CONST_CS); /* ENC7BIT 7 bit SMTP semantic data ENC8BIT 8 bit SMTP semantic data @@ -1042,9 +1042,9 @@ PHP_MINIT_FUNCTION(imap) ENCOTHER unknown */ - REGISTER_LONG_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_GC_ELT", GC_ELT , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_GC_ENV", GC_ENV , CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("IMAP_GC_TEXTS", GC_TEXTS , CONST_PERSISTENT | CONST_CS); /* GC_ELT message cache elements GC_ENV ENVELOPEs and BODYs @@ -1173,7 +1173,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if ((disabled_auth_method = zend_hash_str_find(HASH_OF(params), "DISABLE_AUTHENTICATOR", sizeof("DISABLE_AUTHENTICATOR") - 1)) != NULL) { switch (Z_TYPE_P(disabled_auth_method)) { case IS_STRING: - if (Z_STRLEN_P(disabled_auth_method) > 1) { + if (Z_STRSIZE_P(disabled_auth_method) > 1) { mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(disabled_auth_method)); } break; @@ -1189,7 +1189,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) for (i = 0; i < nelems; i++) { if ((z_auth_method = zend_hash_index_find(Z_ARRVAL_P(disabled_auth_method), i)) != NULL) { if (Z_TYPE_P(z_auth_method) == IS_STRING) { - if (Z_STRLEN_P(z_auth_method) > 1) { + if (Z_STRSIZE_P(z_auth_method) > 1) { mail_parameters(NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_P(z_auth_method)); } } else { @@ -1199,7 +1199,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } } break; - case IS_LONG: + case IS_INT: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); break; @@ -1339,7 +1339,7 @@ PHP_FUNCTION(imap_append) php_pcre_match_impl(pce, internal_date, internal_date_len, return_value, subpats, global, 0, regex_flags, start_offset TSRMLS_CC); - if (!Z_LVAL_P(return_value)) { + if (!Z_IVAL_P(return_value)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted"); internal_date = NULL; } @@ -1370,7 +1370,7 @@ PHP_FUNCTION(imap_num_msg) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_LONG(imap_le_struct->imap_stream->nmsgs); + RETURN_INT(imap_le_struct->imap_stream->nmsgs); } /* }}} */ @@ -1404,7 +1404,7 @@ PHP_FUNCTION(imap_num_recent) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_LONG(imap_le_struct->imap_stream->recent); + RETURN_INT(imap_le_struct->imap_stream->recent); } /* }}} */ @@ -1906,7 +1906,7 @@ PHP_FUNCTION(imap_list_full) while (cur != NIL) { object_init(&mboxob); add_property_string(&mboxob, "name", (char*)cur->LTEXT); - add_property_long(&mboxob, "attributes", cur->attributes); + add_property_int(&mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; @@ -1981,8 +1981,8 @@ PHP_FUNCTION(imap_check) add_property_string(return_value, "Date", date); add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); - add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); - add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); + add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); + add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent); } else { RETURN_FALSE; } @@ -2101,7 +2101,7 @@ PHP_FUNCTION(imap_headerinfo) snprintf(dummy, sizeof(dummy), "%ld", cache->rfc822_size); add_property_string(return_value, "Size", dummy); - add_property_long(return_value, "udate", mail_longdate(cache)); + add_property_int(return_value, "udate", mail_longdate(cache)); if (en->from && fromlength) { fulladdress[0] = 0x00; @@ -2211,7 +2211,7 @@ PHP_FUNCTION(imap_lsub_full) while (cur != NIL) { object_init(&mboxob); add_property_string(&mboxob, "name", (char*)cur->LTEXT); - add_property_long(&mboxob, "attributes", cur->attributes); + add_property_int(&mboxob, "attributes", cur->attributes); #ifdef IMAP41 delim[0] = (char)cur->delimiter; delim[1] = 0; @@ -2424,7 +2424,7 @@ PHP_FUNCTION(imap_savebody) switch (Z_TYPE_P(out)) { - case IS_LONG: + case IS_INT: case IS_RESOURCE: close_stream = 0; php_stream_from_zval(writer, out); @@ -2581,15 +2581,15 @@ PHP_FUNCTION(imap_mailboxmsginfo) } msize = msize + cache->rfc822_size; } - add_property_long(return_value, "Unread", unreadmsg); - add_property_long(return_value, "Deleted", deletedmsg); - add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); - add_property_long(return_value, "Size", msize); + add_property_int(return_value, "Unread", unreadmsg); + add_property_int(return_value, "Deleted", deletedmsg); + add_property_int(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs); + add_property_int(return_value, "Size", msize); rfc822_date(date); add_property_string(return_value, "Date", date); add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name); add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox); - add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent); + add_property_int(return_value, "Recent", imap_le_struct->imap_stream->recent); } /* }}} */ @@ -3130,7 +3130,7 @@ PHP_FUNCTION(imap_sort) array_init(return_value); if (slst != NIL && slst != 0) { for (sl = slst; *sl; sl++) { - add_next_index_long(return_value, *sl); + add_next_index_int(return_value, *sl); } fs_give ((void **) &slst); } @@ -3193,7 +3193,7 @@ PHP_FUNCTION(imap_uid) RETURN_FALSE; } - RETURN_LONG(mail_uid(imap_le_struct->imap_stream, msgno)); + RETURN_INT(mail_uid(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3211,7 +3211,7 @@ PHP_FUNCTION(imap_msgno) ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); - RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno)); + RETURN_INT(mail_msgno(imap_le_struct->imap_stream, msgno)); } /* }}} */ @@ -3234,21 +3234,21 @@ PHP_FUNCTION(imap_status) object_init(return_value); if (mail_status(imap_le_struct->imap_stream, mbx, flags)) { - add_property_long(return_value, "flags", IMAPG(status_flags)); + add_property_int(return_value, "flags", IMAPG(status_flags)); if (IMAPG(status_flags) & SA_MESSAGES) { - add_property_long(return_value, "messages", IMAPG(status_messages)); + add_property_int(return_value, "messages", IMAPG(status_messages)); } if (IMAPG(status_flags) & SA_RECENT) { - add_property_long(return_value, "recent", IMAPG(status_recent)); + add_property_int(return_value, "recent", IMAPG(status_recent)); } if (IMAPG(status_flags) & SA_UNSEEN) { - add_property_long(return_value, "unseen", IMAPG(status_unseen)); + add_property_int(return_value, "unseen", IMAPG(status_unseen)); } if (IMAPG(status_flags) & SA_UIDNEXT) { - add_property_long(return_value, "uidnext", IMAPG(status_uidnext)); + add_property_int(return_value, "uidnext", IMAPG(status_uidnext)); } if (IMAPG(status_flags) & SA_UIDVALIDITY) { - add_property_long(return_value, "uidvalidity", IMAPG(status_uidvalidity)); + add_property_int(return_value, "uidvalidity", IMAPG(status_uidvalidity)); } } else { RETURN_FALSE; @@ -3288,49 +3288,49 @@ PHP_FUNCTION(imap_bodystruct) RETURN_FALSE; } if (body->type <= TYPEMAX) { - add_property_long(return_value, "type", body->type); + add_property_int(return_value, "type", body->type); } if (body->encoding <= ENCMAX) { - add_property_long(return_value, "encoding", body->encoding); + add_property_int(return_value, "encoding", body->encoding); } if (body->subtype) { - add_property_long(return_value, "ifsubtype", 1); + add_property_int(return_value, "ifsubtype", 1); add_property_string(return_value, "subtype", body->subtype); } else { - add_property_long(return_value, "ifsubtype", 0); + add_property_int(return_value, "ifsubtype", 0); } if (body->description) { - add_property_long(return_value, "ifdescription", 1); + add_property_int(return_value, "ifdescription", 1); add_property_string(return_value, "description", body->description); } else { - add_property_long(return_value, "ifdescription", 0); + add_property_int(return_value, "ifdescription", 0); } if (body->id) { - add_property_long(return_value, "ifid", 1); + add_property_int(return_value, "ifid", 1); add_property_string(return_value, "id", body->id); } else { - add_property_long(return_value, "ifid", 0); + add_property_int(return_value, "ifid", 0); } if (body->size.lines) { - add_property_long(return_value, "lines", body->size.lines); + add_property_int(return_value, "lines", body->size.lines); } if (body->size.bytes) { - add_property_long(return_value, "bytes", body->size.bytes); + add_property_int(return_value, "bytes", body->size.bytes); } #ifdef IMAP41 if (body->disposition.type) { - add_property_long(return_value, "ifdisposition", 1); + add_property_int(return_value, "ifdisposition", 1); add_property_string(return_value, "disposition", body->disposition.type); } else { - add_property_long(return_value, "ifdisposition", 0); + add_property_int(return_value, "ifdisposition", 0); } if (body->disposition.parameter) { dpar = body->disposition.parameter; - add_property_long(return_value, "ifdparameters", 1); + add_property_int(return_value, "ifdparameters", 1); array_init(&dparametres); do { object_init(&dparam); @@ -3340,12 +3340,12 @@ PHP_FUNCTION(imap_bodystruct) } while ((dpar = dpar->next)); add_assoc_object(return_value, "dparameters", &dparametres TSRMLS_CC); } else { - add_property_long(return_value, "ifdparameters", 0); + add_property_int(return_value, "ifdparameters", 0); } #endif if ((par = body->parameter)) { - add_property_long(return_value, "ifparameters", 1); + add_property_int(return_value, "ifparameters", 1); array_init(¶metres); do { @@ -3361,7 +3361,7 @@ PHP_FUNCTION(imap_bodystruct) } while ((par = par->next)); } else { object_init(¶metres); - add_property_long(return_value, "ifparameters", 0); + add_property_int(return_value, "ifparameters", 0); } add_assoc_object(return_value, "parameters", ¶metres TSRMLS_CC); } @@ -3436,16 +3436,16 @@ PHP_FUNCTION(imap_fetch_overview) if (env->in_reply_to) { add_property_string(&myoverview, "in_reply_to", env->in_reply_to); } - add_property_long(&myoverview, "size", elt->rfc822_size); - add_property_long(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); - add_property_long(&myoverview, "msgno", i); - add_property_long(&myoverview, "recent", elt->recent); - add_property_long(&myoverview, "flagged", elt->flagged); - add_property_long(&myoverview, "answered", elt->answered); - add_property_long(&myoverview, "deleted", elt->deleted); - add_property_long(&myoverview, "seen", elt->seen); - add_property_long(&myoverview, "draft", elt->draft); - add_property_long(&myoverview, "udate", mail_longdate(elt)); + add_property_int(&myoverview, "size", elt->rfc822_size); + add_property_int(&myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i)); + add_property_int(&myoverview, "msgno", i); + add_property_int(&myoverview, "recent", elt->recent); + add_property_int(&myoverview, "flagged", elt->flagged); + add_property_int(&myoverview, "answered", elt->answered); + add_property_int(&myoverview, "deleted", elt->deleted); + add_property_int(&myoverview, "seen", elt->seen); + add_property_int(&myoverview, "draft", elt->draft); + add_property_int(&myoverview, "udate", mail_longdate(elt)); add_next_index_object(return_value, &myoverview TSRMLS_CC); } } @@ -3474,7 +3474,7 @@ PHP_FUNCTION(imap_mail_compose) } #define PHP_RFC822_PARSE_ADRLIST(target, value) \ - str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \ + str_copy = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); \ rfc822_parse_adrlist(target, str_copy, "NO HOST"); \ efree(str_copy); @@ -3530,9 +3530,9 @@ PHP_FUNCTION(imap_mail_compose) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) { custom_headers_param = mail_newbody_parameter(); convert_to_string_ex(env_data); - custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1); + custom_headers_param->value = (char *) fs_get(Z_STRSIZE_P(env_data) + 1); custom_headers_param->attribute = NULL; - memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1); + memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRSIZE_P(env_data) + 1); custom_headers_param->next = tmp_param; tmp_param = custom_headers_param; } ZEND_HASH_FOREACH_END(); @@ -3553,12 +3553,12 @@ PHP_FUNCTION(imap_mail_compose) topbod = bod; if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->type = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->type = (short) Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->encoding = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->encoding = (short) Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -3575,8 +3575,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3597,8 +3597,8 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) { if (Z_TYPE_P(pvalue) == IS_ARRAY) { @@ -3607,8 +3607,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3617,21 +3617,21 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); - bod->contents.text.size = Z_STRLEN_P(pvalue); + bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); + bod->contents.text.size = Z_STRSIZE_P(pvalue); } else { bod->contents.text.data = fs_get(1); memcpy(bod->contents.text.data, "", 1); bod->contents.text.size = 0; } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.lines = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.lines = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.bytes = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.bytes = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -3640,8 +3640,8 @@ PHP_FUNCTION(imap_mail_compose) } else if (Z_TYPE_P(data) == IS_ARRAY) { short type = -1; if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "type", sizeof("type") - 1)) != NULL) { - convert_to_long_ex(pvalue); - type = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + type = (short) Z_IVAL_P(pvalue); } if (!toppart) { @@ -3660,14 +3660,14 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "encoding", sizeof("encoding") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->encoding = (short) Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->encoding = (short) Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) { convert_to_string_ex(pvalue); tmp_param = mail_newbody_parameter(); - tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1); + tmp_param->value = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1); tmp_param->attribute = cpystr("CHARSET"); tmp_param->next = bod->parameter; bod->parameter = tmp_param; @@ -3679,8 +3679,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *)fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3701,8 +3701,8 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1); + bod->disposition.type = (char *) fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue)+1); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition", sizeof("disposition") - 1)) != NULL) { if (Z_TYPE_P(pvalue) == IS_ARRAY) { @@ -3711,8 +3711,8 @@ PHP_FUNCTION(imap_mail_compose) disp_param = mail_newbody_parameter(); disp_param->attribute = cpystr(key->val); convert_to_string_ex(disp_data); - disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); - memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); + disp_param->value = (char *) fs_get(Z_STRSIZE_P(disp_data) + 1); + memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRSIZE_P(disp_data) + 1); disp_param->next = tmp_param; tmp_param = disp_param; } ZEND_HASH_FOREACH_END(); @@ -3721,21 +3721,21 @@ PHP_FUNCTION(imap_mail_compose) } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "contents.data", sizeof("contents.data") - 1)) != NULL) { convert_to_string_ex(pvalue); - bod->contents.text.data = fs_get(Z_STRLEN_P(pvalue) + 1); - memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1); - bod->contents.text.size = Z_STRLEN_P(pvalue); + bod->contents.text.data = fs_get(Z_STRSIZE_P(pvalue) + 1); + memcpy(bod->contents.text.data, Z_STRVAL_P(pvalue), Z_STRSIZE_P(pvalue) + 1); + bod->contents.text.size = Z_STRSIZE_P(pvalue); } else { bod->contents.text.data = fs_get(1); memcpy(bod->contents.text.data, "", 1); bod->contents.text.size = 0; } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "lines", sizeof("lines") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.lines = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.lines = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "bytes", sizeof("bytes") - 1)) != NULL) { - convert_to_long_ex(pvalue); - bod->size.bytes = Z_LVAL_P(pvalue); + convert_to_int_ex(pvalue); + bod->size.bytes = Z_IVAL_P(pvalue); } if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) { convert_to_string_ex(pvalue); @@ -4101,7 +4101,7 @@ PHP_FUNCTION(imap_search) cur = IMAPG(imap_messages); while (cur != NIL) { - add_next_index_long(return_value, cur->msgid); + add_next_index_int(return_value, cur->msgid); cur = cur->next; } mail_free_messagelist(&IMAPG(imap_messages), &IMAPG(imap_messages_tail)); @@ -4513,53 +4513,53 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) PART *part; if (body->type <= TYPEMAX) { - add_property_long(arg, "type", body->type); + add_property_int(arg, "type", body->type); } if (body->encoding <= ENCMAX) { - add_property_long(arg, "encoding", body->encoding); + add_property_int(arg, "encoding", body->encoding); } if (body->subtype) { - add_property_long(arg, "ifsubtype", 1); + add_property_int(arg, "ifsubtype", 1); add_property_string(arg, "subtype", body->subtype); } else { - add_property_long(arg, "ifsubtype", 0); + add_property_int(arg, "ifsubtype", 0); } if (body->description) { - add_property_long(arg, "ifdescription", 1); + add_property_int(arg, "ifdescription", 1); add_property_string(arg, "description", body->description); } else { - add_property_long(arg, "ifdescription", 0); + add_property_int(arg, "ifdescription", 0); } if (body->id) { - add_property_long(arg, "ifid", 1); + add_property_int(arg, "ifid", 1); add_property_string(arg, "id", body->id); } else { - add_property_long(arg, "ifid", 0); + add_property_int(arg, "ifid", 0); } if (body->size.lines) { - add_property_long(arg, "lines", body->size.lines); + add_property_int(arg, "lines", body->size.lines); } if (body->size.bytes) { - add_property_long(arg, "bytes", body->size.bytes); + add_property_int(arg, "bytes", body->size.bytes); } #ifdef IMAP41 if (body->disposition.type) { - add_property_long(arg, "ifdisposition", 1); + add_property_int(arg, "ifdisposition", 1); add_property_string(arg, "disposition", body->disposition.type); } else { - add_property_long(arg, "ifdisposition", 0); + add_property_int(arg, "ifdisposition", 0); } if (body->disposition.parameter) { dpar = body->disposition.parameter; - add_property_long(arg, "ifdparameters", 1); + add_property_int(arg, "ifdparameters", 1); array_init(&dparametres); do { object_init(&dparam); @@ -4569,12 +4569,12 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } while ((dpar = dpar->next)); add_assoc_object(arg, "dparameters", &dparametres TSRMLS_CC); } else { - add_property_long(arg, "ifdparameters", 0); + add_property_int(arg, "ifdparameters", 0); } #endif if ((par = body->parameter)) { - add_property_long(arg, "ifparameters", 1); + add_property_int(arg, "ifparameters", 1); array_init(¶metres); do { @@ -4590,7 +4590,7 @@ void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC) } while ((par = par->next)); } else { object_init(¶metres); - add_property_long(arg, "ifparameters", 0); + add_property_int(arg, "ifparameters", 0); } add_assoc_object(arg, "parameters", ¶metres TSRMLS_CC); @@ -4627,24 +4627,24 @@ static void build_thread_tree_helper(THREADNODE *cur, zval *tree, long *numNodes /* define "#.num" */ snprintf(buf, 25, "%ld.num", thisNode); - add_assoc_long(tree, buf, cur->num); + add_assoc_int(tree, buf, cur->num); snprintf(buf, 25, "%ld.next", thisNode); if(cur->next) { (*numNodes)++; - add_assoc_long(tree, buf, *numNodes); + add_assoc_int(tree, buf, *numNodes); build_thread_tree_helper(cur->next, tree, numNodes, buf); } else { /* "null pointer" */ - add_assoc_long(tree, buf, 0); + add_assoc_int(tree, buf, 0); } snprintf(buf, 25, "%ld.branch", thisNode); if(cur->branch) { (*numNodes)++; - add_assoc_long(tree, buf, *numNodes); + add_assoc_int(tree, buf, *numNodes); build_thread_tree_helper(cur->branch, tree, numNodes, buf); } else { /* "null pointer" */ - add_assoc_long(tree, buf, 0); + add_assoc_int(tree, buf, 0); } } /* }}} */ @@ -4733,7 +4733,7 @@ PHP_FUNCTION(imap_timeout) } timeout = (long) mail_parameters(NIL, timeout_type, NIL); - RETURN_LONG(timeout); + RETURN_INT(timeout); } else if (timeout >= 0) { switch (ttype) { case 1: diff --git a/ext/interbase/ibase_blobs.c b/ext/interbase/ibase_blobs.c index 8b8d731d7b..13265c7745 100644 --- a/ext/interbase/ibase_blobs.c +++ b/ext/interbase/ibase_blobs.c @@ -135,7 +135,7 @@ int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob TSRMLS_DC) /* {{{ convert_to_string_ex(string_arg); - for (rem_cnt = Z_STRLEN_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRSIZE_P(string_arg); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -337,9 +337,9 @@ PHP_FUNCTION(ibase_blob_get) RETURN_FALSE; } - convert_to_long_ex(len_arg); + convert_to_int_ex(len_arg); - if (_php_ibase_blob_get(return_value, ib_blob, Z_LVAL_P(len_arg) TSRMLS_CC) != SUCCESS) { + if (_php_ibase_blob_get(return_value, ib_blob, Z_IVAL_P(len_arg) TSRMLS_CC) != SUCCESS) { RETURN_FALSE; } } @@ -460,14 +460,14 @@ PHP_FUNCTION(ibase_blob_info) array_init(return_value); - add_index_long(return_value, 0, bl_info.total_length); - add_assoc_long(return_value, "length", bl_info.total_length); + add_index_int(return_value, 0, bl_info.total_length); + add_assoc_int(return_value, "length", bl_info.total_length); - add_index_long(return_value, 1, bl_info.num_segments); - add_assoc_long(return_value, "numseg", bl_info.num_segments); + add_index_int(return_value, 1, bl_info.num_segments); + add_assoc_int(return_value, "numseg", bl_info.num_segments); - add_index_long(return_value, 2, bl_info.max_segment); - add_assoc_long(return_value, "maxseg", bl_info.max_segment); + add_index_int(return_value, 2, bl_info.max_segment); + add_assoc_int(return_value, "maxseg", bl_info.max_segment); add_index_bool(return_value, 3, bl_info.bl_stream); add_assoc_bool(return_value, "stream", bl_info.bl_stream); diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c index ab1a791d37..f8eb3b8521 100644 --- a/ext/interbase/ibase_events.c +++ b/ext/interbase/ibase_events.c @@ -297,8 +297,8 @@ PHP_FUNCTION(ibase_set_event_handler) RETURN_FALSE; } - convert_to_long_ex(&args[0]); - link_res_id = Z_LVAL(args[0]); + convert_to_int_ex(&args[0]); + link_res_id = Z_IVAL(args[0]); } else { /* callback, event_1 [, ... event_15] diff --git a/ext/interbase/ibase_query.c b/ext/interbase/ibase_query.c index 1899e5aae1..13306c78eb 100644 --- a/ext/interbase/ibase_query.c +++ b/ext/interbase/ibase_query.c @@ -29,8 +29,8 @@ #include "php_interbase.h" #include "php_ibase_includes.h" -#define ISC_LONG_MIN INT_MIN -#define ISC_LONG_MAX INT_MAX +#define ISC_INT_MIN INT_MIN +#define ISC_INT_MAX INT_MAX #define QUERY_RESULT 1 #define EXECUTE_RESULT 2 @@ -498,7 +498,7 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, / *(short*) buf = (short) l; break; case SQL_LONG: - if (l > ISC_LONG_MAX || l < ISC_LONG_MIN) { + if (l > ISC_INT_MAX || l < ISC_INT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } @@ -534,27 +534,27 @@ static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, / ISC_INT64 l; case SQL_SHORT: - convert_to_long(val); - if (Z_LVAL_P(val) > SHRT_MAX || Z_LVAL_P(val) < SHRT_MIN) { + convert_to_int(val); + if (Z_IVAL_P(val) > SHRT_MAX || Z_IVAL_P(val) < SHRT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } - *(short *) buf = (short) Z_LVAL_P(val); + *(short *) buf = (short) Z_IVAL_P(val); break; case SQL_LONG: - convert_to_long(val); + convert_to_int(val); #if (SIZEOF_LONG > 4) - if (Z_LVAL_P(val) > ISC_LONG_MAX || Z_LVAL_P(val) < ISC_LONG_MIN) { + if (Z_IVAL_P(val) > ISC_INT_MAX || Z_IVAL_P(val) < ISC_INT_MIN) { _php_ibase_module_error("Array parameter exceeds field width" TSRMLS_CC); return FAILURE; } #endif - *(ISC_LONG *) buf = (ISC_LONG) Z_LVAL_P(val); + *(ISC_LONG *) buf = (ISC_LONG) Z_IVAL_P(val); break; case SQL_INT64: #if (SIZEOF_LONG >= 8) - convert_to_long(val); - *(long *) buf = Z_LVAL_P(val); + convert_to_int(val); + *(long *) buf = Z_IVAL_P(val); #else convert_to_string(val); if (!sscanf(Z_STRVAL_P(val), "%" LL_MASK "d", &l)) { @@ -664,7 +664,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRLEN_P(b_var) == 0); + force_null = (Z_STRSIZE_P(b_var) == 0); } if (! force_null) break; @@ -689,9 +689,9 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - if (Z_TYPE_P(b_var) == IS_LONG) { + if (Z_TYPE_P(b_var) == IS_INT) { struct tm *res; - res = php_gmtime_r(&Z_LVAL_P(b_var), &t); + res = php_gmtime_r(&Z_IVAL_P(b_var), &t); if (!res) { return FAILURE; } @@ -734,7 +734,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ convert_to_string(b_var); - if (Z_STRLEN_P(b_var) != BLOB_ID_LEN || + if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN || !_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) { ibase_blob ib_blob = { NULL, BLOB_INPUT }; @@ -762,7 +762,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ if (Z_TYPE_P(b_var) != IS_ARRAY) { convert_to_string(b_var); - if (Z_STRLEN_P(b_var) != BLOB_ID_LEN || + if (Z_STRSIZE_P(b_var) != BLOB_ID_LEN || !_php_ibase_string_to_quad(Z_STRVAL_P(b_var), &buf[i].val.qval)) { _php_ibase_module_error("Parameter %d: invalid array ID" TSRMLS_CC,i+1); @@ -799,7 +799,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, zval *b_vars, BIND_BUF *buf, /* {{{ */ /* we end up here if none of the switch cases handled the field */ convert_to_string(b_var); var->sqldata = Z_STRVAL_P(b_var); - var->sqllen = Z_STRLEN_P(b_var); + var->sqllen = Z_STRSIZE_P(b_var); var->sqltype = SQL_TEXT; } /* for */ return rv; @@ -1022,7 +1022,7 @@ static int _php_ibase_exec(INTERNAL_FUNCTION_PARAMETERS, ibase_result **ib_resul if (!ib_query->out_sqlda) { /* no result set is being returned */ if (affected_rows) { - RETVAL_LONG(affected_rows); + RETVAL_INT(affected_rows); } else { RETVAL_TRUE; } @@ -1228,7 +1228,7 @@ PHP_FUNCTION(ibase_affected_rows) trans = ib_link->tr_list->trans; } } - RETURN_LONG(trans->affected_rows); + RETURN_INT(trans->affected_rows); } /* }}} */ @@ -1281,7 +1281,7 @@ PHP_FUNCTION(ibase_num_rows) while (result[i] != isc_info_end && i < result_size) { short len = (short)isc_vax_integer(&result[i+1],2); if (result[i] == isc_info_req_select_count) { - RETURN_LONG(isc_vax_integer(&result[i+3],len)); + RETURN_INT(isc_vax_integer(&result[i+3],len)); } i += len+3; } @@ -1354,7 +1354,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{ n = *(ISC_LONG *) data; _sql_long: if (scale == 0) { - ZVAL_LONG(val,n); + ZVAL_INT(val,n); } else { long f = (long) scales[-scale]; @@ -1396,7 +1396,7 @@ format_date_time: t.tm_zone = tzname[0]; #endif if (flag & PHP_IBASE_UNIXTIME) { - ZVAL_LONG(val, mktime(&t)); + ZVAL_INT(val, mktime(&t)); } else { #if HAVE_STRFTIME l = strftime(string_data, sizeof(string_data), format, &t); @@ -1463,7 +1463,7 @@ static int _php_ibase_arr_zval(zval *ar_zval, char *data, unsigned long data_siz if (ib_array->ar_desc.array_desc_dtype == blr_varying || ib_array->ar_desc.array_desc_dtype == blr_varying2) { - Z_STRLEN_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval)); + Z_STRSIZE_P(ar_zval) = strlen(Z_STRVAL_P(ar_zval)); } } return SUCCESS; @@ -1904,9 +1904,9 @@ PHP_FUNCTION(ibase_num_fields) } if (sqlda == NULL) { - RETURN_LONG(0); + RETURN_INT(0); } else { - RETURN_LONG(sqlda->sqld); + RETURN_INT(sqlda->sqld); } } /* }}} */ @@ -2055,9 +2055,9 @@ PHP_FUNCTION(ibase_num_params) ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query); if (ib_query->in_sqlda == NULL) { - RETURN_LONG(0); + RETURN_INT(0); } else { - RETURN_LONG(ib_query->in_sqlda->sqld); + RETURN_INT(ib_query->in_sqlda->sqld); } } /* }}} */ diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c index 95f068e7ff..a38ebcdf73 100644 --- a/ext/interbase/ibase_service.c +++ b/ext/interbase/ibase_service.c @@ -67,67 +67,67 @@ void php_ibase_service_minit(INIT_FUNC_ARGS) /* {{{ */ "interbase service manager handle", module_number); /* backup options */ - REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_CHECKSUMS", isc_spb_bkp_ignore_checksums, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_IGNORE_LIMBO", isc_spb_bkp_ignore_limbo, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_METADATA_ONLY", isc_spb_bkp_metadata_only, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_NO_GARBAGE_COLLECT", isc_spb_bkp_no_garbage_collect, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_OLD_DESCRIPTIONS", isc_spb_bkp_old_descriptions, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_NON_TRANSPORTABLE", isc_spb_bkp_non_transportable, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_BKP_CONVERT", isc_spb_bkp_convert, CONST_PERSISTENT); /* restore options */ - REGISTER_LONG_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_DEACTIVATE_IDX", isc_spb_res_deactivate_idx, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_NO_SHADOW", isc_spb_res_no_shadow, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_NO_VALIDITY", isc_spb_res_no_validity, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_ONE_AT_A_TIME", isc_spb_res_one_at_a_time, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_REPLACE", isc_spb_res_replace, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_CREATE", isc_spb_res_create, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RES_USE_ALL_SPACE", isc_spb_res_use_all_space, CONST_PERSISTENT); /* manage options */ - REGISTER_LONG_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_PAGE_BUFFERS", isc_spb_prp_page_buffers, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_SWEEP_INTERVAL", isc_spb_prp_sweep_interval, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_SHUTDOWN_DB", isc_spb_prp_shutdown_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_TRANSACTIONS", isc_spb_prp_deny_new_transactions, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_DENY_NEW_ATTACHMENTS", isc_spb_prp_deny_new_attachments, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_RESERVE_SPACE", isc_spb_prp_reserve_space, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_RES_USE_FULL", isc_spb_prp_res_use_full, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_RES", isc_spb_prp_res, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_WRITE_MODE", isc_spb_prp_write_mode, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_WM_ASYNC", isc_spb_prp_wm_async, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_WM_SYNC", isc_spb_prp_wm_sync, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_ACCESS_MODE", isc_spb_prp_access_mode, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_AM_READONLY", isc_spb_prp_am_readonly, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_AM_READWRITE", isc_spb_prp_am_readwrite, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_SET_SQL_DIALECT", isc_spb_prp_set_sql_dialect, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_ACTIVATE", isc_spb_prp_activate, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_PRP_DB_ONLINE", isc_spb_prp_db_online, CONST_PERSISTENT); /* repair options */ - REGISTER_LONG_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_CHECK_DB", isc_spb_rpr_check_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_IGNORE_CHECKSUM", isc_spb_rpr_ignore_checksum, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_KILL_SHADOWS", isc_spb_rpr_kill_shadows, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_MEND_DB", isc_spb_rpr_mend_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_VALIDATE_DB", isc_spb_rpr_validate_db, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_FULL", isc_spb_rpr_full, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_RPR_SWEEP_DB", isc_spb_rpr_sweep_db, CONST_PERSISTENT); /* db info arguments */ - REGISTER_LONG_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_DATA_PAGES", isc_spb_sts_data_pages, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_DB_LOG", isc_spb_sts_db_log, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_HDR_PAGES", isc_spb_sts_hdr_pages, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_IDX_PAGES", isc_spb_sts_idx_pages, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_STS_SYS_RELATIONS", isc_spb_sts_sys_relations, CONST_PERSISTENT); /* server info arguments */ - REGISTER_LONG_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_SERVER_VERSION", isc_info_svc_server_version, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_IMPLEMENTATION", isc_info_svc_implementation, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV", isc_info_svc_get_env, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_LOCK", isc_info_svc_get_env_lock, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_ENV_MSG", isc_info_svc_get_env_msg, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_USER_DBPATH", isc_info_svc_user_dbpath, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_SVR_DB_INFO", isc_info_svc_svr_db_info, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_SVC_GET_USERS", isc_info_svc_get_users, CONST_PERSISTENT); } /* }}} */ @@ -343,12 +343,12 @@ query_loop: int len; case isc_spb_num_att: - add_assoc_long(return_value, "attachments", isc_vax_integer(result,4)); + add_assoc_int(return_value, "attachments", isc_vax_integer(result,4)); result += 4; break; case isc_spb_num_db: - add_assoc_long(return_value, "databases", isc_vax_integer(result,4)); + add_assoc_int(return_value, "databases", isc_vax_integer(result,4)); result += 4; break; @@ -398,12 +398,12 @@ query_loop: break; case isc_spb_sec_userid: - add_assoc_long(&user, "user_id", isc_vax_integer(result, 4)); + add_assoc_int(&user, "user_id", isc_vax_integer(result, 4)); result += 4; break; case isc_spb_sec_groupid: - add_assoc_long(&user, "group_id", isc_vax_integer(result, 4)); + add_assoc_int(&user, "group_id", isc_vax_integer(result, 4)); result += 4; break; } diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c index c6c108f377..13513cefc6 100644 --- a/ext/interbase/interbase.c +++ b/ext/interbase/interbase.c @@ -495,7 +495,7 @@ PHP_FUNCTION(ibase_errcode) } if (IBG(sql_code) != 0) { - RETURN_LONG(IBG(sql_code)); + RETURN_INT(IBG(sql_code)); } RETURN_FALSE; } @@ -735,23 +735,23 @@ PHP_MINIT_FUNCTION(ibase) le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, _php_ibase_close_plink, LE_PLINK, module_number); le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, LE_TRANS, module_number); - REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */ - REGISTER_LONG_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_CREATE", PHP_IBASE_CREATE, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_TEXT", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); /* deprecated, for BC only */ + REGISTER_INT_CONSTANT("IBASE_FETCH_BLOBS", PHP_IBASE_FETCH_BLOBS, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_FETCH_ARRAYS", PHP_IBASE_FETCH_ARRAYS, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT); /* transactions */ - REGISTER_LONG_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_WRITE", PHP_IBASE_WRITE, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_CONCURRENCY", PHP_IBASE_CONCURRENCY, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_REC_VERSION", PHP_IBASE_REC_VERSION, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_REC_NO_VERSION", PHP_IBASE_REC_NO_VERSION, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IBASE_WAIT", PHP_IBASE_WAIT, CONST_PERSISTENT); php_ibase_query_minit(INIT_FUNC_ARGS_PASSTHRU); php_ibase_blobs_minit(INIT_FUNC_ARGS_PASSTHRU); @@ -1194,8 +1194,8 @@ PHP_FUNCTION(ibase_trans) tpb_len = 0; - convert_to_long_ex(&args[i]); - trans_argl = Z_LVAL(args[i]); + convert_to_int_ex(&args[i]); + trans_argl = Z_IVAL(args[i]); if (trans_argl != PHP_IBASE_DEFAULT) { last_tpb[tpb_len++] = isc_tpb_version3; @@ -1475,7 +1475,7 @@ PHP_FUNCTION(ibase_gen_id) RETURN_STRINGL(res, l, 0); } #endif - RETURN_LONG((long)result); + RETURN_INT((long)result); } /* }}} */ diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c index 5a53df8b6b..d37e077240 100644 --- a/ext/interbase/php_ibase_udf.c +++ b/ext/interbase/php_ibase_udf.c @@ -231,7 +231,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case dtype_short: if (argv[i]->dsc_scale == 0) { - ZVAL_LONG(&args[i], *(short*)argv[i]->dsc_address); + ZVAL_INT(&args[i], *(short*)argv[i]->dsc_address); } else { ZVAL_DOUBLE(&args[i], ((double)*(short*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]); @@ -240,7 +240,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case dtype_long: if (argv[i]->dsc_scale == 0) { - ZVAL_LONG(&args[i], *(ISC_LONG*)argv[i]->dsc_address); + ZVAL_INT(&args[i], *(ISC_LONG*)argv[i]->dsc_address); } else { ZVAL_DOUBLE(&args[i], ((double)*(ISC_LONG*)argv[i]->dsc_address)/scales[-argv[i]->dsc_scale]); @@ -251,7 +251,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) l = *(ISC_INT64*)argv[i]->dsc_address; if (argv[i]->dsc_scale == 0 && l <= LONG_MAX && l >= LONG_MIN) { - ZVAL_LONG(&args[i], (long)l); + ZVAL_INT(&args[i], (long)l); } else { ZVAL_DOUBLE(&args[i], ((double)l)/scales[-argv[i]->dsc_scale]); } @@ -307,9 +307,9 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) /* return whatever type we got back from the callback: let DB handle conversion */ switch (Z_TYPE(return_value)) { - case IS_LONG: + case IS_INT: r->dsc_dtype = dtype_long; - *(long*)r->dsc_address = Z_LVAL(return_value); + *(long*)r->dsc_address = Z_IVAL(return_value); r->dsc_length = sizeof(long); break; @@ -329,7 +329,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) case IS_STRING: r->dsc_dtype = dtype_varying; memcpy(res->vary_string, Z_STRVAL(return_value), - (res->vary_length = min(r->dsc_length-2,Z_STRLEN(return_value)))); + (res->vary_length = min(r->dsc_length-2,Z_STRSIZE(return_value)))); r->dsc_length = res->vary_length+2; break; } diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp index 7aa1eae0bc..7c06af792c 100644 --- a/ext/intl/breakiterator/breakiterator_class.cpp +++ b/ext/intl/breakiterator/breakiterator_class.cpp @@ -338,36 +338,36 @@ U_CFUNC void breakiterator_register_BreakIterator_class(TSRMLS_D) zend_class_implements(BreakIterator_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); - zend_declare_class_constant_long(BreakIterator_ce_ptr, + zend_declare_class_constant_int(BreakIterator_ce_ptr, "DONE", sizeof("DONE") - 1, BreakIterator::DONE TSRMLS_CC ); /* Declare constants that are defined in the C header */ -#define BREAKITER_DECL_LONG_CONST(name) \ - zend_declare_class_constant_long(BreakIterator_ce_ptr, #name, \ +#define BREAKITER_DECL_INT_CONST(name) \ + zend_declare_class_constant_int(BreakIterator_ce_ptr, #name, \ sizeof(#name) - 1, UBRK_ ## name TSRMLS_CC) - BREAKITER_DECL_LONG_CONST(WORD_NONE); - BREAKITER_DECL_LONG_CONST(WORD_NONE_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_NUMBER); - BREAKITER_DECL_LONG_CONST(WORD_NUMBER_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_LETTER); - BREAKITER_DECL_LONG_CONST(WORD_LETTER_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_KANA); - BREAKITER_DECL_LONG_CONST(WORD_KANA_LIMIT); - BREAKITER_DECL_LONG_CONST(WORD_IDEO); - BREAKITER_DECL_LONG_CONST(WORD_IDEO_LIMIT); - - BREAKITER_DECL_LONG_CONST(LINE_SOFT); - BREAKITER_DECL_LONG_CONST(LINE_SOFT_LIMIT); - BREAKITER_DECL_LONG_CONST(LINE_HARD); - BREAKITER_DECL_LONG_CONST(LINE_HARD_LIMIT); - - BREAKITER_DECL_LONG_CONST(SENTENCE_TERM); - BREAKITER_DECL_LONG_CONST(SENTENCE_TERM_LIMIT); - BREAKITER_DECL_LONG_CONST(SENTENCE_SEP); - BREAKITER_DECL_LONG_CONST(SENTENCE_SEP_LIMIT); - -#undef BREAKITER_DECL_LONG_CONST + BREAKITER_DECL_INT_CONST(WORD_NONE); + BREAKITER_DECL_INT_CONST(WORD_NONE_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_NUMBER); + BREAKITER_DECL_INT_CONST(WORD_NUMBER_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_LETTER); + BREAKITER_DECL_INT_CONST(WORD_LETTER_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_KANA); + BREAKITER_DECL_INT_CONST(WORD_KANA_LIMIT); + BREAKITER_DECL_INT_CONST(WORD_IDEO); + BREAKITER_DECL_INT_CONST(WORD_IDEO_LIMIT); + + BREAKITER_DECL_INT_CONST(LINE_SOFT); + BREAKITER_DECL_INT_CONST(LINE_SOFT_LIMIT); + BREAKITER_DECL_INT_CONST(LINE_HARD); + BREAKITER_DECL_INT_CONST(LINE_HARD_LIMIT); + + BREAKITER_DECL_INT_CONST(SENTENCE_TERM); + BREAKITER_DECL_INT_CONST(SENTENCE_TERM_LIMIT); + BREAKITER_DECL_INT_CONST(SENTENCE_SEP); + BREAKITER_DECL_INT_CONST(SENTENCE_SEP_LIMIT); + +#undef BREAKITER_DECL_INT_CONST /* Create and register 'RuleBasedBreakIterator' class. */ diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 7783235d8d..c04e33e11b 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -67,7 +67,7 @@ static void _breakiterator_move_forward(zend_object_iterator *iter TSRMLS_DC) int32_t pos = biter->next(); if (pos != BreakIterator::DONE) { - ZVAL_LONG(&zoi_iter->current, (long)pos); + ZVAL_INT(&zoi_iter->current, (php_int_t)pos); } //else we've reached the end of the enum, nothing more is required } @@ -77,7 +77,7 @@ static void _breakiterator_rewind(zend_object_iterator *iter TSRMLS_DC) zoi_with_current *zoi_iter = (zoi_with_current*)iter; int32_t pos = biter->first(); - ZVAL_LONG(&zoi_iter->current, (long)pos); + ZVAL_INT(&zoi_iter->current, (php_int_t)pos); } static zend_object_iterator_funcs breakiterator_iterator_funcs = { @@ -137,7 +137,7 @@ static void _breakiterator_parts_destroy_it(zend_object_iterator *iter TSRMLS_DC static void _breakiterator_parts_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) { /* the actual work is done in move_forward and rewind */ - ZVAL_LONG(key, iter->index); + ZVAL_INT(key, iter->index); } static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_DC) @@ -168,7 +168,7 @@ static void _breakiterator_parts_move_forward(zend_object_iterator *iter TSRMLS_ * No need to do anything, the engine increments ->index */ const char *s = Z_STRVAL(bio->text); - int32_t slen = Z_STRLEN(bio->text); + int32_t slen = Z_STRSIZE(bio->text); zend_string *res; if (next == BreakIterator::DONE) { @@ -315,7 +315,7 @@ U_CFUNC void breakiterator_register_IntlPartsIterator_class(TSRMLS_D) IntlPartsIterator_handlers.get_method = IntlPartsIterator_get_method; #define PARTSITER_DECL_LONG_CONST(name) \ - zend_declare_class_constant_long(IntlPartsIterator_ce_ptr, #name, \ + zend_declare_class_constant_int(IntlPartsIterator_ce_ptr, #name, \ sizeof(#name) - 1, PARTS_ITERATOR_ ## name TSRMLS_CC) PARTSITER_DECL_LONG_CONST(KEY_SEQUENTIAL); diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp index ed5944a3da..a8c32cc8d4 100644 --- a/ext/intl/breakiterator/breakiterator_methods.cpp +++ b/ext/intl/breakiterator/breakiterator_methods.cpp @@ -208,7 +208,7 @@ static void _breakiter_no_args_ret_int32( int32_t res = (bio->biter->*func)(); - RETURN_LONG((long)res); + RETURN_INT((php_int_t)res); } static void _breakiter_int32_ret_int32( @@ -217,11 +217,11 @@ static void _breakiter_int32_ret_int32( INTERNAL_FUNCTION_PARAMETERS) { char *msg; - long arg; + php_int_t arg; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg) == FAILURE) { spprintf(&msg, 0, "%s: bad arguments", func_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); @@ -240,7 +240,7 @@ static void _breakiter_int32_ret_int32( int32_t res = (bio->biter->*func)((int32_t)arg); - RETURN_LONG((long)res); + RETURN_INT((php_int_t)res); } U_CFUNC PHP_FUNCTION(breakiter_first) @@ -308,7 +308,7 @@ U_CFUNC PHP_FUNCTION(breakiter_current) int32_t res = bio->biter->current(); - RETURN_LONG((long)res); + RETURN_INT((php_int_t)res); } U_CFUNC PHP_FUNCTION(breakiter_following) @@ -327,11 +327,11 @@ U_CFUNC PHP_FUNCTION(breakiter_preceding) U_CFUNC PHP_FUNCTION(breakiter_is_boundary) { - long offset; + php_int_t offset; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &offset) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_is_boundary: bad arguments", 0 TSRMLS_CC); @@ -349,16 +349,16 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary) UBool res = bio->biter->isBoundary((int32_t)offset); - RETURN_BOOL((long)res); + RETURN_BOOL((php_int_t)res); } U_CFUNC PHP_FUNCTION(breakiter_get_locale) { - long locale_type; + php_int_t locale_type; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &locale_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -382,11 +382,11 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale) U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator) { - long key_type = 0; + php_int_t key_type = 0; BREAKITER_METHOD_INIT_VARS; object = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &key_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &key_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "breakiter_get_parts_iterator: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -422,7 +422,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code) if (bio == NULL) RETURN_FALSE; - RETURN_LONG((long)BREAKITER_ERROR_CODE(bio)); + RETURN_INT((php_int_t)BREAKITER_ERROR_CODE(bio)); } U_CFUNC PHP_FUNCTION(breakiter_get_error_message) diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp index bf9239d531..142cc28342 100644 --- a/ext/intl/breakiterator/codepointiterator_internal.cpp +++ b/ext/intl/breakiterator/codepointiterator_internal.cpp @@ -18,9 +18,11 @@ #include <unicode/uchriter.h> #include <typeinfo> +#include "php.h" + //copied from cmemory.h, which is not public typedef union { - long t1; + php_int_t t1; double t2; void *t3; } UAlignedMemory; diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp index a833cf1853..a12924afef 100644 --- a/ext/intl/breakiterator/codepointiterator_methods.cpp +++ b/ext/intl/breakiterator/codepointiterator_methods.cpp @@ -40,5 +40,5 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_LONG(fetch_cpbi(bio)->getLastCodePoint()); + RETURN_INT(fetch_cpbi(bio)->getLastCodePoint()); } diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index 50df1a61ab..5755b0adb8 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -151,7 +151,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status) BREAKITER_METHOD_FETCH_OBJECT; - RETURN_LONG(fetch_rbbi(bio)->getRuleStatus()); + RETURN_INT(fetch_rbbi(bio)->getRuleStatus()); } U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) @@ -189,7 +189,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec) array_init_size(return_value, num_rules); for (int32_t i = 0; i < num_rules; i++) { - add_next_index_long(return_value, rules[i]); + add_next_index_int(return_value, rules[i]); } delete[] rules; } diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp index a62ad7b9d9..af4f53907f 100644 --- a/ext/intl/calendar/calendar_class.cpp +++ b/ext/intl/calendar/calendar_class.cpp @@ -209,7 +209,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp TSRMLS_DC) const char *name = debug_info_fields[i].name; int32_t res = cal->get(debug_info_fields[i].field, uec); if (U_SUCCESS(uec)) { - add_assoc_long(&zfields, name, (long)res); + add_assoc_int(&zfields, name, (php_int_t)res); } else { add_assoc_string(&zfields, name, const_cast<char*>(u_errorName(uec))); } @@ -489,57 +489,57 @@ void calendar_register_IntlCalendar_class(TSRMLS_D) } /* Declare 'IntlCalendar' class constants */ -#define CALENDAR_DECL_LONG_CONST(name, val) \ - zend_declare_class_constant_long(Calendar_ce_ptr, name, sizeof(name) - 1, \ +#define CALENDAR_DECL_INT_CONST(name, val) \ + zend_declare_class_constant_int(Calendar_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - CALENDAR_DECL_LONG_CONST("FIELD_ERA", UCAL_ERA); - CALENDAR_DECL_LONG_CONST("FIELD_YEAR", UCAL_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_MONTH", UCAL_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_DATE", UCAL_DATE); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_AM_PM", UCAL_AM_PM); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR", UCAL_HOUR); - CALENDAR_DECL_LONG_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_MINUTE", UCAL_MINUTE); - CALENDAR_DECL_LONG_CONST("FIELD_SECOND", UCAL_SECOND); - CALENDAR_DECL_LONG_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); - CALENDAR_DECL_LONG_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); - CALENDAR_DECL_LONG_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); - CALENDAR_DECL_LONG_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); - CALENDAR_DECL_LONG_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); - CALENDAR_DECL_LONG_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); - CALENDAR_DECL_LONG_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); - CALENDAR_DECL_LONG_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); - CALENDAR_DECL_LONG_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); - CALENDAR_DECL_LONG_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); - - CALENDAR_DECL_LONG_CONST("DOW_SUNDAY", UCAL_SUNDAY); - CALENDAR_DECL_LONG_CONST("DOW_MONDAY", UCAL_MONDAY); - CALENDAR_DECL_LONG_CONST("DOW_TUESDAY", UCAL_TUESDAY); - CALENDAR_DECL_LONG_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); - CALENDAR_DECL_LONG_CONST("DOW_THURSDAY", UCAL_THURSDAY); - CALENDAR_DECL_LONG_CONST("DOW_FRIDAY", UCAL_FRIDAY); - CALENDAR_DECL_LONG_CONST("DOW_SATURDAY", UCAL_SATURDAY); + CALENDAR_DECL_INT_CONST("FIELD_ERA", UCAL_ERA); + CALENDAR_DECL_INT_CONST("FIELD_YEAR", UCAL_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_MONTH", UCAL_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_YEAR", UCAL_WEEK_OF_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_WEEK_OF_MONTH", UCAL_WEEK_OF_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_DATE", UCAL_DATE); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_YEAR", UCAL_DAY_OF_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK", UCAL_DAY_OF_WEEK); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_WEEK_IN_MONTH", UCAL_DAY_OF_WEEK_IN_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_AM_PM", UCAL_AM_PM); + CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_INT_CONST("FIELD_HOUR", UCAL_HOUR); + CALENDAR_DECL_INT_CONST("FIELD_HOUR_OF_DAY", UCAL_HOUR_OF_DAY); + CALENDAR_DECL_INT_CONST("FIELD_MINUTE", UCAL_MINUTE); + CALENDAR_DECL_INT_CONST("FIELD_SECOND", UCAL_SECOND); + CALENDAR_DECL_INT_CONST("FIELD_MILLISECOND", UCAL_MILLISECOND); + CALENDAR_DECL_INT_CONST("FIELD_ZONE_OFFSET", UCAL_ZONE_OFFSET); + CALENDAR_DECL_INT_CONST("FIELD_DST_OFFSET", UCAL_DST_OFFSET); + CALENDAR_DECL_INT_CONST("FIELD_YEAR_WOY", UCAL_YEAR_WOY); + CALENDAR_DECL_INT_CONST("FIELD_DOW_LOCAL", UCAL_DOW_LOCAL); + CALENDAR_DECL_INT_CONST("FIELD_EXTENDED_YEAR", UCAL_EXTENDED_YEAR); + CALENDAR_DECL_INT_CONST("FIELD_JULIAN_DAY", UCAL_JULIAN_DAY); + CALENDAR_DECL_INT_CONST("FIELD_MILLISECONDS_IN_DAY", UCAL_MILLISECONDS_IN_DAY); + CALENDAR_DECL_INT_CONST("FIELD_IS_LEAP_MONTH", UCAL_IS_LEAP_MONTH); + CALENDAR_DECL_INT_CONST("FIELD_FIELD_COUNT", UCAL_FIELD_COUNT); + CALENDAR_DECL_INT_CONST("FIELD_DAY_OF_MONTH", UCAL_DAY_OF_MONTH); + + CALENDAR_DECL_INT_CONST("DOW_SUNDAY", UCAL_SUNDAY); + CALENDAR_DECL_INT_CONST("DOW_MONDAY", UCAL_MONDAY); + CALENDAR_DECL_INT_CONST("DOW_TUESDAY", UCAL_TUESDAY); + CALENDAR_DECL_INT_CONST("DOW_WEDNESDAY", UCAL_WEDNESDAY); + CALENDAR_DECL_INT_CONST("DOW_THURSDAY", UCAL_THURSDAY); + CALENDAR_DECL_INT_CONST("DOW_FRIDAY", UCAL_FRIDAY); + CALENDAR_DECL_INT_CONST("DOW_SATURDAY", UCAL_SATURDAY); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); - CALENDAR_DECL_LONG_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKDAY", UCAL_WEEKDAY); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND", UCAL_WEEKEND); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_OFFSET", UCAL_WEEKEND_ONSET); + CALENDAR_DECL_INT_CONST("DOW_TYPE_WEEKEND_CEASE", UCAL_WEEKEND_CEASE); #endif #if U_ICU_VERSION_MAJOR_NUM >= 49 - CALENDAR_DECL_LONG_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); - CALENDAR_DECL_LONG_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); - CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); + CALENDAR_DECL_INT_CONST("WALLTIME_FIRST", UCAL_WALLTIME_FIRST); + CALENDAR_DECL_INT_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST); + CALENDAR_DECL_INT_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID); #endif } /* }}} */ diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 3684c229a1..23fb376604 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -219,12 +219,12 @@ static void _php_intlcal_field_uec_ret_in32t_method( const char *method_name, INTERNAL_FUNCTION_PARAMETERS) { - long field; + php_int_t field; char *message; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { spprintf(&message, 0, "%s: bad arguments", method_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); @@ -244,7 +244,7 @@ static void _php_intlcal_field_uec_ret_in32t_method( (UCalendarDateFields)field, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } U_CFUNC PHP_FUNCTION(intlcal_get) @@ -295,12 +295,12 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time) U_CFUNC PHP_FUNCTION(intlcal_add) { - long field, + php_int_t field, amount; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { + "Oii", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_add: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -399,7 +399,7 @@ U_CFUNC PHP_FUNCTION(intlcal_before) U_CFUNC PHP_FUNCTION(intlcal_set) { - long arg1, arg2, arg3, arg4, arg5, arg6; + php_int_t arg1, arg2, arg3, arg4, arg5, arg6; zval args_a[7] = {0}, *args = args_a; int i; @@ -423,7 +423,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) if (variant == 4 || zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, + "Oii|iiii", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: bad arguments", 0 TSRMLS_CC); @@ -431,7 +431,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) } for (i = 0; i < variant; i++) { - if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) { + if (Z_IVAL(args[i]) < INT32_MIN || Z_IVAL(args[i]) > INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: at least one of the arguments has an absolute " "value that is too large", 0 TSRMLS_CC); @@ -462,7 +462,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set) U_CFUNC PHP_FUNCTION(intlcal_roll) { - long field, + php_int_t field, value; zval args_a[3] = {0}, *args = args_a; @@ -488,7 +488,7 @@ U_CFUNC PHP_FUNCTION(intlcal_roll) } bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { + "Oii", &object, Calendar_ce_ptr, &field, &value) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_roll: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -524,7 +524,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) { zval args_a[2] = {0}, *args = &args_a[0]; - long field; + php_int_t field; int variant; CALENDAR_METHOD_INIT_VARS; @@ -547,7 +547,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) } variant = 0; } else if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - getThis(), "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { + getThis(), "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_clear: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -572,12 +572,12 @@ U_CFUNC PHP_FUNCTION(intlcal_clear) U_CFUNC PHP_FUNCTION(intlcal_field_difference) { - long field; + php_int_t field; double when; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { + "Odi", &object, Calendar_ce_ptr, &when, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_field_difference: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -596,7 +596,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference) INTL_METHOD_CHECK_STATUS(co, "intlcal_field_difference: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } U_CFUNC PHP_FUNCTION(intlcal_get_actual_maximum) @@ -614,11 +614,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_actual_minimum) #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) { - long dow; + php_uint_t dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_day_of_week_type: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -637,7 +637,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_day_of_week_type: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } #endif @@ -658,7 +658,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } static void _php_intlcal_field_ret_in32t_method( @@ -666,12 +666,12 @@ static void _php_intlcal_field_ret_in32t_method( const char *method_name, INTERNAL_FUNCTION_PARAMETERS) { - long field; + php_int_t field; char *message; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { spprintf(&message, 0, "%s: bad arguments", method_name); intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); @@ -690,7 +690,7 @@ static void _php_intlcal_field_ret_in32t_method( int32_t result = (co->ucal->*func)((UCalendarDateFields)field); INTL_METHOD_CHECK_STATUS(co, "Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } U_CFUNC PHP_FUNCTION(intlcal_get_greatest_minimum) @@ -707,11 +707,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_least_maximum) U_CFUNC PHP_FUNCTION(intlcal_get_locale) { - long locale_type; + php_int_t locale_type; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -756,7 +756,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_first_day_of_week: Call to ICU method has failed"); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } U_CFUNC PHP_FUNCTION(intlcal_get_minimum) @@ -807,11 +807,11 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type) #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) { - long dow; + php_int_t dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_weekend_transition: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -830,7 +830,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition) INTL_METHOD_CHECK_STATUS(co, "intlcal_get_weekend_transition: " "Error calling ICU method"); - RETURN_LONG((long)res); + RETURN_INT((php_int_t)res); } #endif @@ -898,11 +898,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient) U_CFUNC PHP_FUNCTION(intlcal_is_set) { - long field; + php_int_t field; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &field) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &field) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_is_set: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -953,11 +953,11 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend) U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week) { - long dow; + php_int_t dow; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &dow) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_first_day_of_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -997,11 +997,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient) U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week) { - long num_days; + php_int_t num_days; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &num_days) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_minimal_days_in_first_week: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1064,7 +1064,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_LONG(co->ucal->getRepeatedWallTimeOption()); + RETURN_INT(co->ucal->getRepeatedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) @@ -1080,16 +1080,16 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option) CALENDAR_METHOD_FETCH_OBJECT; - RETURN_LONG(co->ucal->getSkippedWallTimeOption()); + RETURN_INT(co->ucal->getSkippedWallTimeOption()); } U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) { - long option; + php_int_t option; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_repeated_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1110,11 +1110,11 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option) U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option) { - long option; + php_int_t option; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, Calendar_ce_ptr, &option) == FAILURE) { + "Oi", &object, Calendar_ce_ptr, &option) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set_skipped_wall_time_option: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -1179,7 +1179,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) } zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp); - if (Z_TYPE(zv_timestamp) != IS_LONG) { + if (Z_TYPE(zv_timestamp) != IS_INT) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_from_date_time: bad DateTime; call to " "DateTime::getTimestamp() failed", 0 TSRMLS_CC); @@ -1209,7 +1209,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time) "error creating ICU Calendar object", 0 TSRMLS_CC); goto error; } - cal->setTime(((UDate)Z_LVAL(zv_timestamp)) * 1000., status); + cal->setTime(((UDate)Z_IVAL(zv_timestamp)) * 1000., status); if (U_FAILURE(status)) { /* time zone was adopted by cal; should not be deleted here */ delete cal; @@ -1322,7 +1322,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code) if (co == NULL) RETURN_FALSE; - RETURN_LONG((long)CALENDAR_ERROR_CODE(co)); + RETURN_INT((php_int_t)CALENDAR_ERROR_CODE(co)); } U_CFUNC PHP_FUNCTION(intlcal_get_error_message) diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index e62164f7d6..09ad390b96 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -43,7 +43,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) *args = &args_a[0]; char *locale = NULL; int locale_len; - long largs[6]; + php_int_t largs[6]; UErrorCode status = U_ZERO_ERROR; int variant; intl_error_reset(NULL TSRMLS_CC); @@ -242,11 +242,11 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change) U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year) { - long year; + php_int_t year; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { + "Oi", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlgregcal_is_leap_year: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c index eff9568de1..08da6d3831 100644 --- a/ext/intl/collator/collator.c +++ b/ext/intl/collator/collator.c @@ -38,9 +38,9 @@ void collator_register_constants( INIT_FUNC_ARGS ) return; } - #define COLLATOR_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); - #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define COLLATOR_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define COLLATOR_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( #x ) - 1, UCOL_##x TSRMLS_CC ); + #define COLLATOR_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Collator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UColAttributeValue constants */ COLLATOR_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_VALUE", UCOL_DEFAULT ); diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c index 684e72cc58..a0a4bf8df3 100644 --- a/ext/intl/collator/collator_attr.c +++ b/ext/intl/collator/collator_attr.c @@ -33,12 +33,12 @@ */ PHP_FUNCTION( collator_get_attribute ) { - long attribute, value; + php_int_t attribute, value; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, Collator_ce_ptr, &attribute ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -53,7 +53,7 @@ PHP_FUNCTION( collator_get_attribute ) value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) ); COLLATOR_CHECK_STATUS( co, "Error getting attribute value" ); - RETURN_LONG( value ); + RETURN_INT( value ); } /* }}} */ @@ -64,12 +64,12 @@ PHP_FUNCTION( collator_get_attribute ) */ PHP_FUNCTION( collator_set_attribute ) { - long attribute, value; + php_int_t attribute, value; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &object, Collator_ce_ptr, &attribute, &value ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -112,7 +112,7 @@ PHP_FUNCTION( collator_get_strength ) COLLATOR_METHOD_FETCH_OBJECT; /* Get current strength and return it. */ - RETURN_LONG( ucol_getStrength( co->ucoll ) ); + RETURN_INT( ucol_getStrength( co->ucoll ) ); } /* }}} */ @@ -123,12 +123,12 @@ PHP_FUNCTION( collator_get_strength ) */ PHP_FUNCTION( collator_set_strength ) { - long strength; + php_int_t strength; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, Collator_ce_ptr, &strength ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c index 4384558ac6..497061e157 100644 --- a/ext/intl/collator/collator_compare.c +++ b/ext/intl/collator/collator_compare.c @@ -119,7 +119,7 @@ PHP_FUNCTION( collator_compare ) efree( ustr2 ); /* Return result of the comparison. */ - RETURN_LONG( result ); + RETURN_INT( result ); } /* }}} */ diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 7d8bf0bbc8..89224d0341 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -41,7 +41,7 @@ /* {{{ collator_convert_hash_item_from_utf8_to_utf16 */ static void collator_convert_hash_item_from_utf8_to_utf16( - HashTable* hash, zval *hashData, zend_string *hashKey, ulong hashIndex, + HashTable* hash, zval *hashData, zend_string *hashKey, php_uint_t hashIndex, UErrorCode* status ) { const char* old_val; @@ -55,7 +55,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRLEN_P( hashData ); + old_val_len = Z_STRSIZE_P( hashData ); /* Convert it from UTF-8 to UTF-16LE and save the result to new_val[_len]. */ intl_convert_utf8_to_utf16( &new_val, &new_val_len, old_val, old_val_len, status ); @@ -67,13 +67,13 @@ static void collator_convert_hash_item_from_utf8_to_utf16( //??? efree(new_val); /* hack to fix use of initialized value */ - Z_STRLEN(znew_val) = Z_STRLEN(znew_val) - UBYTES(1); + Z_STRSIZE(znew_val) = Z_STRSIZE(znew_val) - UBYTES(1); if( hashKey) { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_LONG */ + else /* hashKeyType == HASH_KEY_IS_INT */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -82,7 +82,7 @@ static void collator_convert_hash_item_from_utf8_to_utf16( /* {{{ collator_convert_hash_item_from_utf16_to_utf8 */ static void collator_convert_hash_item_from_utf16_to_utf8( - HashTable* hash, zval * hashData, zend_string* hashKey, ulong hashIndex, + HashTable* hash, zval * hashData, zend_string* hashKey, php_uint_t hashIndex, UErrorCode* status ) { const char* old_val; @@ -96,7 +96,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( return; old_val = Z_STRVAL_P( hashData ); - old_val_len = Z_STRLEN_P( hashData ); + old_val_len = Z_STRSIZE_P( hashData ); /* Convert it from UTF-16LE to UTF-8 and save the result to new_val[_len]. */ intl_convert_utf16_to_utf8( &new_val, &new_val_len, @@ -113,7 +113,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( { zend_hash_update( hash, hashKey, &znew_val); } - else /* hashKeyType == HASH_KEY_IS_LONG */ + else /* hashKeyType == HASH_KEY_IS_INT */ { zend_hash_index_update( hash, hashIndex, &znew_val); } @@ -125,7 +125,7 @@ static void collator_convert_hash_item_from_utf16_to_utf8( */ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* status ) { - ulong hashIndex; + php_uint_t hashIndex; zval *hashData; zend_string *hashKey; @@ -144,7 +144,7 @@ void collator_convert_hash_from_utf8_to_utf16( HashTable* hash, UErrorCode* stat */ void collator_convert_hash_from_utf16_to_utf8( HashTable* hash, UErrorCode* status ) { - ulong hashIndex; + php_uint_t hashIndex; zend_string *hashKey; zval *hashData; @@ -176,7 +176,7 @@ zval* collator_convert_zstr_utf16_to_utf8( zval* utf16_zval, zval *rv ) /* Convert to utf8 then. */ intl_convert_utf16_to_utf8( &str, &str_len, - (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRLEN_P(utf16_zval) ), &status ); + (UChar*) Z_STRVAL_P(utf16_zval), UCHARS( Z_STRSIZE_P(utf16_zval) ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error converting utf16 to utf8 in collator_convert_zval_utf16_to_utf8()" ); @@ -207,7 +207,7 @@ zval* collator_convert_zstr_utf8_to_utf16( zval* utf8_zval, zval *rv ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( utf8_zval ), Z_STRLEN_P( utf8_zval ), + Z_STRVAL_P( utf8_zval ), Z_STRSIZE_P( utf8_zval ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_zstr_utf8_to_utf16()" ); @@ -282,7 +282,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv TSRMLS_DC ) /* Convert the string to UTF-16. */ intl_convert_utf8_to_utf16( &ustr, &ustr_len, - Z_STRVAL_P( zstr ), Z_STRLEN_P( zstr ), + Z_STRVAL_P( zstr ), Z_STRSIZE_P( zstr ), &status ); if( U_FAILURE( status ) ) php_error( E_WARNING, "Error casting object to string in collator_convert_object_to_string()" ); @@ -320,7 +320,7 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval_ptr_dtor( num ); num = rv; - ZVAL_LONG( num, 0 ); + ZVAL_INT( num, 0 ); } return num; @@ -338,9 +338,9 @@ zval* collator_convert_string_to_number( zval* str, zval *rv ) zval* collator_convert_string_to_double( zval* str, zval *rv ) { zval* num = collator_convert_string_to_number( str, rv ); - if( Z_TYPE_P(num) == IS_LONG ) + if( Z_TYPE_P(num) == IS_INT ) { - ZVAL_DOUBLE( num, Z_LVAL_P( num ) ); + ZVAL_DOUBLE( num, Z_IVAL_P( num ) ); } return num; @@ -359,7 +359,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv ) zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) { int is_numeric = 0; - long lval = 0; + php_int_t lval = 0; double dval = 0; if( Z_TYPE_P( str ) != IS_STRING ) @@ -367,10 +367,10 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) COLLATOR_CONVERT_RETURN_FAILED( str ); } - if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) ) + if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRSIZE_P(str) ), &lval, &dval, 1 ) ) ) { - if( is_numeric == IS_LONG ) { - ZVAL_LONG(rv, lval); + if( is_numeric == IS_INT ) { + ZVAL_INT(rv, lval); } if( is_numeric == IS_DOUBLE ) ZVAL_DOUBLE(rv, dval); diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c index 91bc25d077..acfa43c498 100644 --- a/ext/intl/collator/collator_error.c +++ b/ext/intl/collator/collator_error.c @@ -48,7 +48,7 @@ PHP_FUNCTION( collator_get_error_code ) RETURN_FALSE; /* Return collator's last error code. */ - RETURN_LONG( COLLATOR_ERROR_CODE( co ) ); + RETURN_INT( COLLATOR_ERROR_CODE( co ) ); } /* }}} */ diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index a8abfac12b..f92133e3d5 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -125,15 +125,15 @@ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */ * * Ignores `locale' stuff. */ -static long collator_u_strtol(nptr, endptr, base) +static php_int_t collator_u_strtol(nptr, endptr, base) const UChar *nptr; UChar **endptr; register int base; { register const UChar *s = nptr; - register unsigned long acc; + register php_uint_t acc; register UChar c; - register unsigned long cutoff; + register php_uint_t cutoff; register int neg = 0, any, cutlim; if (s == NULL) { @@ -184,9 +184,9 @@ static long collator_u_strtol(nptr, endptr, base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; - cutlim = cutoff % (unsigned long)base; - cutoff /= (unsigned long)base; + cutoff = neg ? -(php_uint_t)PHP_INT_MIN : PHP_INT_MAX; + cutlim = cutoff % (php_uint_t)base; + cutoff /= (php_uint_t)base; for (acc = 0, any = 0;; c = *s++) { if (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) c -= 0x30 /*'0'*/; @@ -208,7 +208,7 @@ static long collator_u_strtol(nptr, endptr, base) } } if (any < 0) { - acc = neg ? LONG_MIN : LONG_MAX; + acc = neg ? PHP_INT_MIN : PHP_INT_MAX; errno = ERANGE; } else if (neg) acc = -acc; @@ -222,9 +222,9 @@ static long collator_u_strtol(nptr, endptr, base) /* {{{ collator_is_numeric] * Taken from PHP6:is_numeric_unicode() */ -zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval, int allow_errors ) +zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors ) { - long local_lval; + php_int_t local_lval; double local_dval; UChar *end_ptr_long, *end_ptr_double; int conv_base=10; @@ -245,7 +245,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval if (lval) { *lval = local_lval; } - return IS_LONG; + return IS_INT; } else if (end_ptr_long == str && *end_ptr_long != '\0' && *str != '.' && *str != '-') { /* ignore partial string matches */ return 0; } @@ -288,7 +288,7 @@ zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval return IS_DOUBLE; } else if (end_ptr_long && lval) { *lval = local_lval; - return IS_LONG; + return IS_INT; } } return 0; diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h index 585d58917a..bd5ccfdd26 100644 --- a/ext/intl/collator/collator_is_numeric.h +++ b/ext/intl/collator/collator_is_numeric.h @@ -21,6 +21,6 @@ #include <php.h> #include <unicode/uchar.h> -zend_uchar collator_is_numeric( UChar *str, int length, long *lval, double *dval, int allow_errors ); +zend_uchar collator_is_numeric( UChar *str, int length, php_int_t *lval, double *dval, int allow_errors ); #endif // COLLATOR_IS_NUMERIC_H diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c index e5640beca6..786719c131 100644 --- a/ext/intl/collator/collator_locale.c +++ b/ext/intl/collator/collator_locale.c @@ -33,13 +33,13 @@ */ PHP_FUNCTION( collator_get_locale ) { - long type = 0; + php_int_t type = 0; char* locale_name = NULL; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, Collator_ce_ptr, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 43140b2f41..1d9c955fda 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -27,7 +27,7 @@ #include "intl_convert.h" #if !defined(HAVE_PTRDIFF_T) && !defined(_PTRDIFF_T_DEFINED) -typedef long ptrdiff_t; +typedef php_int_t ptrdiff_t; #endif /** @@ -80,10 +80,10 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2 } /* Compare the strings using ICU. */ - ZVAL_LONG(result, ucol_strcoll( + ZVAL_INT(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); } else { @@ -190,10 +190,10 @@ static int collator_icu_compare_function(zval *result, zval *op1, zval *op2 TSRM co = Z_INTL_COLLATOR_P(&INTL_G(current_collator)); /* Compare the strings using ICU. */ - ZVAL_LONG(result, ucol_strcoll( + ZVAL_INT(result, ucol_strcoll( co->ucoll, - INTL_Z_STRVAL_P(str1_p), INTL_Z_STRLEN_P(str1_p), - INTL_Z_STRVAL_P(str2_p), INTL_Z_STRLEN_P(str2_p) )); + INTL_Z_STRVAL_P(str1_p), INTL_Z_STRSIZE_P(str1_p), + INTL_Z_STRVAL_P(str2_p), INTL_Z_STRSIZE_P(str2_p) )); zval_ptr_dtor( str1_p ); zval_ptr_dtor( str2_p ); @@ -232,11 +232,11 @@ static int collator_compare_func( const void* a, const void* b TSRMLS_DC ) return 0; } - convert_to_long(&result); + convert_to_int(&result); - if( Z_LVAL(result) < 0 ) + if( Z_IVAL(result) < 0 ) return -1; - else if( Z_LVAL(result) > 0 ) + else if( Z_IVAL(result) > 0 ) return 1; return 0; @@ -258,7 +258,7 @@ static int collator_cmp_sort_keys( const void *p1, const void *p2 TSRMLS_DC ) /* {{{ collator_get_compare_function * Choose compare function according to sort flags. */ -static collator_compare_func_t collator_get_compare_function( const long sort_flags ) +static collator_compare_func_t collator_get_compare_function( const php_int_t sort_flags ) { collator_compare_func_t func; @@ -290,12 +290,12 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS ) zval saved_collator; zval* array = NULL; HashTable* hash = NULL; - long sort_flags = COLLATOR_SORT_REGULAR; + php_int_t sort_flags = COLLATOR_SORT_REGULAR; COLLATOR_METHOD_INIT_VARS /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|l", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oa/|i", &object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -424,7 +424,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) /* Process string values only. */ if( Z_TYPE_P( hashData ) == IS_STRING ) { - intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRLEN_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); + intl_convert_utf8_to_utf16( &utf16_buf, &utf16_len, Z_STRVAL_P( hashData ), Z_STRSIZE_P( hashData ), COLLATOR_ERROR_CODE_P( co ) ); if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) ) { diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index 7c7510d554..885d08cd2c 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -127,7 +127,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, if (millis) { ZVAL_STRING(&zfuncname, "getTimestamp"); if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL TSRMLS_CC) - != SUCCESS || Z_TYPE(retval) != IS_LONG) { + != SUCCESS || Z_TYPE(retval) != IS_INT) { spprintf(&message, 0, "%s: error calling ::getTimeStamp() on the " "object", func); intl_errors_set(err, U_INTERNAL_PROGRAM_ERROR, @@ -137,7 +137,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, return FAILURE; } - *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval); + *millis = U_MILLIS_PER_SECOND * (double)Z_IVAL(retval); zval_ptr_dtor(&zfuncname); } @@ -174,7 +174,7 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TSRMLS_DC) { double rv = NAN; - long lv; + php_int_t lv; int type; char *message; @@ -184,10 +184,10 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS switch (Z_TYPE_P(z)) { case IS_STRING: - type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0); + type = is_numeric_string(Z_STRVAL_P(z), Z_STRSIZE_P(z), &lv, &rv, 0); if (type == IS_DOUBLE) { rv *= U_MILLIS_PER_SECOND; - } else if (type == IS_LONG) { + } else if (type == IS_INT) { rv = U_MILLIS_PER_SECOND * (double)lv; } else { spprintf(&message, 0, "%s: string '%s' is not numeric, " @@ -198,8 +198,8 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func TS efree(message); } break; - case IS_LONG: - rv = U_MILLIS_PER_SECOND * (double)Z_LVAL_P(z); + case IS_INT: + rv = U_MILLIS_PER_SECOND * (double)Z_IVAL_P(z); break; case IS_DOUBLE: rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp index ff28bdb456..cfe46ce75a 100644 --- a/ext/intl/common/common_enum.cpp +++ b/ext/intl/common/common_enum.cpp @@ -238,7 +238,7 @@ static PHP_METHOD(IntlIterator, key) if (ii->iterator->funcs->get_current_key) { ii->iterator->funcs->get_current_key(ii->iterator, return_value TSRMLS_CC); } else { - RETURN_LONG(ii->iterator->index); + RETURN_INT(ii->iterator->index); } } diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c index 2db688ac71..126c9cc35b 100644 --- a/ext/intl/common/common_error.c +++ b/ext/intl/common/common_error.c @@ -28,7 +28,7 @@ */ PHP_FUNCTION( intl_get_error_code ) { - RETURN_LONG( intl_error_get_code( NULL TSRMLS_CC ) ); + RETURN_INT( intl_error_get_code( NULL TSRMLS_CC ) ); } /* }}} */ @@ -48,10 +48,10 @@ PHP_FUNCTION( intl_get_error_message ) */ PHP_FUNCTION( intl_is_failure ) { - long err_code; + php_int_t err_code; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i", &err_code ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -70,10 +70,10 @@ PHP_FUNCTION( intl_is_failure ) */ PHP_FUNCTION( intl_error_name ) { - long err_code; + php_int_t err_code; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "l", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "i", &err_code ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -91,7 +91,7 @@ PHP_FUNCTION( intl_error_name ) */ void intl_expose_icu_error_codes( INIT_FUNC_ARGS ) { - #define INTL_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define INTL_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) /* Warnings */ INTL_EXPOSE_CONST( U_USING_FALLBACK_WARNING ); diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 4630a302ef..5afee4809e 100644 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -85,7 +85,7 @@ if test "$PHP_INTL" != "no"; then breakiterator/codepointiterator_internal.cpp \ breakiterator/codepointiterator_methods.cpp \ idn/idn.c \ - $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings) + $icu_spoof_src, $ext_shared,,$ICU_INCS -Wno-write-strings -D__STDC_LIMIT_MACROS) PHP_ADD_BUILD_DIR($ext_builddir/collator) PHP_ADD_BUILD_DIR($ext_builddir/converter) PHP_ADD_BUILD_DIR($ext_builddir/common) diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 0064497b41..95f49d94cb 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -62,10 +62,10 @@ static inline void php_converter_throw_failure(php_converter_object *objval, UEr /* }}} */ /* {{{ php_converter_default_callback */ -static void php_converter_default_callback(zval *return_value, zval *zobj, long reason, zval *error TSRMLS_DC) { +static void php_converter_default_callback(zval *return_value, zval *zobj, php_int_t reason, zval *error TSRMLS_DC) { ZVAL_DEREF(error); zval_dtor(error); - ZVAL_LONG(error, U_ZERO_ERROR); + ZVAL_INT(error, U_ZERO_ERROR); /* Basic functionality so children can call parent::toUCallback() */ switch (reason) { case UCNV_UNASSIGNED: @@ -81,7 +81,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_LONG(error, U_INVALID_STATE_ERROR); + ZVAL_INT(error, U_INVALID_STATE_ERROR); RETVAL_STRINGL(chars, chars_len); return; } @@ -99,7 +99,7 @@ static void php_converter_default_callback(zval *return_value, zval *zobj, long chars[0] = 0x1A; chars[1] = 0; chars_len = 1; - ZVAL_LONG(error, uerror); + ZVAL_INT(error, uerror); } RETVAL_STRINGL(chars, chars_len); } @@ -117,10 +117,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_toUCallback_arginfo, 0, ZEND_RETURN_VALUE, ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, toUCallback) { - long reason; + php_int_t reason; zval *source, *codeUnits, *error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz", &reason, &source, &codeUnits, &error) == FAILURE) { return; } @@ -139,10 +139,10 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_fromUCallback_arginfo, 0, ZEND_RETURN_VALUE ZEND_ARG_INFO(1, error) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, fromUCallback) { - long reason; + php_int_t reason; zval *source, *codePoint, *error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lzzz", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "izzz", &reason, &source, &codePoint, &error) == FAILURE) { return; } @@ -152,7 +152,7 @@ static PHP_METHOD(UConverter, fromUCallback) { /* }}} */ /* {{{ php_converter_check_limits */ -static inline zend_bool php_converter_check_limits(php_converter_object *objval, long available, long needed TSRMLS_DC) { +static inline zend_bool php_converter_check_limits(php_converter_object *objval, php_int_t available, php_int_t needed TSRMLS_DC) { if (available < needed) { php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR TSRMLS_CC, "Buffer overrun %ld bytes needed, %ld available", needed, available); return 0; @@ -169,9 +169,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_NULL: /* Code unit is being skipped */ return; - case IS_LONG: + case IS_INT: { - long lval = Z_LVAL_P(val); + php_int_t lval = Z_IVAL_P(val); if ((lval < 0) || (lval > 0x10FFFF)) { php_converter_throw_failure(objval, U_ILLEGAL_ARGUMENT_ERROR TSRMLS_CC, "Invalid codepoint U+%04lx", lval); return; @@ -194,7 +194,7 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode case IS_STRING: { const char *strval = Z_STRVAL_P(val); - int i = 0, strlen = Z_STRLEN_P(val); + int i = 0, strlen = Z_STRSIZE_P(val); while((i != strlen) && TARGET_CHECK(args, 1)) { UChar c; @@ -233,10 +233,10 @@ static void php_converter_to_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_LONG(&zargs[0], reason); + ZVAL_INT(&zargs[0], reason); ZVAL_STRINGL(&zargs[1], args->source, args->sourceLimit - args->source); ZVAL_STRINGL(&zargs[2], codeUnits, length); - ZVAL_LONG(&zargs[3], *pErrorCode); + ZVAL_INT(&zargs[3], *pErrorCode); objval->to_cb.param_count = 4; objval->to_cb.params = zargs; @@ -250,10 +250,10 @@ static void php_converter_to_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_LONG) { - *pErrorCode = Z_LVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { - *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_INT) { + *pErrorCode = Z_IVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { + *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -269,14 +269,14 @@ static void php_converter_append_fromUnicode_target(zval *val, UConverterFromUni case IS_NULL: /* Ignore */ return; - case IS_LONG: + case IS_INT: if (TARGET_CHECK(args, 1)) { - *(args->target++) = Z_LVAL_P(val); + *(args->target++) = Z_IVAL_P(val); } return; case IS_STRING: { - int vallen = Z_STRLEN_P(val); + int vallen = Z_STRSIZE_P(val); if (TARGET_CHECK(args, vallen)) { memcpy(args->target, Z_STRVAL_P(val), vallen); args->target += vallen; @@ -312,16 +312,16 @@ static void php_converter_from_u_callback(const void *context, TSRMLS_D = objval->tsrm_ls; #endif - ZVAL_LONG(&zargs[0], reason); + ZVAL_INT(&zargs[0], reason); array_init(&zargs[1]); i = 0; while (i < length) { UChar32 c; U16_NEXT(codeUnits, i, length, c); - add_next_index_long(&zargs[1], c); + add_next_index_int(&zargs[1], c); } - ZVAL_LONG(&zargs[2], codePoint); - ZVAL_LONG(&zargs[3], *pErrorCode); + ZVAL_INT(&zargs[2], codePoint); + ZVAL_INT(&zargs[3], *pErrorCode); objval->from_cb.param_count = 4; objval->from_cb.params = zargs; @@ -335,10 +335,10 @@ static void php_converter_from_u_callback(const void *context, zval_ptr_dtor(&retval); } - if (Z_TYPE(zargs[3]) == IS_LONG) { - *pErrorCode = Z_LVAL(zargs[3]); - } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_LONG) { - *pErrorCode = Z_LVAL_P(Z_REFVAL(zargs[3])); + if (Z_TYPE(zargs[3]) == IS_INT) { + *pErrorCode = Z_IVAL(zargs[3]); + } else if (Z_ISREF(zargs[3]) && Z_TYPE_P(Z_REFVAL(zargs[3])) == IS_INT) { + *pErrorCode = Z_IVAL_P(Z_REFVAL(zargs[3])); } zval_ptr_dtor(&zargs[0]); @@ -512,7 +512,7 @@ static void php_converter_do_get_type(php_converter_object *objval, UConverter * RETURN_FALSE; } - RETURN_LONG(t); + RETURN_INT(t); } /* }}} */ @@ -731,9 +731,9 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_reasontext_arginfo, 0, ZEND_RETURN_VALUE, 0 ZEND_ARG_INFO(0, reason) ZEND_END_ARG_INFO(); static PHP_METHOD(UConverter, reasonText) { - long reason; + php_int_t reason; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &reason) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &reason) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "UConverter::reasonText(): bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -824,13 +824,13 @@ static PHP_METHOD(UConverter, transcode) { (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "from_subst", sizeof("from_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(src_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); } if (U_SUCCESS(error) && (tmpzval = zend_hash_str_find(Z_ARRVAL_P(options), "to_subst", sizeof("to_subst") - 1)) != NULL && Z_TYPE_P(tmpzval) == IS_STRING) { error = U_ZERO_ERROR; - ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) & 0x7F, &error); + ucnv_setSubstChars(dest_cnv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) & 0x7F, &error); } } @@ -871,7 +871,7 @@ static PHP_METHOD(UConverter, getErrorCode) { RETURN_FALSE; } - RETURN_LONG(intl_error_get_code(&(objval->error) TSRMLS_CC)); + RETURN_INT(intl_error_get_code(&(objval->error) TSRMLS_CC)); } /* }}} */ @@ -1098,8 +1098,8 @@ static zend_object *php_converter_clone_object(zval *object TSRMLS_DC) { } /* }}} */ -#define CONV_REASON_CONST(v) zend_declare_class_constant_long(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) -#define CONV_TYPE_CONST(v) zend_declare_class_constant_long(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_REASON_CONST(v) zend_declare_class_constant_int(php_converter_ce, "REASON_" #v, sizeof("REASON_" #v) - 1, UCNV_ ## v TSRMLS_CC) +#define CONV_TYPE_CONST(v) zend_declare_class_constant_int(php_converter_ce, #v , sizeof(#v) - 1, UCNV_ ## v TSRMLS_CC) /* {{{ php_converter_minit */ int php_converter_minit(INIT_FUNC_ARGS) { diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c index eedc60040e..c51b33144b 100644 --- a/ext/intl/dateformat/dateformat.c +++ b/ext/intl/dateformat/dateformat.c @@ -34,11 +34,11 @@ void dateformat_register_constants( INIT_FUNC_ARGS ) return; } - #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define DATEFORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UDAT_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); - #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_long( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); + #define DATEFORMATTER_EXPOSE_UCAL_CLASS_CONST(x) zend_declare_class_constant_int( IntlDateFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UCAL_##x TSRMLS_CC ); /* UDateFormatStyle constants */ DATEFORMATTER_EXPOSE_CLASS_CONST( FULL ); @@ -85,7 +85,7 @@ PHP_FUNCTION( datefmt_get_error_code ) dfo = Z_INTL_DATEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(dfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(dfo) ); } /* }}} */ diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c index e13b0f4cd2..0ee5412a90 100644 --- a/ext/intl/dateformat/dateformat_attr.c +++ b/ext/intl/dateformat/dateformat_attr.c @@ -48,7 +48,7 @@ PHP_FUNCTION( datefmt_get_datetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter datetype." ); - RETURN_LONG(dfo->date_type ); + RETURN_INT(dfo->date_type ); } /* }}} */ @@ -74,7 +74,7 @@ PHP_FUNCTION( datefmt_get_timetype ) INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timetype." ); - RETURN_LONG(dfo->time_type ); + RETURN_INT(dfo->time_type ); } /* }}} */ @@ -170,12 +170,12 @@ PHP_FUNCTION( datefmt_set_pattern ) PHP_FUNCTION( datefmt_get_locale ) { char *loc; - long loc_type =ULOC_ACTUAL_LOCALE; + php_int_t loc_type =ULOC_ACTUAL_LOCALE; DATE_FORMAT_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp index 8ca880d956..4446922252 100644 --- a/ext/intl/dateformat/dateformat_attrcpp.cpp +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -160,7 +160,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar) RETURN_FALSE; } - RETURN_LONG(dfo->calendar); + RETURN_INT(dfo->calendar); } /* }}} */ @@ -220,7 +220,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar) DATE_FORMAT_METHOD_FETCH_OBJECT; Calendar *cal; - long cal_type; + php_int_t cal_type; bool cal_owned; Locale locale = Locale::createFromName(dfo->requested_locale); // getting the actual locale from the DateFormat is not enough diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index 856db16b1d..5242c5f5ac 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -43,11 +43,11 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) const char *locale_str; int locale_len = 0; Locale locale; - long date_type = 0; - long time_type = 0; + php_int_t date_type = 0; + php_int_t time_type = 0; zval *calendar_zv = NULL; Calendar *calendar = NULL; - long calendar_type; + php_int_t calendar_type; bool calendar_owned; zval *timezone_zv = NULL; TimeZone *timezone = NULL; @@ -61,7 +61,7 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) intl_error_reset(NULL TSRMLS_CC); object = return_value; /* Parse parameters. */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|zzs", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|zzs", &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c index 467053ef84..9ec012c570 100644 --- a/ext/intl/dateformat/dateformat_format.c +++ b/ext/intl/dateformat/dateformat_format.c @@ -71,21 +71,21 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo, } if ((ele_value = zend_hash_str_find(hash_arr, key_name, strlen(key_name))) != NULL) { - if(Z_TYPE_P(ele_value) != IS_LONG) { + if(Z_TYPE_P(ele_value) != IS_INT) { spprintf(&message, 0, "datefmt_format: parameter array contains " "a non-integer element for key '%s'", key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - if (Z_LVAL_P(ele_value) > INT32_MAX || - Z_LVAL_P(ele_value) < INT32_MIN) { + if (Z_IVAL_P(ele_value) > INT32_MAX || + Z_IVAL_P(ele_value) < INT32_MIN) { spprintf(&message, 0, "datefmt_format: value %ld is out of " "bounds for a 32-bit integer in key '%s'", - Z_LVAL_P(ele_value), key_name); + Z_IVAL_P(ele_value), key_name); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC); efree(message); } else { - result = Z_LVAL_P(ele_value); + result = Z_IVAL_P(ele_value); } } } diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index ac8aa2fe4c..58d9af2772 100644 --- a/ext/intl/dateformat/dateformat_format_object.cpp +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -46,10 +46,10 @@ static const DateFormat::EStyle valid_styles[] = { }; static bool valid_format(zval *z) { - if (Z_TYPE_P(z) == IS_LONG) { - long lval = Z_LVAL_P(z); + if (Z_TYPE_P(z) == IS_INT) { + php_int_t lval = Z_IVAL_P(z); for (int i = 0; i < sizeof(valid_styles) / sizeof(*valid_styles); i++) { - if ((long)valid_styles[i] == lval) { + if ((php_int_t)valid_styles[i] == lval) { return true; } } @@ -103,7 +103,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = (DateFormat::EStyle)Z_LVAL_P(z); + dateStyle = (DateFormat::EStyle)Z_IVAL_P(z); zend_hash_move_forward_ex(ht, &pos); z = zend_hash_get_current_data_ex(ht, &pos); @@ -113,18 +113,18 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) "second element of the array) is not valid", 0 TSRMLS_CC); RETURN_FALSE; } - timeStyle = (DateFormat::EStyle)Z_LVAL_P(z); - } else if (Z_TYPE_P(format) == IS_LONG) { + timeStyle = (DateFormat::EStyle)Z_IVAL_P(z); + } else if (Z_TYPE_P(format) == IS_INT) { if (!valid_format(format)) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the date/time format type is invalid", 0 TSRMLS_CC); RETURN_FALSE; } - dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format); + dateStyle = timeStyle = (DateFormat::EStyle)Z_IVAL_P(format); } else { convert_to_string_ex(format); - if (Z_STRLEN_P(format) == 0) { + if (Z_STRSIZE_P(format) == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format_object: the format is empty", 0 TSRMLS_CC); RETURN_FALSE; @@ -176,7 +176,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) if (pattern) { df = new SimpleDateFormat( - UnicodeString(Z_STRVAL_P(format), Z_STRLEN_P(format), + UnicodeString(Z_STRVAL_P(format), Z_STRSIZE_P(format), UnicodeString::kInvariant), Locale::createFromName(locale_str), status); diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp index 74758bbec9..680df46f42 100644 --- a/ext/intl/dateformat/dateformat_helpers.cpp +++ b/ext/intl/dateformat/dateformat_helpers.cpp @@ -33,7 +33,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, const char *func_name, intl_error *err, Calendar*& cal, - long& cal_int_type, + php_int_t& cal_int_type, bool& calendar_owned TSRMLS_DC) { char *msg; @@ -47,10 +47,10 @@ int datefmt_process_calendar_arg(zval* calendar_zv, cal_int_type = UCAL_GREGORIAN; - } else if (Z_TYPE_P(calendar_zv) == IS_LONG) { + } else if (Z_TYPE_P(calendar_zv) == IS_INT) { - long v = Z_LVAL_P(calendar_zv); - if (v != (long)UCAL_TRADITIONAL && v != (long)UCAL_GREGORIAN) { + php_int_t v = Z_IVAL_P(calendar_zv); + if (v != (php_int_t)UCAL_TRADITIONAL && v != (php_int_t)UCAL_GREGORIAN) { spprintf(&msg, 0, "%s: invalid value for calendar type; it must be " "one of IntlDateFormatter::TRADITIONAL (locale's default " "calendar) or IntlDateFormatter::GREGORIAN. " @@ -59,14 +59,14 @@ int datefmt_process_calendar_arg(zval* calendar_zv, intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, msg, 1 TSRMLS_CC); efree(msg); return FAILURE; - } else if (v == (long)UCAL_TRADITIONAL) { + } else if (v == (php_int_t)UCAL_TRADITIONAL) { cal = Calendar::createInstance(locale, status); } else { //UCAL_GREGORIAN cal = new GregorianCalendar(locale, status); } calendar_owned = true; - cal_int_type = Z_LVAL_P(calendar_zv); + cal_int_type = Z_IVAL_P(calendar_zv); } else if (Z_TYPE_P(calendar_zv) == IS_OBJECT && instanceof_function_ex(Z_OBJCE_P(calendar_zv), diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h index bded0b7d78..0c5647b0ab 100644 --- a/ext/intl/dateformat/dateformat_helpers.h +++ b/ext/intl/dateformat/dateformat_helpers.h @@ -32,7 +32,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv, const char *func_name, intl_error *err, Calendar*& cal, - long& cal_int_type, + php_int_t& cal_int_type, bool& calendar_owned TSRMLS_DC); #endif /* DATEFORMAT_HELPERS_H */ diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c index fb3da3e053..eb28a39ba2 100644 --- a/ext/intl/dateformat/dateformat_parse.c +++ b/ext/intl/dateformat/dateformat_parse.c @@ -57,24 +57,24 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex if(result > LONG_MAX || result < -LONG_MAX) { ZVAL_DOUBLE(return_value, result<0?ceil(result):floor(result)); } else { - ZVAL_LONG(return_value, (long)result); + ZVAL_INT(return_value, (php_int_t)result); } } /* }}} */ -static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, long calendar_field, char* key_name TSRMLS_DC) +static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, php_int_t calendar_field, char* key_name TSRMLS_DC) { - long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); + php_int_t calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" ); if( strcmp(key_name, CALENDAR_YEAR )==0 ){ /* since tm_year is years from 1900 */ - add_assoc_long( return_value, key_name,( calendar_field_val-1900) ); + add_assoc_int( return_value, key_name,( calendar_field_val-1900) ); }else if( strcmp(key_name, CALENDAR_WDAY )==0 ){ /* since tm_wday starts from 0 whereas ICU WDAY start from 1 */ - add_assoc_long( return_value, key_name,( calendar_field_val-1) ); + add_assoc_int( return_value, key_name,( calendar_field_val-1) ); }else{ - add_assoc_long( return_value, key_name, calendar_field_val ); + add_assoc_int( return_value, key_name, calendar_field_val ); } } @@ -86,7 +86,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex UCalendar *parsed_calendar = NULL; UChar* text_utf16 = NULL; int32_t text_utf16_len = 0; - long isInDST = 0; + php_int_t isInDST = 0; /* Convert timezone to UTF-16. */ intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo)); @@ -116,7 +116,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex /* Is in DST? */ isInDST = ucal_inDaylightTime(parsed_calendar , &INTL_DATA_ERROR_CODE(dfo)); INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : while checking if currently in DST." ); - add_assoc_long( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); + add_assoc_int( return_value, CALENDAR_ISDST,(isInDST==1?1:0)); } /* }}} */ @@ -146,8 +146,8 @@ PHP_FUNCTION(datefmt_parse) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); - convert_to_long(z_parse_pos); - parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); + convert_to_int(z_parse_pos); + parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -155,7 +155,7 @@ PHP_FUNCTION(datefmt_parse) internal_parse_to_timestamp( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if(z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_LONG(z_parse_pos, parse_pos); + ZVAL_INT(z_parse_pos, parse_pos); } } /* }}} */ @@ -185,8 +185,8 @@ PHP_FUNCTION(datefmt_localtime) if (z_parse_pos) { ZVAL_DEREF(z_parse_pos); - convert_to_long(z_parse_pos); - parse_pos = (int32_t)Z_LVAL_P(z_parse_pos); + convert_to_int(z_parse_pos); + parse_pos = (int32_t)Z_IVAL_P(z_parse_pos); if(parse_pos > text_len) { RETURN_FALSE; } @@ -194,7 +194,7 @@ PHP_FUNCTION(datefmt_localtime) internal_parse_to_localtime( dfo, text_to_parse, text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC); if (z_parse_pos) { zval_dtor(z_parse_pos); - ZVAL_LONG(z_parse_pos, parse_pos); + ZVAL_INT(z_parse_pos, parse_pos); } } /* }}} */ diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c index 12cbb6c75b..2c3ffaa569 100644 --- a/ext/intl/formatter/formatter.c +++ b/ext/intl/formatter/formatter.c @@ -40,9 +40,9 @@ void formatter_register_constants( INIT_FUNC_ARGS ) zend_error(E_ERROR, "NumberFormatter class not defined"); } - #define FORMATTER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); - #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define FORMATTER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define FORMATTER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( #x ) - 1, UNUM_##x TSRMLS_CC ); + #define FORMATTER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( NumberFormatter_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* UNumberFormatStyle constants */ FORMATTER_EXPOSE_CLASS_CONST( PATTERN_DECIMAL ); diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c index af58cfe37f..1a1409448a 100644 --- a/ext/intl/formatter/formatter_attr.c +++ b/ext/intl/formatter/formatter_attr.c @@ -32,7 +32,7 @@ */ PHP_FUNCTION( numfmt_get_attribute ) { - long attribute, value; + php_int_t attribute, value; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ @@ -72,7 +72,7 @@ PHP_FUNCTION( numfmt_get_attribute ) if(value == -1) { INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR; } else { - RETVAL_LONG(value); + RETVAL_INT(value); } break; case UNUM_ROUNDING_INCREMENT: @@ -101,7 +101,7 @@ PHP_FUNCTION( numfmt_get_attribute ) */ PHP_FUNCTION( numfmt_get_text_attribute ) { - long attribute; + php_int_t attribute; UChar value_buf[64]; int value_buf_size = USIZE( value_buf ); UChar* value = value_buf; @@ -109,7 +109,7 @@ PHP_FUNCTION( numfmt_get_text_attribute ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -145,12 +145,12 @@ PHP_FUNCTION( numfmt_get_text_attribute ) */ PHP_FUNCTION( numfmt_set_attribute ) { - long attribute; + php_int_t attribute; zval *value; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", &object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -182,8 +182,8 @@ PHP_FUNCTION( numfmt_set_attribute ) case UNUM_MIN_SIGNIFICANT_DIGITS: case UNUM_MAX_SIGNIFICANT_DIGITS: case UNUM_LENIENT_PARSE: - convert_to_long_ex(value); - unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value)); + convert_to_int_ex(value); + unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_IVAL_P(value)); break; case UNUM_ROUNDING_INCREMENT: convert_to_double_ex(value); @@ -209,13 +209,13 @@ PHP_FUNCTION( numfmt_set_text_attribute ) { int slength = 0; UChar *svalue = NULL; - long attribute; + php_int_t attribute; char *value; int len; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -249,14 +249,14 @@ PHP_FUNCTION( numfmt_set_text_attribute ) */ PHP_FUNCTION( numfmt_get_symbol ) { - long symbol; + php_int_t symbol; UChar value_buf[4]; UChar *value = value_buf; int length = USIZE(value_buf); FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &object, NumberFormatter_ce_ptr, &symbol ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -297,7 +297,7 @@ PHP_FUNCTION( numfmt_get_symbol ) */ PHP_FUNCTION( numfmt_set_symbol ) { - long symbol; + php_int_t symbol; char* value = NULL; int value_len = 0; UChar* svalue = 0; @@ -305,7 +305,7 @@ PHP_FUNCTION( numfmt_set_symbol ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -426,12 +426,12 @@ PHP_FUNCTION( numfmt_set_pattern ) */ PHP_FUNCTION( numfmt_get_locale ) { - long type = ULOC_ACTUAL_LOCALE; + php_int_t type = ULOC_ACTUAL_LOCALE; char* loc; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &object, NumberFormatter_ce_ptr, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c index 4b98f4fb17..3fe5d6abf1 100644 --- a/ext/intl/formatter/formatter_format.c +++ b/ext/intl/formatter/formatter_format.c @@ -33,14 +33,14 @@ PHP_FUNCTION( numfmt_format ) { zval *number; - long type = FORMAT_TYPE_DEFAULT; + php_int_t type = FORMAT_TYPE_DEFAULT; UChar format_buf[32]; UChar* formatted = format_buf; int formatted_len = USIZE(format_buf); FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|l", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oz|i", &object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -57,9 +57,9 @@ PHP_FUNCTION( numfmt_format ) convert_scalar_to_number_ex(number); } - if(Z_TYPE_P(number) == IS_LONG) { + if(Z_TYPE_P(number) == IS_INT) { /* take INT32 on 32-bit, int64 on 64-bit */ - type = (sizeof(long) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; + type = (sizeof(php_int_t) == 8)?FORMAT_TYPE_INT64:FORMAT_TYPE_INT32; } else if(Z_TYPE_P(number) == IS_DOUBLE) { type = FORMAT_TYPE_DOUBLE; } else { @@ -67,20 +67,20 @@ PHP_FUNCTION( numfmt_format ) } } - if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_LONG) { + if(Z_TYPE_P(number) != IS_DOUBLE && Z_TYPE_P(number) != IS_INT) { SEPARATE_ZVAL_IF_NOT_REF(number); convert_scalar_to_number(number TSRMLS_CC ); } switch(type) { case FORMAT_TYPE_INT32: - convert_to_long_ex(number); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), + convert_to_int_ex(number); + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC); formatted = eumalloc(formatted_len); - formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_LVAL_P(number), + formatted_len = unum_format(FORMATTER_OBJECT(nfo), (int32_t)Z_IVAL_P(number), formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (U_FAILURE( INTL_DATA_ERROR_CODE(nfo) ) ) { efree(formatted); @@ -91,7 +91,7 @@ PHP_FUNCTION( numfmt_format ) case FORMAT_TYPE_INT64: { - int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_LVAL_P(number); + int64_t value = (Z_TYPE_P(number) == IS_DOUBLE)?(int64_t)Z_DVAL_P(number):Z_IVAL_P(number); formatted_len = unum_formatInt64(FORMATTER_OBJECT(nfo), value, formatted, formatted_len, NULL, &INTL_DATA_ERROR_CODE(nfo)); if (INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR) { intl_error_reset(INTL_DATA_ERROR_P(nfo) TSRMLS_CC); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 26473ebe78..f24df76f51 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -30,13 +30,13 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) const char* locale; char* pattern = NULL; int locale_len = 0, pattern_len = 0; - long style; + php_int_t style; UChar* spattern = NULL; int spattern_len = 0; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sl|s", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "si|s", &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -125,7 +125,7 @@ PHP_FUNCTION( numfmt_get_error_code ) nfo = Z_INTL_NUMBERFORMATTER_P(object); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(nfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(nfo) ); } /* }}} */ diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index 73b331302b..3d0c84dab6 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -36,7 +36,7 @@ */ PHP_FUNCTION( numfmt_parse ) { - long type = FORMAT_TYPE_DOUBLE; + php_int_t type = FORMAT_TYPE_DOUBLE; UChar* sstr = NULL; int sstr_len = 0; char* str = NULL; @@ -50,7 +50,7 @@ PHP_FUNCTION( numfmt_parse ) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|lz/!", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|iz/!", &object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -68,8 +68,8 @@ PHP_FUNCTION( numfmt_parse ) if(zposition) { ZVAL_DEREF(zposition); - convert_to_long(zposition); - position = (int32_t)Z_LVAL_P( zposition ); + convert_to_int(zposition); + position = (int32_t)Z_IVAL_P( zposition ); position_p = &position; } @@ -82,14 +82,14 @@ PHP_FUNCTION( numfmt_parse ) switch(type) { case FORMAT_TYPE_INT32: val32 = unum_parse(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); - RETVAL_LONG(val32); + RETVAL_INT(val32); break; case FORMAT_TYPE_INT64: val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); - if(val64 > LONG_MAX || val64 < LONG_MIN) { + if(val64 > ZEND_INT_MAX || val64 < ZEND_INT_MIN) { RETVAL_DOUBLE(val64); } else { - RETVAL_LONG((long)val64); + RETVAL_INT((php_int_t)val64); } break; case FORMAT_TYPE_DOUBLE: @@ -107,7 +107,7 @@ PHP_FUNCTION( numfmt_parse ) #endif if(zposition) { zval_dtor(zposition); - ZVAL_LONG(zposition, position); + ZVAL_INT(zposition, position); } if (sstr) { @@ -157,15 +157,15 @@ PHP_FUNCTION( numfmt_parse_currency ) if(zposition) { ZVAL_DEREF(zposition); - convert_to_long(zposition); - position = (int32_t)Z_LVAL_P( zposition ); + convert_to_int(zposition); + position = (int32_t)Z_IVAL_P( zposition ); position_p = &position; } number = unum_parseDoubleCurrency(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, currency, &INTL_DATA_ERROR_CODE(nfo)); if(zposition) { zval_dtor(zposition); - ZVAL_LONG(zposition, position); + ZVAL_INT(zposition, position); } if (sstr) { efree(sstr); diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 5caacb4f28..3968508c51 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -44,9 +44,9 @@ */ void grapheme_register_constants( INIT_FUNC_ARGS ) { - REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GRAPHEME_EXTR_COUNT", GRAPHEME_EXTRACT_TYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXBYTES", GRAPHEME_EXTRACT_TYPE_MAXBYTES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GRAPHEME_EXTR_MAXCHARS", GRAPHEME_EXTRACT_TYPE_MAXCHARS, CONST_CS | CONST_PERSISTENT); } /* }}} */ @@ -72,7 +72,7 @@ PHP_FUNCTION(grapheme_strlen) ret_len = grapheme_ascii_check(string, string_len); if ( ret_len >= 0 ) - RETURN_LONG(ret_len); + RETURN_INT(ret_len); /* convert the string to UTF-16. */ status = U_ZERO_ERROR; @@ -97,7 +97,7 @@ PHP_FUNCTION(grapheme_strlen) } if (ret_len >= 0) { - RETVAL_LONG(ret_len); + RETVAL_INT(ret_len); } else { RETVAL_FALSE; } @@ -111,11 +111,11 @@ PHP_FUNCTION(grapheme_strpos) unsigned char *haystack, *needle; int haystack_len, needle_len; unsigned char *found; - long loffset = 0; + php_int_t loffset = 0; int32_t offset = 0; int ret_pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: unable to parse input param", 0 TSRMLS_CC ); @@ -156,14 +156,14 @@ PHP_FUNCTION(grapheme_strpos) /* if it is there, and if the haystack is ascii, we are all done */ if ( grapheme_ascii_check(haystack, haystack_len) >= 0 ) { - RETURN_LONG(found - haystack); + RETURN_INT(found - haystack); } /* do utf16 part of the strpos */ ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* fIgnoreCase */, 0 /* last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -178,12 +178,12 @@ PHP_FUNCTION(grapheme_stripos) unsigned char *haystack, *needle, *haystack_dup, *needle_dup; int haystack_len, needle_len; unsigned char *found; - long loffset = 0; + php_int_t loffset = 0; int32_t offset = 0; int ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_stripos: unable to parse input param", 0 TSRMLS_CC ); @@ -225,7 +225,7 @@ PHP_FUNCTION(grapheme_stripos) efree(needle_dup); if (found) { - RETURN_LONG(found - haystack_dup); + RETURN_INT(found - haystack_dup); } /* if needle was ascii too, we are all done, otherwise we need to try using Unicode to see what we get */ @@ -238,7 +238,7 @@ PHP_FUNCTION(grapheme_stripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* fIgnoreCase */, 0 /*last */ TSRMLS_CC ); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -252,12 +252,12 @@ PHP_FUNCTION(grapheme_strrpos) { unsigned char *haystack, *needle; int haystack_len, needle_len; - long loffset = 0; + php_int_t loffset = 0; int32_t offset = 0; int32_t ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC ); @@ -292,7 +292,7 @@ PHP_FUNCTION(grapheme_strrpos) if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } /* if the needle was ascii too, we are done */ @@ -307,7 +307,7 @@ PHP_FUNCTION(grapheme_strrpos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 0 /* f_ignore_case */, 1/* last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -322,12 +322,12 @@ PHP_FUNCTION(grapheme_strripos) { unsigned char *haystack, *needle; int haystack_len, needle_len; - long loffset = 0; + php_int_t loffset = 0; int32_t offset = 0; int32_t ret_pos; int is_ascii; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strrpos: unable to parse input param", 0 TSRMLS_CC ); @@ -370,7 +370,7 @@ PHP_FUNCTION(grapheme_strripos) efree(needle_dup); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } /* if the needle was ascii too, we are done */ @@ -385,7 +385,7 @@ PHP_FUNCTION(grapheme_strripos) ret_pos = grapheme_strpos_utf16(haystack, haystack_len, needle, needle_len, offset, NULL, 1 /* f_ignore_case */, 1 /*last */ TSRMLS_CC); if ( ret_pos >= 0 ) { - RETURN_LONG(ret_pos); + RETURN_INT(ret_pos); } else { RETURN_FALSE; } @@ -401,7 +401,7 @@ PHP_FUNCTION(grapheme_substr) unsigned char *str, *sub_str; UChar *ustr; int str_len, sub_str_len, ustr_len; - long lstart = 0, length = 0; + php_int_t lstart = 0, length = 0; int32_t start = 0; int iter_val; UErrorCode status; @@ -410,7 +410,7 @@ PHP_FUNCTION(grapheme_substr) int sub_str_start_pos, sub_str_end_pos; int32_t (*iter_func)(UBreakIterator *); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", (char **)&str, &str_len, &lstart, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|i", (char **)&str, &str_len, &lstart, &length) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: unable to parse input param", 0 TSRMLS_CC ); @@ -816,17 +816,17 @@ PHP_FUNCTION(grapheme_extract) unsigned char *str, *pstr; UChar *ustr; int str_len, ustr_len; - long size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ - long lstart = 0; /* starting position in str in bytes */ + php_int_t size; /* maximum number of grapheme clusters, bytes, or characters (based on extract_type) to return */ + php_int_t lstart = 0; /* starting position in str in bytes */ int32_t start = 0; - long extract_type = GRAPHEME_EXTRACT_TYPE_COUNT; + php_int_t extract_type = GRAPHEME_EXTRACT_TYPE_COUNT; UErrorCode status; unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE]; UBreakIterator* bi = NULL; int ret_pos; zval *next = NULL; /* return offset of next part of the string */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|llz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|iiz", (char **)&str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: unable to parse input param", 0 TSRMLS_CC ); @@ -846,7 +846,7 @@ PHP_FUNCTION(grapheme_extract) /* initialize next */ SEPARATE_ZVAL(next); zval_dtor(next); - ZVAL_LONG(next, lstart); + ZVAL_INT(next, lstart); } } @@ -898,9 +898,9 @@ PHP_FUNCTION(grapheme_extract) */ if ( -1 != grapheme_ascii_check(pstr, size + 1 < str_len ? size + 1 : str_len ) ) { - long nsize = ( size < str_len ? size : str_len ); + php_int_t nsize = ( size < str_len ? size : str_len ); if ( NULL != next ) { - ZVAL_LONG(next, start+nsize); + ZVAL_INT(next, start+nsize); } RETURN_STRINGL(((char *)pstr), nsize); } @@ -943,7 +943,7 @@ PHP_FUNCTION(grapheme_extract) ubrk_close(bi); if ( NULL != next ) { - ZVAL_LONG(next, start+ret_pos); + ZVAL_INT(next, start+ret_pos); } RETURN_STRINGL(((char *)pstr), ret_pos); diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h index 14f3f22c45..576e524b16 100644 --- a/ext/intl/grapheme/grapheme_util.h +++ b/ext/intl/grapheme/grapheme_util.h @@ -44,6 +44,6 @@ int32_t grapheme_strrpos_ascii(unsigned char *haystack, int32_t haystack_len, un UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status TSRMLS_DC ); /* OUTSIDE_STRING: check if (possibly negative) long offset is outside the string with int32_t length */ -#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (long) max_len : offset >= (long) max_len) ) +#define OUTSIDE_STRING(offset, max_len) ( offset <= INT32_MIN || offset > INT32_MAX || (offset < 0 ? -offset > (php_int_t) max_len : offset >= (php_int_t) max_len) ) #endif // GRAPHEME_GRAPHEME_UTIL_H diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 6bf187a068..96bec482a1 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -51,56 +51,56 @@ void idn_register_constants( INIT_FUNC_ARGS ) /* Option to prohibit processing of unassigned codepoints in the input and do not check if the input conforms to STD-3 ASCII rules. */ - REGISTER_LONG_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_DEFAULT", UIDNA_DEFAULT, CONST_CS | CONST_PERSISTENT); /* Option to allow processing of unassigned codepoints in the input */ - REGISTER_LONG_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ALLOW_UNASSIGNED", UIDNA_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT); /* Option to check if input conforms to STD-3 ASCII rules */ - REGISTER_LONG_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_USE_STD3_RULES", UIDNA_USE_STD3_RULES, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API /* Option to check for whether the input conforms to the BiDi rules. * Ignored by the IDNA2003 implementation. (IDNA2003 always performs a BiDi check.) */ - REGISTER_LONG_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_CHECK_BIDI", UIDNA_CHECK_BIDI, CONST_CS | CONST_PERSISTENT); /* Option to check for whether the input conforms to the CONTEXTJ rules. * Ignored by the IDNA2003 implementation. (The CONTEXTJ check is new in IDNA2008.) */ - REGISTER_LONG_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_CHECK_CONTEXTJ", UIDNA_CHECK_CONTEXTJ, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToASCII(). * By default, ToASCII() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_ASCII", UIDNA_NONTRANSITIONAL_TO_ASCII, CONST_CS | CONST_PERSISTENT); /* Option for nontransitional processing in ToUnicode(). * By default, ToUnicode() uses transitional processing. * Ignored by the IDNA2003 implementation. */ - REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT); #endif /* VARIANTS */ - REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_46_API - REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_46_API /* PINFO ERROR CODES */ - REGISTER_LONG_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_EMPTY_LABEL", UIDNA_ERROR_EMPTY_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_TOO_LONG", UIDNA_ERROR_LABEL_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_DOMAIN_NAME_TOO_LONG", UIDNA_ERROR_DOMAIN_NAME_TOO_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_HYPHEN", UIDNA_ERROR_LEADING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_TRAILING_HYPHEN", UIDNA_ERROR_TRAILING_HYPHEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_HYPHEN_3_4", UIDNA_ERROR_HYPHEN_3_4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LEADING_COMBINING_MARK", UIDNA_ERROR_LEADING_COMBINING_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_DISALLOWED", UIDNA_ERROR_DISALLOWED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_PUNYCODE", UIDNA_ERROR_PUNYCODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_LABEL_HAS_DOT", UIDNA_ERROR_LABEL_HAS_DOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_INVALID_ACE_LABEL", UIDNA_ERROR_INVALID_ACE_LABEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_BIDI", UIDNA_ERROR_BIDI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IDNA_ERROR_CONTEXTJ", UIDNA_ERROR_CONTEXTJ, CONST_CS | CONST_PERSISTENT); #endif } /* }}} */ @@ -190,7 +190,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, } add_assoc_bool_ex(idna_info, "isTransitionalDifferent", sizeof("isTransitionalDifferent")-1, info.isTransitionalDifferent); - add_assoc_long_ex(idna_info, "errors", sizeof("errors")-1, (long)info.errors); + add_assoc_int_ex(idna_info, "errors", sizeof("errors")-1, (php_int_t)info.errors); } if (!buffer_used) { @@ -265,13 +265,13 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode) { char *domain; int domain_len; - long option = 0, + php_int_t option = 0, variant = INTL_IDN_VARIANT_2003; zval *idna_info = NULL; intl_error_reset(NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|llz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iiz/", &domain, &domain_len, &option, &variant, &idna_info) == FAILURE) { php_intl_bad_args("bad arguments", mode TSRMLS_CC); RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */ diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h index 9424571d02..cf83e6d7ee 100644 --- a/ext/intl/intl_common.h +++ b/ext/intl/intl_common.h @@ -39,6 +39,6 @@ #define UCHARS(len) ((len) / sizeof(UChar)) #define INTL_Z_STRVAL_P(str) (UChar*) Z_STRVAL_P(str) -#define INTL_Z_STRLEN_P(str) UCHARS( Z_STRLEN_P(str) ) +#define INTL_Z_STRSIZE_P(str) UCHARS( Z_STRSIZE_P(str) ) #endif /* INTL_COMMON_H */ diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index e692e5dc0d..a94b076511 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -258,7 +258,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) if( pe->line > 0 ) { smart_str_appends( &ret, "on line " ); - smart_str_append_long( &ret, (long ) pe->line ); + smart_str_append_int( &ret, (php_int_t ) pe->line ); any = 1; } if( pe->offset >= 0 ) { @@ -268,7 +268,7 @@ smart_str intl_parse_error_to_string( UParseError* pe ) smart_str_appends( &ret, "at " ); smart_str_appends( &ret, "offset " ); - smart_str_append_long( &ret, (long ) pe->offset ); + smart_str_append_int( &ret, (php_int_t ) pe->offset ); any = 1; } diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c index 921e6e589f..fa8edddfa3 100644 --- a/ext/intl/locale/locale.c +++ b/ext/intl/locale/locale.c @@ -39,8 +39,8 @@ void locale_register_constants( INIT_FUNC_ARGS ) return; } - #define LOCALE_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); + #define LOCALE_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define LOCALE_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Locale_ce_ptr, ZEND_STRS( #x ) - 1, ULOC_##x TSRMLS_CC ); #define LOCALE_EXPOSE_CUSTOM_CLASS_CONST_STR(name, value) zend_declare_class_constant_string( Locale_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); LOCALE_EXPOSE_CLASS_CONST( ACTUAL_LOCALE ); diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 01cbddd062..34e7374969 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -782,7 +782,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, char* key_ /* not lang or grandfathered tag */ smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); } - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); return SUCCESS; } @@ -822,7 +822,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix( loc_name , key_name); smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); return SUCCESS; } else if(Z_TYPE_P(ele_value) == IS_ARRAY ) { HashTable *arr = HASH_OF(ele_value); @@ -836,7 +836,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data)); + smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRSIZE_P(data)); } ZEND_HASH_FOREACH_END(); return SUCCESS; } else { @@ -869,7 +869,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , cur_key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRSIZE_P(ele_value)); } } /* end of for */ } /* end of else */ @@ -1439,7 +1439,7 @@ static char* lookup_loc_range(const char* loc_range, HashTable* hash_arr, int ca intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: locale array element is not a string", 0 TSRMLS_CC); LOOKUP_CLEAN_RETURN(NULL); } - cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRLEN_P(ele_value)); + cur_arr[cur_arr_len*2] = estrndup(Z_STRVAL_P(ele_value), Z_STRSIZE_P(ele_value)); result = strToMatch(Z_STRVAL_P(ele_value), cur_arr[cur_arr_len*2]); if(result == 0) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "lookup_loc_range: unable to canonicalize lang_tag", 0 TSRMLS_CC); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index b9f6c7a369..cfe6538f0a 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -144,7 +144,7 @@ PHP_FUNCTION( msgfmt_get_error_code ) mfo = Z_INTL_MESSAGEFORMATTER_P( object ); /* Return formatter's last error code. */ - RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) ); + RETURN_INT( INTL_DATA_ERROR_CODE(mfo) ); } /* }}} */ diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h index 51d7687a3a..188e6580f7 100644 --- a/ext/intl/msgformat/msgformat_data.h +++ b/ext/intl/msgformat/msgformat_data.h @@ -30,7 +30,7 @@ typedef struct { // formatter handling UMessageFormat* umsgf; char* orig_format; - ulong orig_format_len; + php_uint_t orig_format_len; HashTable* arg_types; int tz_set; /* if we've already the time zone in sub-formats */ } msgformat_data; diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index ba5a5df001..3be80791ba 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -112,7 +112,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo, for (int i = 0; i < parts_count; i++) { const Formattable::Type t = types[i]; - if (zend_hash_index_update_mem(ret, (ulong)i, (void*)&t, sizeof(t)) == NULL) { + if (zend_hash_index_update_mem(ret, (php_uint_t)i, (void*)&t, sizeof(t)) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); break; @@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo, "Found part with negative number", 0 TSRMLS_CC); continue; } - if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (ulong)argNumber)) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (php_uint_t)argNumber)) == NULL) { /* not found already; create new entry in HT */ Formattable::Type bogusType = Formattable::kObject; - if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { + if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (php_uint_t)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) { intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR, "Write to argument types hash table failed", 0 TSRMLS_CC); continue; @@ -388,7 +388,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, // Key related variables zend_string *str_index; - ulong num_index; + php_uint_t num_index; ZEND_HASH_FOREACH_KEY_VAL(args, num_index, str_index, elem) { Formattable& formattable = fargs[argNum]; @@ -401,7 +401,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, /* Process key and retrieve type */ if (str_index == NULL) { /* includes case where index < 0 because it's exposed as unsigned */ - if (num_index > (ulong)INT32_MAX) { + if (num_index > (php_uint_t)INT32_MAX) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found negative or too large array key", 0 TSRMLS_CC); continue; @@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index); key.append(temp, len); - storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (ulong)num_index); + storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (php_uint_t)num_index); } else { //string; assumed to be in UTF-8 intl_stringFromChar(key, str_index->val, str_index->len, &err.code); @@ -447,7 +447,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, UnicodeString *text = new UnicodeString(); intl_stringFromChar(*text, - Z_STRVAL_P(elem), Z_STRLEN_P(elem), &err.code); + Z_STRVAL_P(elem), Z_STRSIZE_P(elem), &err.code); if (U_FAILURE(err.code)) { char *message; @@ -466,14 +466,14 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, double d; if (Z_TYPE_P(elem) == IS_DOUBLE) { d = Z_DVAL_P(elem); - } else if (Z_TYPE_P(elem) == IS_LONG) { - d = (double)Z_LVAL_P(elem); + } else if (Z_TYPE_P(elem) == IS_INT) { + d = (double)Z_IVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); d = (Z_TYPE_P(elem) == IS_DOUBLE) ? Z_DVAL_P(elem) - : (double)Z_LVAL_P(elem); + : (double)Z_IVAL_P(elem); } formattable.setDouble(d); break; @@ -491,14 +491,14 @@ retry_klong: } else { tInt32 = (int32_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_LONG) { - if (Z_LVAL_P(elem) > INT32_MAX || - Z_LVAL_P(elem) < INT32_MIN) { + } else if (Z_TYPE_P(elem) == IS_INT) { + if (Z_IVAL_P(elem) > INT32_MAX || + Z_IVAL_P(elem) < INT32_MIN) { intl_errors_set(&err, U_ILLEGAL_ARGUMENT_ERROR, "Found PHP integer with absolute value too large " "for 32 bit integer argument", 0 TSRMLS_CC); } else { - tInt32 = (int32_t)Z_LVAL_P(elem); + tInt32 = (int32_t)Z_IVAL_P(elem); } } else { SEPARATE_ZVAL_IF_NOT_REF(elem); @@ -521,9 +521,9 @@ retry_kint64: } else { tInt64 = (int64_t)Z_DVAL_P(elem); } - } else if (Z_TYPE_P(elem) == IS_LONG) { + } else if (Z_TYPE_P(elem) == IS_INT) { /* assume long is not wider than 64 bits */ - tInt64 = (int64_t)Z_LVAL_P(elem); + tInt64 = (int64_t)Z_IVAL_P(elem); } else { SEPARATE_ZVAL_IF_NOT_REF(elem); convert_scalar_to_number(elem TSRMLS_CC); @@ -567,10 +567,10 @@ retry_kint64: break; case IS_TRUE: case IS_FALSE: - convert_to_long_ex(elem); + convert_to_int_ex(elem); /* Intentional fallthrough */ - case IS_LONG: - formattable.setInt64((int64_t)Z_LVAL_P(elem)); + case IS_INT: + formattable.setInt64((int64_t)Z_IVAL_P(elem)); break; case IS_NULL: formattable.setInt64((int64_t)0); @@ -658,15 +658,15 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh break; case Formattable::kLong: - ZVAL_LONG(&(*args)[i], fargs[i].getLong()); + ZVAL_INT(&(*args)[i], fargs[i].getLong()); break; case Formattable::kInt64: aInt64 = fargs[i].getInt64(); - if(aInt64 > LONG_MAX || aInt64 < -LONG_MAX) { + if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) { ZVAL_DOUBLE(&(*args)[i], (double)aInt64); } else { - ZVAL_LONG(&(*args)[i], (long)aInt64); + ZVAL_INT(&(*args)[i], (php_int_t)aInt64); } break; diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c index f06a3e685c..cbc680e7aa 100644 --- a/ext/intl/normalizer/normalizer.c +++ b/ext/intl/normalizer/normalizer.c @@ -37,9 +37,9 @@ void normalizer_register_constants( INIT_FUNC_ARGS ) return; } - #define NORMALIZER_EXPOSE_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) - #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); - #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CONST(x) REGISTER_INT_CONSTANT(#x, x, CONST_PERSISTENT | CONST_CS) + #define NORMALIZER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( #x ) - 1, NORMALIZER_##x TSRMLS_CC ); + #define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_int( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC ); /* Normalization form constants */ NORMALIZER_EXPOSE_CLASS_CONST( NONE ); diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c index fe1d61e052..ad600c1b55 100644 --- a/ext/intl/normalizer/normalizer_normalize.c +++ b/ext/intl/normalizer/normalizer_normalize.c @@ -34,7 +34,7 @@ PHP_FUNCTION( normalizer_normalize ) { char* input = NULL; /* form is optional, defaults to FORM_C */ - long form = NORMALIZER_DEFAULT; + php_int_t form = NORMALIZER_DEFAULT; int input_len = 0; UChar* uinput = NULL; @@ -53,7 +53,7 @@ PHP_FUNCTION( normalizer_normalize ) intl_error_reset( NULL TSRMLS_CC ); /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i", &input, &input_len, &form ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -174,7 +174,7 @@ PHP_FUNCTION( normalizer_is_normalized ) { char* input = NULL; /* form is optional, defaults to FORM_C */ - long form = NORMALIZER_DEFAULT; + php_int_t form = NORMALIZER_DEFAULT; int input_len = 0; UChar* uinput = NULL; @@ -186,7 +186,7 @@ PHP_FUNCTION( normalizer_is_normalized ) intl_error_reset( NULL TSRMLS_CC ); /* Parse parameters. */ - if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|l", + if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "s|i", &input, &input_len, &form) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c index 9ca225ab88..f837bf9d78 100644 --- a/ext/intl/php_intl.c +++ b/ext/intl/php_intl.c @@ -910,7 +910,7 @@ PHP_MINIT_FUNCTION( intl ) /* For the default locale php.ini setting */ REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS); #ifdef U_ICU_DATA_VERSION REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS); diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h index f863f4bd47..1ee496402f 100644 --- a/ext/intl/php_intl.h +++ b/ext/intl/php_intl.h @@ -50,7 +50,7 @@ ZEND_BEGIN_MODULE_GLOBALS(intl) collator_compare_func_t compare_func; UBreakIterator* grapheme_iterator; intl_error g_error; - long error_level; + php_int_t error_level; zend_bool use_exceptions; ZEND_END_MODULE_GLOBALS(intl) diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c index 66978eb888..b13ee901f4 100644 --- a/ext/intl/resourcebundle/resourcebundle.c +++ b/ext/intl/resourcebundle/resourcebundle.c @@ -32,7 +32,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so const int32_t* vfield; int32_t ilen; int i; - long lfield; + php_int_t lfield; ResourceBundle_object* newrb; restype = ures_getType( source->child ); @@ -53,7 +53,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so case URES_INT: lfield = ures_getInt( source->child, &INTL_DATA_ERROR_CODE(source) ); INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve integer value"); - ZVAL_LONG( return_value, lfield ); + ZVAL_INT( return_value, lfield ); break; case URES_INT_VECTOR: @@ -61,7 +61,7 @@ void resourcebundle_extract_value( zval *return_value, ResourceBundle_object *so INTL_METHOD_CHECK_STATUS(source, "Failed to retrieve vector value"); array_init( return_value ); for (i=0; i<ilen; i++) { - add_next_index_long( return_value, vfield[i] ); + add_next_index_int( return_value, vfield[i] ); } break; diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 77f2e90588..5975c26607 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -177,9 +177,9 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_ intl_error_reset( NULL TSRMLS_CC ); RESOURCEBUNDLE_METHOD_FETCH_OBJECT; - if(Z_TYPE_P(offset) == IS_LONG) { + if(Z_TYPE_P(offset) == IS_INT) { is_numeric = 1; - meindex = Z_LVAL_P(offset); + meindex = Z_IVAL_P(offset); rb->child = ures_getByIndex( rb->me, meindex, rb->child, &INTL_DATA_ERROR_CODE(rb) ); } else if(Z_TYPE_P(offset) == IS_STRING) { mekey = Z_STRVAL_P(offset); @@ -259,7 +259,7 @@ PHP_FUNCTION( resourcebundle_get ) /* }}} */ /* {{{ resourcebundle_array_count */ -int resourcebundle_array_count(zval *object, long *count TSRMLS_DC) +int resourcebundle_array_count(zval *object, php_int_t *count TSRMLS_DC) { ResourceBundle_object *rb; RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; @@ -299,7 +299,7 @@ PHP_FUNCTION( resourcebundle_count ) RESOURCEBUNDLE_METHOD_FETCH_OBJECT; len = ures_getSize( rb->me ); - RETURN_LONG( len ); + RETURN_INT( len ); } /* {{{ arginfo_resourcebundle_getlocales */ @@ -372,7 +372,7 @@ PHP_FUNCTION( resourcebundle_get_error_code ) rb = Z_INTL_RESOURCEBUNDLE_P( object ); - RETURN_LONG(INTL_DATA_ERROR_CODE(rb)); + RETURN_INT(INTL_DATA_ERROR_CODE(rb)); } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c index bdedfd15bc..79149cb234 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.c +++ b/ext/intl/resourcebundle/resourcebundle_iterator.c @@ -109,7 +109,7 @@ static void resourcebundle_iterator_key( zend_object_iterator *iter, zval *key T if (iterator->is_table) { ZVAL_STRING(key, iterator->currentkey); } else { - ZVAL_LONG(key, iterator->i); + ZVAL_INT(key, iterator->i); } } /* }}} */ diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h index 01a66650b9..0c0849eddd 100644 --- a/ext/intl/resourcebundle/resourcebundle_iterator.h +++ b/ext/intl/resourcebundle/resourcebundle_iterator.h @@ -25,10 +25,10 @@ typedef struct { zend_object_iterator intern; ResourceBundle_object *subject; zend_bool is_table; - long length; + php_int_t length; zval current; char *currentkey; - long i; + php_int_t i; } ResourceBundle_iterator; zend_object_iterator *resourcebundle_get_iterator( zend_class_entry *ce, zval *object, int byref TSRMLS_DC ); diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c index 42a014a90e..747654a53b 100644 --- a/ext/intl/spoofchecker/spoofchecker.c +++ b/ext/intl/spoofchecker/spoofchecker.c @@ -35,7 +35,7 @@ void spoofchecker_register_constants(INIT_FUNC_ARGS) return; } - #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_long(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); + #define SPOOFCHECKER_EXPOSE_CLASS_CONST(x) zend_declare_class_constant_int(Spoofchecker_ce_ptr, ZEND_STRS( #x ) - 1, USPOOF_##x TSRMLS_CC); SPOOFCHECKER_EXPOSE_CLASS_CONST(SINGLE_SCRIPT_CONFUSABLE) SPOOFCHECKER_EXPOSE_CLASS_CONST(MIXED_SCRIPT_CONFUSABLE) diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c index c37b9186a2..57b3bdffc9 100644 --- a/ext/intl/spoofchecker/spoofchecker_main.c +++ b/ext/intl/spoofchecker/spoofchecker_main.c @@ -47,7 +47,7 @@ PHP_METHOD(Spoofchecker, isSuspicious) if (error_code) { zval_dtor(error_code); - ZVAL_LONG(error_code, ret); + ZVAL_INT(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -80,7 +80,7 @@ PHP_METHOD(Spoofchecker, areConfusable) if (error_code) { zval_dtor(error_code); - ZVAL_LONG(error_code, ret); + ZVAL_INT(error_code, ret); } RETVAL_BOOL(ret != 0); } @@ -115,10 +115,10 @@ PHP_METHOD(Spoofchecker, setAllowedLocales) */ PHP_METHOD(Spoofchecker, setChecks) { - long checks; + php_int_t checks; SPOOFCHECKER_METHOD_INIT_VARS; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &checks)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &checks)) { return; } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index be30c2d541..a0651d5352 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -180,7 +180,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, gottenId; UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */ convert_to_string_ex(zv_timezone); - if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRLEN_P(zv_timezone), + if (intl_stringFromChar(id, Z_STRVAL_P(zv_timezone), Z_STRSIZE_P(zv_timezone), &status) == FAILURE) { spprintf(&message, 0, "%s: Time zone identifier given is not a " "valid UTF-8 string", func); @@ -331,9 +331,9 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC) return debug_info; } - ZVAL_LONG(&zv, (long)rawOffset); + ZVAL_INT(&zv, (php_int_t)rawOffset); zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); - ZVAL_LONG(&zv, (long)(rawOffset + dstOffset)); + ZVAL_INT(&zv, (php_int_t)(rawOffset + dstOffset)); zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); return debug_info; @@ -513,26 +513,26 @@ U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D) /* Declare 'IntlTimeZone' class constants */ -#define TIMEZONE_DECL_LONG_CONST(name, val) \ - zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \ +#define TIMEZONE_DECL_INT_CONST(name, val) \ + zend_declare_class_constant_int(TimeZone_ce_ptr, name, sizeof(name) - 1, \ val TSRMLS_CC) - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT); - TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT", TimeZone::SHORT); + TIMEZONE_DECL_INT_CONST("DISPLAY_LONG", TimeZone::LONG); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); - TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); - TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); - TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); - TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); + TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); + TIMEZONE_DECL_INT_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); + TIMEZONE_DECL_INT_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); + TIMEZONE_DECL_INT_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); #endif #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 - TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); - TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); - TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); + TIMEZONE_DECL_INT_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); + TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); + TIMEZONE_DECL_INT_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); #endif /* Declare 'IntlTimeZone' class properties */ diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp index a8332dbf7e..4dbb6ddda3 100644 --- a/ext/intl/timezone/timezone_methods.cpp +++ b/ext/intl/timezone/timezone_methods.cpp @@ -159,34 +159,34 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration) if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) { se = TimeZone::createEnumeration(); - } else if (Z_TYPE_P(arg) == IS_LONG) { + } else if (Z_TYPE_P(arg) == IS_INT) { int_offset: - if (Z_LVAL_P(arg) < (long)INT32_MIN || - Z_LVAL_P(arg) > (long)INT32_MAX) { + if (Z_IVAL_P(arg) < (php_int_t)INT32_MIN || + Z_IVAL_P(arg) > (php_int_t)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_enumeration: value is out of range", 0 TSRMLS_CC); RETURN_FALSE; } else { - se = TimeZone::createEnumeration((int32_t) Z_LVAL_P(arg)); + se = TimeZone::createEnumeration((int32_t) Z_IVAL_P(arg)); } } else if (Z_TYPE_P(arg) == IS_DOUBLE) { double_offset: - convert_to_long_ex(arg); + convert_to_int_ex(arg); goto int_offset; } else if (Z_TYPE_P(arg) == IS_OBJECT || Z_TYPE_P(arg) == IS_STRING) { - long lval; + php_int_t lval; double dval; convert_to_string_ex(arg); - switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), &lval, &dval, 0)) { case IS_DOUBLE: SEPARATE_ZVAL(arg); zval_dtor(arg); ZVAL_DOUBLE(arg, dval); goto double_offset; - case IS_LONG: + case IS_INT: SEPARATE_ZVAL(arg); zval_dtor(arg); - ZVAL_LONG(arg, lval); + ZVAL_INT(arg, lval); goto int_offset; } /* else call string version */ @@ -228,13 +228,13 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids) } int32_t result = TimeZone::countEquivalentIDs(id); - RETURN_LONG((long)result); + RETURN_INT((php_int_t)result); } #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) { - long zoneType, + php_int_t zoneType, offset_arg; char *region = NULL; int region_len = 0; @@ -250,7 +250,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) != FAILURE && Z_TYPE_P(zvoffset) == IS_NULL; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s!l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s!i", &zoneType, ®ion, ®ion_len, &offset_arg) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_time_zone_id_enumeration: bad arguments", 0 TSRMLS_CC); @@ -265,7 +265,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration) } if (ZEND_NUM_ARGS() == 3) { - if (offset_arg < (long)INT32_MIN || offset_arg > (long)INT32_MAX) { + if (offset_arg < (php_int_t)INT32_MIN || offset_arg > (php_int_t)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_create_time_zone_id_enumeration: offset out of bounds", 0 TSRMLS_CC); RETURN_FALSE; @@ -383,12 +383,12 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id) { char *str_id; int str_id_len; - long index; + php_int_t index; intl_error_reset(NULL TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &str_id, &str_id_len, &index) == FAILURE || - index < (long)INT32_MIN || index > (long)INT32_MAX) { + index < (php_int_t)INT32_MIN || index > (php_int_t)INT32_MAX) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_equivalent_id: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; @@ -485,10 +485,10 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset) ZVAL_DEREF(rawOffsetArg); zval_dtor(rawOffsetArg); - ZVAL_LONG(rawOffsetArg, rawOffset); + ZVAL_INT(rawOffsetArg, rawOffset); ZVAL_DEREF(dstOffsetArg); zval_dtor(dstOffsetArg); - ZVAL_LONG(dstOffsetArg, dstOffset); + ZVAL_INT(dstOffsetArg, dstOffset); RETURN_TRUE; } @@ -506,7 +506,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_LONG(to->utimezone->getRawOffset()); + RETURN_INT(to->utimezone->getRawOffset()); } U_CFUNC PHP_FUNCTION(intltz_has_same_rules) @@ -545,13 +545,13 @@ static const TimeZone::EDisplayType display_types[] = { U_CFUNC PHP_FUNCTION(intltz_get_display_name) { zend_bool daylight = 0; - long display_type = TimeZone::LONG; + php_int_t display_type = TimeZone::LONG; const char *locale_str = NULL; int dummy = 0; TIMEZONE_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), - "O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type, + "O|bis!", &object, TimeZone_ce_ptr, &daylight, &display_type, &locale_str, &dummy) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_display_name: bad arguments", 0 TSRMLS_CC); @@ -603,7 +603,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings) TIMEZONE_METHOD_FETCH_OBJECT; - RETURN_LONG((long)to->utimezone->getDSTSavings()); + RETURN_INT((php_int_t)to->utimezone->getDSTSavings()); } U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone) @@ -646,7 +646,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code) if (to == NULL) RETURN_FALSE; - RETURN_LONG((long)TIMEZONE_ERROR_CODE(to)); + RETURN_INT((php_int_t)TIMEZONE_ERROR_CODE(to)); } U_CFUNC PHP_FUNCTION(intltz_get_error_message) diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c index 5f698e2b90..88e1225654 100644 --- a/ext/intl/transliterator/transliterator.c +++ b/ext/intl/transliterator/transliterator.c @@ -35,9 +35,9 @@ void transliterator_register_constants( INIT_FUNC_ARGS ) return; } - #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_LONG_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) - #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); - #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_long( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ + #define TRANSLITERATOR_EXPOSE_CONST( x ) REGISTER_INT_CONSTANT( #x, x, CONST_PERSISTENT | CONST_CS ) + #define TRANSLITERATOR_EXPOSE_CLASS_CONST( x ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( #x ) - 1, TRANSLITERATOR_##x TSRMLS_CC ); + #define TRANSLITERATOR_EXPOSE_CUSTOM_CLASS_CONST( name, value ) zend_declare_class_constant_int( Transliterator_ce_ptr, ZEND_STRS( name ) - 1, value TSRMLS_CC );*/ /* Normalization form constants */ TRANSLITERATOR_EXPOSE_CLASS_CONST( FORWARD ); diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 1373db0c5b..e5f26f2829 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -223,7 +223,7 @@ static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, in TRANSLITERATOR_PROPERTY_HANDLER_PROLOG; if(zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) + Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) { retval = NULL; /* fallback to read_property */ } @@ -247,7 +247,7 @@ static zval *Transliterator_read_property( zval *object, zval *member, int type, if( ( type != BP_VAR_R && type != BP_VAR_IS ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); retval = &EG( uninitialized_zval ); @@ -272,7 +272,7 @@ static void Transliterator_write_property( zval *object, zval *member, zval *val if( ( EG( scope ) != Transliterator_ce_ptr ) && ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) ) + Z_STRVAL_P( member ), Z_STRSIZE_P( member ) ) == 0 ) ) { php_error_docref0( NULL TSRMLS_CC, E_WARNING, "The property \"id\" is read-only" ); } diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index 4403de08aa..c4f620f9ca 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -27,7 +27,7 @@ #include <zend_exceptions.h> -static int create_transliterator( char *str_id, int str_id_len, long direction, zval *object TSRMLS_DC ) +static int create_transliterator( char *str_id, int str_id_len, php_int_t direction, zval *object TSRMLS_DC ) { Transliterator_object *to; UChar *ustr_id = NULL; @@ -105,14 +105,14 @@ PHP_FUNCTION( transliterator_create ) { char *str_id; int str_id_len; - long direction = TRANSLITERATOR_FORWARD; + php_int_t direction = TRANSLITERATOR_FORWARD; int res; TRANSLITERATOR_METHOD_INIT_VARS; (void) to; /* unused */ - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str_id, &str_id_len, &direction ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -139,14 +139,14 @@ PHP_FUNCTION( transliterator_create_from_rules ) int str_rules_len; UChar *ustr_rules = NULL; int32_t ustr_rules_len = 0; - long direction = TRANSLITERATOR_FORWARD; + php_int_t direction = TRANSLITERATOR_FORWARD; UParseError parse_error = {0, -1}; UTransliterator *utrans; UChar id[] = {0x52, 0x75, 0x6C, 0x65, 0x73, 0x54, 0x72, 0x61, 0x6E, 0x73, 0x50, 0x48, 0x50, 0}; /* RulesTransPHP */ TRANSLITERATOR_METHOD_INIT_VARS; - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|l", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str_rules, &str_rules_len, &direction ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -307,7 +307,7 @@ PHP_FUNCTION( transliterator_transliterate ) int32_t ustr_len = 0, capacity, uresult_len; - long start = 0, + php_int_t start = 0, limit = -1; int success = 0; zval tmp_object; @@ -320,7 +320,7 @@ PHP_FUNCTION( transliterator_transliterate ) { /* in non-OOP version, accept both a transliterator and a string */ zval *arg1; - if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ll", + if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "zs|ii", &arg1, &str, &str_len, &start, &limit ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -342,7 +342,7 @@ PHP_FUNCTION( transliterator_transliterate ) convert_to_string( arg1 ); } object = &tmp_object; - res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ), + res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRSIZE_P( arg1 ), TRANSLITERATOR_FORWARD, object TSRMLS_CC ); if( res == FAILURE ) { @@ -355,7 +355,7 @@ PHP_FUNCTION( transliterator_transliterate ) } } } - else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", + else if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s|ii", &str, &str_len, &start, &limit ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -497,7 +497,7 @@ PHP_FUNCTION( transliterator_get_error_code ) if (to == NULL ) RETURN_FALSE; - RETURN_LONG( (long) TRANSLITERATOR_ERROR_CODE( to ) ); + RETURN_INT( (php_int_t) TRANSLITERATOR_ERROR_CODE( to ) ); } /* }}} */ diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 116fc0c9b6..f2a1ee4dda 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -293,7 +293,7 @@ static int dehexchar(char c) static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC) { - if (type == IS_LONG) + if (type == IS_INT) { zend_bool bigint = 0; @@ -301,9 +301,9 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM buf->s->len--; } - if (buf->s->len >= MAX_LENGTH_OF_LONG - 1) { - if (buf->s->len == MAX_LENGTH_OF_LONG - 1) { - int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), long_min_digits); + if (buf->s->len >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (buf->s->len == MAX_LENGTH_OF_ZEND_INT - 1) { + int cmp = strcmp(buf->s->val + (buf->s->val[0] == '-'), int_min_digits); if (!(cmp < 0 || (cmp == 0 && buf->s->val[0] == '-'))) { bigint = 1; @@ -326,7 +326,7 @@ static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRM } } - ZVAL_LONG(z, strtol(buf->s->val, NULL, 10)); + ZVAL_INT(z, strtol(buf->s->val, NULL, 10)); } else if (type == IS_DOUBLE) { @@ -373,7 +373,7 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16) && ((unsigned char) buf->s->val[buf->s->len - 1] & 0xc0) == 0x80) { /* found surrogate pair */ - unsigned long utf32; + php_uint_t utf32; utf32 = (((buf->s->val[buf->s->len - 2] & 0xf) << 16) | ((buf->s->val[buf->s->len - 1] & 0x3f) << 10) @@ -516,10 +516,10 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, utf16 += dehexchar(next_char); utf16_to_utf8(&buf, utf16); } - } else if (type < IS_LONG && (next_class == C_DIGIT || next_class == C_ZERO)) { - type = IS_LONG; + } else if (type < IS_INT && (next_class == C_DIGIT || next_class == C_ZERO)) { + type = IS_INT; smart_str_appendc(&buf, next_char); - } else if (type == IS_LONG && next_state == E1) { + } else if (type == IS_INT && next_state == E1) { type = IS_DOUBLE; smart_str_appendc(&buf, next_char); } else if (type < IS_DOUBLE && next_class == C_POINT) { diff --git a/ext/json/json.c b/ext/json/json.c index bc0544808f..60893fe1ea 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -93,29 +93,29 @@ static PHP_MINIT_FUNCTION(json) INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface); php_json_serializable_ce = zend_register_internal_interface(&ce TSRMLS_CC); - REGISTER_LONG_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_APOS", PHP_JSON_HEX_APOS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_UNESCAPED_SLASHES", PHP_JSON_UNESCAPED_SLASHES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_PRETTY_PRINT", PHP_JSON_PRETTY_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_RECURSION", PHP_JSON_ERROR_RECURSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_INF_OR_NAN", PHP_JSON_ERROR_INF_OR_NAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_ERROR_UNSUPPORTED_TYPE", PHP_JSON_ERROR_UNSUPPORTED_TYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("JSON_BIGINT_AS_STRING", PHP_JSON_BIGINT_AS_STRING, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -177,7 +177,7 @@ static int json_determine_array_type(zval *val TSRMLS_DC) /* {{{ */ i = myht ? zend_hash_num_elements(myht) : 0; if (i > 0) { zend_string *key; - ulong index, idx; + php_uint_t index, idx; idx = 0; ZEND_HASH_FOREACH_KEY(myht, index, key) { @@ -252,7 +252,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC) if (i > 0) { zend_string *key; zval *data; - ulong index; + php_uint_t index; HashTable *tmp_ht; ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) { @@ -308,7 +308,7 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC) json_pretty_print_indent(buf, options TSRMLS_CC); smart_str_appendc(buf, '"'); - smart_str_append_long(buf, (long) index); + smart_str_append_int(buf, (php_int_t) index); smart_str_appendc(buf, '"'); smart_str_appendc(buf, ':'); @@ -395,11 +395,11 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR if (options & PHP_JSON_NUMERIC_CHECK) { double d; int type; - long p; + php_int_t p; if ((type = is_numeric_string(s, len, &p, &d, 0)) != 0) { - if (type == IS_LONG) { - smart_str_append_long(buf, p); + if (type == IS_INT) { + smart_str_append_int(buf, p); } else if (type == IS_DOUBLE) { if (!zend_isinf(d) && !zend_isnan(d)) { char *tmp; @@ -602,8 +602,8 @@ again: smart_str_appendl(buf, "false", 5); break; - case IS_LONG: - smart_str_append_long(buf, Z_LVAL_P(val)); + case IS_INT: + smart_str_append_int(buf, Z_IVAL_P(val)); break; case IS_DOUBLE: @@ -624,7 +624,7 @@ again: break; case IS_STRING: - json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options TSRMLS_CC); + json_escape_string(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val), options TSRMLS_CC); break; case IS_OBJECT: @@ -651,7 +651,7 @@ again: } /* }}} */ -PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, long depth TSRMLS_DC) /* {{{ */ +PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, php_int_t depth TSRMLS_DC) /* {{{ */ { int utf16_len; unsigned short *utf16; @@ -678,7 +678,7 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, if (!parse_JSON_ex(jp, return_value, utf16, utf16_len, options TSRMLS_CC)) { double d; int type, overflow_info; - long p; + php_int_t p; char *trim = str; int trim_len = str_len; @@ -710,8 +710,8 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, } if ((type = is_numeric_string_ex(trim, trim_len, &p, &d, 0, &overflow_info)) != 0) { - if (type == IS_LONG) { - RETVAL_LONG(p); + if (type == IS_INT) { + RETVAL_INT(p); } else if (type == IS_DOUBLE) { if (options & PHP_JSON_BIGINT_AS_STRING && overflow_info) { /* Within an object or array, a numeric literal is assumed @@ -758,10 +758,10 @@ static PHP_FUNCTION(json_encode) { zval *parameter; smart_str buf = {0}; - long options = 0; - long depth = JSON_PARSER_DEFAULT_DEPTH; + php_int_t options = 0; + php_int_t depth = JSON_PARSER_DEFAULT_DEPTH; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", ¶meter, &options, &depth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ii", ¶meter, &options, &depth) == FAILURE) { return; } @@ -788,10 +788,10 @@ static PHP_FUNCTION(json_decode) char *str; int str_len; zend_bool assoc = 0; /* return JS objects as PHP objects by default */ - long depth = JSON_PARSER_DEFAULT_DEPTH; - long options = 0; + php_int_t depth = JSON_PARSER_DEFAULT_DEPTH; + php_int_t options = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bll", &str, &str_len, &assoc, &depth, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bii", &str, &str_len, &assoc, &depth, &options) == FAILURE) { return; } @@ -820,7 +820,7 @@ static PHP_FUNCTION(json_last_error) return; } - RETURN_LONG(JSON_G(error_code)); + RETURN_INT(JSON_G(error_code)); } /* }}} */ diff --git a/ext/json/php_json.h b/ext/json/php_json.h index e00de6a27b..b42aecba7d 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -50,7 +50,7 @@ ZEND_END_MODULE_GLOBALS(json) #endif PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC); -PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, long depth TSRMLS_DC); +PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, php_int_t depth TSRMLS_DC); extern PHP_JSON_API zend_class_entry *php_json_serializable_ce; @@ -74,7 +74,7 @@ extern PHP_JSON_API zend_class_entry *php_json_serializable_ce; #define PHP_JSON_OBJECT_AS_ARRAY (1<<0) #define PHP_JSON_BIGINT_AS_STRING (1<<1) -static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, long depth TSRMLS_DC) +static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, php_int_t depth TSRMLS_DC) { php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC); } diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 8f52f1f3fb..9bfbaaa1ae 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -147,65 +147,65 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_INI_ENTRIES(); /* Constants to be used with deref-parameter in php_ldap_do_search() */ - REGISTER_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); /* Constants to be used with ldap_modify_batch() */ - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_ATTRIB", LDAP_MODIFY_BATCH_ATTRIB, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* LDAP options */ - REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_NETWORK_TIMEOUT - REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); #elif defined (LDAP_X_OPT_CONNECT_TIMEOUT) - REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_RESTART - REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_HOST_NAME - REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_MATCHED_DN - REGISTER_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_DEBUG_LEVEL - REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); #endif #ifdef HAVE_LDAP_SASL - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); #endif #ifdef ORALDAP - REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); @@ -295,11 +295,11 @@ PHP_FUNCTION(ldap_connect) { char *host = NULL; int hostlen; - long port = 389; /* Default port */ + php_int_t port = 389; /* Default port */ #ifdef HAVE_ORALDAP char *wallet = NULL, *walletpasswd = NULL; int walletlen = 0, walletpasswdlen = 0; - long authmode = GSLC_SSL_NO_AUTH; + php_int_t authmode = GSLC_SSL_NO_AUTH; int ssl=0; #endif ldap_linkdata *ld; @@ -310,7 +310,7 @@ PHP_FUNCTION(ldap_connect) WRONG_PARAM_COUNT; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sissi", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) { RETURN_FALSE; } @@ -318,7 +318,7 @@ PHP_FUNCTION(ldap_connect) ssl = 1; } #else - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &host, &hostlen, &port) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|si", &host, &hostlen, &port) != SUCCESS) { RETURN_FALSE; } #endif @@ -610,7 +610,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) { zval *link, *base_dn, *filter, *attrs = NULL, *attr; - long attrsonly, sizelimit, timelimit, deref; + php_int_t attrsonly, sizelimit, timelimit, deref; char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL; ldap_linkdata *ld = NULL; LDAPMessage *ldap_res; @@ -618,7 +618,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1; int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argcount TSRMLS_CC, "zzz|allll", &link, &base_dn, &filter, &attrs, &attrsonly, + if (zend_parse_parameters(argcount TSRMLS_CC, "zzz|aiiii", &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) == FAILURE) { return; } @@ -870,7 +870,7 @@ PHP_FUNCTION(ldap_count_entries) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result); - RETURN_LONG(ldap_count_entries(ld->link, ldap_result)); + RETURN_INT(ldap_count_entries(ld->link, ldap_result)); } /* }}} */ @@ -957,7 +957,7 @@ PHP_FUNCTION(ldap_get_entries) num_entries = ldap_count_entries(ldap, ldap_result); array_init(return_value); - add_assoc_long(return_value, "count", num_entries); + add_assoc_int(return_value, "count", num_entries); if (num_entries == 0) { return; @@ -981,7 +981,7 @@ PHP_FUNCTION(ldap_get_entries) num_values = ldap_count_values_len(ldap_value); array_init(&tmp2); - add_assoc_long(&tmp2, "count", num_values); + add_assoc_int(&tmp2, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1003,7 +1003,7 @@ PHP_FUNCTION(ldap_get_entries) } #endif - add_assoc_long(&tmp1, "count", num_attrib); + add_assoc_int(&tmp1, "count", num_attrib); dn = ldap_get_dn(ldap, ldap_result_entry); add_assoc_string(&tmp1, "dn", dn); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS @@ -1018,7 +1018,7 @@ PHP_FUNCTION(ldap_get_entries) ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry); } - add_assoc_long(return_value, "count", num_entries); + add_assoc_int(return_value, "count", num_entries); } /* }}} */ @@ -1031,9 +1031,9 @@ PHP_FUNCTION(ldap_first_attribute) ldap_linkdata *ld; ldap_resultentry *resultentry; char *attribute; - long dummy_ber; + php_int_t dummy_ber; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &link, &result_entry, &dummy_ber) != SUCCESS) { return; } @@ -1059,9 +1059,9 @@ PHP_FUNCTION(ldap_next_attribute) ldap_linkdata *ld; ldap_resultentry *resultentry; char *attribute; - long dummy_ber; + php_int_t dummy_ber; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|i", &link, &result_entry, &dummy_ber) != SUCCESS) { return; } @@ -1119,7 +1119,7 @@ PHP_FUNCTION(ldap_get_attributes) num_values = ldap_count_values_len(ldap_value); array_init(&tmp); - add_assoc_long(&tmp, "count", num_values); + add_assoc_int(&tmp, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1140,7 +1140,7 @@ PHP_FUNCTION(ldap_get_attributes) } #endif - add_assoc_long(return_value, "count", num_attrib); + add_assoc_int(return_value, "count", num_attrib); } /* }}} */ @@ -1174,7 +1174,7 @@ PHP_FUNCTION(ldap_get_values_len) add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len); } - add_assoc_long(return_value, "count", num_values); + add_assoc_int(return_value, "count", num_values); ldap_value_free_len(ldap_value_len); } @@ -1214,11 +1214,11 @@ PHP_FUNCTION(ldap_get_dn) Splits DN into its component parts */ PHP_FUNCTION(ldap_explode_dn) { - long with_attrib; + php_int_t with_attrib; char *dn, **ldap_value; int i, count, dn_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &dn, &dn_len, &with_attrib) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &dn, &dn_len, &with_attrib) != SUCCESS) { return; } @@ -1233,7 +1233,7 @@ PHP_FUNCTION(ldap_explode_dn) array_init(return_value); - add_assoc_long(return_value, "count", count); + add_assoc_int(return_value, "count", count); for (i = 0; i<count; i++) { add_index_string(return_value, i, ldap_value[i]); } @@ -1280,7 +1280,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) int i, j, num_attribs, num_values, dn_len; int *num_berval; zend_string *attribute; - ulong index; + php_uint_t index; int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) { @@ -1338,7 +1338,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) if ((num_values == 1) && (Z_TYPE_P(value) != IS_ARRAY)) { convert_to_string_ex(value); ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_P(value); + ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRSIZE_P(value); ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_P(value); } else { for (j = 0; j < num_values; j++) { @@ -1351,7 +1351,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } convert_to_string_ex(ivalue); ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(ivalue); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(ivalue); ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_P(ivalue); } } @@ -1539,10 +1539,10 @@ PHP_FUNCTION(ldap_modify_batch) /* perform validation */ { zend_string *modkey; - long modtype; + php_int_t modtype; /* to store the wrongly-typed keys */ - ulong tmpUlong; + php_uint_t tmpUlong; /* make sure the DN contains no NUL bytes */ if (_ldap_strlen_max(dn, dn_len) != dn_len) { @@ -1552,7 +1552,7 @@ PHP_FUNCTION(ldap_modify_batch) /* make sure the top level is a normal array */ zend_hash_internal_pointer_reset(Z_ARRVAL_P(mods)); - if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_LONG) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must not be string-indexed"); RETURN_FALSE; } @@ -1604,19 +1604,19 @@ PHP_FUNCTION(ldap_modify_batch) RETURN_FALSE; } - if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) { + if (Z_STRSIZE_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRSIZE_P(modinfo))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes"); RETURN_FALSE; } } else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE)) { - if (Z_TYPE_P(modinfo) != IS_LONG) { + if (Z_TYPE_P(modinfo) != IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long"); RETURN_FALSE; } /* is the value in range? */ - modtype = Z_LVAL_P(modinfo); + modtype = Z_IVAL_P(modinfo); if ( modtype != LDAP_MODIFY_BATCH_ADD && modtype != LDAP_MODIFY_BATCH_REMOVE && @@ -1656,7 +1656,7 @@ PHP_FUNCTION(ldap_modify_batch) } /* are its keys integers? */ - if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must not be string-indexed"); RETURN_FALSE; } @@ -1700,7 +1700,7 @@ PHP_FUNCTION(ldap_modify_batch) _ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_VALUES, &vals); /* map the modification type */ - switch (Z_LVAL_P(modtype)) { + switch (Z_IVAL_P(modtype)) { case LDAP_MODIFY_BATCH_ADD: oper = LDAP_MOD_ADD; break; @@ -1718,9 +1718,9 @@ PHP_FUNCTION(ldap_modify_batch) /* fill in the basic info */ ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; - ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRLEN_P(attrib)); + ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRSIZE_P(attrib)); - if (Z_LVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { + if (Z_IVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { /* no values */ ldap_mods[i]->mod_bvalues = NULL; } @@ -1739,8 +1739,8 @@ PHP_FUNCTION(ldap_modify_batch) ldap_mods[i]->mod_bvalues[j] = safe_emalloc(1, sizeof(struct berval), 0); /* fill it */ - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(modval); - ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRLEN_P(modval)); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(modval); + ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRSIZE_P(modval)); } /* NULL-terminate values */ @@ -1800,7 +1800,7 @@ PHP_FUNCTION(ldap_errno) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - RETURN_LONG(_get_lderrno(ld->link)); + RETURN_INT(_get_lderrno(ld->link)); } /* }}} */ @@ -1808,9 +1808,9 @@ PHP_FUNCTION(ldap_errno) Convert error number to error string */ PHP_FUNCTION(ldap_err2str) { - long perrno; + php_int_t perrno; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perrno) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &perrno) != SUCCESS) { return; } @@ -1867,7 +1867,7 @@ PHP_FUNCTION(ldap_compare) } php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno)); - RETURN_LONG(-1); + RETURN_INT(-1); } /* }}} */ @@ -1908,9 +1908,9 @@ PHP_FUNCTION(ldap_get_option) { zval *link, *retval; ldap_linkdata *ld; - long option; + php_int_t option; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/", &link, &option, &retval) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz/", &link, &option, &retval) != SUCCESS) { return; } @@ -1934,7 +1934,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, val); + ZVAL_INT(retval, val); } break; #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: @@ -1951,7 +1951,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, timeout->tv_sec); + ZVAL_INT(retval, timeout->tv_sec); ldap_memfree(timeout); } break; #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) @@ -1963,7 +1963,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, (timeout / 1000)); + ZVAL_INT(retval, (timeout / 1000)); } break; #endif /* options with string value */ @@ -2013,9 +2013,9 @@ PHP_FUNCTION(ldap_set_option) zval *link, *newval; ldap_linkdata *ld; LDAP *ldap; - long option; + php_int_t option; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zlz", &link, &option, &newval) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ziz", &link, &option, &newval) != SUCCESS) { return; } @@ -2039,8 +2039,8 @@ PHP_FUNCTION(ldap_set_option) { int val; - convert_to_long_ex(newval); - val = Z_LVAL_P(newval); + convert_to_int_ex(newval); + val = Z_IVAL_P(newval); if (ldap_set_option(ldap, option, &val)) { RETURN_FALSE; } @@ -2050,8 +2050,8 @@ PHP_FUNCTION(ldap_set_option) { struct timeval timeout; - convert_to_long_ex(newval); - timeout.tv_sec = Z_LVAL_P(newval); + convert_to_int_ex(newval); + timeout.tv_sec = Z_IVAL_P(newval); timeout.tv_usec = 0; if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { RETURN_FALSE; @@ -2062,8 +2062,8 @@ PHP_FUNCTION(ldap_set_option) { int timeout; - convert_to_long_ex(newval); - timeout = 1000 * Z_LVAL_P(newval); /* Convert to milliseconds */ + convert_to_int_ex(newval); + timeout = 1000 * Z_IVAL_P(newval); /* Convert to milliseconds */ if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { RETURN_FALSE; } @@ -2138,7 +2138,7 @@ PHP_FUNCTION(ldap_set_option) if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "value", sizeof("value") - 1)) != NULL) { convert_to_string_ex(val); ctrl->ldctl_value.bv_val = Z_STRVAL_P(val); - ctrl->ldctl_value.bv_len = Z_STRLEN_P(val); + ctrl->ldctl_value.bv_len = Z_STRSIZE_P(val); } else { ctrl->ldctl_value.bv_val = NULL; ctrl->ldctl_value.bv_len = 0; @@ -2204,7 +2204,7 @@ PHP_FUNCTION(ldap_parse_result) } zval_ptr_dtor(errcode); - ZVAL_LONG(errcode, lerrcode); + ZVAL_INT(errcode, lerrcode); /* Reverse -> fall through */ switch (myargcount) { @@ -2424,8 +2424,8 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi ZVAL_COPY_VALUE(&cb_args[0], cb_link); ZVAL_STRING(&cb_args[1], url); if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(cb_retval)) { - convert_to_long_ex(&cb_retval); - retval = Z_LVAL(cb_retval); + convert_to_int_ex(&cb_retval); + retval = Z_IVAL(cb_retval); zval_ptr_dtor(&cb_retval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed"); @@ -2450,7 +2450,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) { + if (Z_TYPE_P(callback) == IS_STRING && Z_STRSIZE_P(callback) == 0) { /* unregister rebind procedure */ if (!Z_ISUNDEF(ld->rebindproc)) { zval_ptr_dtor(&ld->rebindproc); @@ -2522,10 +2522,10 @@ PHP_FUNCTION(ldap_escape) char *value, *ignores, *result; int valuelen = 0, ignoreslen = 0, i; size_t resultlen; - long flags = 0; + php_int_t flags = 0; zend_bool map[256] = {0}, havecharlist = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|si", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) { return; } @@ -2613,7 +2613,7 @@ PHP_FUNCTION(ldap_8859_to_t61) Inject paged results control*/ PHP_FUNCTION(ldap_control_paged_result) { - long pagesize; + php_int_t pagesize; zend_bool iscritical; zval *link; char *cookie = NULL; @@ -2625,7 +2625,7 @@ PHP_FUNCTION(ldap_control_paged_result) LDAPControl ctrl, *ctrlsp[2]; int rc, myargcount = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) { return; } @@ -2778,7 +2778,7 @@ PHP_FUNCTION(ldap_control_paged_result_response) ldap_controls_free(lserverctrls); if (myargcount == 4) { zval_dtor(estimated); - ZVAL_LONG(estimated, lestimated); + ZVAL_INT(estimated, lestimated); } zval_ptr_dtor(cookie); diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h index bd3731819d..4588c53cd3 100644 --- a/ext/ldap/php_ldap.h +++ b/ext/ldap/php_ldap.h @@ -38,8 +38,8 @@ PHP_MSHUTDOWN_FUNCTION(ldap); PHP_MINFO_FUNCTION(ldap); ZEND_BEGIN_MODULE_GLOBALS(ldap) - long num_links; - long max_links; + php_int_t num_links; + php_int_t max_links; ZEND_END_MODULE_GLOBALS(ldap) #ifdef ZTS diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 8fd661c81d..3580891019 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -779,51 +779,51 @@ static PHP_MINIT_FUNCTION(libxml) php_libxml_initialize(); - REGISTER_LONG_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_DOTTED_VERSION", LIBXML_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_LOADED_VERSION", (char *)xmlParserVersion, CONST_CS | CONST_PERSISTENT); /* For use with loading xml */ - REGISTER_LONG_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOENT", XML_PARSE_NOENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_DTDLOAD", XML_PARSE_DTDLOAD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_DTDATTR", XML_PARSE_DTDATTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_DTDVALID", XML_PARSE_DTDVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOERROR", XML_PARSE_NOERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOWARNING", XML_PARSE_NOWARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOBLANKS", XML_PARSE_NOBLANKS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_XINCLUDE", XML_PARSE_XINCLUDE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NSCLEAN", XML_PARSE_NSCLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); #if LIBXML_VERSION >= 20621 - REGISTER_LONG_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); #endif #if LIBXML_VERSION >= 20703 - REGISTER_LONG_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); /* Schema validation options */ #if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614 - REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); #endif /* Additional constants for use with loading html */ #if LIBXML_VERSION >= 20707 - REGISTER_LONG_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_HTML_NOIMPLIED", HTML_PARSE_NOIMPLIED, CONST_CS | CONST_PERSISTENT); #endif #if LIBXML_VERSION >= 20708 - REGISTER_LONG_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_HTML_NODEFDTD", HTML_PARSE_NODEFDTD, CONST_CS | CONST_PERSISTENT); #endif /* Error levels */ - REGISTER_LONG_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_NONE", XML_ERR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_WARNING", XML_ERR_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_ERROR", XML_ERR_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBXML_ERR_FATAL", XML_ERR_FATAL, CONST_CS | CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "LibXMLError", NULL); libxmlerror_class_entry = zend_register_internal_class(&ce TSRMLS_CC); @@ -991,9 +991,9 @@ static PHP_FUNCTION(libxml_get_last_error) if (error) { object_init_ex(return_value, libxmlerror_class_entry); - add_property_long(return_value, "level", error->level); - add_property_long(return_value, "code", error->code); - add_property_long(return_value, "column", error->int2); + add_property_int(return_value, "level", error->level); + add_property_int(return_value, "code", error->code); + add_property_int(return_value, "column", error->int2); if (error->message) { add_property_string(return_value, "message", error->message); } else { @@ -1004,7 +1004,7 @@ static PHP_FUNCTION(libxml_get_last_error) } else { add_property_stringl(return_value, "file", "", 0); } - add_property_long(return_value, "line", error->line); + add_property_int(return_value, "line", error->line); } else { RETURN_FALSE; } @@ -1030,9 +1030,9 @@ static PHP_FUNCTION(libxml_get_errors) zval z_error; object_init_ex(&z_error, libxmlerror_class_entry); - add_property_long(&z_error, "level", error->level); - add_property_long(&z_error, "code", error->code); - add_property_long(&z_error, "column", error->int2); + add_property_int(&z_error, "level", error->level); + add_property_int(&z_error, "code", error->code); + add_property_int(&z_error, "column", error->int2); if (error->message) { add_property_string(&z_error, "message", error->message); } else { @@ -1043,7 +1043,7 @@ static PHP_FUNCTION(libxml_get_errors) } else { add_property_stringl(&z_error, "file", "", 0); } - add_property_long(&z_error, "line", error->line); + add_property_int(&z_error, "line", error->line); add_next_index_zval(return_value, &z_error); error = zend_llist_get_next(LIBXML(error_list)); diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index a0aab076a5..63670d5177 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -197,7 +197,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i char *strtok_buf = NULL, **val_list = NULL; zval *array_ptr = (zval *) arg; int n, num, *len_list = NULL; - unsigned int val_len, new_val_len; + php_size_t val_len, new_val_len; mbfl_string string, resvar, resval; const mbfl_encoding *from_encoding = NULL; mbfl_encoding_detector *identd = NULL; diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 248bd98535..31b8a6251e 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1443,7 +1443,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) } php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC); - if (Z_STRLEN(tmp) > 0) { + if (Z_STRSIZE(tmp) > 0) { if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) { zval_dtor(&tmp); return FAILURE; @@ -1559,13 +1559,13 @@ PHP_MINIT_FUNCTION(mbstring) sapi_register_post_entries(mbstr_post_entries TSRMLS_CC); } - REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); #if HAVE_MBREGEX PHP_MINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); @@ -1938,7 +1938,7 @@ PHP_FUNCTION(mb_detect_order) break; default: convert_to_string_ex(arg1); - if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0 TSRMLS_CC)) { + if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), &list, &size, 0 TSRMLS_CC)) { if (list) { efree(list); } @@ -1979,25 +1979,25 @@ PHP_FUNCTION(mb_substitute_character) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { RETURN_STRING("entity"); } else { - RETURN_LONG(MBSTRG(current_filter_illegal_substchar)); + RETURN_INT(MBSTRG(current_filter_illegal_substchar)); } } else { RETVAL_TRUE; switch (Z_TYPE_P(arg1)) { case IS_STRING: - if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + if (strncasecmp("none", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; - } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + } else if (strncasecmp("long", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; - } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)) == 0) { + } else if (strncasecmp("entity", Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)) == 0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; } else { - convert_to_long_ex(arg1); + convert_to_int_ex(arg1); - if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) { + if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character."); RETURN_FALSE; @@ -2005,10 +2005,10 @@ PHP_FUNCTION(mb_substitute_character) } break; default: - convert_to_long_ex(arg1); - if (Z_LVAL_P(arg1) < 0xffff && Z_LVAL_P(arg1) > 0x0) { + convert_to_int_ex(arg1); + if (Z_IVAL_P(arg1) < 0xffff && Z_IVAL_P(arg1) > 0x0) { MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; - MBSTRG(current_filter_illegal_substchar) = Z_LVAL_P(arg1); + MBSTRG(current_filter_illegal_substchar) = Z_IVAL_P(arg1); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown character."); RETURN_FALSE; @@ -2106,7 +2106,7 @@ PHP_FUNCTION(mb_output_handler) { char *arg_string; int arg_string_len; - long arg_status; + php_int_t arg_status; mbfl_string string, result; const char *charset; char *p; @@ -2115,7 +2115,7 @@ PHP_FUNCTION(mb_output_handler) unsigned char send_text_mimetype = 0; char *s, *mimetype = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &arg_string, &arg_string_len, &arg_status) == FAILURE) { return; } @@ -2232,7 +2232,7 @@ PHP_FUNCTION(mb_strlen) n = mbfl_strlen(&string); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2244,7 +2244,7 @@ PHP_FUNCTION(mb_strlen) PHP_FUNCTION(mb_strpos) { int n, reverse = 0; - long offset; + php_int_t offset; mbfl_string haystack, needle; char *enc_name = NULL; int enc_name_len; @@ -2257,7 +2257,7 @@ PHP_FUNCTION(mb_strpos) needle.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name, &enc_name_len) == FAILURE) { return; } @@ -2280,7 +2280,7 @@ PHP_FUNCTION(mb_strpos) n = mbfl_strpos(&haystack, &needle, offset, reverse); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { switch (-n) { case 1: @@ -2330,7 +2330,7 @@ PHP_FUNCTION(mb_strrpos) if (zoffset) { if (Z_TYPE_P(zoffset) == IS_STRING) { enc_name2 = Z_STRVAL_P(zoffset); - enc_name_len2 = Z_STRLEN_P(zoffset); + enc_name_len2 = Z_STRSIZE_P(zoffset); str_flg = 1; if (enc_name2 != NULL) { @@ -2356,15 +2356,15 @@ PHP_FUNCTION(mb_strrpos) } if (str_flg) { - convert_to_long_ex(zoffset); - offset = Z_LVAL_P(zoffset); + convert_to_int_ex(zoffset); + offset = Z_IVAL_P(zoffset); } else { enc_name = enc_name2; enc_name_len = enc_name_len2; } } else { - convert_to_long_ex(zoffset); - offset = Z_LVAL_P(zoffset); + convert_to_int_ex(zoffset); + offset = Z_IVAL_P(zoffset); } } @@ -2394,7 +2394,7 @@ PHP_FUNCTION(mb_strrpos) n = mbfl_strpos(&haystack, &needle, offset, 1); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2406,14 +2406,14 @@ PHP_FUNCTION(mb_strrpos) PHP_FUNCTION(mb_stripos) { int n; - long offset; + php_int_t offset; mbfl_string haystack, needle; const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; int from_encoding_len; n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { return; } if (needle.len == 0) { @@ -2423,7 +2423,7 @@ PHP_FUNCTION(mb_stripos) n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2435,21 +2435,21 @@ PHP_FUNCTION(mb_stripos) PHP_FUNCTION(mb_strripos) { int n; - long offset; + php_int_t offset; mbfl_string haystack, needle; const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; int from_encoding_len; n = -1; offset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|is", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &offset, &from_encoding, &from_encoding_len) == FAILURE) { return; } n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding TSRMLS_CC); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2737,7 +2737,7 @@ PHP_FUNCTION(mb_substr_count) n = mbfl_substr_count(&haystack, &needle); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2750,12 +2750,12 @@ PHP_FUNCTION(mb_substr) { size_t argc = ZEND_NUM_ARGS(); char *str, *encoding; - long from, len; + php_int_t from, len; int mblen, str_len, encoding_len; zval *z_len = NULL; mbfl_string string, result, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|zs", &str, &str_len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2777,8 +2777,8 @@ PHP_FUNCTION(mb_substr) if (argc < 3 || Z_TYPE_P(z_len) == IS_NULL) { len = str_len; } else { - convert_to_long_ex(z_len); - len = Z_LVAL_P(z_len); + convert_to_int_ex(z_len); + len = Z_IVAL_P(z_len); } /* measures length */ @@ -2829,7 +2829,7 @@ PHP_FUNCTION(mb_strcut) { size_t argc = ZEND_NUM_ARGS(); char *encoding; - long from, len; + php_int_t from, len; int encoding_len; zval *z_len = NULL; mbfl_string string, result, *ret; @@ -2838,7 +2838,7 @@ PHP_FUNCTION(mb_strcut) string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|zs", (char **)&string.val, (int **)&string.len, &from, &z_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -2853,8 +2853,8 @@ PHP_FUNCTION(mb_strcut) if (argc < 3 || Z_TYPE_P(z_len) == IS_NULL) { len = string.len; } else { - convert_to_long_ex(z_len); - len = Z_LVAL_P(z_len); + convert_to_int_ex(z_len); + len = Z_IVAL_P(z_len); } /* if "from" position is negative, count start position from the end @@ -2920,7 +2920,7 @@ PHP_FUNCTION(mb_strwidth) n = mbfl_strwidth(&string); if (n >= 0) { - RETVAL_LONG(n); + RETVAL_INT(n); } else { RETVAL_FALSE; } @@ -2932,11 +2932,11 @@ PHP_FUNCTION(mb_strwidth) PHP_FUNCTION(mb_strimwidth) { char *str, *trimmarker, *encoding; - long from, width; + php_int_t from, width; int str_len, trimmarker_len, encoding_len; mbfl_string string, result, marker, *ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll|ss", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding, &encoding_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii|ss", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding, &encoding_len) == FAILURE) { return; } @@ -3106,7 +3106,7 @@ PHP_FUNCTION(mb_convert_encoding) n = strlen(Z_STRVAL_P(hash_entry)); _from_encodings = erealloc(_from_encodings, l+n+2); memcpy(_from_encodings + l, ",", 1); - memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRLEN_P(hash_entry) + 1); + memcpy(_from_encodings + l + 1, Z_STRVAL_P(hash_entry), Z_STRSIZE_P(hash_entry) + 1); } else { _from_encodings = estrdup(Z_STRVAL_P(hash_entry)); } @@ -3148,12 +3148,12 @@ PHP_FUNCTION(mb_convert_case) const char *from_encoding = MBSTRG(current_internal_encoding)->mime_name; char *str; int str_len, from_encoding_len; - long case_mode = 0; + php_int_t case_mode = 0; char *newstr; size_t ret_len; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|s!", &str, &str_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|s!", &str, &str_len, &case_mode, &from_encoding, &from_encoding_len) == FAILURE) { return; } @@ -3256,7 +3256,7 @@ PHP_FUNCTION(mb_detect_encoding) break; default: convert_to_string(encoding_list); - if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0 TSRMLS_CC)) { + if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRSIZE_P(encoding_list), &list, &size, 0 TSRMLS_CC)) { if (list) { efree(list); list = NULL; @@ -3356,13 +3356,13 @@ PHP_FUNCTION(mb_encode_mimeheader) int trans_enc_name_len; char *linefeed = "\r\n"; int linefeed_len; - long indent = 0; + php_int_t indent = 0; mbfl_string_init(&string); string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssi", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { return; } @@ -3579,7 +3579,7 @@ PHP_FUNCTION(mb_convert_variables) break; default: convert_to_string_ex(zfrom_enc); - php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC); + php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRSIZE_P(zfrom_enc), &elist, &elistsz, 0 TSRMLS_CC); break; } @@ -3636,7 +3636,7 @@ PHP_FUNCTION(mb_convert_variables) } } else if (Z_TYPE_P(hash_entry) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(hash_entry); - string.len = Z_STRLEN_P(hash_entry); + string.len = Z_STRSIZE_P(hash_entry); if (mbfl_encoding_detector_feed(identd, &string)) { goto detect_end; /* complete detecting */ } @@ -3645,7 +3645,7 @@ PHP_FUNCTION(mb_convert_variables) } } else if (Z_TYPE_P(var) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(var); - string.len = Z_STRLEN_P(var); + string.len = Z_STRSIZE_P(var); if (mbfl_encoding_detector_feed(identd, &string)) { goto detect_end; /* complete detecting */ } @@ -3725,7 +3725,7 @@ detect_end: } } else if (Z_TYPE_P(hash_entry) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(hash_entry); - string.len = Z_STRLEN_P(hash_entry); + string.len = Z_STRSIZE_P(hash_entry); ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret != NULL) { zval_ptr_dtor(hash_entry_ptr); @@ -3738,7 +3738,7 @@ detect_end: } } else if (Z_TYPE_P(var) == IS_STRING) { string.val = (unsigned char *)Z_STRVAL_P(var); - string.len = Z_STRLEN_P(var); + string.len = Z_STRSIZE_P(var); ret = mbfl_buffer_converter_feed_result(convd, &string, &result); if (ret != NULL) { zval_ptr_dtor(var); @@ -3814,8 +3814,8 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) mapelm = convmap; mapsize = 0; ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) { - convert_to_long_ex(hash_entry); - *mapelm++ = Z_LVAL_P(hash_entry); + convert_to_int_ex(hash_entry); + *mapelm++ = Z_IVAL_P(hash_entry); mapsize++; } ZEND_HASH_FOREACH_END(); } @@ -4352,7 +4352,7 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { add_assoc_string(return_value, "http_output_conv_mimetypes", name); } - add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); + add_assoc_int(return_value, "func_overload", MBSTRG(func_overload)); if (MBSTRG(func_overload)){ over_func = &(mb_ovld[0]); array_init(&row1); @@ -4377,7 +4377,7 @@ PHP_FUNCTION(mb_get_info) add_assoc_string(return_value, "mail_body_encoding", name); } } - add_assoc_long(return_value, "illegal_chars", MBSTRG(illegalchars)); + add_assoc_int(return_value, "illegal_chars", MBSTRG(illegalchars)); if (MBSTRG(encoding_translation)) { add_assoc_string(return_value, "encoding_translation", "On"); } else { @@ -4404,7 +4404,7 @@ PHP_FUNCTION(mb_get_info) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { add_assoc_string(return_value, "substitute_character", "entity"); } else { - add_assoc_long(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); + add_assoc_int(return_value, "substitute_character", MBSTRG(current_filter_illegal_substchar)); } if (MBSTRG(strict_detection)) { add_assoc_string(return_value, "strict_detection", "On"); @@ -4428,7 +4428,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING(name); } } else if (!strcasecmp("func_overload", typ)) { - RETVAL_LONG(MBSTRG(func_overload)); + RETVAL_INT(MBSTRG(func_overload)); } else if (!strcasecmp("func_overload_list", typ)) { if (MBSTRG(func_overload)){ over_func = &(mb_ovld[0]); @@ -4455,7 +4455,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING(name); } } else if (!strcasecmp("illegal_chars", typ)) { - RETVAL_LONG(MBSTRG(illegalchars)); + RETVAL_INT(MBSTRG(illegalchars)); } else if (!strcasecmp("encoding_translation", typ)) { if (MBSTRG(encoding_translation)) { RETVAL_STRING("On"); @@ -4485,7 +4485,7 @@ PHP_FUNCTION(mb_get_info) } else if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { RETVAL_STRING("entity"); } else { - RETVAL_LONG(MBSTRG(current_filter_illegal_substchar)); + RETVAL_INT(MBSTRG(current_filter_illegal_substchar)); } } else if (!strcasecmp("strict_detection", typ)) { if (MBSTRG(strict_detection)) { diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index ab03306f14..baf0a2d44a 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -711,19 +711,19 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) if (Z_TYPE_P(arg_pattern) != IS_STRING) { /* we convert numbers to integers and treat them as a string */ if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) { - convert_to_long_ex(arg_pattern); /* get rid of decimal places */ + convert_to_int_ex(arg_pattern); /* get rid of decimal places */ } convert_to_string_ex(arg_pattern); /* don't bother doing an extended regex with just a number */ } - if (!Z_STRVAL_P(arg_pattern) || Z_STRLEN_P(arg_pattern) == 0) { + if (!Z_STRVAL_P(arg_pattern) || Z_STRSIZE_P(arg_pattern) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty pattern"); RETVAL_FALSE; goto out; } - re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC); + re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRSIZE_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax) TSRMLS_CC); if (re == NULL) { RETVAL_FALSE; goto out; @@ -758,7 +758,7 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) if (match_len == 0) { match_len = 1; } - RETVAL_LONG(match_len); + RETVAL_INT(match_len); out: if (regs != NULL) { onig_region_free(regs, 1); @@ -855,11 +855,11 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) { arg_pattern = Z_STRVAL_P(arg_pattern_zval); - arg_pattern_len = Z_STRLEN_P(arg_pattern_zval); + arg_pattern_len = Z_STRSIZE_P(arg_pattern_zval); } else { /* FIXME: this code is not multibyte aware! */ - convert_to_long_ex(arg_pattern_zval); - pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval); + convert_to_int_ex(arg_pattern_zval); + pat_buf[0] = (char)Z_IVAL_P(arg_pattern_zval); pat_buf[1] = '\0'; arg_pattern = pat_buf; @@ -947,7 +947,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp /* result of eval */ convert_to_string(&v); - smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v)); + smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRSIZE(v)); /* Clean up */ eval_buf.s->len = 0; zval_dtor(&v); @@ -971,7 +971,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp if (zend_call_function(&arg_replace_fci, &arg_replace_fci_cache TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(retval)) { convert_to_string_ex(&retval); - smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRLEN(retval)); + smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRSIZE(retval)); if (eval_buf.s) { eval_buf.s->len = 0; } @@ -1060,9 +1060,9 @@ PHP_FUNCTION(mb_split) int string_len; int n, err; - long count = -1; + php_int_t count = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) { RETURN_FALSE; } @@ -1209,7 +1209,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) len = 0; if (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING){ str = (OnigUChar *)Z_STRVAL(MBREX(search_str)); - len = Z_STRLEN(MBREX(search_str)); + len = Z_STRSIZE(MBREX(search_str)); } if (MBREX(search_re) == NULL) { @@ -1245,8 +1245,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) array_init(return_value); beg = MBREX(search_regs)->beg[0]; end = MBREX(search_regs)->end[0]; - add_next_index_long(return_value, beg); - add_next_index_long(return_value, end - beg); + add_next_index_int(return_value, beg); + add_next_index_int(return_value, end - beg); break; case 2: array_init(return_value); @@ -1368,7 +1368,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) array_init(return_value); str = (OnigUChar *)Z_STRVAL(MBREX(search_str)); - len = Z_STRLEN(MBREX(search_str)); + len = Z_STRSIZE(MBREX(search_str)); n = MBREX(search_regs)->num_regs; for (i = 0; i < n; i++) { beg = MBREX(search_regs)->beg[i]; @@ -1389,7 +1389,7 @@ PHP_FUNCTION(mb_ereg_search_getregs) Get search start position */ PHP_FUNCTION(mb_ereg_search_getpos) { - RETVAL_LONG(MBREX(search_pos)); + RETVAL_INT(MBREX(search_pos)); } /* }}} */ @@ -1397,13 +1397,13 @@ PHP_FUNCTION(mb_ereg_search_getpos) Set search start position */ PHP_FUNCTION(mb_ereg_search_setpos) { - long position; + php_int_t position; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) { return; } - if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRLEN(MBREX(search_str)))) { + if (position < 0 || (!Z_ISUNDEF(MBREX(search_str)) && Z_TYPE(MBREX(search_str)) == IS_STRING && position >= Z_STRSIZE(MBREX(search_str)))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range"); MBREX(search_pos) = 0; RETURN_FALSE; diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 74bc951c47..3ae0bb314f 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -386,13 +386,13 @@ static PHP_MINIT_FUNCTION(mcrypt) /* {{{ */ le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number); /* modes for mcrypt_??? routines */ - REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT); /* sources for mcrypt_create_iv */ - REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_DEV_RANDOM", RANDOM, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_DEV_URANDOM", URANDOM, CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCRYPT_RAND", RAND, CONST_PERSISTENT); /* ciphers */ MCRYPT_ENTRY2_2_4(3DES, "tripledes"); @@ -603,7 +603,7 @@ PHP_FUNCTION(mcrypt_generic_init) } } pm->init = 1; - RETVAL_LONG(result); + RETVAL_INT(result); efree(iv_s); efree(key_s); @@ -712,7 +712,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes) key_sizes = mcrypt_enc_get_supported_key_sizes(pm->td, &count); for (i = 0; i < count; i++) { - add_index_long(return_value, i, key_sizes[i]); + add_index_int(return_value, i, key_sizes[i]); } mcrypt_free(key_sizes); @@ -724,7 +724,7 @@ PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes) PHP_FUNCTION(mcrypt_enc_self_test) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_self_test(pm->td)); + RETURN_INT(mcrypt_enc_self_test(pm->td)); } /* }}} */ @@ -800,7 +800,7 @@ PHP_FUNCTION(mcrypt_enc_is_block_mode) PHP_FUNCTION(mcrypt_enc_get_block_size) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_get_block_size(pm->td)); + RETURN_INT(mcrypt_enc_get_block_size(pm->td)); } /* }}} */ @@ -809,7 +809,7 @@ PHP_FUNCTION(mcrypt_enc_get_block_size) PHP_FUNCTION(mcrypt_enc_get_key_size) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_get_key_size(pm->td)); + RETURN_INT(mcrypt_enc_get_key_size(pm->td)); } /* }}} */ @@ -818,7 +818,7 @@ PHP_FUNCTION(mcrypt_enc_get_key_size) PHP_FUNCTION(mcrypt_enc_get_iv_size) { MCRYPT_GET_TD_ARG - RETURN_LONG(mcrypt_enc_get_iv_size(pm->td)); + RETURN_INT(mcrypt_enc_get_iv_size(pm->td)); } /* }}} */ @@ -910,7 +910,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_block_size) { MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir) - RETURN_LONG(mcrypt_module_get_algo_block_size(module, dir)); + RETURN_INT(mcrypt_module_get_algo_block_size(module, dir)); } /* }}} */ @@ -920,7 +920,7 @@ PHP_FUNCTION(mcrypt_module_get_algo_key_size) { MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir); - RETURN_LONG(mcrypt_module_get_algo_key_size(module, dir)); + RETURN_INT(mcrypt_module_get_algo_key_size(module, dir)); } /* }}} */ @@ -937,7 +937,7 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes) key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count); for (i = 0; i < count; i++) { - add_index_long(return_value, i, key_sizes[i]); + add_index_int(return_value, i, key_sizes[i]); } mcrypt_free(key_sizes); } @@ -1017,7 +1017,7 @@ PHP_FUNCTION(mcrypt_get_key_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_LONG(mcrypt_enc_get_key_size(td)); + RETVAL_INT(mcrypt_enc_get_key_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1046,7 +1046,7 @@ PHP_FUNCTION(mcrypt_get_block_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_LONG(mcrypt_enc_get_block_size(td)); + RETVAL_INT(mcrypt_enc_get_block_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1075,7 +1075,7 @@ PHP_FUNCTION(mcrypt_get_iv_size) td = mcrypt_module_open(cipher, cipher_dir_string, module, module_dir_string); if (td != MCRYPT_FAILED) { - RETVAL_LONG(mcrypt_enc_get_iv_size(td)); + RETVAL_INT(mcrypt_enc_get_iv_size(td)); mcrypt_module_close(td); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED); @@ -1149,7 +1149,7 @@ static char *php_mcrypt_get_key_size_str( smart_str_appends(&str, ", "); } - smart_str_append_long(&str, key_sizes[i]); + smart_str_append_int(&str, key_sizes[i]); } smart_str_appends(&str, " supported"); @@ -1341,9 +1341,9 @@ PHP_FUNCTION(mcrypt_ecb) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1357,9 +1357,9 @@ PHP_FUNCTION(mcrypt_cbc) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1373,9 +1373,9 @@ PHP_FUNCTION(mcrypt_cfb) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1389,9 +1389,9 @@ PHP_FUNCTION(mcrypt_ofb) MCRYPT_GET_CRYPT_ARGS - convert_to_long_ex(mode); + convert_to_int_ex(mode); - php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_P(mode), return_value TSRMLS_CC); + php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_IVAL_P(mode), return_value TSRMLS_CC); } /* }}} */ @@ -1400,11 +1400,11 @@ PHP_FUNCTION(mcrypt_ofb) PHP_FUNCTION(mcrypt_create_iv) { char *iv; - long source = URANDOM; - long size; + php_int_t source = URANDOM; + php_int_t size; int n = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &size, &source) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &size, &source) == FAILURE) { return; } diff --git a/ext/mcrypt/mcrypt_filter.c b/ext/mcrypt/mcrypt_filter.c index 698664b236..c0b89300a9 100644 --- a/ext/mcrypt/mcrypt_filter.c +++ b/ext/mcrypt/mcrypt_filter.c @@ -201,7 +201,7 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), ZEND_STRL("key"))) && Z_TYPE_P(tmpzval) == IS_STRING) { key = Z_STRVAL_P(tmpzval); - key_len = Z_STRLEN_P(tmpzval); + key_len = Z_STRSIZE_P(tmpzval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "key not specified or is not a string"); return NULL; @@ -226,11 +226,11 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval } iv = emalloc(iv_len + 1); - if (iv_len <= Z_STRLEN_P(tmpzval)) { + if (iv_len <= Z_STRSIZE_P(tmpzval)) { memcpy(iv, Z_STRVAL_P(tmpzval), iv_len); } else { - memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); - memset(iv + Z_STRLEN_P(tmpzval), 0, iv_len - Z_STRLEN_P(tmpzval)); + memcpy(iv, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); + memset(iv + Z_STRSIZE_P(tmpzval), 0, iv_len - Z_STRSIZE_P(tmpzval)); } result = mcrypt_generic_init(mcrypt_module, key, key_len, iv); diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 340f55b421..03dbeca61c 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -424,7 +424,7 @@ static PHP_GINIT_FUNCTION(mssql) mssql_globals->num_persistent = 0; mssql_globals->get_column_content = php_mssql_get_column_content_with_type; - if (cfg_get_long("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { + if (cfg_get_int("mssql.compatibility_mode", &compatibility_mode) == SUCCESS) { if (compatibility_mode) { mssql_globals->get_column_content = php_mssql_get_column_content_without_type; } @@ -449,20 +449,20 @@ PHP_MINIT_FUNCTION(mssql) } /* BEGIN MSSQL data types for mssql_bind */ - REGISTER_LONG_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLFLT4",SQLFLT4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLFLTN",SQLFLTN, CONST_CS | CONST_PERSISTENT); /* END MSSQL data types for mssql_bind */ return SUCCESS; @@ -773,7 +773,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr = zend_list_find(link,&type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - Z_LVAL_P(return_value) = link; + Z_IVAL_P(return_value) = link; php_mssql_set_default_link(link TSRMLS_CC); Z_TYPE_P(return_value) = IS_RESOURCE; dbfreelogin(mssql.login); @@ -828,7 +828,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + new_index_ptr.ptr = (void *) Z_IVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry),NULL)==FAILURE) { efree(hashed_details); @@ -837,7 +837,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) MS_SQL_G(num_links)++; } efree(hashed_details); - php_mssql_set_default_link(Z_LVAL_P(return_value) TSRMLS_CC); + php_mssql_set_default_link(Z_IVAL_P(return_value) TSRMLS_CC); } /* }}} */ @@ -944,7 +944,7 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off case SQLINT2: case SQLINT4: case SQLINTN: { - ZVAL_LONG(result, (long) anyintcol(offset)); + ZVAL_INT(result, (long) anyintcol(offset)); break; } case SQLCHAR: @@ -1160,9 +1160,9 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme case SQLINT1: case SQLINT2: case SQLINT4: - convert_to_long_ex(&bind->zval); + convert_to_int_ex(&bind->zval); /* FIXME this works only on little endian machine !!! */ - Z_LVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i))); + Z_IVAL_P(bind->zval) = *((int *)(dbretdata(mssql_ptr->link,i))); break; case SQLFLT4: @@ -1179,8 +1179,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme case SQLVARCHAR: case SQLTEXT: convert_to_string_ex(&bind->zval); - Z_STRLEN_P(bind->zval) = dbretlen(mssql_ptr->link,i); - Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRLEN_P(bind->zval)); + Z_STRSIZE_P(bind->zval) = dbretlen(mssql_ptr->link,i); + Z_STRVAL_P(bind->zval) = estrndup(dbretdata(mssql_ptr->link,i),Z_STRSIZE_P(bind->zval)); break; /* TODO binary */ } @@ -1195,8 +1195,8 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme if (statement->binds != NULL) { /* Maybe a non-parameter sp */ if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) { if (dbhasretstat(mssql_ptr->link)) { - convert_to_long_ex(&bind->zval); - Z_LVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); + convert_to_int_ex(&bind->zval); + Z_IVAL_P(bind->zval)=dbretstatus(mssql_ptr->link); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "stored procedure has no return value. Nothing was returned into RETVAL"); @@ -1315,7 +1315,7 @@ PHP_FUNCTION(mssql_fetch_batch) result->cur_row=result->num_rows=0; result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult TSRMLS_CC); - RETURN_LONG(result->num_rows); + RETURN_INT(result->num_rows); } /* }}} */ @@ -1407,7 +1407,7 @@ PHP_FUNCTION(mssql_rows_affected) ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, &mssql_link_index, -1, "MS SQL-Link", le_link, le_plink); - RETURN_LONG(DBCOUNT(mssql_ptr->link)); + RETURN_INT(DBCOUNT(mssql_ptr->link)); } /* }}} */ @@ -1468,7 +1468,7 @@ PHP_FUNCTION(mssql_num_rows) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); - RETURN_LONG(result->num_rows); + RETURN_INT(result->num_rows); } /* }}} */ @@ -1485,7 +1485,7 @@ PHP_FUNCTION(mssql_num_fields) ZEND_FETCH_RESOURCE(result, mssql_result *, &mssql_result_index, -1, "MS SQL-result", le_result); - RETURN_LONG(result->num_fields); + RETURN_INT(result->num_fields); } /* }}} */ @@ -1535,7 +1535,7 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) { data = Z_STRVAL(result->data[result->cur_row][i]); - data_len = Z_STRLEN(result->data[result->cur_row][i]); + data_len = Z_STRSIZE(result->data[result->cur_row][i]); if (result_type & MSSQL_NUM) { add_index_stringl(return_value, i, data, data_len); @@ -1545,12 +1545,12 @@ static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) add_assoc_stringl(return_value, result->fields[i].name, data, data_len); } } - else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) { + else if (Z_TYPE(result->data[result->cur_row][i]) == IS_INT) { if (result_type & MSSQL_NUM) - add_index_long(return_value, i, Z_LVAL(result->data[result->cur_row][i])); + add_index_int(return_value, i, Z_IVAL(result->data[result->cur_row][i])); if (result_type & MSSQL_ASSOC) - add_assoc_long(return_value, result->fields[i].name, Z_LVAL(result->data[result->cur_row][i])); + add_assoc_int(return_value, result->fields[i].name, Z_IVAL(result->data[result->cur_row][i])); } else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) { if (result_type & MSSQL_NUM) @@ -1719,9 +1719,9 @@ PHP_FUNCTION(mssql_fetch_field) object_init(return_value); add_property_string(return_value, "name",result->fields[field_offset].name); - add_property_long(return_value, "max_length",result->fields[field_offset].max_length); + add_property_int(return_value, "max_length",result->fields[field_offset].max_length); add_property_string(return_value, "column_source",result->fields[field_offset].column_source); - add_property_long(return_value, "numeric", result->fields[field_offset].numeric); + add_property_int(return_value, "numeric", result->fields[field_offset].numeric); add_property_string(return_value, "type", php_mssql_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ @@ -1752,7 +1752,7 @@ PHP_FUNCTION(mssql_field_length) RETURN_FALSE; } - RETURN_LONG(result->fields[field_offset].max_length); + RETURN_INT(result->fields[field_offset].max_length); } /* }}} */ @@ -1877,8 +1877,8 @@ PHP_FUNCTION(mssql_result) break; } default: - convert_to_long_ex(field); - field_offset = Z_LVAL_PP(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_PP(field); if (field_offset<0 || field_offset>=result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -2043,7 +2043,7 @@ PHP_FUNCTION(mssql_bind) datalen=0; } else { convert_to_string_ex(var); - datalen=Z_STRLEN_PP(var); + datalen=Z_STRSIZE_PP(var); value=(LPBYTE)Z_STRVAL_PP(var); } } else { @@ -2067,8 +2067,8 @@ PHP_FUNCTION(mssql_bind) case SQLINT1: case SQLINT2: case SQLINT4: - convert_to_long_ex(var); - value=(LPBYTE)(&Z_LVAL_PP(var)); + convert_to_int_ex(var); + value=(LPBYTE)(&Z_IVAL_PP(var)); break; default: diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index f4124d306b..b0596c396a 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -80,7 +80,7 @@ static int le_result, le_link, le_plink; #define SAFE_STRING(s) ((s)?(s):"") #if MYSQL_VERSION_ID > 32199 || defined(MYSQL_USE_MYSQLND) -# define mysql_row_length_type unsigned long +# define mysql_row_length_type php_uint_t # define HAVE_MYSQL_ERRNO #else # define mysql_row_length_type unsigned int @@ -568,15 +568,15 @@ ZEND_MODULE_STARTUP_D(mysql) le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number); mysql_module_entry.type = type; - REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID >= 40000 - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); #ifndef MYSQL_USE_MYSQLND #if MYSQL_VERSION_ID >= 40000 @@ -727,12 +727,12 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) char *tmp = NULL, *host = NULL; int user_len = 0, passwd_len = 0, host_len = 0; int port = MYSQL_PORT; - long client_flags = 0; + php_int_t client_flags = 0; php_mysql_conn *mysql = NULL; #if MYSQL_VERSION_ID <= 32230 void (*handler) (int); #endif - long connect_timeout; + php_int_t connect_timeout; zend_string *hashed_details = NULL; zend_bool free_host = 0, new_link = 0; @@ -780,13 +780,13 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } else { /* mysql_pconnect does not support new_link parameter */ if (persistent) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!l", &host_and_port, &host_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!i", &host_and_port, &host_len, &user, &user_len, &passwd, &passwd_len, &client_flags)==FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bi", &host_and_port, &host_len, &user, &user_len, &passwd, &passwd_len, &new_link, &client_flags)==FAILURE) { return; @@ -820,7 +820,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) client_flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */ #endif hashed_details = STR_ALLOC(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0) - + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_LONG - 1, 0); + + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_ZEND_INT - 1, 0); hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_%ld", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags); } @@ -1225,7 +1225,7 @@ PHP_FUNCTION(mysql_get_proto_info) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_LONG(mysql_get_proto_info(mysql->conn)); + RETURN_INT(mysql_get_proto_info(mysql->conn)); } /* }}} */ @@ -1299,7 +1299,7 @@ PHP_FUNCTION(mysql_thread_id) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_LONG((long) mysql_thread_id(mysql->conn)); + RETURN_INT((long) mysql_thread_id(mysql->conn)); } /* }}} */ @@ -1802,7 +1802,7 @@ PHP_FUNCTION(mysql_errno) if (!mysql_link) { if (MySG(default_link) == NULL) { if (MySG(connect_error) != NULL){ - RETURN_LONG(MySG(connect_errno)); + RETURN_INT(MySG(connect_errno)); } else { RETURN_FALSE; } @@ -1812,7 +1812,7 @@ PHP_FUNCTION(mysql_errno) ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, -1, "MySQL-Link", le_link, le_plink); } - RETURN_LONG(mysql_errno(mysql->conn)); + RETURN_INT(mysql_errno(mysql->conn)); } #endif /* }}} */ @@ -1837,7 +1837,7 @@ PHP_FUNCTION(mysql_affected_rows) } /* conversion from int64 to long happing here */ - RETURN_LONG((long)mysql_affected_rows(mysql->conn)); + RETURN_INT((long)mysql_affected_rows(mysql->conn)); } /* }}} */ @@ -1918,7 +1918,7 @@ PHP_FUNCTION(mysql_insert_id) } /* conversion from int64 to long happing here */ - RETURN_LONG((long)mysql_insert_id(mysql->conn)); + RETURN_INT((long)mysql_insert_id(mysql->conn)); } /* }}} */ @@ -1927,7 +1927,7 @@ PHP_FUNCTION(mysql_insert_id) PHP_FUNCTION(mysql_result) { zval *result, *field=NULL; - long row; + php_int_t row; MYSQL_RES *mysql_result; #ifndef MYSQL_USE_MYSQLND MYSQL_ROW sql_row; @@ -1940,7 +1940,7 @@ johannes TODO: Do 2 zend_parse_parameters calls instead of type "z" and switch below Q: String or long first? */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z", &result, &row, &field) == FAILURE) { return; } @@ -1964,7 +1964,7 @@ Q: String or long first? field_name = estrdup(tmp + 1); } else { table_name = NULL; - field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field)); + field_name = estrndup(Z_STRVAL_P(field),Z_STRSIZE_P(field)); } mysql_field_seek(mysql_result, 0); while ((tmp_field = mysql_fetch_field(mysql_result))) { @@ -1992,8 +1992,8 @@ Q: String or long first? } break; default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_P(field); if (field_offset < 0 || field_offset >= (int)mysql_num_fields(mysql_result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified"); RETURN_FALSE; @@ -2040,7 +2040,7 @@ PHP_FUNCTION(mysql_num_rows) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); /* conversion from int64 to long happing here */ - RETURN_LONG((long) mysql_num_rows(mysql_result)); + RETURN_INT((long) mysql_num_rows(mysql_result)); } /* }}} */ @@ -2057,13 +2057,13 @@ PHP_FUNCTION(mysql_num_fields) ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); - RETURN_LONG(mysql_num_fields(mysql_result)); + RETURN_INT(mysql_num_fields(mysql_result)); } /* }}} */ /* {{{ php_mysql_fetch_hash */ -static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, int expected_args, int into_object) +static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int expected_args, int into_object) { MYSQL_RES *mysql_result; zval *res, *ctor_params = NULL; @@ -2096,7 +2096,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, } else #endif { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &res, &result_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &res, &result_type) == FAILURE) { return; } if (!result_type) { @@ -2271,10 +2271,10 @@ PHP_FUNCTION(mysql_fetch_assoc) PHP_FUNCTION(mysql_data_seek) { zval *result; - long offset; + php_int_t offset; MYSQL_RES *mysql_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset)) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset)) { return; } @@ -2312,7 +2312,7 @@ PHP_FUNCTION(mysql_fetch_lengths) num_fields = mysql_num_fields(mysql_result); for (i=0; i<num_fields; i++) { - add_index_long(return_value, i, lengths[i]); + add_index_int(return_value, i, lengths[i]); } } /* }}} */ @@ -2398,11 +2398,11 @@ static char *php_mysql_get_field_name(int field_type) PHP_FUNCTION(mysql_fetch_field) { zval *result; - long field=0; + php_int_t field=0; MYSQL_RES *mysql_result; const MYSQL_FIELD *mysql_field; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &field) == FAILURE) { return; } @@ -2427,16 +2427,16 @@ PHP_FUNCTION(mysql_fetch_field) #endif add_property_stringl(return_value, "table", (mysql_field->table?mysql_field->table:""), mysql_field->table_length); add_property_stringl(return_value, "def", (mysql_field->def?mysql_field->def:""), mysql_field->def_length); - add_property_long(return_value, "max_length", mysql_field->max_length); - add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); - add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); - add_property_long(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); - add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); - add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); - add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); + add_property_int(return_value, "max_length", mysql_field->max_length); + add_property_int(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); + add_property_int(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); + add_property_int(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); + add_property_int(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); + add_property_int(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); + add_property_int(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type)); - add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); - add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); + add_property_int(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); + add_property_int(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); } /* }}} */ @@ -2445,10 +2445,10 @@ PHP_FUNCTION(mysql_fetch_field) PHP_FUNCTION(mysql_field_seek) { zval *result; - long offset; + php_int_t offset; MYSQL_RES *mysql_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset) == FAILURE) { return; } ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result); @@ -2473,13 +2473,13 @@ PHP_FUNCTION(mysql_field_seek) static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; - long field; + php_int_t field; MYSQL_RES *mysql_result; const MYSQL_FIELD *mysql_field = {0}; char buf[512]; int len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) { return; } @@ -2506,7 +2506,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) RETVAL_STRING(mysql_field->table); break; case PHP_MYSQL_FIELD_LEN: - RETVAL_LONG(mysql_field->length); + RETVAL_INT(mysql_field->length); break; case PHP_MYSQL_FIELD_TYPE: RETVAL_STRING(php_mysql_get_field_name(mysql_field->type)); diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h index 0e8ab482a1..0f4dbec110 100644 --- a/ext/mysql/php_mysql_structs.h +++ b/ext/mysql/php_mysql_structs.h @@ -112,18 +112,18 @@ PHP_FUNCTION(mysql_set_charset); ZEND_BEGIN_MODULE_GLOBALS(mysql) zend_resource *default_link; - long num_links,num_persistent; - long max_links,max_persistent; - long allow_persistent; - long default_port; + php_int_t num_links,num_persistent; + php_int_t max_links,max_persistent; + php_int_t allow_persistent; + php_int_t default_port; char *default_host, *default_user, *default_password; char *default_socket; char *connect_error; - long connect_errno; - long connect_timeout; - long result_allocated; - long trace_mode; - long allow_local_infile; + php_int_t connect_errno; + php_int_t connect_timeout; + php_int_t result_allocated; + php_int_t trace_mode; + php_int_t allow_local_infile; ZEND_END_MODULE_GLOBALS(mysql) #ifdef ZTS diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 02e6898f7f..79d340b2a6 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -612,7 +612,7 @@ PHP_MINIT_FUNCTION(mysqli) mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC); #endif mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_int(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED TSRMLS_CC); REGISTER_MYSQLI_CLASS_ENTRY("mysqli_driver", mysqli_driver_class_entry, mysqli_driver_methods); @@ -694,179 +694,179 @@ PHP_MINIT_FUNCTION(mysqli) zend_hash_add_ptr(&classes, ce->name, &mysqli_stmt_properties); /* mysqli_options */ - REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_GROUP", MYSQL_READ_DEFAULT_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_READ_DEFAULT_FILE", MYSQL_READ_DEFAULT_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_CONNECT_TIMEOUT", MYSQL_OPT_CONNECT_TIMEOUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_LOCAL_INFILE", MYSQL_OPT_LOCAL_INFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_INIT_COMMAND", MYSQL_INIT_COMMAND, CONST_CS | CONST_PERSISTENT); #if defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_CMD_BUFFER_SIZE", MYSQLND_OPT_NET_CMD_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_NET_READ_BUFFER_SIZE", MYSQLND_OPT_NET_READ_BUFFER_SIZE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MYSQLND_STRING_TO_INT_CONVERSION - REGISTER_LONG_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_INT_AND_FLOAT_NATIVE", MYSQLND_OPT_INT_AND_FLOAT_NATIVE, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50110 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50605 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_PUBLIC_KEY", MYSQL_SERVER_PUBLIC_KEY, CONST_CS | CONST_PERSISTENT); #endif /* mysqli_real_connect flags */ - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_COMPRESS",CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_NO_SCHEMA", CLIENT_NO_SCHEMA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_FOUND_ROWS", CLIENT_FOUND_ROWS, CONST_CS | CONST_PERSISTENT); #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS", CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS", MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, CONST_CS | CONST_PERSISTENT); #endif /* for mysqli_query */ - REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT", MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_USE_RESULT", MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); #if defined (MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ASYNC", MYSQLI_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STORE_RESULT_COPY_DATA", MYSQLI_STORE_RESULT_COPY_DATA, CONST_CS | CONST_PERSISTENT); #endif /* for mysqli_fetch_assoc */ - REGISTER_LONG_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ASSOC", MYSQLI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT); /* for mysqli_stmt_set_attr */ - REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50003 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_CURSOR_TYPE", STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_NO_CURSOR", CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_READ_ONLY", CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_FOR_UPDATE", CURSOR_TYPE_FOR_UPDATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_CURSOR_TYPE_SCROLLABLE", CURSOR_TYPE_SCROLLABLE, CONST_CS | CONST_PERSISTENT); #endif #if MYSQL_VERSION_ID > 50007 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_STMT_ATTR_PREFETCH_ROWS", STMT_ATTR_PREFETCH_ROWS, CONST_CS | CONST_PERSISTENT); #endif /* column information */ - REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_PRI_KEY_FLAG", PRI_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_UNIQUE_KEY_FLAG", UNIQUE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_MULTIPLE_KEY_FLAG", MULTIPLE_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_BLOB_FLAG", BLOB_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_UNSIGNED_FLAG", UNSIGNED_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ZEROFILL_FLAG", ZEROFILL_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_AUTO_INCREMENT_FLAG", AUTO_INCREMENT_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TIMESTAMP_FLAG", TIMESTAMP_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SET_FLAG", SET_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NUM_FLAG", NUM_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_PART_KEY_FLAG", PART_KEY_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_GROUP_FLAG", GROUP_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ENUM_FLAG", ENUM_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_BINARY_FLAG", BINARY_FLAG, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50001 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NO_DEFAULT_VALUE_FLAG", NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT); #endif #if (MYSQL_VERSION_ID > 51122 && MYSQL_VERSION_ID < 60000) || (MYSQL_VERSION_ID > 60003) || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_ON_UPDATE_NOW_FLAG", ON_UPDATE_NOW_FLAG, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DECIMAL", FIELD_TYPE_DECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY", FIELD_TYPE_TINY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_SHORT", FIELD_TYPE_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG", FIELD_TYPE_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_FLOAT", FIELD_TYPE_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DOUBLE", FIELD_TYPE_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_NULL", FIELD_TYPE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIMESTAMP", FIELD_TYPE_TIMESTAMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONGLONG", FIELD_TYPE_LONGLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_INT24", FIELD_TYPE_INT24, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATE", FIELD_TYPE_DATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TIME", FIELD_TYPE_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_DATETIME", FIELD_TYPE_DATETIME , CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_YEAR", FIELD_TYPE_YEAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDATE", FIELD_TYPE_NEWDATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_ENUM", FIELD_TYPE_ENUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_SET", FIELD_TYPE_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_TINY_BLOB", FIELD_TYPE_TINY_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_MEDIUM_BLOB", FIELD_TYPE_MEDIUM_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_LONG_BLOB", FIELD_TYPE_LONG_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_BLOB", FIELD_TYPE_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_VAR_STRING", FIELD_TYPE_VAR_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_STRING", FIELD_TYPE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_GEOMETRY", FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); #if MYSQL_VERSION_ID > 50002 || defined(MYSQLI_USE_MYSQLND) - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_NEWDECIMAL", FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_NAME", MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SET_CHARSET_DIR", MYSQL_SET_CHARSET_DIR, CONST_CS | CONST_PERSISTENT); /* bind support */ - REGISTER_LONG_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_NO_DATA", MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); #ifdef MYSQL_DATA_TRUNCATED - REGISTER_LONG_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DATA_TRUNCATED", MYSQL_DATA_TRUNCATED, CONST_CS | CONST_PERSISTENT); #endif /* reporting */ - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_INDEX", MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_ERROR", MYSQLI_REPORT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_STRICT", MYSQLI_REPORT_STRICT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | CONST_PERSISTENT); /* We use non-nested macros with expansion, as VC has problems */ #ifdef MYSQLI_USE_MYSQLND - REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT); #else #ifdef DBUG_ON - REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_DEBUG_TRACE_ENABLED", 0, CONST_CS | CONST_PERSISTENT); #endif #endif - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED", SERVER_QUERY_NO_GOOD_INDEX_USED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_NO_INDEX_USED", SERVER_QUERY_NO_INDEX_USED, CONST_CS | CONST_PERSISTENT); #ifdef SERVER_QUERY_WAS_SLOW - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); #endif #ifdef SERVER_PS_OUT_PARAMS - REGISTER_LONG_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_SERVER_PS_OUT_PARAMS", SERVER_PS_OUT_PARAMS, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_GRANT", REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_LOG", REFRESH_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_TABLES", REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_HOSTS", REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_STATUS", REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_THREADS", REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_SLAVE", REFRESH_SLAVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_MASTER", REFRESH_MASTER, CONST_CS | CONST_PERSISTENT); #ifdef REFRESH_BACKUP_LOG - REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT", TRANS_START_WITH_CONSISTENT_SNAPSHOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_WRITE", TRANS_START_READ_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_START_READ_ONLY", TRANS_START_READ_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_CHAIN", TRANS_COR_AND_CHAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_AND_NO_CHAIN", TRANS_COR_AND_NO_CHAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT); #ifdef MYSQLI_USE_MYSQLND @@ -884,7 +884,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli) #ifndef MYSQLI_USE_MYSQLND #if MYSQL_VERSION_ID >= 40000 #ifdef PHP_WIN32 - unsigned long client_ver = mysql_get_client_version(); + php_uint_t client_ver = mysql_get_client_version(); /* Can't call mysql_server_end() multiple times prior to 5.0.46 on Windows. PHP bug#41350 MySQL bug#25621 @@ -1105,7 +1105,7 @@ PHP_FUNCTION(mysqli_result_construct) MYSQL_RES *result = NULL; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - long resmode = MYSQLI_STORE_RESULT; + php_int_t resmode = MYSQLI_STORE_RESULT; switch (ZEND_NUM_ARGS()) { case 1: @@ -1114,7 +1114,7 @@ PHP_FUNCTION(mysqli_result_construct) } break; case 2: - if (zend_parse_parameters(2 TSRMLS_CC, "Ol", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) { + if (zend_parse_parameters(2 TSRMLS_CC, "Oi", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) { return; } break; @@ -1149,13 +1149,13 @@ PHP_FUNCTION(mysqli_result_construct) /* {{{ php_mysqli_fetch_into_hash_aux */ -void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC) +void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC) { #if !defined(MYSQLI_USE_MYSQLND) MYSQL_ROW row; unsigned int i; MYSQL_FIELD *fields; - unsigned long *field_len; + php_uint_t *field_len; if (!(row = mysql_fetch_row(result))) { RETURN_NULL(); @@ -1238,7 +1238,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags { MYSQL_RES *result; zval *mysql_result; - long fetchtype; + php_int_t fetchtype; zval *ctor_params = NULL; zend_class_entry *ce = NULL; @@ -1266,7 +1266,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags fetchtype = override_flags; } else { fetchtype = MYSQLI_BOTH; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) { return; } } diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 254bae1695..d2567ae1b4 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -152,9 +152,9 @@ PHP_FUNCTION(mysqli_affected_rows) rc = mysql_affected_rows(mysql->mysql); if (rc == (my_ulonglong) -1) { - RETURN_LONG(-1); + RETURN_INT(-1); } - MYSQLI_RETURN_LONG_LONG(rc); + MYSQLI_RETURN_INT_INT(rc); } /* }}} */ @@ -213,12 +213,12 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in break; case 'i': /* Integer */ -#if SIZEOF_LONG==8 +#if SIZEOF_ZEND_INT==8 bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG; -#elif SIZEOF_LONG==4 +#elif SIZEOF_ZEND_INT==4 bind[ofs].buffer_type = MYSQL_TYPE_LONG; #endif - bind[ofs].buffer = &Z_LVAL_P(param); + bind[ofs].buffer = &Z_IVAL_P(param); bind[ofs].is_null = &stmt->param.is_null[ofs]; break; @@ -284,9 +284,9 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in type = MYSQL_TYPE_DOUBLE; break; case 'i': /* Integer */ -#if SIZEOF_LONG==8 +#if SIZEOF_ZEND_INT==8 type = MYSQL_TYPE_LONGLONG; -#elif SIZEOF_LONG==4 +#elif SIZEOF_ZEND_INT==4 type = MYSQL_TYPE_LONG; #endif break; @@ -326,7 +326,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param) zval *mysql_stmt; char *types; int types_len; - unsigned long rc; + php_uint_t rc; /* calculate and check number of parameters */ if (argc < 2) { @@ -391,8 +391,8 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un MYSQL_BIND *bind; int i, ofs; int var_cnt = argc - start; - long col_type; - ulong rc; + php_int_t col_type; + php_uint_t rc; /* prevent leak if variables are already bound */ if (stmt->result.var_cnt) { @@ -443,7 +443,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un case MYSQL_TYPE_LONG: case MYSQL_TYPE_INT24: case MYSQL_TYPE_YEAR: - stmt->result.buf[ofs].type = IS_LONG; + stmt->result.buf[ofs].type = IS_INT; /* don't set stmt->result.buf[ofs].buflen to 0, we used ecalloc */ stmt->result.buf[ofs].val = (char *)emalloc(sizeof(int)); bind[ofs].buffer_type = MYSQL_TYPE_LONG; @@ -488,7 +488,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un /* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */ my_bool tmp; #else - ulong tmp = 0; + php_uint_t tmp = 0; #endif stmt->result.buf[ofs].type = IS_STRING; /* @@ -578,7 +578,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result) zval *args; int argc = ZEND_NUM_ARGS(); int start = 1; - ulong rc; + php_uint_t rc; MY_STMT *stmt; zval *mysql_stmt; @@ -624,7 +624,7 @@ PHP_FUNCTION(mysqli_change_user) zval *mysql_link = NULL; char *user, *password, *dbname; int user_len, password_len, dbname_len; - ulong rc; + php_uint_t rc; #if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET) const CHARSET_INFO * old_charset; #endif @@ -752,11 +752,11 @@ PHP_FUNCTION(mysqli_commit) { MY_MYSQL *mysql; zval *mysql_link; - long flags = TRANS_COR_NO_OPT; + php_int_t flags = TRANS_COR_NO_OPT; char * name = NULL; int name_len = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -778,9 +778,9 @@ PHP_FUNCTION(mysqli_data_seek) { MYSQL_RES *result; zval *mysql_result; - long offset; + php_int_t offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { return; } @@ -843,7 +843,7 @@ PHP_FUNCTION(mysqli_errno) return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_errno(mysql->mysql)); + RETURN_INT(mysql_errno(mysql->mysql)); } /* }}} */ @@ -911,7 +911,7 @@ PHP_FUNCTION(mysqli_stmt_execute) case MYSQL_TYPE_VAR_STRING: convert_to_string_ex(param); stmt->stmt->params[i].buffer = Z_STRVAL_P(param); - stmt->stmt->params[i].buffer_length = Z_STRLEN_P(param); + stmt->stmt->params[i].buffer_length = Z_STRSIZE_P(param); break; case MYSQL_TYPE_DOUBLE: convert_to_double_ex(param); @@ -919,8 +919,8 @@ PHP_FUNCTION(mysqli_stmt_execute) break; case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONG: - convert_to_long_ex(param); - stmt->stmt->params[i].buffer = &Z_LVAL_P(param); + convert_to_int_ex(param); + stmt->stmt->params[i].buffer = &Z_IVAL_P(param); break; default: break; @@ -951,7 +951,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) MY_STMT *stmt; zval *mysql_stmt; unsigned int i; - ulong ret; + php_uint_t ret; unsigned int uval; my_ulonglong llval; @@ -990,13 +990,13 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) zval_ptr_dtor(result); if (!stmt->result.is_null[i]) { switch (stmt->result.buf[i].type) { - case IS_LONG: + case IS_INT: if ((stmt->stmt->fields[i].type == MYSQL_TYPE_LONG) && (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)) { /* unsigned int (11) */ uval= *(unsigned int *) stmt->result.buf[i].val; -#if SIZEOF_LONG==4 +#if SIZEOF_ZEND_INT==4 if (uval > INT_MAX) { char *tmp, *p; int j = 10; @@ -1015,9 +1015,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) #endif } if (stmt->stmt->fields[i].flags & UNSIGNED_FLAG) { - ZVAL_LONG(result, *(unsigned int *)stmt->result.buf[i].val); + ZVAL_INT(result, *(unsigned int *)stmt->result.buf[i].val); } else { - ZVAL_LONG(result, *(int *)stmt->result.buf[i].val); + ZVAL_INT(result, *(int *)stmt->result.buf[i].val); } break; case IS_DOUBLE: @@ -1047,9 +1047,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) { llval= *(my_ulonglong *) stmt->result.buf[i].val; } -#if SIZEOF_LONG==8 +#if SIZEOF_ZEND_INT==8 if (uns && llval > 9223372036854775807L) { -#elif SIZEOF_LONG==4 +#elif SIZEOF_ZEND_INT==4 if ((uns && llval > L64(2147483647)) || (!uns && (( L64(2147483647) < (my_longlong) llval) || (L64(-2147483648) > (my_longlong) llval)))) @@ -1063,7 +1063,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS) snprintf(tmp, sizeof(tmp), (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval); ZVAL_STRING(result, tmp); } else { - ZVAL_LONG(result, llval); + ZVAL_INT(result, llval); } } else { #if defined(MYSQL_DATA_TRUNCATED) && MYSQL_VERSION_ID > 50002 @@ -1166,12 +1166,12 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRML */ add_property_string(value, "catalog", "def"); - add_property_long(value, "max_length", field->max_length); - add_property_long(value, "length", field->length); - add_property_long(value, "charsetnr", field->charsetnr); - add_property_long(value, "flags", field->flags); - add_property_long(value, "type", field->type); - add_property_long(value, "decimals", field->decimals); + add_property_int(value, "max_length", field->max_length); + add_property_int(value, "length", field->length); + add_property_int(value, "charsetnr", field->charsetnr); + add_property_int(value, "flags", field->flags); + add_property_int(value, "type", field->type); + add_property_int(value, "decimals", field->decimals); } /* }}} */ @@ -1234,15 +1234,15 @@ PHP_FUNCTION(mysqli_fetch_field_direct) MYSQL_RES *result; zval *mysql_result; const MYSQL_FIELD *field; - long offset; + php_int_t offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - if (offset < 0 || offset >= (long) mysql_num_fields(result)) { + if (offset < 0 || offset >= (php_int_t) mysql_num_fields(result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset"); RETURN_FALSE; } @@ -1263,7 +1263,7 @@ PHP_FUNCTION(mysqli_fetch_lengths) MYSQL_RES *result; zval *mysql_result; unsigned int i; - unsigned long *ret; + php_uint_t *ret; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { return; @@ -1278,7 +1278,7 @@ PHP_FUNCTION(mysqli_fetch_lengths) array_init(return_value); for (i = 0; i < mysql_num_fields(result); i++) { - add_index_long(return_value, i, ret[i]); + add_index_int(return_value, i, ret[i]); } } /* }}} */ @@ -1304,7 +1304,7 @@ PHP_FUNCTION(mysqli_field_count) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_field_count(mysql->mysql)); + RETURN_INT(mysql_field_count(mysql->mysql)); } /* }}} */ @@ -1315,9 +1315,9 @@ PHP_FUNCTION(mysqli_field_seek) { MYSQL_RES *result; zval *mysql_result; - long fieldnr; + php_int_t fieldnr; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); @@ -1344,7 +1344,7 @@ PHP_FUNCTION(mysqli_field_tell) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_field_tell(result)); + RETURN_INT(mysql_field_tell(result)); } /* }}} */ @@ -1380,7 +1380,7 @@ PHP_FUNCTION(mysqli_get_client_info) Get MySQL client info */ PHP_FUNCTION(mysqli_get_client_version) { - RETURN_LONG((long)mysql_get_client_version()); + RETURN_INT((php_int_t)mysql_get_client_version()); } /* }}} */ @@ -1414,7 +1414,7 @@ PHP_FUNCTION(mysqli_get_proto_info) return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_get_proto_info(mysql->mysql)); + RETURN_INT(mysql_get_proto_info(mysql->mysql)); } /* }}} */ @@ -1450,7 +1450,7 @@ PHP_FUNCTION(mysqli_get_server_version) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_get_server_version(mysql->mysql)); + RETURN_INT(mysql_get_server_version(mysql->mysql)); } /* }}} */ @@ -1540,7 +1540,7 @@ PHP_FUNCTION(mysqli_insert_id) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); rc = mysql_insert_id(mysql->mysql); - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -1550,9 +1550,9 @@ PHP_FUNCTION(mysqli_kill) { MY_MYSQL *mysql; zval *mysql_link; - long processid; + php_int_t processid; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -1658,7 +1658,7 @@ PHP_FUNCTION(mysqli_num_fields) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_num_fields(result)); + RETURN_INT(mysql_num_fields(result)); } /* }}} */ @@ -1676,10 +1676,10 @@ PHP_FUNCTION(mysqli_num_rows) if (mysqli_result_is_unbuffered_and_not_everything_is_fetched(result)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT"); - RETURN_LONG(0); + RETURN_INT(0); } - MYSQLI_RETURN_LONG_LONG(mysql_num_rows(result)); + MYSQLI_RETURN_INT_INT(mysql_num_rows(result)); } /* }}} */ @@ -1725,12 +1725,12 @@ static int mysqli_options_get_option_zval_type(int option) case MYSQL_OPT_COMPRESS: #endif /* mysqlnd @ PHP 5.3.2 */ #ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT - REGISTER_LONG_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MYSQLI_OPT_SSL_VERIFY_SERVER_CERT", MYSQL_OPT_SSL_VERIFY_SERVER_CERT, CONST_CS | CONST_PERSISTENT); #endif /* MySQL 5.1.1., mysqlnd @ PHP 5.3.3 */ #if (MYSQL_VERSION_ID >= 50611 && defined(CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS)) || defined(MYSQLI_USE_MYSQLND) case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS: #endif - return IS_LONG; + return IS_INT; #ifdef MYSQL_SHARED_MEMORY_BASE_NAME case MYSQL_SHARED_MEMORY_BASE_NAME: @@ -1761,12 +1761,12 @@ PHP_FUNCTION(mysqli_options) MY_MYSQL *mysql; zval *mysql_link = NULL; zval *mysql_value; - long mysql_option; + php_int_t mysql_option; unsigned int l_value; - long ret; + php_int_t ret; int expected_type; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED); @@ -1786,8 +1786,8 @@ PHP_FUNCTION(mysqli_options) case IS_STRING: convert_to_string_ex(mysql_value); break; - case IS_LONG: - convert_to_long_ex(mysql_value); + case IS_INT: + convert_to_int_ex(mysql_value); break; default: break; @@ -1797,8 +1797,8 @@ PHP_FUNCTION(mysqli_options) case IS_STRING: ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_P(mysql_value)); break; - case IS_LONG: - l_value = Z_LVAL_P(mysql_value); + case IS_INT: + l_value = Z_IVAL_P(mysql_value); ret = mysql_options(mysql->mysql, mysql_option, (char *)&l_value); break; default: @@ -1816,7 +1816,7 @@ PHP_FUNCTION(mysqli_ping) { MY_MYSQL *mysql; zval *mysql_link; - long rc; + php_int_t rc; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -1976,11 +1976,11 @@ PHP_FUNCTION(mysqli_rollback) { MY_MYSQL *mysql; zval *mysql_link; - long flags = TRANS_COR_NO_OPT; + php_int_t flags = TRANS_COR_NO_OPT; char * name = NULL; int name_len = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -2003,10 +2003,10 @@ PHP_FUNCTION(mysqli_stmt_send_long_data) MY_STMT *stmt; zval *mysql_stmt; char *data; - long param_nr; + php_int_t param_nr; int data_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); @@ -2037,9 +2037,9 @@ PHP_FUNCTION(mysqli_stmt_affected_rows) rc = mysql_stmt_affected_rows(stmt->stmt); if (rc == (my_ulonglong) -1) { - RETURN_LONG(-1); + RETURN_INT(-1); } - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -2069,9 +2069,9 @@ PHP_FUNCTION(mysqli_stmt_data_seek) { MY_STMT *stmt; zval *mysql_stmt; - long offset; + php_int_t offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) { return; } if (offset < 0) { @@ -2097,7 +2097,7 @@ PHP_FUNCTION(mysqli_stmt_field_count) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_stmt_field_count(stmt->stmt)); + RETURN_INT(mysql_stmt_field_count(stmt->stmt)); } /* }}} */ @@ -2131,7 +2131,7 @@ PHP_FUNCTION(mysqli_stmt_insert_id) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); rc = mysql_stmt_insert_id(stmt->stmt); - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -2147,7 +2147,7 @@ PHP_FUNCTION(mysqli_stmt_param_count) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_stmt_param_count(stmt->stmt)); + RETURN_INT(mysql_stmt_param_count(stmt->stmt)); } /* }}} */ @@ -2186,7 +2186,7 @@ PHP_FUNCTION(mysqli_stmt_num_rows) MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); rc = mysql_stmt_num_rows(stmt->stmt); - MYSQLI_RETURN_LONG_LONG(rc) + MYSQLI_RETURN_INT_INT(rc) } /* }}} */ @@ -2296,9 +2296,9 @@ PHP_FUNCTION(mysqli_refresh) { MY_MYSQL *mysql; zval *mysql_link = NULL; - long options; + php_int_t options; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED); @@ -2316,21 +2316,21 @@ PHP_FUNCTION(mysqli_stmt_attr_set) { MY_STMT *stmt; zval *mysql_stmt; - long mode_in; + php_int_t mode_in; #if MYSQL_VERSION_ID >= 50107 my_bool mode_b; #endif - ulong mode; - ulong attr; + php_uint_t mode; + php_int_t attr; void *mode_p; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); if (mode_in < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mode should be non-negative, %ld passed", mode_in); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "mode should be non-negative, %pd passed", mode_in); RETURN_FALSE; } @@ -2363,11 +2363,11 @@ PHP_FUNCTION(mysqli_stmt_attr_get) { MY_STMT *stmt; zval *mysql_stmt; - ulong value = 0; - ulong attr; + php_uint_t value = 0; + php_int_t attr; int rc; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); @@ -2380,7 +2380,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get) if (attr == STMT_ATTR_UPDATE_MAX_LENGTH) value = *((my_bool *)&value); #endif - RETURN_LONG((long)value); + RETURN_INT((php_uint_t)value); } /* }}} */ @@ -2396,7 +2396,7 @@ PHP_FUNCTION(mysqli_stmt_errno) } MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED); - RETURN_LONG(mysql_stmt_errno(stmt->stmt)); + RETURN_INT(mysql_stmt_errno(stmt->stmt)); } /* }}} */ @@ -2580,10 +2580,10 @@ PHP_FUNCTION(mysqli_store_result) MYSQL_RES *result; zval *mysql_link; MYSQLI_RESOURCE *mysqli_resource; - long flags = 0; + php_int_t flags = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -2619,7 +2619,7 @@ PHP_FUNCTION(mysqli_thread_id) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG((long) mysql_thread_id(mysql->mysql)); + RETURN_INT((php_int_t) mysql_thread_id(mysql->mysql)); } /* }}} */ @@ -2672,7 +2672,7 @@ PHP_FUNCTION(mysqli_warning_count) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); - RETURN_LONG(mysql_warning_count(mysql->mysql)); + RETURN_INT(mysql_warning_count(mysql->mysql)); } /* }}} */ diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c index cb8a477be4..a895fd0bae 100644 --- a/ext/mysqli/mysqli_driver.c +++ b/ext/mysqli/mysqli_driver.c @@ -39,21 +39,21 @@ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \ #define MAP_PROPERTY_MYG_BOOL_WRITE(name, value) \ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ { \ - MyG(value) = Z_LVAL_P(value) > 0; \ + MyG(value) = Z_IVAL_P(value) > 0; \ return SUCCESS; \ } \ #define MAP_PROPERTY_MYG_LONG_READ(name, value) \ static zval *name(mysqli_object *obj, zval *retval TSRMLS_DC) \ { \ - ZVAL_LONG(retval, MyG(value)); \ + ZVAL_INT(retval, MyG(value)); \ return retval; \ } \ #define MAP_PROPERTY_MYG_LONG_WRITE(name, value) \ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ { \ - MyG(value) = Z_LVAL_P(value); \ + MyG(value) = Z_IVAL_P(value); \ return SUCCESS; \ } \ @@ -74,7 +74,7 @@ static int name(mysqli_object *obj, zval *value TSRMLS_DC) \ /* {{{ property driver_report_write */ static int driver_report_write(mysqli_object *obj, zval *value TSRMLS_DC) { - MyG(report_mode) = Z_LVAL_P(value); + MyG(report_mode) = Z_IVAL_P(value); /*FIXME*/ /* zend_replace_error_handling(MyG(report_mode) & MYSQLI_REPORT_STRICT ? EH_THROW : EH_NORMAL, NULL, NULL TSRMLS_CC); */ return SUCCESS; @@ -96,7 +96,7 @@ static zval *driver_embedded_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property driver_client_version_read */ static zval *driver_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, MYSQL_VERSION_ID); + ZVAL_INT(retval, MYSQL_VERSION_ID); return retval; } /* }}} */ @@ -112,7 +112,7 @@ static zval *driver_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property driver_driver_version_read */ static zval *driver_driver_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, MYSQLI_VERSION_ID); + ZVAL_INT(retval, MYSQLI_VERSION_ID); return retval; } /* }}} */ diff --git a/ext/mysqli/mysqli_embedded.c b/ext/mysqli/mysqli_embedded.c index e56e936f63..34d0b6fa78 100644 --- a/ext/mysqli/mysqli_embedded.c +++ b/ext/mysqli/mysqli_embedded.c @@ -32,7 +32,7 @@ PHP_FUNCTION(mysqli_embedded_server_start) { #ifdef HAVE_EMBEDDED_MYSQLI - long start; + php_int_t start; zval *args; zval *grps; @@ -42,7 +42,7 @@ PHP_FUNCTION(mysqli_embedded_server_start) HashPosition pos; int index, rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "laa", &start, &args, &grps) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iaa", &start, &args, &grps) == FAILURE) { return; } diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c index 30ed75ddb7..191a16ce31 100644 --- a/ext/mysqli/mysqli_exception.c +++ b/ext/mysqli/mysqli_exception.c @@ -68,7 +68,7 @@ void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC, char } efree(message); - zend_update_property_long(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC); + zend_update_property_int(mysqli_exception_class_entry, &sql_ex, "code", sizeof("code") - 1, errorno TSRMLS_CC); zend_throw_exception_object(&sql_ex TSRMLS_CC); } diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index c274c98056..82cb1baf26 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -42,7 +42,7 @@ /* {{{ php_mysqli_set_error */ -static void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC) +static void php_mysqli_set_error(php_int_t mysql_errno, char *mysql_err TSRMLS_DC) { MyG(error_no) = mysql_errno; if (MyG(error_msg)) { @@ -64,7 +64,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0; zend_bool persistent = FALSE; - long port = 0, flags = 0; + php_int_t port = 0, flags = 0; zend_string *hash_key = NULL; zend_bool new_connection = FALSE; zend_resource *le; @@ -87,7 +87,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne hostname = username = dbname = passwd = socket = NULL; if (!is_real_connect) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssls", &hostname, &hostname_len, &username, &username_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssis", &hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len) == FAILURE) { return; } @@ -105,7 +105,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */ } else { /* We have flags too */ - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &object, mysqli_link_class_entry, + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ssssisi", &object, mysqli_link_class_entry, &hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len, &flags) == FAILURE) { return; @@ -207,7 +207,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne if (persistent && MyG(max_persistent) != -1 && (MyG(num_active_persistent) + MyG(num_inactive_persistent))>= MyG(max_persistent)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%ld)", + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%pd)", MyG(num_active_persistent) + MyG(num_inactive_persistent)); goto err; } @@ -321,7 +321,7 @@ PHP_FUNCTION(mysqli_link_construct) Returns the numerical value of the error message from last connect command */ PHP_FUNCTION(mysqli_connect_errno) { - RETURN_LONG(MyG(error_no)); + RETURN_INT(MyG(error_no)); } /* }}} */ @@ -360,9 +360,9 @@ PHP_FUNCTION(mysqli_fetch_all) { MYSQL_RES *result; zval *mysql_result; - long mode = MYSQLND_FETCH_NUM; + php_int_t mode = MYSQLND_FETCH_NUM; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); @@ -428,7 +428,7 @@ PHP_FUNCTION(mysqli_error_list) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(return_value, &single_error); @@ -438,7 +438,7 @@ PHP_FUNCTION(mysqli_error_list) if (mysql_errno(mysql->mysql)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql)); add_next_index_zval(return_value, &single_error); @@ -469,7 +469,7 @@ PHP_FUNCTION(mysqli_stmt_error_list) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(return_value, &single_error); @@ -479,7 +479,7 @@ PHP_FUNCTION(mysqli_stmt_error_list) if (mysql_stmt_errno(stmt->stmt)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt)); add_next_index_zval(return_value, &single_error); @@ -549,9 +549,9 @@ PHP_FUNCTION(mysqli_query) MYSQL_RES *result = NULL; char *query = NULL; int query_len; - long resultmode = MYSQLI_STORE_RESULT; + php_int_t resultmode = MYSQLI_STORE_RESULT; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) { return; } @@ -750,11 +750,11 @@ PHP_FUNCTION(mysqli_poll) { zval *r_array, *e_array, *dont_poll_array; MYSQLND **new_r_array = NULL, **new_e_array = NULL, **new_dont_poll_array = NULL; - long sec = 0, usec = 0; + php_int_t sec = 0, usec = 0; enum_func_status ret; int desc_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!al|l", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!ai|i", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) { return; } if (sec < 0 || usec < 0) { @@ -795,7 +795,7 @@ PHP_FUNCTION(mysqli_poll) efree(new_e_array); } if (ret == PASS) { - RETURN_LONG(desc_num); + RETURN_INT(desc_num); } else { RETURN_FALSE; } @@ -1009,10 +1009,10 @@ PHP_FUNCTION(mysqli_get_charset) add_property_string(return_value, "charset", (name) ? (char *)name : ""); add_property_string(return_value, "collation",(collation) ? (char *)collation : ""); add_property_string(return_value, "dir", (dir) ? (char *)dir : ""); - add_property_long(return_value, "min_length", minlength); - add_property_long(return_value, "max_length", maxlength); - add_property_long(return_value, "number", number); - add_property_long(return_value, "state", state); + add_property_int(return_value, "min_length", minlength); + add_property_int(return_value, "max_length", maxlength); + add_property_int(return_value, "number", number); + add_property_int(return_value, "state", state); add_property_string(return_value, "comment", (comment) ? (char *)comment : ""); } /* }}} */ @@ -1076,12 +1076,12 @@ PHP_FUNCTION(mysqli_begin_transaction) { MY_MYSQL *mysql; zval *mysql_link; - long flags = TRANS_START_NO_OPT; + php_int_t flags = TRANS_START_NO_OPT; char * name = NULL; int name_len = -1; zend_bool err = FALSE; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); @@ -1190,9 +1190,9 @@ PHP_FUNCTION(mysqli_get_links_stats) return; } array_init(return_value); - add_assoc_long_ex(return_value, "total", sizeof("total") - 1, MyG(num_links)); - add_assoc_long_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent)); - add_assoc_long_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent)); + add_assoc_int_ex(return_value, "total", sizeof("total") - 1, MyG(num_links)); + add_assoc_int_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent)); + add_assoc_int_ex(return_value, "cached_plinks", sizeof("cached_plinks") - 1, MyG(num_inactive_persistent)); } /* }}} */ diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h index f49236358e..8ca60a9055 100644 --- a/ext/mysqli/mysqli_priv.h +++ b/ext/mysqli/mysqli_priv.h @@ -96,10 +96,10 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry * TSRMLS_DC mysql->multi_query = 1; \ } -#define MYSQLI_RETURN_LONG_LONG(__val) \ +#define MYSQLI_RETURN_INT_INT(__val) \ { \ - if ((__val) < LONG_MAX) { \ - RETURN_LONG((long) (__val)); \ + if ((__val) < PHP_INT_MAX) { \ + RETURN_INT((php_int_t) (__val)); \ } else { \ /* always used with my_ulonglong -> %llu */ \ RETURN_STR(strpprintf(0, MYSQLI_LLU_SPEC, (__val))); \ diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index cd0639d98f..912152343a 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -72,7 +72,7 @@ if (!obj->ptr) { \ p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->stmt;\ } -#define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\ +#define MYSQLI_MAP_PROPERTY_FUNC_INT( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ {\ __ret_type l;\ @@ -81,8 +81,8 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ ZVAL_NULL(retval);\ } else {\ l = (__ret_type)__int_func(p);\ - if (l < LONG_MAX) {\ - ZVAL_LONG(retval, (long) l);\ + if (l < PHP_INT_MAX) {\ + ZVAL_INT(retval, (php_int_t) l);\ } else { \ ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \ } \ @@ -111,7 +111,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC)\ /* {{{ property link_client_version_read */ static zval *link_client_version_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, MYSQL_VERSION_ID); + ZVAL_INT(retval, MYSQL_VERSION_ID); return retval; } /* }}} */ @@ -128,7 +128,7 @@ static zval *link_client_info_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* {{{ property link_connect_errno_read */ static zval *link_connect_errno_read(mysqli_object *obj, zval *retval TSRMLS_DC) { - ZVAL_LONG(retval, (long)MyG(error_no)); + ZVAL_INT(retval, (php_int_t)MyG(error_no)); return retval; } /* }}} */ @@ -163,12 +163,12 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) rc = mysql_affected_rows(mysql->mysql); if (rc == (my_ulonglong) -1) { - ZVAL_LONG(retval, -1); + ZVAL_INT(retval, -1); return retval; } - if (rc < LONG_MAX) { - ZVAL_LONG(retval, (long) rc); + if (rc < PHP_INT_MAX) { + ZVAL_INT(retval, (php_int_t) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); } @@ -198,7 +198,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(retval, &single_error); @@ -208,7 +208,7 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (mysql_errno(mysql->mysql)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql)); add_next_index_zval(retval, &single_error); @@ -221,18 +221,18 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* }}} */ /* link properties */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_INT(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) /* {{{ property link_stat_read */ static zval *link_stat_read(mysqli_object *obj, zval *retval TSRMLS_DC) @@ -279,7 +279,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p) { ZVAL_NULL(retval); } else { - ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT); + ZVAL_INT(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT); } return retval; } @@ -289,7 +289,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC) static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC) { MYSQL_RES *p; - ulong *ret; + php_uint_t *ret; uint field_count; CHECK_STATUS(MYSQLI_STATUS_VALID); @@ -298,21 +298,21 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p || !field_count || !(ret = mysql_fetch_lengths(p))) { ZVAL_NULL(retval); } else { - ulong i; + php_uint_t i; array_init(retval); for (i = 0; i < field_count; i++) { - add_index_long(retval, i, ret[i]); + add_index_int(retval, i, ret[i]); } } return retval; } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_INT(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_INT(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) /* statement properties */ @@ -328,7 +328,7 @@ static zval *stmt_id_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (!p) { ZVAL_NULL(retval); } else { - ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt)); + ZVAL_INT(retval, mysqli_stmt_get_id(p->stmt)); } return retval; } @@ -350,12 +350,12 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) rc = mysql_stmt_affected_rows(p->stmt); if (rc == (my_ulonglong) -1) { - ZVAL_LONG(retval, -1); + ZVAL_INT(retval, -1); return retval; } - if (rc < LONG_MAX) { - ZVAL_LONG(retval, (long) rc); + if (rc < PHP_INT_MAX) { + ZVAL_INT(retval, (php_int_t) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); } @@ -384,7 +384,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error); add_next_index_zval(retval, &single_error); @@ -394,7 +394,7 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) if (mysql_stmt_errno(stmt->stmt)) { zval single_error; array_init(&single_error); - add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); + add_assoc_int_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt)); add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt)); add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt)); add_next_index_zval(retval, &single_error); @@ -405,11 +405,11 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu") -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), ulong, "%lu") +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) diff --git a/ext/mysqli/mysqli_report.c b/ext/mysqli/mysqli_report.c index bdd3adaf5f..c4ffd1c199 100644 --- a/ext/mysqli/mysqli_report.c +++ b/ext/mysqli/mysqli_report.c @@ -33,10 +33,10 @@ extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC sets report level */ PHP_FUNCTION(mysqli_report) { - long flags; + php_int_t flags; - 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; } diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c index 615ba94bbf..c60946b449 100644 --- a/ext/mysqli/mysqli_result_iterator.c +++ b/ext/mysqli/mysqli_result_iterator.c @@ -141,7 +141,7 @@ static void php_mysqli_result_iterator_current_key(zend_object_iterator *iter, z { php_mysqli_result_iterator *iterator = (php_mysqli_result_iterator*) iter; - ZVAL_LONG(key, iterator->row_num); + ZVAL_INT(key, iterator->row_num); } /* }}} */ diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c index afcc05c16f..3c86bee800 100644 --- a/ext/mysqli/mysqli_warning.c +++ b/ext/mysqli/mysqli_warning.c @@ -108,7 +108,7 @@ MYSQLI_WARNING *php_new_warning(const zval * reason, int errorno TSRMLS_DC) ZVAL_DUP(&w->reason, (zval *)reason); convert_to_string(&w->reason); - //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRLEN(w->reason), ZSTR_AUTOFREE); + //????ZVAL_UTF8_STRINGL(&(w->reason), Z_STRVAL(w->reason), Z_STRSIZE(w->reason), ZSTR_AUTOFREE); ZVAL_UTF8_STRINGL(&(w->sqlstate), "HY000", sizeof("HY000") - 1, ZSTR_DUPLICATE); @@ -146,8 +146,8 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql TSRMLS_DC) /* 1. Here comes the error no */ entry = zend_hash_get_current_data(Z_ARRVAL(row)); - convert_to_long_ex(entry); - errno = Z_LVAL_P(entry); + convert_to_int_ex(entry); + errno = Z_IVAL_P(entry); zend_hash_move_forward(Z_ARRVAL(row)); /* 2. Here comes the reason */ @@ -243,7 +243,7 @@ zval *mysqli_warning_errno(mysqli_object *obj, zval *retval TSRMLS_DC) return NULL; } w = (MYSQLI_WARNING *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; - ZVAL_LONG(retval, w->errorno); + ZVAL_INT(retval, w->errorno); return retval; } /* }}} */ diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index 8b0bf1faf9..607f9c602a 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -99,9 +99,9 @@ enum mysqli_status { typedef struct { char *val; - ulong buflen; - ulong output_len; - ulong type; + php_uint_t buflen; + php_uint_t output_len; + php_uint_t type; } VAR_BUFFER; typedef struct { @@ -214,7 +214,7 @@ extern void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_stat extern zend_object_iterator_funcs php_mysqli_result_iterator_funcs; extern zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); -extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC); +extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC); #ifdef HAVE_SPL extern PHPAPI zend_class_entry *spl_ce_RuntimeException; @@ -318,27 +318,27 @@ extern PHPAPI zend_class_entry *spl_ce_RuntimeException; ZEND_BEGIN_MODULE_GLOBALS(mysqli) - long default_link; - long num_links; - long max_links; - long num_active_persistent; - long num_inactive_persistent; - long max_persistent; - long allow_persistent; - unsigned long default_port; + php_int_t default_link; + php_int_t num_links; + php_int_t max_links; + php_int_t num_active_persistent; + php_int_t num_inactive_persistent; + php_int_t max_persistent; + php_int_t allow_persistent; + php_uint_t default_port; char *default_host; char *default_user; char *default_socket; char *default_pw; - long reconnect; - long allow_local_infile; - long strict; - long error_no; + php_int_t reconnect; + php_int_t allow_local_infile; + php_int_t strict; + php_int_t error_no; char *error_msg; - long report_mode; + php_int_t report_mode; HashTable *report_ht; - unsigned long multi_query; - unsigned long embedded; + php_uint_t multi_query; + php_uint_t embedded; zend_bool rollback_on_cached_plink; ZEND_END_MODULE_GLOBALS(mysqli) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index e05d6844bc..65752d74a8 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -440,7 +440,7 @@ mysqlnd_switch_to_ssl_if_needed( MYSQLND_CONN_DATA * conn, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, - unsigned long mysql_flags + php_uint_t mysql_flags TSRMLS_DC ) { @@ -546,7 +546,7 @@ mysqlnd_run_authentication( const char * const auth_protocol, unsigned int charset_no, const MYSQLND_OPTIONS * const options, - unsigned long mysql_flags, + php_uint_t mysql_flags, zend_bool silent, zend_bool is_change_user TSRMLS_DC) @@ -678,7 +678,7 @@ mysqlnd_connect_run_authentication( size_t passwd_len, const MYSQLND_PACKET_GREET * const greet_packet, const MYSQLND_OPTIONS * const options, - unsigned long mysql_flags + php_uint_t mysql_flags TSRMLS_DC) { enum_func_status ret = FAIL; @@ -1588,7 +1588,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn /* {{{ mysqlnd_old_escape_string */ -PHPAPI ulong +PHPAPI php_uint_t mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { DBG_ENTER("mysqlnd_old_escape_string"); @@ -1622,11 +1622,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const /* {{{ mysqlnd_conn_data::escape_string */ -static ulong +static php_uint_t MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string); - ulong ret = FAIL; + php_uint_t ret = FAIL; DBG_ENTER("mysqlnd_conn_data::escape_string"); DBG_INF_FMT("conn=%llu", conn->thread_id); @@ -2114,23 +2114,23 @@ MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const con /* {{{ mysqlnd_conn_data::get_server_version */ -static unsigned long +static php_uint_t MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC) { - long major, minor, patch; + php_int_t major, minor, patch; char *p; if (!(p = conn->server_version)) { return 0; } - major = strtol(p, &p, 10); + major = ZEND_STRTOI(p, &p, 10); p += 1; /* consume the dot */ - minor = strtol(p, &p, 10); + minor = ZEND_STRTOI(p, &p, 10); p += 1; /* consume the dot */ - patch = strtol(p, &p, 10); + patch = ZEND_STRTOI(p, &p, 10); - return (unsigned long)(major * 10000L + (unsigned long)(minor * 100L + patch)); + return (php_uint_t)(major * Z_I(10000) + (php_uint_t)(minor * Z_I(100) + patch)); } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 94620d9369..f79dc37a3e 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -219,7 +219,7 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn); #define mysqlnd_escape_string(newstr, escapestr, escapestr_len) \ mysqlnd_old_escape_string((newstr), (escapestr), (escapestr_len) TSRMLS_CC) -PHPAPI ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); +PHPAPI php_uint_t mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); /* PS */ @@ -270,17 +270,17 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqlnd) char * trace_alloc_settings; /* The actual string */ MYSQLND_DEBUG * dbg; /* The DBG object for standard tracing */ MYSQLND_DEBUG * trace_alloc; /* The DBG object for allocation tracing */ - long net_cmd_buffer_size; - long net_read_buffer_size; - long log_mask; - long net_read_timeout; - long mempool_default_size; - long debug_emalloc_fail_threshold; - long debug_ecalloc_fail_threshold; - long debug_erealloc_fail_threshold; - long debug_malloc_fail_threshold; - long debug_calloc_fail_threshold; - long debug_realloc_fail_threshold; + php_int_t net_cmd_buffer_size; + php_int_t net_read_buffer_size; + php_int_t log_mask; + php_int_t net_read_timeout; + php_int_t mempool_default_size; + php_int_t debug_emalloc_fail_threshold; + php_int_t debug_ecalloc_fail_threshold; + php_int_t debug_erealloc_fail_threshold; + php_int_t debug_malloc_fail_threshold; + php_int_t debug_calloc_fail_threshold; + php_int_t debug_realloc_fail_threshold; char * sha256_server_public_key; zend_bool fetch_data_copy; ZEND_END_MODULE_GLOBALS(mysqlnd) diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index c3228aa4f1..903753ef89 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -79,7 +79,7 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); + php_int_t * threshold = &MYSQLND_G(debug_emalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_emalloc_name); @@ -119,7 +119,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); + php_int_t * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name); @@ -162,7 +162,7 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); + php_int_t * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name); @@ -203,7 +203,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); + php_int_t * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name); #if PHP_DEBUG @@ -246,7 +246,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D) zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0; #if PHP_DEBUG - long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); + php_int_t * threshold = &MYSQLND_G(debug_erealloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_erealloc_name); @@ -287,7 +287,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0; #if PHP_DEBUG - long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); + php_int_t * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_perealloc_name); @@ -393,7 +393,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); + php_int_t * threshold = &MYSQLND_G(debug_malloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_malloc_name); @@ -432,7 +432,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); + php_int_t * threshold = &MYSQLND_G(debug_calloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_calloc_name); @@ -471,7 +471,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) void *ret; zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); #if PHP_DEBUG - long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); + php_int_t * threshold = &MYSQLND_G(debug_realloc_fail_threshold); #endif TRACE_ALLOC_ENTER(mysqlnd_realloc_name); diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c index 1ac05930f7..76d4a56f38 100644 --- a/ext/mysqlnd/mysqlnd_auth.c +++ b/ext/mysqlnd/mysqlnd_auth.c @@ -37,7 +37,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, const char * const db, const size_t db_len, const MYSQLND_OPTIONS * const options, - unsigned long mysql_flags, + php_uint_t mysql_flags, unsigned int server_charset_no, zend_bool use_full_blown_auth_packet, const char * const auth_protocol, @@ -361,7 +361,7 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - unsigned long mysql_flags + php_uint_t mysql_flags TSRMLS_DC) { zend_uchar * ret = NULL; @@ -421,7 +421,7 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self, const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - unsigned long mysql_flags + php_uint_t mysql_flags TSRMLS_DC) { zend_uchar * ret = NULL; @@ -571,7 +571,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, const MYSQLND_NET_OPTIONS * const net_options, - unsigned long mysql_flags + php_uint_t mysql_flags TSRMLS_DC) { RSA * server_public_key; diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index dfa90db255..fa97b877e5 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -726,7 +726,7 @@ PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const name /* {{{ mysqlnd_cset_escape_quotes */ -PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { const char *newstr_s = newstr; @@ -780,7 +780,7 @@ PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char /* {{{ mysqlnd_cset_escape_slashes */ -PHPAPI ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC) { const char *newstr_s = newstr; diff --git a/ext/mysqlnd/mysqlnd_charset.h b/ext/mysqlnd/mysqlnd_charset.h index cf3eada8af..0a7ced68aa 100644 --- a/ext/mysqlnd/mysqlnd_charset.h +++ b/ext/mysqlnd/mysqlnd_charset.h @@ -21,10 +21,10 @@ #ifndef MYSQLND_CHARSET_H #define MYSQLND_CHARSET_H -PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr, +PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); -PHPAPI ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, +PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); struct st_mysqlnd_plugin_charsets @@ -34,8 +34,8 @@ struct st_mysqlnd_plugin_charsets { const MYSQLND_CHARSET * (*const find_charset_by_nr)(unsigned int charsetnr); const MYSQLND_CHARSET * (*const find_charset_by_name)(const char * const name); - unsigned long (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); - unsigned long (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); + php_uint_t (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); + php_uint_t (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC); } methods; }; diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h index 3212c778a8..81be117277 100644 --- a/ext/mysqlnd/mysqlnd_enum_n_def.h +++ b/ext/mysqlnd/mysqlnd_enum_n_def.h @@ -606,7 +606,7 @@ enum php_mysqlnd_server_command }; -#define MYSQLND_DEFAULT_PREFETCH_ROWS (ulong) 1 +#define MYSQLND_DEFAULT_PREFETCH_ROWS (php_uint_t) 1 #define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */ #define MYSQLND_REFRESH_LOG 2 /* Start on new log file */ diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index 84757f88c1..e014f86390 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -676,7 +676,7 @@ MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * co } net->compressed_envelope_packet_no++; #ifdef MYSQLND_DUMP_HEADER_N_BODY - DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (unsigned long) net_payload_size); + DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (php_uint_t) net_payload_size); #endif /* Now let's read from the wire, decompress it and fill the read buffer */ net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_stats, error_info TSRMLS_CC); diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index 72a156a795..d9936e0425 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -194,13 +194,13 @@ This file is public domain and comes with NO WARRANTY of any kind */ (((uint32_t) (zend_uchar) (A)[2]) << 16) |\ (((uint32_t) (zend_uchar) (A)[1]) << 8) | \ ((uint32_t) (zend_uchar) (A)[0]))) -#define sint4korr(A) (*((long *) (A))) +#define sint4korr(A) (*((php_int_t *) (A))) #define uint2korr(A) (*((uint16_t *) (A))) #define uint3korr(A) (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\ (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\ (((uint32_t) ((zend_uchar) (A)[2])) << 16)) -#define uint4korr(A) (*((unsigned long *) (A))) +#define uint4korr(A) (*((php_uint_t *) (A))) @@ -211,7 +211,7 @@ This file is public domain and comes with NO WARRANTY of any kind */ *(T)= (zend_uchar) ((A));\ *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\ *(T+2)=(zend_uchar) (((A) >> 16)); } -#define int4store(T,A) *((long *) (T))= (long) (A) +#define int4store(T,A) *((php_int_t *) (T))= (php_int_t) (A) #define int5store(T,A) { \ *((zend_uchar *)(T))= (zend_uchar)((A));\ *(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\ @@ -232,12 +232,12 @@ This file is public domain and comes with NO WARRANTY of any kind */ typedef union { double v; - long m[2]; + php_int_t m[2]; } float8get_union; -#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((long*) (M)); \ - ((float8get_union *)&(V))->m[1] = *(((long*) (M))+1); } -#define float8store(T,V) { *((long *) (T)) = ((float8get_union *)&(V))->m[0]; \ - *(((long *) (T))+1) = ((float8get_union *)&(V))->m[1]; } +#define float8get(V,M) { ((float8get_union *)&(V))->m[0] = *((php_int_t*) (M)); \ + ((float8get_union *)&(V))->m[1] = *(((php_int_t*) (M))+1); } +#define float8store(T,V) { *((php_int_t *) (T)) = ((float8get_union *)&(V))->m[0]; \ + *(((php_int_t *) (T))+1) = ((float8get_union *)&(V))->m[1]; } #define float4get(V,M) { *((float *) &(V)) = *((float*) (M)); } /* From Andrey Hristov based on float8get */ #define floatget(V,M) memcpy((char*) &(V),(char*) (M),sizeof(float)) diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h index 536b37caa7..475a33d38e 100644 --- a/ext/mysqlnd/mysqlnd_priv.h +++ b/ext/mysqlnd/mysqlnd_priv.h @@ -209,7 +209,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, const char * const db, const size_t db_len, const MYSQLND_OPTIONS * const options, - unsigned long mysql_flags, + php_uint_t mysql_flags, unsigned int server_charset_no, zend_bool use_full_blown_auth_packet, const char * const auth_protocol, diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 986a664410..c47da0262a 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -776,7 +776,7 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + php_uint_t len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -905,8 +905,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES * result, void * param, unsigned i #endif if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { - meta->fields[i].max_length = Z_STRLEN_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { + meta->fields[i].max_length = Z_STRSIZE_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1093,8 +1093,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int f if (!Z_ISNULL_P(data)) { if ((Z_TYPE_P(data) == IS_STRING) && - (meta->fields[i].max_length < (unsigned long) Z_STRLEN_P(data))) { - meta->fields[i].max_length = Z_STRLEN_P(data); + (meta->fields[i].max_length < (unsigned long) Z_STRSIZE_P(data))) { + meta->fields[i].max_length = Z_STRSIZE_P(data); } ZVAL_COPY_VALUE(result, data); /* copied data, thus also the ownership. Thus null data */ @@ -1302,7 +1302,7 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC) /* {{{ mysqlnd_stmt::send_long_data */ static enum_func_status MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned int param_no, - const char * const data, unsigned long length TSRMLS_DC) + const char * const data, php_uint_t length TSRMLS_DC) { MYSQLND_STMT_DATA * stmt = s? s->data:NULL; enum_func_status ret = FAIL; @@ -1879,7 +1879,7 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s, } case STMT_ATTR_CURSOR_TYPE: { unsigned int ival = *(unsigned int *) value; - if (ival > (unsigned long) CURSOR_TYPE_READ_ONLY) { + if (ival > (php_uint_t) CURSOR_TYPE_READ_ONLY) { SET_STMT_ERROR(stmt, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); DBG_INF("FAIL"); DBG_RETURN(FAIL); @@ -1927,10 +1927,10 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_get)(const MYSQLND_STMT * const s, *(zend_bool *) value= stmt->update_max_length; break; case STMT_ATTR_CURSOR_TYPE: - *(unsigned long *) value= stmt->flags; + *(php_uint_t *) value= stmt->flags; break; case STMT_ATTR_PREFETCH_ROWS: - *(unsigned long *) value= stmt->prefetch_rows; + *(php_uint_t *) value= stmt->prefetch_rows; break; default: DBG_RETURN(FAIL); diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 746cf01a26..8b59d918ba 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -41,7 +41,7 @@ enum mysqlnd_timestamp_type struct st_mysqlnd_time { unsigned int year, month, day, hour, minute, second; - unsigned long second_part; + php_uint_t second_part; zend_bool neg; enum mysqlnd_timestamp_type time_type; }; @@ -76,7 +76,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne case 1:uval = (uint64_t) uint1korr(*row);break; } -#if SIZEOF_LONG==4 +#if SIZEOF_ZEND_INT==4 if (uval > INT_MAX) { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); @@ -84,7 +84,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne #endif /* #if SIZEOF_LONG==4 */ { if (byte_count < 8 || uval <= L64(9223372036854775807)) { - ZVAL_LONG(zv, (long) uval); /* the cast is safe, we are in the range */ + ZVAL_INT(zv, (php_int_t) uval); /* the cast is safe, we are in the range */ } else { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval); @@ -105,14 +105,14 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne case 1:lval = (int64_t) *(int8_t*)*row;break; } -#if SIZEOF_LONG==4 +#if SIZEOF_ZEND_INT==4 if ((L64(2147483647) < (int64_t) lval) || (L64(-2147483648) > (int64_t) lval)) { DBG_INF("stringify"); tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval); } else #endif /* SIZEOF */ { - ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are in the range */ + ZVAL_INT(zv, (php_int_t) lval); /* the cast is safe, we are in the range */ } } @@ -246,7 +246,7 @@ static void ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t; - unsigned long length; /* First byte encodes the length*/ + php_uint_t length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_time"); @@ -256,11 +256,11 @@ ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_le t.time_type = MYSQLND_TIMESTAMP_TIME; t.neg = (zend_bool) to[0]; - t.day = (unsigned long) sint4korr(to+1); + t.day = (php_uint_t) sint4korr(to+1); t.hour = (unsigned int) to[5]; t.minute = (unsigned int) to[6]; t.second = (unsigned int) to[7]; - t.second_part = (length > 8) ? (unsigned long) sint4korr(to+8) : 0; + t.second_part = (length > 8) ? (php_uint_t) sint4korr(to+8) : 0; t.year = t.month= 0; if (t.day) { /* Convert days to hours at once */ @@ -289,7 +289,7 @@ static void ps_fetch_date(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t = {0}; - unsigned long length; /* First byte encodes the length*/ + php_uint_t length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_date"); @@ -326,7 +326,7 @@ static void ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { struct st_mysqlnd_time t; - unsigned long length; /* First byte encodes the length*/ + php_uint_t length; /* First byte encodes the length*/ char * value; DBG_ENTER("ps_fetch_datetime"); @@ -347,7 +347,7 @@ ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pac } else { t.hour = t.minute = t.second= 0; } - t.second_part = (length > 7) ? (unsigned long) sint4korr(to+7) : 0; + t.second_part = (length > 7) ? (php_uint_t) sint4korr(to+7) : 0; (*row)+= length; } else { @@ -373,7 +373,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_ For now just copy, before we make it possible to write \0 to the row buffer */ - const unsigned long length = php_mysqlnd_net_field_length(row); + const php_uint_t length = php_mysqlnd_net_field_length(row); DBG_ENTER("ps_fetch_string"); DBG_INF_FMT("len = %lu", length); DBG_INF("copying from the row buffer"); @@ -389,7 +389,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_ static void ps_fetch_bit(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC) { - unsigned long length = php_mysqlnd_net_field_length(row); + php_uint_t length = php_mysqlnd_net_field_length(row); ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, length TSRMLS_CC); } /* }}} */ @@ -406,32 +406,32 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_TINY].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_SHORT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_YEAR].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_INT24].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].php_type= IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_LONGLONG].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float; @@ -495,7 +495,7 @@ void _mysqlnd_init_ps_fetch_subsystem() mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].func = ps_fetch_bit; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].pack_len = 8; - mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_LONG; + mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].php_type = IS_INT; mysqlnd_ps_fetch_functions[MYSQL_TYPE_BIT].can_ret_as_str_in_uni = TRUE; mysqlnd_ps_fetch_functions[MYSQL_TYPE_VAR_STRING].func = ps_fetch_string; @@ -610,7 +610,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie ZVAL_DEREF(parameter); if (!Z_ISNULL_P(parameter) && (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) { /* always copy the var, because we do many conversions */ - if (Z_TYPE_P(parameter) != IS_LONG && + if (Z_TYPE_P(parameter) != IS_INT && PASS != mysqlnd_stmt_copy_it(copies_param, parameter, stmt->param_count, i TSRMLS_CC)) { SET_OOM_ERROR(*stmt->error_info); @@ -620,7 +620,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_LONG) { + if (Z_TYPE_P(parameter) != IS_INT) { zval *tmp_data = (*copies_param && !Z_ISUNDEF((*copies_param)[i]))? &(*copies_param)[i]: parameter; /* Because converting to double and back to long can lead @@ -636,11 +636,11 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX We do transformation here, which will be used later when sending types. The code later relies on this. */ - if (Z_DVAL(tmp_data_copy) > LONG_MAX || Z_DVAL(tmp_data_copy) < LONG_MIN) { + if (Z_DVAL(tmp_data_copy) > PHP_INT_MAX || Z_DVAL(tmp_data_copy) < PHP_INT_MIN) { stmt->send_types_to_server = *resend_types_next_time = 1; convert_to_string_ex(tmp_data); } else { - convert_to_long_ex(tmp_data); + convert_to_int_ex(tmp_data); } zval_ptr_dtor(&tmp_data_copy); @@ -663,7 +663,7 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u short current_type = stmt->param_bind[i].type; zval *parameter = &stmt->param_bind[i].zv; /* our types are not unsigned */ -#if SIZEOF_LONG==8 +#if SIZEOF_ZEND_INT==8 if (current_type == MYSQL_TYPE_LONG) { current_type = MYSQL_TYPE_LONGLONG; } @@ -674,17 +674,17 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX */ - if (Z_TYPE_P(parameter) != IS_LONG) { + if (Z_TYPE_P(parameter) != IS_INT) { const zval *tmp_data = (copies && !Z_ISUNDEF(copies[i]))? &copies[i] : parameter; /* - In case of IS_LONG we do nothing, it is ok, in case of string, we just need to set current_type. + In case of IS_INT we do nothing, it is ok, in case of string, we just need to set current_type. The actual transformation has been performed several dozens line above. */ if (Z_TYPE_P(tmp_data) == IS_STRING) { current_type = MYSQL_TYPE_VAR_STRING; /* don't change stmt->param_bind[i].type to MYSQL_TYPE_VAR_STRING - we force convert_to_long_ex in all cases, thus the type will be right in the next switch. + we force convert_to_int_ex in all cases, thus the type will be right in the next switch. if the type is however not long, then we will do a goto in the next switch. We want to preserve the original bind type given by the user. Thus, we do these hacks. */ @@ -751,7 +751,7 @@ mysqlnd_stmt_execute_calculate_param_values_size(MYSQLND_STMT_DATA * stmt, zval if (Z_TYPE_P(tmp_data) == IS_STRING) { goto use_string; } - convert_to_long_ex(tmp_data); + convert_to_int_ex(tmp_data); } *data_size += 4 + is_longlong; break; @@ -778,7 +778,7 @@ use_string: the_var = &((*copies_param)[i]); } convert_to_string_ex(the_var); - *data_size += Z_STRLEN_P(the_var); + *data_size += Z_STRSIZE_P(the_var); break; } } @@ -814,7 +814,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int8store(*p, Z_LVAL_P(data)); + int8store(*p, Z_IVAL_P(data)); (*p) += 8; break; case MYSQL_TYPE_LONG: @@ -822,7 +822,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, goto send_string; } /* data has alreade been converted to long */ - int4store(*p, Z_LVAL_P(data)); + int4store(*p, Z_IVAL_P(data)); (*p) += 4; break; case MYSQL_TYPE_LONG_BLOB: @@ -836,7 +836,7 @@ mysqlnd_stmt_execute_store_param_values(MYSQLND_STMT_DATA * stmt, zval * copies, case MYSQL_TYPE_VAR_STRING: send_string: { - size_t len = Z_STRLEN_P(data); + size_t len = Z_STRSIZE_P(data); /* to is after p. The latter hasn't been moved */ *p = php_mysqlnd_net_store_length(*p, len); memcpy(*p, Z_STRVAL_P(data), len); diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 0641d504c6..65ad1099b6 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -71,7 +71,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, initialize_result_set_rest)(MYSQLND Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(data_cursor[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(data_cursor[i]); + php_uint_t len = Z_STRSIZE(data_cursor[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -126,7 +126,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, initialize_result_set_rest)(MYSQLND_RE Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + php_uint_t len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -599,7 +599,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s of PHP, to be called as separate function. But let's have it for completeness. */ -static unsigned long * +static php_uint_t * MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC) { const MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result; @@ -631,7 +631,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED of PHP, to be called as separate function. But let's have it for completeness. */ -static unsigned long * +static php_uint_t * MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC) { const MYSQLND_RES_BUFFERED_C * set = (MYSQLND_RES_BUFFERED_C *) result; @@ -648,7 +648,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * /* {{{ mysqlnd_result_unbuffered::fetch_lengths */ -static unsigned long * +static php_uint_t * MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC) { /* simulate output of libmysql */ @@ -658,10 +658,10 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED /* {{{ mysqlnd_res::fetch_lengths */ -static unsigned long * +static php_uint_t * MYSQLND_METHOD(mysqlnd_res, fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC) { - unsigned long * ret; + php_uint_t * ret; DBG_ENTER("mysqlnd_res::fetch_lengths"); ret = result->stored_data && result->stored_data->m.fetch_lengths ? result->stored_data->m.fetch_lengths(result->stored_data TSRMLS_CC) : @@ -731,11 +731,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi *row = mnd_malloc(field_count * sizeof(char *)); if (*row) { MYSQLND_FIELD * field = meta->fields; - unsigned long * lengths = result->unbuf->lengths; + php_uint_t * lengths = result->unbuf->lengths; for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; /* BEGIN difference between normal normal fetch and _c */ if (Z_TYPE_P(data) != IS_NULL) { @@ -849,11 +849,11 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void { HashTable * row_ht = Z_ARRVAL_P(row); MYSQLND_FIELD * field = meta->fields; - unsigned long * lengths = result->unbuf->lengths; + php_uint_t * lengths = result->unbuf->lengths; for (i = 0; i < field_count; i++, field++) { zval * data = &result->unbuf->last_row_data[i]; - unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + unsigned int len = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1002,7 +1002,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + php_uint_t len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1017,7 +1017,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (Z_TYPE_P(data) != IS_NULL) { convert_to_string(data); @@ -1093,7 +1093,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + php_uint_t len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1104,7 +1104,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1188,7 +1188,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void Thus for NULL and zero-length we are quite efficient. */ if (Z_TYPE(current_row[i]) == IS_STRING) { - unsigned long len = Z_STRLEN(current_row[i]); + php_uint_t len = Z_STRSIZE(current_row[i]); if (meta->fields[i].max_length < len) { meta->fields[i].max_length = len; } @@ -1199,7 +1199,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void for (i = 0; i < field_count; i++) { zval * data = ¤t_row[i]; - set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRLEN_P(data) : 0; + set->lengths[i] = (Z_TYPE_P(data) == IS_STRING)? Z_STRSIZE_P(data) : 0; if (flags & MYSQLND_FETCH_NUM) { Z_TRY_ADDREF_P(data); @@ -1776,7 +1776,7 @@ static void MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, const unsigned int flags, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC) { zval row; - ulong i = 0; + php_uint_t i = 0; MYSQLND_RES_BUFFERED *set = result->stored_data; DBG_ENTER("mysqlnd_res::fetch_all"); @@ -1927,7 +1927,7 @@ mysqlnd_result_unbuffered_init(unsigned int field_count, zend_bool ps, zend_bool DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(unsigned long), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } @@ -1967,7 +1967,7 @@ mysqlnd_result_buffered_zval_init(unsigned int field_count, zend_bool ps, zend_b if (!ret) { DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(unsigned long), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } @@ -2010,7 +2010,7 @@ mysqlnd_result_buffered_c_init(unsigned int field_count, zend_bool ps, zend_bool if (!ret) { DBG_RETURN(NULL); } - if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(unsigned long), persistent))) { + if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) { mnd_pefree(ret, persistent); DBG_RETURN(NULL); } diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c index f6e38c809e..ac7526d22d 100644 --- a/ext/mysqlnd/mysqlnd_result_meta.c +++ b/ext/mysqlnd/mysqlnd_result_meta.c @@ -64,7 +64,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met } field_packet->persistent_alloc = meta->persistent; for (;i < meta->field_count; i++) { - long idx; + php_int_t idx; if (meta->fields[i].root) { /* We re-read metadata for PS */ diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 9ec924ead6..87270a93c8 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -80,8 +80,8 @@ typedef struct st_mysqlnd_field const char *db; /* Database for table */ const char *catalog; /* Catalog for table */ char *def; /* Default value (set by mysql_list_fields) */ - unsigned long length; /* Width of column (create length) */ - unsigned long max_length; /* Max width for selected set */ + php_uint_t length; /* Width of column (create length) */ + php_uint_t max_length; /* Max width for selected set */ unsigned int name_length; unsigned int org_name_length; unsigned int table_length; @@ -414,7 +414,7 @@ struct st_mysqlnd_object_factory_methods typedef enum_func_status (*func_mysqlnd_conn_data__init)(MYSQLND_CONN_DATA * conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__connect)(MYSQLND_CONN_DATA * conn, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC); -typedef ulong (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); +typedef php_int_t (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__set_charset)(MYSQLND_CONN_DATA * const conn, const char * const charset TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__send_query)(MYSQLND_CONN_DATA * conn, const char *query, unsigned int query_len TSRMLS_DC); @@ -441,7 +441,7 @@ typedef const char * (*func_mysqlnd_conn_data__get_sqlstate)(const MYSQLND_CONN typedef uint64_t (*func_mysqlnd_conn_data__get_thread_id)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef void (*func_mysqlnd_conn_data__get_statistics)(const MYSQLND_CONN_DATA * const conn, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); -typedef unsigned long (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); +typedef php_uint_t (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef const char * (*func_mysqlnd_conn_data__get_server_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn_data__get_server_statistics)(MYSQLND_CONN_DATA * conn, zend_string **message TSRMLS_DC); typedef const char * (*func_mysqlnd_conn_data__get_host_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC); @@ -639,7 +639,7 @@ typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_field_direct)(MYSQLND_RES typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_fields)(MYSQLND_RES * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_res__read_result_metadata)(MYSQLND_RES * result, MYSQLND_CONN_DATA * conn TSRMLS_DC); -typedef unsigned long * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC); +typedef php_uint_t * (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_res__store_result_fetch_data)(MYSQLND_CONN_DATA * const conn, MYSQLND_RES * result, MYSQLND_RES_METADATA * meta, MYSQLND_MEMORY_POOL_CHUNK *** row_buffers, zend_bool binary_protocol TSRMLS_DC); typedef void (*func_mysqlnd_res__free_result_buffers)(MYSQLND_RES * result TSRMLS_DC); /* private */ @@ -690,7 +690,7 @@ struct st_mysqlnd_res_methods typedef uint64_t (*func_mysqlnd_result_unbuffered__num_rows)(const MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); -typedef unsigned long * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); +typedef php_uint_t * (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC); typedef void (*func_mysqlnd_result_unbuffered__free_last_data)(MYSQLND_RES_UNBUFFERED * result, MYSQLND_STATS * const global_stats TSRMLS_DC); typedef void (*func_mysqlnd_result_unbuffered__free_result)(MYSQLND_RES_UNBUFFERED * const result, MYSQLND_STATS * const global_stats TSRMLS_DC); @@ -707,7 +707,7 @@ struct st_mysqlnd_result_unbuffered_methods typedef uint64_t (*func_mysqlnd_result_buffered__num_rows)(const MYSQLND_RES_BUFFERED * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_result_buffered__initialize_result_set_rest)(MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta, MYSQLND_STATS * stats, zend_bool int_and_float_native TSRMLS_DC); -typedef unsigned long * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); +typedef php_uint_t * (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_result_buffered__data_seek)(MYSQLND_RES_BUFFERED * const result, const uint64_t row TSRMLS_DC); typedef void (*func_mysqlnd_result_buffered__free_result)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC); @@ -763,7 +763,7 @@ typedef enum_func_status (*func_mysqlnd_stmt__bind_one_parameter)(MYSQLND_STMT * typedef enum_func_status (*func_mysqlnd_stmt__refresh_bind_param)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_stmt__bind_result)(MYSQLND_STMT * const stmt, MYSQLND_RESULT_BIND * const result_bind TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_stmt__bind_one_result)(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC); -typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, unsigned long length TSRMLS_DC); +typedef enum_func_status (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, php_uint_t length TSRMLS_DC); typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_parameter_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef MYSQLND_RES * (*func_mysqlnd_stmt__get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC); typedef uint64_t (*func_mysqlnd_stmt__get_last_insert_id)(const MYSQLND_STMT * const stmt TSRMLS_DC); @@ -923,10 +923,10 @@ struct st_mysqlnd_connection_data unsigned int connect_or_select_db_len; MYSQLND_INFILE infile; unsigned int protocol_version; - unsigned long max_packet_size; + php_uint_t max_packet_size; unsigned int port; - unsigned long client_flag; - unsigned long server_capabilities; + php_uint_t client_flag; + php_uint_t server_capabilities; /* For UPSERT queries */ MYSQLND_UPSERT_STATUS * upsert_status; @@ -986,7 +986,7 @@ struct st_mysqlnd_connection struct mysqlnd_field_hash_key { zend_bool is_numeric; - unsigned long key; + php_uint_t key; }; @@ -1011,7 +1011,7 @@ struct st_mysqlnd_result_metadata uint64_t initialized_rows; \ \ /* Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ \ - unsigned long *lengths; \ + php_uint_t *lengths; \ \ MYSQLND_MEMORY_POOL *result_set_memory_pool; \ \ @@ -1064,7 +1064,7 @@ struct st_mysqlnd_unbuffered_result Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ - unsigned long *lengths; + php_uint_t *lengths; MYSQLND_MEMORY_POOL *result_set_memory_pool; @@ -1117,8 +1117,8 @@ struct st_mysqlnd_result_bind struct st_mysqlnd_stmt_data { MYSQLND_CONN_DATA *conn; - unsigned long stmt_id; - unsigned long flags;/* cursor is set here */ + php_uint_t stmt_id; + php_uint_t flags;/* cursor is set here */ enum_mysqlnd_stmt_state state; unsigned int warning_count; MYSQLND_RES *result; @@ -1137,7 +1137,7 @@ struct st_mysqlnd_stmt_data MYSQLND_ERROR_INFO error_info_impl; zend_bool update_max_length; - unsigned long prefetch_rows; + php_uint_t prefetch_rows; zend_bool cursor_exists; mysqlnd_stmt_use_or_store_func default_rset_handler; @@ -1166,7 +1166,7 @@ struct st_mysqlnd_plugin_header { unsigned int plugin_api_version; const char * plugin_name; - unsigned long plugin_version; + php_uint_t plugin_version; const char * plugin_string_version; const char * plugin_license; const char * plugin_author; @@ -1203,7 +1203,7 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len, const MYSQLND_OPTIONS * const options, - const MYSQLND_NET_OPTIONS * const net_options, unsigned long mysql_flags + const MYSQLND_NET_OPTIONS * const net_options, php_uint_t mysql_flags TSRMLS_DC); struct st_mysqlnd_authentication_plugin diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 2aa7afde0d..2acccf3f43 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -126,14 +126,14 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L /* {{{ php_mysqlnd_net_field_length Get next field's length */ -unsigned long +php_uint_t php_mysqlnd_net_field_length(zend_uchar **packet) { register zend_uchar *p= (zend_uchar *)*packet; if (*p < 251) { (*packet)++; - return (unsigned long) *p; + return (php_uint_t) *p; } switch (*p) { @@ -142,13 +142,13 @@ php_mysqlnd_net_field_length(zend_uchar **packet) return MYSQLND_NULL_LENGTH; case 252: (*packet) += 3; - return (unsigned long) uint2korr(p+1); + return (php_uint_t) uint2korr(p+1); case 253: (*packet) += 4; - return (unsigned long) uint3korr(p+1); + return (php_uint_t) uint3korr(p+1); default: (*packet) += 9; - return (unsigned long) uint4korr(p+1); + return (php_uint_t) uint4korr(p+1); } } /* }}} */ @@ -201,7 +201,7 @@ php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length) if (length < (uint64_t) L64(16777216)) { *packet++ = 253; - int3store(packet,(ulong) length); + int3store(packet,(php_uint_t) length); return packet + 3; } *packet++ = 254; @@ -567,7 +567,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; - unsigned long num_key; + php_uint_t num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { @@ -582,11 +582,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC { zend_string * key; - unsigned long unused_num_key; + php_uint_t unused_num_key; zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRLEN_P(entry_value); + size_t value_len = Z_STRSIZE_P(entry_value); ca_payload_len += php_mysqlnd_net_store_length_size(key->len); ca_payload_len += key->len; @@ -604,7 +604,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) { char *s_key; unsigned int s_len; - unsigned long num_key; + php_uint_t num_key; size_t value_len = strlen(*entry_value); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) { /* copy key */ @@ -621,11 +621,11 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC #else { zend_string * key; - unsigned long unused_num_key; + php_uint_t unused_num_key; zval * entry_value; ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) { if (key) { /* HASH_KEY_IS_STRING */ - size_t value_len = Z_STRLEN_P(entry_value); + size_t value_len = Z_STRSIZE_P(entry_value); /* copy key */ p = php_mysqlnd_net_store_length(p, key->len); @@ -685,7 +685,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf; zend_uchar *p = buf; zend_uchar *begin = buf; - unsigned long i; + php_uint_t i; register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet; DBG_ENTER("php_mysqlnd_auth_response_read"); @@ -753,7 +753,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D packet->message_len = 0; } - DBG_INF_FMT("OK packet: aff_rows=%lld last_ins_id=%ld server_status=%u warnings=%u", + DBG_INF_FMT("OK packet: aff_rows=%lld last_ins_id=%pd server_status=%u warnings=%u", packet->affected_rows, packet->last_insert_id, packet->server_status, packet->warning_count); } @@ -848,7 +848,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf; zend_uchar *p = buf; zend_uchar *begin = buf; - unsigned long i; + php_uint_t i; register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet; DBG_ENTER("php_mysqlnd_ok_read"); @@ -1230,7 +1230,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) zend_uchar *p = buf; zend_uchar *begin = buf; char *root_ptr; - unsigned long len; + php_uint_t len; MYSQLND_FIELD *meta; unsigned int i, field_count = sizeof(rset_field_offsets)/sizeof(size_t); @@ -1587,7 +1587,7 @@ php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, zv MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_PS, (Z_TYPE_P(current_field) == IS_STRING)? - Z_STRLEN_P(current_field) : (p - orig_p)); + Z_STRSIZE_P(current_field) : (p - orig_p)); if (!((bit<<=1) & 255)) { bit = 1; /* to the following byte */ @@ -1622,7 +1622,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) { /* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */ - unsigned long len = php_mysqlnd_net_field_length(&p); + php_uint_t len = php_mysqlnd_net_field_length(&p); /* NULL or NOT NULL, this is the question! */ if (len == MYSQLND_NULL_LENGTH) { @@ -1667,11 +1667,11 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT, len); } #ifdef MYSQLND_STRING_TO_INT_CONVERSION - if (as_int_or_float && perm_bind.php_type == IS_LONG) { + if (as_int_or_float && perm_bind.php_type == IS_INT) { zend_uchar save = *(p + len); /* We have to make it ASCIIZ temporarily */ *(p + len) = '\0'; - if (perm_bind.pack_len < SIZEOF_LONG) { + if (perm_bind.pack_len < SIZEOF_ZEND_INT) { /* direct conversion */ int64_t v = #ifndef PHP_WIN32 @@ -1679,7 +1679,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, #else _atoi64((char *) p); #endif - ZVAL_LONG(current_field, (long) v); /* the cast is safe */ + ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */ } else { uint64_t v = #ifndef PHP_WIN32 @@ -1689,9 +1689,9 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, #endif zend_bool uns = fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE; /* We have to make it ASCIIZ temporarily */ -#if SIZEOF_LONG==8 +#if SIZEOF_ZEND_INT==8 if (uns == TRUE && v > 9223372036854775807L) -#elif SIZEOF_LONG==4 +#elif SIZEOF_ZEND_INT==4 if ((uns == TRUE && v > L64(2147483647)) || (uns == FALSE && (( L64(2147483647) < (int64_t) v) || (L64(-2147483648) > (int64_t) v)))) @@ -1701,7 +1701,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, { ZVAL_STRINGL(current_field, (char *)p, len); } else { - ZVAL_LONG(current_field, (long) v); /* the cast is safe */ + ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */ } } *(p + len) = save; @@ -1730,12 +1730,12 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, later in this function there will be an advancement. */ p -= len; - if (Z_TYPE_P(current_field) == IS_LONG) { - bit_area += 1 + sprintf((char *)start, "%ld", Z_LVAL_P(current_field)); + if (Z_TYPE_P(current_field) == IS_INT) { + bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_IVAL_P(current_field)); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); } else if (Z_TYPE_P(current_field) == IS_STRING){ - memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field)); - bit_area += Z_STRLEN_P(current_field); + memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRSIZE_P(current_field)); + bit_area += Z_STRSIZE_P(current_field); *bit_area++ = '\0'; zval_dtor(current_field); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h index bd87d9e757..059cfb2416 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.h +++ b/ext/mysqlnd/mysqlnd_wireprotocol.h @@ -28,7 +28,7 @@ #define MYSQLND_HEADER_SIZE 4 #define COMPRESSED_HEADER_SIZE 3 -#define MYSQLND_NULL_LENGTH (unsigned long) ~0 +#define MYSQLND_NULL_LENGTH (php_uint_t) ~0 /* Used in mysqlnd_debug.c */ PHPAPI extern const char mysqlnd_read_header_name[]; @@ -185,7 +185,7 @@ typedef struct st_mysqlnd_packet_rset_header { error_no != 0 => error others => result set -> Read res_field packets up to field_count */ - unsigned long field_count; + php_uint_t field_count; /* These are filled if no SELECT query. For SELECT warning_count and server status are in the last row packet, the EOF packet. @@ -258,7 +258,7 @@ typedef struct st_mysqlnd_packet_prepare_response { MYSQLND_PACKET_HEADER header; /* also known as field_count 0x00=OK , 0xFF=error */ unsigned char error_code; - unsigned long stmt_id; + php_uint_t stmt_id; unsigned int field_count; unsigned int param_count; unsigned int warning_count; @@ -300,7 +300,7 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response { PHPAPI void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const pass, size_t pass_len); -unsigned long php_mysqlnd_net_field_length(zend_uchar **packet); +php_uint_t php_mysqlnd_net_field_length(zend_uchar **packet); zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length); size_t php_mysqlnd_net_store_length_size(uint64_t length); diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index e0bc6d126d..95747a7e3a 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -138,11 +138,11 @@ PHP_MINFO_FUNCTION(mysqlnd) #else "not supported"); #endif - snprintf(buf, sizeof(buf), "%ld", MYSQLND_G(net_cmd_buffer_size)); + snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_cmd_buffer_size)); php_info_print_table_row(2, "Command buffer size", buf); - snprintf(buf, sizeof(buf), "%ld", MYSQLND_G(net_read_buffer_size)); + snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_read_buffer_size)); php_info_print_table_row(2, "Read buffer size", buf); - snprintf(buf, sizeof(buf), "%ld", MYSQLND_G(net_read_timeout)); + snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_read_timeout)); php_info_print_table_row(2, "Read timeout", buf); php_info_print_table_row(2, "Collecting statistics", MYSQLND_G(collect_statistics)? "Yes":"No"); php_info_print_table_row(2, "Collecting memory statistics", MYSQLND_G(collect_memory_statistics)? "Yes":"No"); @@ -206,7 +206,9 @@ static PHP_GINIT_FUNCTION(mysqlnd) */ static PHP_INI_MH(OnUpdateNetCmdBufferSize) { - long long_value = atol(new_value); + php_int_t long_value; + + ZEND_ATOI(long_value, new_value); if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) { return FAILURE; } diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index f05c0e8109..73f0c7f682 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1207,92 +1207,92 @@ PHP_MINIT_FUNCTION(oci) oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry TSRMLS_CC); /* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */ - REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SYSOPER",OCI_SYSOPER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SYSDBA",OCI_SYSDBA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_CRED_EXT",PHP_OCI_CRED_EXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_NO_AUTO_COMMIT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT); /* for $LOB->seek() */ - REGISTER_LONG_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SEEK_SET",PHP_OCI_SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SEEK_CUR",PHP_OCI_SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_SEEK_END",PHP_OCI_SEEK_END, CONST_CS | CONST_PERSISTENT); /* for $LOB->flush() */ - REGISTER_LONG_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_LOB_BUFFER_FREE",OCI_LOB_BUFFER_FREE, CONST_CS | CONST_PERSISTENT); /* for OCIBindByName (real "oci" names + short "php" names */ - REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_RSET",SQLT_RSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_AFC",SQLT_AFC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_CHR",SQLT_CHR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_VCS",SQLT_VCS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_AVC",SQLT_AVC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_STR",SQLT_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_LVC",SQLT_LVC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 10) - REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BFLOAT",SQLT_BFLOAT, CONST_CS | CONST_PERSISTENT); #endif #if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12 - REGISTER_LONG_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE", CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_INT",SQLT_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_NUM",SQLT_NUM, CONST_CS | CONST_PERSISTENT); #if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12 - REGISTER_LONG_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_B_BOL",SQLT_BOL, CONST_CS | CONST_PERSISTENT); #endif /* for OCIFetchStatement */ - REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_COLUMN", PHP_OCI_FETCHSTATEMENT_BY_COLUMN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_FETCHSTATEMENT_BY_ROW", PHP_OCI_FETCHSTATEMENT_BY_ROW, CONST_CS | CONST_PERSISTENT); /* for OCIFetchInto & OCIResult */ - REGISTER_LONG_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_ASSOC",PHP_OCI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_NUM",PHP_OCI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_BOTH",PHP_OCI_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_RETURN_NULLS",PHP_OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_RETURN_LOBS",PHP_OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT); /* for OCINewDescriptor (real "oci" names + short "php" names */ - REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); /* for OCIWriteTemporaryLob */ - REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -2791,7 +2791,7 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg /* Only for ocifetchinto BC. In all other cases we return array, not long */ REPLACE_ZVAL_VALUE(&array, return_value, 1); /* copy return_value to given reference */ zval_dtor(return_value); - RETURN_LONG(statement->ncolumns); + RETURN_INT(statement->ncolumns); } } /* }}} */ diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 198493b946..985fd973c8 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -402,7 +402,7 @@ PHP_FUNCTION(oci_lob_tell) PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); - RETURN_LONG(descriptor->lob_current_position); + RETURN_INT(descriptor->lob_current_position); } /* }}} */ @@ -508,7 +508,7 @@ PHP_FUNCTION(oci_lob_size) if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(lob_length); + RETURN_INT(lob_length); } /* }}} */ @@ -550,13 +550,13 @@ PHP_FUNCTION(oci_lob_write) PHP_OCI_ZVAL_TO_DESCRIPTOR(*tmp, descriptor); if (data_len <= 0) { - RETURN_LONG(0); + RETURN_INT(0); } if (php_oci_lob_write(descriptor, descriptor->lob_current_position, data, data_len, &bytes_written TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(bytes_written); + RETURN_INT(bytes_written); } /* }}} */ @@ -689,7 +689,7 @@ PHP_FUNCTION(oci_lob_erase) if (php_oci_lob_erase(descriptor, offset, length, &bytes_erased TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(bytes_erased); + RETURN_INT(bytes_erased); } /* }}} */ @@ -1161,9 +1161,9 @@ PHP_FUNCTION(oci_field_size) if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { /* Handle data type of LONG */ if (column->data_type == SQLT_LNG){ - RETURN_LONG(column->storage_size4); + RETURN_INT(column->storage_size4); } - RETURN_LONG(column->data_size); + RETURN_INT(column->data_size); } RETURN_FALSE; } @@ -1176,7 +1176,7 @@ PHP_FUNCTION(oci_field_scale) php_oci_out_column *column; if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_LONG(column->scale); + RETURN_INT(column->scale); } RETURN_FALSE; } @@ -1189,7 +1189,7 @@ PHP_FUNCTION(oci_field_precision) php_oci_out_column *column; if ( ( column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) ) ) { - RETURN_LONG(column->precision); + RETURN_INT(column->precision); } RETURN_FALSE; } @@ -1270,7 +1270,7 @@ PHP_FUNCTION(oci_field_type) RETVAL_STRING("ROWID",1); break; default: - RETVAL_LONG(column->data_type); + RETVAL_INT(column->data_type); } } /* }}} */ @@ -1283,7 +1283,7 @@ PHP_FUNCTION(oci_field_type_raw) column = php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (column) { - RETURN_LONG(column->data_type); + RETURN_INT(column->data_type); } RETURN_FALSE; } @@ -1405,7 +1405,7 @@ PHP_FUNCTION(oci_fetch_all) while (skip--) { if (php_oci_statement_fetch(statement, nrows TSRMLS_CC)) { - RETURN_LONG(0); + RETURN_INT(0); } } @@ -1484,7 +1484,7 @@ PHP_FUNCTION(oci_fetch_all) efree(outarrs); } - RETURN_LONG(rows); + RETURN_INT(rows); } /* }}} */ @@ -1659,11 +1659,11 @@ go_out: if (errcode) { array_init(return_value); - add_assoc_long(return_value, "code", errcode); + add_assoc_int(return_value, "code", errcode); // TODO: avoid reallocation ??? add_assoc_string(return_value, "message", (char*) errbuf); efree(errbuf); - add_assoc_long(return_value, "offset", error_offset); + add_assoc_int(return_value, "offset", error_offset); add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : ""); } else { RETURN_FALSE; @@ -1684,7 +1684,7 @@ PHP_FUNCTION(oci_num_fields) PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement); - RETURN_LONG(statement->ncolumns); + RETURN_INT(statement->ncolumns); } /* }}} */ @@ -2156,7 +2156,7 @@ PHP_FUNCTION(oci_num_rows) if (php_oci_statement_get_numrows(statement, &rowcount TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(rowcount); + RETURN_INT(rowcount); } /* }}} */ @@ -2353,7 +2353,7 @@ PHP_FUNCTION(oci_collection_size) if (php_oci_collection_size(collection, &size TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(size); + RETURN_INT(size); } /* }}} */ @@ -2381,7 +2381,7 @@ PHP_FUNCTION(oci_collection_max) if (php_oci_collection_max(collection, &max TSRMLS_CC)) { RETURN_FALSE; } - RETURN_LONG(max); + RETURN_INT(max); } /* }}} */ diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index f9d2a3a0ff..16fe457433 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -976,16 +976,16 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) zval_dtor(val); ZVAL_NULL(val); } else if (Z_TYPE_P(bind->zval) == IS_STRING - && Z_STRLEN_P(bind->zval) > 0 - && Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] != '\0') { + && Z_STRSIZE_P(bind->zval) > 0 + && Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] != '\0') { /* The post- PHP 5.3 feature for "interned" strings disallows * their reallocation but (i) any IN binds either interned or * not should already be null terminated and (ii) for OUT * binds, php_oci_bind_out_callback() should have allocated a * new string that we can modify here. */ - Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRLEN_P(bind->zval)+1); - Z_STRVAL_P(bind->zval)[ Z_STRLEN_P(bind->zval) ] = '\0'; + Z_STRVAL_P(bind->zval) = erealloc(Z_STRVAL_P(bind->zval), Z_STRSIZE_P(bind->zval)+1); + Z_STRVAL_P(bind->zval)[ Z_STRSIZE_P(bind->zval) ] = '\0'; } else if (Z_TYPE_P(bind->zval) == IS_ARRAY) { int i; zval **entry; @@ -1000,10 +1000,10 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) for (i = 0; i < bind->array.current_length; i++) { if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { zval_dtor(*entry); - ZVAL_LONG(*entry, ((ub4 *)(bind->array.elements))[i]); + ZVAL_INT(*entry, ((ub4 *)(bind->array.elements))[i]); zend_hash_move_forward(hash); } else { - add_next_index_long(bind->zval, ((ub4 *)(bind->array.elements))[i]); + add_next_index_int(bind->zval, ((ub4 *)(bind->array.elements))[i]); } } break; @@ -1143,8 +1143,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid variable used for bind"); return 1; } - convert_to_long(var); - bind_data = (ub4 *)&Z_LVAL_P(var); + convert_to_int(var); + bind_data = (ub4 *)&Z_IVAL_P(var); value_sz = sizeof(ub4); mode = OCI_DEFAULT; break; @@ -1162,7 +1162,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, convert_to_string(var); } if (maxlength == -1) { - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : 0; + value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRSIZE_P(var) : 0; } else { value_sz = maxlength; } @@ -1190,7 +1190,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, return 1; } convert_to_boolean(var); - bind_data = (int *)&Z_LVAL_P(var); + bind_data = (int *)&Z_IVAL_P(var); value_sz = sizeof(int); mode = OCI_DEFAULT; @@ -1332,7 +1332,7 @@ sb4 php_oci_bind_in_callback( convert_to_string(val); *bufpp = Z_STRVAL_P(val); - *alenp = Z_STRLEN_P(val); + *alenp = Z_STRSIZE_P(val); *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ @@ -1414,11 +1414,11 @@ sb4 php_oci_bind_out_callback( convert_to_string(val); zval_dtor(val); - Z_STRLEN_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ - Z_STRVAL_P(val) = ecalloc(1, Z_STRLEN_P(phpbind->zval) + 1); + Z_STRSIZE_P(val) = PHP_OCI_PIECE_SIZE; /* 64K-1 is max XXX */ + Z_STRVAL_P(val) = ecalloc(1, Z_STRSIZE_P(phpbind->zval) + 1); /* XXX we assume that zend-zval len has 4 bytes */ - *alenpp = (ub4*) &Z_STRLEN_P(phpbind->zval); + *alenpp = (ub4*) &Z_STRSIZE_P(phpbind->zval); *bufpp = Z_STRVAL_P(phpbind->zval); *piecep = OCI_ONE_PIECE; *rcodepp = &phpbind->retcode; @@ -1453,7 +1453,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME } if (Z_TYPE_P(column_index) == IS_STRING) { - column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRLEN_P(column_index) TSRMLS_CC); + column = php_oci_statement_get_column(statement, -1, Z_STRVAL_P(column_index), Z_STRSIZE_P(column_index) TSRMLS_CC); if (!column) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column name \"%s\"", Z_STRVAL_P(column_index)); return NULL; @@ -1463,10 +1463,10 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME /* NB: for PHP4 compat only, it should be using 'Z' instead */ tmp = *column_index; zval_copy_ctor(&tmp); - convert_to_long(&tmp); - column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0 TSRMLS_CC); + convert_to_int(&tmp); + column = php_oci_statement_get_column(statement, Z_IVAL(tmp), NULL, 0 TSRMLS_CC); if (!column) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_LVAL(tmp)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column index \"%ld\"", Z_IVAL(tmp)); zval_dtor(&tmp); return NULL; } @@ -1639,8 +1639,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, zend_hash_internal_pointer_reset(hash); while (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - if (Z_STRLEN_PP(entry) > maxlength) { - maxlength = Z_STRLEN_PP(entry) + 1; + if (Z_STRSIZE_PP(entry) > maxlength) { + maxlength = Z_STRSIZE_PP(entry) + 1; } zend_hash_move_forward(hash); } @@ -1662,8 +1662,8 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, for (i = 0; i < bind->array.current_length; i++) { if (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE) { convert_to_string_ex(entry); - bind->array.element_lengths[i] = Z_STRLEN_PP(entry); - if (Z_STRLEN_PP(entry) == 0) { + bind->array.element_lengths[i] = Z_STRSIZE_PP(entry); + if (Z_STRSIZE_PP(entry) == 0) { bind->array.indicators[i] = -1; } zend_hash_move_forward(hash); @@ -1678,7 +1678,7 @@ php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, int element_length; convert_to_string_ex(entry); - element_length = (maxlength > Z_STRLEN_PP(entry)) ? Z_STRLEN_PP(entry) : maxlength; + element_length = (maxlength > Z_STRSIZE_PP(entry)) ? Z_STRSIZE_PP(entry) : maxlength; memcpy((text *)bind->array.elements + i*maxlength, Z_STRVAL_PP(entry), element_length); ((text *)bind->array.elements)[i*maxlength + element_length] = '\0'; @@ -1720,8 +1720,8 @@ php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length bind->array.element_lengths[i] = sizeof(ub4); } if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { - convert_to_long_ex(entry); - ((ub4 *)bind->array.elements)[i] = (ub4) Z_LVAL_PP(entry); + convert_to_int_ex(entry); + ((ub4 *)bind->array.elements)[i] = (ub4) Z_IVAL_PP(entry); zend_hash_move_forward(hash); } else { ((ub4 *)bind->array.elements)[i] = 0; @@ -1802,7 +1802,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) { convert_to_string_ex(entry); - PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRSIZE_PP(entry), NULL, 0, NULL, 0, &oci_date)); if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c index 7bc3833d86..13e4d523fb 100644 --- a/ext/odbc/birdstep.c +++ b/ext/odbc/birdstep.c @@ -193,7 +193,7 @@ PHP_MINIT_FUNCTION(birdstep) { SQLAllocEnv(&henv); - if ( cfg_get_long("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { + if ( cfg_get_int("birdstep.max_links",&php_birdstep_module.max_links) == FAILURE ) { php_birdstep_module.max_links = -1; } php_birdstep_module.num_links = 0; @@ -291,7 +291,7 @@ PHP_FUNCTION(birdstep_connect) RETCODE stat; HDBC hdbc; VConn *new; - long ind; + php_int_t ind; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) { return; @@ -316,7 +316,7 @@ PHP_FUNCTION(birdstep_connect) new = (VConn *)emalloc(sizeof(VConn)); ind = birdstep_add_conn(list,new,hdbc TSRMLS_CC); php_birdstep_module.num_links++; - RETURN_LONG(ind); + RETURN_INT(ind); } /* }}} */ @@ -324,10 +324,10 @@ PHP_FUNCTION(birdstep_connect) */ PHP_FUNCTION(birdstep_close) { - long id; + php_int_t id; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { return; } @@ -346,7 +346,7 @@ PHP_FUNCTION(birdstep_close) PHP_FUNCTION(birdstep_exec) { char *query; - long ind; + php_int_t ind; int query_len, indx; VConn *conn; Vresult *res; @@ -354,7 +354,7 @@ PHP_FUNCTION(birdstep_exec) SWORD cols,i,colnamelen; SDWORD rows,coldesc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &ind, &query, &query_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &ind, &query, &query_len) == FAILURE) { return; } @@ -392,7 +392,7 @@ PHP_FUNCTION(birdstep_exec) } SQLFreeStmt(res->hstmt,SQL_DROP); efree(res); - RETURN_LONG(rows); + RETURN_INT(rows); } else { /* Was SELECT query */ res->values = (VResVal *)safe_emalloc(sizeof(VResVal), cols, 0); res->numcols = cols; @@ -418,7 +418,7 @@ PHP_FUNCTION(birdstep_exec) } res->fetched = 0; indx = birdstep_add_result(list,res,conn); - RETURN_LONG(indx); + RETURN_INT(indx); } /* }}} */ @@ -426,13 +426,13 @@ PHP_FUNCTION(birdstep_exec) */ PHP_FUNCTION(birdstep_fetch) { - long ind; + php_int_t ind; Vresult *res; RETCODE stat; UDWORD row; UWORD RowStat[1]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) { return; } @@ -441,13 +441,13 @@ PHP_FUNCTION(birdstep_fetch) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } res->fetched = 1; @@ -460,7 +460,7 @@ PHP_FUNCTION(birdstep_fetch) PHP_FUNCTION(birdstep_result) { zval **col; - long ind; + php_int_t ind; Vresult *res; RETCODE stat; int i,sql_c_type; @@ -469,7 +469,7 @@ PHP_FUNCTION(birdstep_result) SWORD indx = -1; char *field = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &ind, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iZ", &ind, &col) == FAILURE) { return; } @@ -478,8 +478,8 @@ PHP_FUNCTION(birdstep_result) if ( Z_TYPE_PP(col) == IS_STRING ) { field = Z_STRVAL_PP(col); } else { - convert_to_long_ex(col); - indx = Z_LVAL_PP(col); + convert_to_int_ex(col); + indx = Z_IVAL_PP(col); } if ( field ) { for ( i = 0; i < res->numcols; i++ ) { @@ -502,13 +502,13 @@ PHP_FUNCTION(birdstep_result) stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } res->fetched = 1; @@ -527,19 +527,19 @@ l1: res->values[indx].value,4095,&res->values[indx].vallen); if ( stat == SQL_NO_DATA_FOUND ) { SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error"); SQLFreeStmt(res->hstmt,SQL_DROP); - birdstep_del_result(list,Z_LVAL_PP(ind)); + birdstep_del_result(list,Z_IVAL_PP(ind)); RETURN_FALSE; } if ( res->values[indx].valtype == SQL_LONGVARCHAR ) { RETURN_STRING(res->values[indx].value,TRUE); } else { - RETURN_LONG((long)res->values[indx].value); + RETURN_INT((long)res->values[indx].value); } default: if ( res->values[indx].value != NULL ) { @@ -553,10 +553,10 @@ l1: */ PHP_FUNCTION(birdstep_freeresult) { - long ind; + php_int_t ind; Vresult *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) { return; } @@ -572,11 +572,11 @@ PHP_FUNCTION(birdstep_freeresult) */ PHP_FUNCTION(birdstep_autocommit) { - long id; + php_int_t id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { return; } @@ -595,11 +595,11 @@ PHP_FUNCTION(birdstep_autocommit) */ PHP_FUNCTION(birdstep_off_autocommit) { - long id; + php_int_t id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { return; } @@ -618,11 +618,11 @@ PHP_FUNCTION(birdstep_off_autocommit) */ PHP_FUNCTION(birdstep_commit) { - long id; +php_int_t RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { return; } @@ -641,11 +641,11 @@ PHP_FUNCTION(birdstep_commit) */ PHP_FUNCTION(birdstep_rollback) { - long id; + php_int_t id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &id) == FAILURE) { return; } @@ -664,11 +664,11 @@ PHP_FUNCTION(birdstep_rollback) */ PHP_FUNCTION(birdstep_fieldname) { - long ind, col; + php_int_t ind, col; Vresult *res; SWORD indx; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &ind, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &ind, &col) == FAILURE) { return; } @@ -687,16 +687,16 @@ PHP_FUNCTION(birdstep_fieldname) */ PHP_FUNCTION(birdstep_fieldnum) { - long ind; + php_int_t ind; Vresult *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ind) == FAILURE) { return; } PHP_GET_BIRDSTEP_RES_IDX(ind); - RETURN_LONG(res->numcols); + RETURN_INT(res->numcols); } /* }}} */ diff --git a/ext/odbc/php_birdstep.h b/ext/odbc/php_birdstep.h index 90180d0641..430445b415 100644 --- a/ext/odbc/php_birdstep.h +++ b/ext/odbc/php_birdstep.h @@ -28,28 +28,28 @@ typedef struct VConn { HDBC hdbc; - long index; + php_int_t index; } VConn; typedef struct { char name[32]; char *value; - long vallen; + php_int_t vallen; SDWORD valtype; } VResVal; typedef struct Vresult { HSTMT hstmt; VConn *conn; - long index; + php_int_t index; VResVal *values; - long numcols; + php_int_t numcols; int fetched; } Vresult; typedef struct { - long num_links; - long max_links; + php_int_t num_links; + php_int_t max_links; int le_link,le_result; } birdstep_module; diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 10384da2ad..d0c7138ab2 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -718,84 +718,84 @@ PHP_MINIT_FUNCTION(odbc) odbc_module_entry.type = type; REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT); /* Define Constants for options these Constants are defined in <sqlext.h> */ - REGISTER_LONG_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); /* these are for the Data Source type */ - REGISTER_LONG_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_FETCH_FIRST", SQL_FETCH_FIRST, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_FETCH_NEXT", SQL_FETCH_NEXT, CONST_PERSISTENT | CONST_CS); /* * register the standard data types */ - REGISTER_LONG_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS); #if defined(ODBCVER) && (ODBCVER >= 0x0300) - REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_WCHAR", SQL_WCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_WVARCHAR", SQL_WVARCHAR, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_WLONGVARCHAR", SQL_WLONGVARCHAR, CONST_PERSISTENT | CONST_CS); /* * SQLSpecialColumns values */ - REGISTER_LONG_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS); /* * SQLStatistics values */ - REGISTER_LONG_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS); #endif #if defined(HAVE_IBMDB2) && defined(_AIX) @@ -841,9 +841,9 @@ PHP_MINFO_FUNCTION(odbc) php_info_print_table_start(); php_info_print_table_header(2, "ODBC Support", "enabled"); - snprintf(buf, sizeof(buf), "%ld", ODBCG(num_persistent)); + snprintf(buf, sizeof(buf), "%pd", ODBCG(num_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), "%ld", ODBCG(num_links)); + snprintf(buf, sizeof(buf), "%pd", ODBCG(num_links)); php_info_print_table_row(2, "Active Links", buf); php_info_print_table_row(2, "ODBC library", PHP_ODBC_TYPE); #ifndef PHP_WIN32 @@ -911,13 +911,13 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) { odbc_result *result; zval *pv_res; - long flag; + php_int_t flag; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &flag) == FAILURE) { return; } - if (Z_LVAL_P(pv_res)) { + if (Z_IVAL_P(pv_res)) { ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); if (mode) { result->longreadlen = flag; @@ -1061,9 +1061,9 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) SQLLEN len; #endif zval *pv_res; - long pv_num; + php_int_t pv_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) { return; } @@ -1086,7 +1086,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len); - RETURN_LONG(len); + RETURN_INT(len); } /* }}} */ @@ -1301,7 +1301,7 @@ PHP_FUNCTION(odbc_execute) } rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable); - params[i-1].vallen = Z_STRLEN_P(tmp); + params[i-1].vallen = Z_STRSIZE_P(tmp); params[i-1].fp = -1; if (rc == SQL_ERROR) { odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter"); @@ -1321,14 +1321,14 @@ PHP_FUNCTION(odbc_execute) ctype = SQL_C_CHAR; } - if (Z_STRLEN_P(tmp) > 2 && + if (Z_STRSIZE_P(tmp) > 2 && Z_STRVAL_P(tmp)[0] == '\'' && - Z_STRVAL_P(tmp)[Z_STRLEN_P(tmp) - 1] == '\'') { + Z_STRVAL_P(tmp)[Z_STRSIZE_P(tmp) - 1] == '\'') { if (CHECK_ZVAL_NULL_PATH(tmp)) { RETURN_FALSE; } - filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRLEN_P(tmp) - 2); + filename = estrndup(&Z_STRVAL_P(tmp)[1], Z_STRSIZE_P(tmp) - 2); filename[strlen(filename)] = '\0'; /* Check the basedir */ @@ -1518,13 +1518,13 @@ PHP_FUNCTION(odbc_cursor) PHP_FUNCTION(odbc_data_source) { zval *zv_conn; - long zv_fetch_type; + php_int_t zv_fetch_type; RETCODE rc = 0; /* assume all is good */ odbc_connection *conn; UCHAR server_name[100], desc[200]; SQLSMALLINT len1=0, len2=0, fetch_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zv_conn, &zv_fetch_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zv_conn, &zv_fetch_type) == FAILURE) { return; } @@ -1573,7 +1573,7 @@ PHP_FUNCTION(odbc_data_source) PHP_FUNCTION(odbc_exec) { zval *pv_conn; - long pv_flags; + php_int_t pv_flags; char *query; int numArgs, query_len; odbc_result *result = NULL; @@ -1585,7 +1585,7 @@ PHP_FUNCTION(odbc_exec) numArgs = ZEND_NUM_ARGS(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) { return; } @@ -1668,9 +1668,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) SQLUSMALLINT RowStatus[1]; SQLLEN rownum; zval *pv_res, tmp; - long pv_row = -1; + php_int_t pv_row = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) { return; } @@ -1815,14 +1815,14 @@ PHP_FUNCTION(odbc_fetch_into) char *buf = NULL; zval *pv_res, *pv_res_arr, tmp; #ifdef HAVE_SQL_EXTENDED_FETCH - long pv_row = 0; + php_int_t pv_row = 0; SQLULEN crow; SQLUSMALLINT RowStatus[1]; SQLLEN rownum = -1; #endif /* HAVE_SQL_EXTENDED_FETCH */ #ifdef HAVE_SQL_EXTENDED_FETCH - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|l", &pv_res, &pv_res_arr, &pv_row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/|i", &pv_res, &pv_res_arr, &pv_row) == FAILURE) { return; } @@ -1919,7 +1919,7 @@ PHP_FUNCTION(odbc_fetch_into) zend_hash_index_update(Z_ARRVAL_P(pv_res_arr), i, &tmp); } if (buf) efree(buf); - RETURN_LONG(result->numcols); + RETURN_INT(result->numcols); } /* }}} */ @@ -1964,13 +1964,13 @@ PHP_FUNCTION(odbc_fetch_row) odbc_result *result; RETCODE rc; zval *pv_res; - long pv_row = 1; + php_int_t pv_row = 1; #ifdef HAVE_SQL_EXTENDED_FETCH SQLULEN crow; SQLUSMALLINT RowStatus[1]; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_res, &pv_row) == FAILURE) { return; } @@ -2035,8 +2035,8 @@ PHP_FUNCTION(odbc_result) if (Z_TYPE_P(pv_field) == IS_STRING) { field = Z_STRVAL_P(pv_field); } else { - convert_to_long_ex(pv_field); - field_ind = Z_LVAL_P(pv_field) - 1; + convert_to_int_ex(pv_field); + field_ind = Z_IVAL_P(pv_field) - 1; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); @@ -2231,7 +2231,7 @@ PHP_FUNCTION(odbc_result_all) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { php_printf("<h2>No rows found</h2>\n"); - RETURN_LONG(0); + RETURN_INT(0); } /* Start table tag */ @@ -2315,7 +2315,7 @@ PHP_FUNCTION(odbc_result_all) } php_printf("</table>\n"); if (buf) efree(buf); - RETURN_LONG(result->fetched); + RETURN_INT(result->fetched); } /* }}} */ @@ -2501,7 +2501,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) { char *db, *uid, *pwd; int db_len, uid_len, pwd_len; - long pv_opt = SQL_CUR_DEFAULT; + php_int_t pv_opt = SQL_CUR_DEFAULT; odbc_connection *db_conn; char *hashed_details; int hashed_len, cur_opt; @@ -2509,7 +2509,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* Now an optional 4th parameter specifying the cursor type * defaulting to the cursors default */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|i", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) { return; } @@ -2709,7 +2709,7 @@ PHP_FUNCTION(odbc_num_rows) } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); SQLRowCount(result->stmt, &rows); - RETURN_LONG(rows); + RETURN_INT(rows); } /* }}} */ @@ -2774,7 +2774,7 @@ PHP_FUNCTION(odbc_num_fields) return; } ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); - RETURN_LONG(result->numcols); + RETURN_INT(result->numcols); } /* }}} */ @@ -2784,9 +2784,9 @@ PHP_FUNCTION(odbc_field_name) { odbc_result *result; zval *pv_res; - long pv_num; + php_int_t pv_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) { return; } @@ -2819,9 +2819,9 @@ PHP_FUNCTION(odbc_field_type) char tmp[32]; SQLSMALLINT tmplen; zval *pv_res; - long pv_num; + php_int_t pv_num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pv_res, &pv_num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pv_res, &pv_num) == FAILURE) { return; } @@ -2893,7 +2893,7 @@ PHP_FUNCTION(odbc_field_num) if (field_ind == -1) { RETURN_FALSE; } - RETURN_LONG(field_ind); + RETURN_INT(field_ind); } /* }}} */ @@ -2905,9 +2905,9 @@ PHP_FUNCTION(odbc_autocommit) odbc_connection *conn; RETCODE rc; zval *pv_conn; - long pv_onoff = 0; + php_int_t pv_onoff = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_onoff) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_onoff) == FAILURE) { return; } @@ -2928,7 +2928,7 @@ PHP_FUNCTION(odbc_autocommit) odbc_sql_error(conn, SQL_NULL_HSTMT, "Get commit status"); RETURN_FALSE; } - RETVAL_LONG((long)status); + RETVAL_INT((long)status); } } /* }}} */ @@ -3017,9 +3017,9 @@ PHP_FUNCTION(odbc_setoption) odbc_result *result; RETCODE rc; zval *pv_handle; - long pv_which, pv_opt, pv_val; + php_int_t pv_which, pv_opt, pv_val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riii", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) { return; } @@ -3344,13 +3344,13 @@ PHP_FUNCTION(odbc_foreignkeys) PHP_FUNCTION(odbc_gettypeinfo) { zval *pv_conn; - long pv_data_type = SQL_ALL_TYPES; + php_int_t pv_data_type = SQL_ALL_TYPES; odbc_result *result = NULL; odbc_connection *conn; RETCODE rc; SQLSMALLINT data_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_data_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pv_conn, &pv_data_type) == FAILURE) { return; } @@ -3597,7 +3597,7 @@ PHP_FUNCTION(odbc_procedures) PHP_FUNCTION(odbc_specialcolumns) { zval *pv_conn; - long vtype, vscope, vnullable; + php_int_t vtype, vscope, vnullable; odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *name = NULL; @@ -3605,7 +3605,7 @@ PHP_FUNCTION(odbc_specialcolumns) SQLUSMALLINT type, scope, nullable; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ris!ssi", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len, &name, &name_len, &vscope, &vnullable) == FAILURE) { return; } @@ -3667,7 +3667,7 @@ PHP_FUNCTION(odbc_specialcolumns) PHP_FUNCTION(odbc_statistics) { zval *pv_conn; - long vunique, vreserved; + php_int_t vunique, vreserved; odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema, *name; @@ -3675,7 +3675,7 @@ PHP_FUNCTION(odbc_statistics) SQLUSMALLINT unique, reserved; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssll", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssii", &pv_conn, &cat, &cat_len, &schema, &schema_len, &name, &name_len, &vunique, &vreserved) == FAILURE) { return; } diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index 8e9eec0f8f..14b3d6812d 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -161,7 +161,7 @@ PHP_FUNCTION(solid_fetch_prev); #define ODBC_TYPE "Birdstep" #define UNIX /* - * Extended Fetch in the Birdstep ODBC API is incapable of returning long varchar (memo) fields. + * Extended Fetch in the Birdstep ODBC API is incapable of returning php_int_t varchar (memo) fields. * So the following line has been commented-out to accommodate. - KNS * * #define HAVE_SQL_EXTENDED_FETCH 1 @@ -247,7 +247,7 @@ typedef struct odbc_result { # if HAVE_SQL_EXTENDED_FETCH int fetch_abs; # endif - long longreadlen; + php_int_t longreadlen; int binmode; int fetched; odbc_connection *conn_ptr; @@ -257,16 +257,16 @@ ZEND_BEGIN_MODULE_GLOBALS(odbc) char *defDB; char *defUser; char *defPW; - long allow_persistent; - long check_persistent; - long max_persistent; - long max_links; - long num_persistent; - long num_links; + php_int_t allow_persistent; + php_int_t check_persistent; + php_int_t max_persistent; + php_int_t max_links; + php_int_t num_persistent; + php_int_t num_links; int defConn; - long defaultlrl; - long defaultbinmode; - long default_cursortype; + php_int_t defaultlrl; + php_int_t defaultbinmode; + php_int_t default_cursortype; char laststate[6]; char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; HashTable *resource_list; diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 32800a1399..fb7e64bb6d 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -644,14 +644,14 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_PRINT && opline->opcode != ZEND_CASE && opline->opcode != ZEND_FREE) { ZEND_OP1_TYPE(opline) = IS_CONST; - LITERAL_LONG(opline->op1, 1); + LITERAL_INT(opline->op1, 1); } if (ZEND_OP2_TYPE(opline) == IS_TMP_VAR && VAR_SOURCE(opline->op2) && VAR_SOURCE(opline->op2)->opcode == ZEND_PRINT) { ZEND_OP2_TYPE(opline) = IS_CONST; - LITERAL_LONG(opline->op2, 1); + LITERAL_INT(opline->op2, 1); } /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */ @@ -706,11 +706,11 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, zend_op *sv = fcall-1; if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(sv) == IS_CONST && Z_TYPE(OPLINE_OP1_LITERAL(sv)) == IS_STRING && - Z_LVAL(OPLINE_OP2_LITERAL(sv)) == 1 + Z_IVAL(OPLINE_OP2_LITERAL(sv)) == 1 ) { zval *arg = &OPLINE_OP1_LITERAL(sv); - char *fname = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].function_name; - int flen = FUNCTION_CACHE->funcs[Z_LVAL(ZEND_OP1_LITERAL(fcall))].name_len; + char *fname = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].function_name; + int flen = FUNCTION_CACHE->funcs[Z_IVAL(ZEND_OP1_LITERAL(fcall))].name_len; if(flen == sizeof("defined")-1 && zend_binary_strcasecmp(fname, flen, "defined", sizeof("defined")-1) == 0) { zval c; if(zend_get_persistent_constant(Z_STR_P(arg), &c, 0 TSRMLS_CC ELS_CC) != 0) { @@ -903,8 +903,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) { convert_to_string_safe(&ZEND_OP1_LITERAL(last_op)); } - old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op)); - l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline)); + old_len = Z_STRSIZE(ZEND_OP1_LITERAL(last_op)); + l = old_len + Z_STRSIZE(ZEND_OP1_LITERAL(opline)); if (IS_INTERNED(Z_STR(ZEND_OP1_LITERAL(last_op)))) { zend_string *tmp = STR_ALLOC(l, 0); memcpy(tmp->val, Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len); @@ -913,7 +913,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, Z_STR(ZEND_OP1_LITERAL(last_op)) = STR_REALLOC(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0); } Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX; - memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRSIZE(ZEND_OP1_LITERAL(opline))); Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0'; zval_dtor(&ZEND_OP1_LITERAL(opline)); Z_STR(ZEND_OP1_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op)) TSRMLS_CC); @@ -947,8 +947,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, opline->opcode = ZEND_ADD_STRING; } COPY_NODE(opline->op1, src->op1); - old_len = Z_STRLEN(ZEND_OP2_LITERAL(src)); - l = old_len + Z_STRLEN(ZEND_OP2_LITERAL(opline)); + old_len = Z_STRSIZE(ZEND_OP2_LITERAL(src)); + l = old_len + Z_STRSIZE(ZEND_OP2_LITERAL(opline)); if (IS_INTERNED(Z_STR(ZEND_OP2_LITERAL(src)))) { zend_string *tmp = STR_ALLOC(l, 0); memcpy(tmp->val, Z_STRVAL(ZEND_OP2_LITERAL(src)), old_len); @@ -957,7 +957,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, Z_STR(ZEND_OP2_LITERAL(src)) = STR_REALLOC(Z_STR(ZEND_OP2_LITERAL(src)), l, 0); } Z_TYPE_INFO(ZEND_OP2_LITERAL(last_op)) = IS_STRING_EX; - memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + memcpy(Z_STRVAL(ZEND_OP2_LITERAL(src)) + old_len, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); Z_STRVAL(ZEND_OP2_LITERAL(src))[l] = '\0'; STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); Z_STR(ZEND_OP2_LITERAL(opline)) = zend_new_interned_string(Z_STR(ZEND_OP2_LITERAL(src)) TSRMLS_CC); @@ -972,7 +972,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, continue; } else if (opline->opcode == ZEND_ADD_CHAR && ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP2_TYPE(opline) == IS_CONST) { /* convert ADD_CHAR(C1, C2) to CONCAT(C1, C2) */ - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); opline->opcode = ZEND_CONCAT; continue; @@ -1002,8 +1002,8 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, int er; if ((opline->opcode == ZEND_DIV || opline->opcode == ZEND_MOD) && - ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG && - Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) || + ((Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT && + Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) || (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_DOUBLE && Z_DVAL(ZEND_OP2_LITERAL(opline)) == 0.0))) { if (RESULT_USED(opline)) { @@ -1062,7 +1062,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_UNSET(opline->op1); COPY_NODE(opline->op1, opline->op2); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP1_LITERAL(opline), &c, 1); } SET_UNUSED(opline->op2); @@ -1077,13 +1077,13 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT && ZEND_OP2_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { + Z_STRSIZE(ZEND_OP2_LITERAL(VAR_SOURCE(opline->op1))) == 0) { /* convert T = CONCAT(X,''), T = ADD_STRING(T, Y) to T = CONCAT(X,Y) */ zend_op *src = VAR_SOURCE(opline->op1); VAR_UNSET(opline->op1); COPY_NODE(opline->op1, src->op1); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); } opline->opcode = ZEND_CONCAT; @@ -1119,7 +1119,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_UNSET(opline->op1); COPY_NODE(opline->op1, src->op1); if (opline->opcode == ZEND_ADD_CHAR) { - char c = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char c = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_STRINGL(&ZEND_OP2_LITERAL(opline), &c, 1); } opline->opcode = ZEND_CONCAT; diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index 551f439041..e941380738 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -291,7 +291,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } @@ -345,13 +345,13 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c } map[i] = l_true; break; - case IS_LONG: - if ((pos = zend_hash_index_find(&hash, Z_LVAL(op_array->literals[i]))) != NULL) { - map[i] = Z_LVAL_P(pos); + case IS_INT: + if ((pos = zend_hash_index_find(&hash, Z_IVAL(op_array->literals[i]))) != NULL) { + map[i] = Z_IVAL_P(pos); } else { map[i] = j; - ZVAL_LONG(&zv, j); - zend_hash_index_update(&hash, Z_LVAL(op_array->literals[i]), &zv); + ZVAL_INT(&zv, j); + zend_hash_index_update(&hash, Z_IVAL(op_array->literals[i]), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; info[j] = info[i]; @@ -361,10 +361,10 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c break; case IS_DOUBLE: if ((pos = zend_hash_str_find(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double))) != NULL) { - map[i] = Z_LVAL_P(pos); + map[i] = Z_IVAL_P(pos); } else { map[i] = j; - ZVAL_LONG(&zv, j); + ZVAL_INT(&zv, j); zend_hash_str_add(&hash, (char*)&Z_DVAL(op_array->literals[i]), sizeof(double), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; @@ -377,32 +377,32 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c case IS_CONSTANT: if (info[i].flags & LITERAL_MAY_MERGE) { if (info[i].flags & LITERAL_EX_OBJ) { - int key_len = MAX_LENGTH_OF_LONG + sizeof("->") + Z_STRLEN(op_array->literals[i]); + int key_len = MAX_LENGTH_OF_ZEND_INT + sizeof("->") + Z_STRSIZE(op_array->literals[i]); key = STR_ALLOC(key_len, 0); key->len = snprintf(key->val, key->len-1, "%d->%s", info[i].u.num, Z_STRVAL(op_array->literals[i])); } else if (info[i].flags & LITERAL_EX_CLASS) { int key_len; zval *class_name = &op_array->literals[(info[i].u.num < i) ? map[info[i].u.num] : info[i].u.num]; - key_len = Z_STRLEN_P(class_name) + sizeof("::") + Z_STRLEN(op_array->literals[i]); + key_len = Z_STRSIZE_P(class_name) + sizeof("::") + Z_STRSIZE(op_array->literals[i]); key = STR_ALLOC(key_len, 0); - memcpy(key->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); - memcpy(key->val + Z_STRLEN_P(class_name), "::", sizeof("::") - 1); - memcpy(key->val + Z_STRLEN_P(class_name) + sizeof("::") - 1, + memcpy(key->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); + memcpy(key->val + Z_STRSIZE_P(class_name), "::", sizeof("::") - 1); + memcpy(key->val + Z_STRSIZE_P(class_name) + sizeof("::") - 1, Z_STRVAL(op_array->literals[i]), - Z_STRLEN(op_array->literals[i]) + 1); + Z_STRSIZE(op_array->literals[i]) + 1); } else { - key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0); + key = STR_INIT(Z_STRVAL(op_array->literals[i]), Z_STRSIZE(op_array->literals[i]), 0); } key->h = zend_hash_func(key->val, key->len); key->h += info[i].flags; } if ((info[i].flags & LITERAL_MAY_MERGE) && (pos = zend_hash_find(&hash, key)) != NULL && - Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) && - info[i].flags == info[Z_LVAL_P(pos)].flags) { + Z_TYPE(op_array->literals[i]) == Z_TYPE(op_array->literals[Z_IVAL_P(pos)]) && + info[i].flags == info[Z_IVAL_P(pos)].flags) { STR_RELEASE(key); - map[i] = Z_LVAL_P(pos); + map[i] = Z_IVAL_P(pos); zval_dtor(&op_array->literals[i]); n = LITERAL_NUM_RELATED(info[i].flags); while (n > 1) { @@ -413,7 +413,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c } else { map[i] = j; if (info[i].flags & LITERAL_MAY_MERGE) { - ZVAL_LONG(&zv, j); + ZVAL_INT(&zv, j); zend_hash_add(&hash, key, &zv); STR_RELEASE(key); } @@ -472,7 +472,7 @@ static void optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_c for (i = 0; i < op_array->last_literal; i++) { zval zv = op_array->literals[i].constant; use_copy = zend_make_printable_zval(&op_array->literals[i].constant, &zv TSRMLS_CC); - fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRLEN(zv), Z_STRVAL(zv)); + fprintf(stderr, "Literal %d, val (%d):%s\n", i, Z_STRSIZE(zv), Z_STRVAL(zv)); if (use_copy) { zval_dtor(&zv); } diff --git a/ext/opcache/Optimizer/nop_removal.c b/ext/opcache/Optimizer/nop_removal.c index 80da02ce32..5f54408d16 100644 --- a/ext/opcache/Optimizer/nop_removal.c +++ b/ext/opcache/Optimizer/nop_removal.c @@ -38,7 +38,7 @@ static void nop_removal(zend_op_array *op_array) /* GOTO target is unresolved yet. We can't optimize. */ if (opline->opcode == ZEND_GOTO && - Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) { /* TODO: in general we can avoid this restriction */ FREE_ALLOCA(shiftlist); return; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index ecbfb638a0..f98058fd9e 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -65,8 +65,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { int er; if (opline->opcode == ZEND_DIV && - Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_LONG && - Z_LVAL(ZEND_OP2_LITERAL(opline)) == 0) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_INT && + Z_IVAL(ZEND_OP2_LITERAL(opline)) == 0) { /* div by 0 */ break; } @@ -103,8 +103,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { case _IS_BOOL: convert_to_boolean(&res); break; - case IS_LONG: - convert_to_long(&res); + case IS_INT: + convert_to_int(&res); break; case IS_DOUBLE: convert_to_double(&res); @@ -174,7 +174,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (next_op->opcode == ZEND_ADD_CHAR) { final_length += 1; } else { /* ZEND_ADD_STRING */ - final_length += Z_STRLEN(ZEND_OP2_LITERAL(next_op)); + final_length += Z_STRSIZE(ZEND_OP2_LITERAL(next_op)); } next_op++; } @@ -182,32 +182,32 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { break; } last_op = next_op; - final_length += (requires_conversion? 1 : Z_STRLEN(ZEND_OP2_LITERAL(opline))); + final_length += (requires_conversion? 1 : Z_STRSIZE(ZEND_OP2_LITERAL(opline))); str = STR_ALLOC(final_length, 0); ptr = str->val; ptr[final_length] = '\0'; if (requires_conversion) { /* ZEND_ADD_CHAR */ - char chval = (char)Z_LVAL(ZEND_OP2_LITERAL(opline)); + char chval = (char)Z_IVAL(ZEND_OP2_LITERAL(opline)); ZVAL_NEW_STR(&ZEND_OP2_LITERAL(opline), str); ptr[0] = chval; opline->opcode = ZEND_ADD_STRING; ptr++; } else { /* ZEND_ADD_STRING */ - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline))); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline))); STR_RELEASE(Z_STR(ZEND_OP2_LITERAL(opline))); Z_STR(ZEND_OP2_LITERAL(opline)) = str; - ptr += Z_STRLEN(ZEND_OP2_LITERAL(opline)); + ptr += Z_STRSIZE(ZEND_OP2_LITERAL(opline)); } - Z_STRLEN(ZEND_OP2_LITERAL(opline)) = final_length; + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) = final_length; next_op = opline + 1; while (next_op < last_op) { if (next_op->opcode == ZEND_ADD_STRING) { - memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRLEN(ZEND_OP2_LITERAL(next_op))); - ptr += Z_STRLEN(ZEND_OP2_LITERAL(next_op)); + memcpy(ptr, Z_STRVAL(ZEND_OP2_LITERAL(next_op)), Z_STRSIZE(ZEND_OP2_LITERAL(next_op))); + ptr += Z_STRSIZE(ZEND_OP2_LITERAL(next_op)); literal_dtor(&ZEND_OP2_LITERAL(next_op)); } else { /* ZEND_ADD_CHAR */ - *ptr = (char)Z_LVAL(ZEND_OP2_LITERAL(next_op)); + *ptr = (char)Z_IVAL(ZEND_OP2_LITERAL(next_op)); ptr++; } MAKE_NOP(next_op); @@ -227,7 +227,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (ZEND_OP1_TYPE(opline) == IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 && memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) { /* substitute __COMPILER_HALT_OFFSET__ constant */ zend_execute_data *orig_execute_data = EG(current_execute_data); @@ -277,7 +277,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* for A::B */ if (op_array->scope && !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), - op_array->scope->name->val, Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) { + op_array->scope->name->val, Z_STRSIZE(ZEND_OP1_LITERAL(opline)) + 1)) { ce = op_array->scope; } else { if ((ce = zend_hash_find_ptr(EG(class_table), @@ -334,8 +334,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (collect_constants && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 && - zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) { + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 && + zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRSIZE(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) { if ((opline+1)->opcode == ZEND_SEND_VAL && ZEND_OP1_TYPE(opline+1) == IS_CONST && @@ -364,17 +364,17 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { (opline + 2)->opcode == ZEND_DO_FCALL && ZEND_OP1_TYPE(opline + 1) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) == IS_STRING && ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { - if ((Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 && + if ((Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "function_exists", sizeof("function_exists")-1)) || - (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 && + (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "is_callable", sizeof("is_callable")))) { zend_internal_function *func; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); - if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)))) != NULL && + if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1)))) != NULL && func->type == ZEND_INTERNAL_FUNCTION && func->module->type == MODULE_PERSISTENT) { zval t; @@ -388,14 +388,14 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } efree(lc_name); - } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 && + } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "extension_loaded", sizeof("extension_loaded")-1)) { zval t; char *lc_name = zend_str_tolower_dup( - Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); zend_module_entry *m = zend_hash_str_find_ptr(&module_registry, - lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + lc_name, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); efree(lc_name); if (!m) { @@ -419,7 +419,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline + 1); MAKE_NOP(opline + 2); } - } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 && + } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "defined", sizeof("defined")-1)) { zval t; @@ -435,7 +435,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { MAKE_NOP(opline + 2); } } - } else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 && + } else if (Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "constant", sizeof("constant")-1)) { zval t; @@ -450,12 +450,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { } } } else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 && - Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 && + Z_STRSIZE(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 && !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "strlen", sizeof("strlen")-1)) { zval t; - ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1))); + ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline + 1))); if (replace_var_by_const(op_array, opline + 3, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) { literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); @@ -471,7 +471,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { zval t; - ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline))); + ZVAL_INT(&t, Z_STRSIZE(ZEND_OP1_LITERAL(opline))); replace_tmp_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC); literal_dtor(&ZEND_OP1_LITERAL(opline)); MAKE_NOP(opline); @@ -535,7 +535,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { opline->op1_type == IS_CONST && opline->op2_type == IS_UNUSED && Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING && - (Z_STRLEN(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || + (Z_STRSIZE(ZEND_OP1_LITERAL(opline)) != sizeof("this")-1 || memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "this", sizeof("this") - 1) != 0)) { int var = opline->result.var; diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c index 083a7b961b..1be6b9cb1c 100644 --- a/ext/opcache/Optimizer/pass2.c +++ b/ext/opcache/Optimizer/pass2.c @@ -61,8 +61,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { case ZEND_SL: case ZEND_SR: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) { - convert_to_long(&ZEND_OP1_LITERAL(opline)); + if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_INT) { + convert_to_int(&ZEND_OP1_LITERAL(opline)); } } /* break missing *intentionally - the assign_op's may only optimize op2 */ @@ -74,8 +74,8 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { break; } if (ZEND_OP2_TYPE(opline) == IS_CONST) { - if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { - convert_to_long(&ZEND_OP2_LITERAL(opline)); + if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_INT) { + convert_to_int(&ZEND_OP2_LITERAL(opline)); } } break; @@ -183,7 +183,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { if (ZEND_OP2_TYPE(opline) != IS_CONST) { break; } - convert_to_long(&ZEND_OP2_LITERAL(opline)); + convert_to_int(&ZEND_OP2_LITERAL(opline)); nest_levels = ZEND_OP2_LITERAL(opline).value.lval; array_offset = ZEND_OP1(opline).opline_num; diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index b783c3777b..a4bf4223a7 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -61,7 +61,7 @@ static int zend_optimizer_get_collected_constant(HashTable *constants, zval *nam static int zend_optimizer_lookup_cv(zend_op_array *op_array, zend_string* name) { int i = 0; - ulong hash_value = STR_HASH_VAL(name); + zend_uint_t hash_value = STR_HASH_VAL(name); while (i < op_array->last_var) { if (op_array->vars[i] == name || @@ -114,9 +114,9 @@ int zend_optimizer_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC) return i; } -# define LITERAL_LONG(op, val) do { \ +# define LITERAL_INT(op, val) do { \ zval _c; \ - ZVAL_LONG(&_c, val); \ + ZVAL_INT(&_c, val); \ op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \ } while (0) @@ -155,7 +155,7 @@ static void update_op1_const(zend_op_array *op_array, opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP1_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op1.constant]) = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op1.constant+1])); break; @@ -176,7 +176,7 @@ static void update_op2_const(zend_op_array *op_array, { ZEND_OP2_TYPE(opline) = IS_CONST; if (opline->opcode == ZEND_INIT_FCALL) { - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(ZEND_OP2_LITERAL(opline))); Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; @@ -200,13 +200,13 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_ADD_INTERFACE: case ZEND_ADD_TRAIT: Z_CACHE_SLOT(op_array->literals[opline->op2.constant]) = op_array->last_cache_slot++; - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); break; case ZEND_INIT_METHOD_CALL: case ZEND_INIT_STATIC_METHOD_CALL: - zend_str_tolower(Z_STRVAL_P(val), Z_STRLEN_P(val)); + zend_str_tolower(Z_STRVAL_P(val), Z_STRSIZE_P(val)); zend_optimizer_add_literal(op_array, val TSRMLS_CC); STR_HASH_VAL(Z_STR(op_array->literals[opline->op2.constant+1])); /* break missing intentionally */ @@ -273,11 +273,11 @@ static void update_op2_const(zend_op_array *op_array, case ZEND_FETCH_DIM_TMP_VAR: check_numeric: { - ulong index; + zend_uint_t index; if (ZEND_HANDLE_NUMERIC(Z_STR_P(val), index)) { zval_dtor(val); - ZVAL_LONG(val, index); + ZVAL_INT(val, index); op_array->literals[opline->op2.constant] = *val; } } diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index ebd3844e38..46c406d99d 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -107,8 +107,8 @@ static void (*orig_chdir)(INTERNAL_FUNCTION_PARAMETERS) = NULL; static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL; #ifdef ZEND_WIN32 -# define INCREMENT(v) InterlockedIncrement(&ZCSG(v)) -# define DECREMENT(v) InterlockedDecrement(&ZCSG(v)) +# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v)) +# define DECREMENT(v) InterlockedDecrement64(&ZCSG(v)) # define LOCKVAL(v) (ZCSG(v)) #endif @@ -299,7 +299,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) { /* for now interned strings are supported only for non-ZTS build */ #ifndef ZTS - ulong h; + zend_uint_t h; uint nIndex; uint idx; Bucket *p; @@ -632,7 +632,7 @@ static inline int accel_is_inactive(TSRMLS_D) return FAILURE; } -static int zend_get_stream_timestamp(const char *filename, struct stat *statbuf TSRMLS_DC) +static int zend_get_stream_timestamp(const char *filename, zend_stat_t *statbuf TSRMLS_DC) { php_stream_wrapper *wrapper; php_stream_statbuf stream_statbuf; @@ -715,7 +715,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size TSRMLS_DC) { - struct stat statbuf; + zend_stat_t statbuf; #ifdef ZEND_WIN32 accel_time_t res; #endif @@ -724,7 +724,7 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle !EG(current_execute_data) && file_handle->filename == SG(request_info).path_translated) { - struct stat *tmpbuf = sapi_module.get_stat(TSRMLS_C); + zend_stat_t *tmpbuf = sapi_module.get_stat(TSRMLS_C); if (tmpbuf) { if (size) { @@ -743,12 +743,12 @@ static accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle switch (file_handle->type) { case ZEND_HANDLE_FD: - if (fstat(file_handle->handle.fd, &statbuf) == -1) { + if (zend_fstat(file_handle->handle.fd, &statbuf) == -1) { return 0; } break; case ZEND_HANDLE_FP: - if (fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { + if (zend_fstat(fileno(file_handle->handle.fp), &statbuf) == -1) { if (zend_get_stream_timestamp(file_handle->filename, &statbuf TSRMLS_CC) != SUCCESS) { return 0; } @@ -1620,8 +1620,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type T ZCSG(hits)++; /* TBFixed: may lose one hit */ persistent_script->dynamic_members.hits++; /* see above */ #else - InterlockedIncrement(&ZCSG(hits)); - InterlockedIncrement(&persistent_script->dynamic_members.hits); + INCREMENT(hits); + InterlockedIncrement64(&persistent_script->dynamic_members.hits); #endif /* see bug #15471 (old BTS) */ @@ -1959,7 +1959,7 @@ static void accel_fast_zval_dtor(zval *zvalue) zend_list_delete(Z_RES_P(zvalue)); } break; - case IS_LONG: + case IS_INT: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 94c467e5fb..c228301362 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -157,7 +157,7 @@ typedef struct _zend_persistent_script { zend_op_array main_op_array; HashTable function_table; HashTable class_table; - long compiler_halt_offset; /* position of __HALT_COMPILER or -1 */ + zend_int_t compiler_halt_offset; /* position of __HALT_COMPILER or -1 */ int ping_auto_globals_mask; /* which autoglobals are used by the script */ accel_time_t timestamp; /* the script modification time */ zend_bool corrupted; @@ -170,7 +170,11 @@ typedef struct _zend_persistent_script { */ struct zend_persistent_script_dynamic_members { time_t last_used; - ulong hits; +#ifdef ZEND_WIN32 + LONGLONG hits; +#else + zend_uint_t hits; +#endif unsigned int memory_consumption; unsigned int checksum; time_t revalidate; @@ -178,12 +182,12 @@ typedef struct _zend_persistent_script { } zend_persistent_script; typedef struct _zend_accel_directives { - long memory_consumption; - long max_accelerated_files; + zend_int_t memory_consumption; + zend_int_t max_accelerated_files; double max_wasted_percentage; char *user_blacklist_filename; - long consistency_checks; - long force_restart_timeout; + zend_int_t consistency_checks; + zend_int_t force_restart_timeout; zend_bool use_cwd; zend_bool ignore_dups; zend_bool validate_timestamps; @@ -195,18 +199,18 @@ typedef struct _zend_accel_directives { zend_bool file_override_enabled; zend_bool inherited_hack; zend_bool enable_cli; - unsigned long revalidate_freq; - unsigned long file_update_protection; + zend_uint_t revalidate_freq; + zend_uint_t file_update_protection; char *error_log; #ifdef ZEND_WIN32 char *mmap_base; #endif char *memory_model; - long log_verbosity_level; + zend_int_t log_verbosity_level; - long optimization_level; - long max_file_size; - long interned_strings_buffer; + zend_int_t optimization_level; + zend_int_t max_file_size; + zend_int_t interned_strings_buffer; char *restrict_api; } zend_accel_directives; @@ -240,12 +244,12 @@ typedef struct _zend_accel_globals { typedef struct _zend_accel_shared_globals { /* Cache Data Structures */ - unsigned long hits; - unsigned long misses; - unsigned long blacklist_misses; - unsigned long oom_restarts; /* number of restarts because of out of memory */ - unsigned long hash_restarts; /* number of restarts because of hash overflow */ - unsigned long manual_restarts; /* number of restarts scheduled by opcache_reset() */ + zend_uint_t hits; + zend_uint_t misses; + zend_uint_t blacklist_misses; + zend_uint_t oom_restarts; /* number of restarts because of out of memory */ + zend_uint_t hash_restarts; /* number of restarts because of hash overflow */ + zend_uint_t manual_restarts; /* number of restarts scheduled by opcache_reset() */ zend_accel_hash hash; /* hash table for cached scripts */ zend_accel_hash include_paths; /* used "include_path" values */ @@ -258,8 +262,8 @@ typedef struct _zend_accel_shared_globals { zend_accel_restart_reason restart_reason; zend_bool cache_status_before_restart; #ifdef ZEND_WIN32 - unsigned long mem_usage; - unsigned long restart_in; + LONGLONG mem_usage; + LONGLONG restart_in; #endif zend_bool restart_in_progress; time_t revalidate_at; diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c index d0198dccb3..dd3193a100 100644 --- a/ext/opcache/zend_accelerator_debug.c +++ b/ext/opcache/zend_accelerator_debug.c @@ -57,7 +57,7 @@ void zend_accel_error(int type, const char *format, ...) } #ifdef ZTS - fprintf(fLog, "%s (%lu): ", time_string, (unsigned long)tsrm_thread_id()); + fprintf(fLog, "%s (" ZEND_UINT_FMT "): ", time_string, (zend_uint_t)tsrm_thread_id()); #else fprintf(fLog, "%s (%d): ", time_string, getpid()); #endif diff --git a/ext/opcache/zend_accelerator_hash.c b/ext/opcache/zend_accelerator_hash.c index b75377d61b..71dd997b79 100644 --- a/ext/opcache/zend_accelerator_hash.c +++ b/ext/opcache/zend_accelerator_hash.c @@ -73,8 +73,8 @@ void zend_accel_hash_init(zend_accel_hash *accel_hash, zend_uint hash_size) */ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char *key, zend_uint key_length, zend_bool indirect, void *data) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry; zend_accel_hash_entry *indirect_bucket = NULL; @@ -142,8 +142,8 @@ zend_accel_hash_entry* zend_accel_hash_update(zend_accel_hash *accel_hash, char */ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key_length) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry; hash_value = zend_inline_hash_func(key, key_length); @@ -170,8 +170,8 @@ void* zend_accel_hash_find(zend_accel_hash *accel_hash, char *key, zend_uint key */ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, char *key, zend_uint key_length) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry; hash_value = zend_inline_hash_func(key, key_length); @@ -195,8 +195,8 @@ zend_accel_hash_entry* zend_accel_hash_find_entry(zend_accel_hash *accel_hash, c int zend_accel_hash_unlink(zend_accel_hash *accel_hash, char *key, zend_uint key_length) { - zend_ulong hash_value; - zend_ulong index; + zend_uint_t hash_value; + zend_uint_t index; zend_accel_hash_entry *entry, *last_entry=NULL; hash_value = zend_inline_hash_func(key, key_length); diff --git a/ext/opcache/zend_accelerator_hash.h b/ext/opcache/zend_accelerator_hash.h index 2de28bffa7..99e92cd194 100644 --- a/ext/opcache/zend_accelerator_hash.h +++ b/ext/opcache/zend_accelerator_hash.h @@ -45,7 +45,7 @@ typedef struct _zend_accel_hash_entry zend_accel_hash_entry; struct _zend_accel_hash_entry { - zend_ulong hash_value; + zend_uint_t hash_value; char *key; zend_uint key_length; zend_accel_hash_entry *next; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index ff8ace863b..c6720419fa 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -100,8 +100,8 @@ static int validate_api_restriction(TSRMLS_D) static ZEND_INI_MH(OnUpdateMemoryConsumption) { - long *p; - long memsize; + php_int_t *p; + php_int_t memsize; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -111,7 +111,7 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (long *) (base + (size_t)mh_arg1); + p = (php_int_t *) (base + (size_t)mh_arg1); memsize = atoi(new_value); /* sanity check we must use at least 8 MB */ if (memsize < 8) { @@ -137,8 +137,8 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption) static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) { - long *p; - long size; + php_int_t *p; + php_int_t size; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -148,7 +148,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) /* keep the compiler happy */ (void)entry; (void)new_value_length; (void)mh_arg2; (void)mh_arg3; (void)stage; - p = (long *) (base + (size_t)mh_arg1); + p = (php_int_t *) (base + (size_t)mh_arg1); size = atoi(new_value); /* sanity check we must use a value between MIN_ACCEL_FILES and MAX_ACCEL_FILES */ @@ -183,7 +183,7 @@ static ZEND_INI_MH(OnUpdateMaxAcceleratedFiles) static ZEND_INI_MH(OnUpdateMaxWastedPercentage) { double *p; - long percentage; + php_int_t percentage; #ifndef ZTS char *base = (char *) mh_arg2; #else @@ -315,10 +315,10 @@ static int accel_file_in_cache(INTERNAL_FUNCTION_PARAMETERS) if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, &zfilename) == FAILURE || Z_TYPE(zfilename) != IS_STRING || - Z_STRLEN(zfilename) == 0) { + Z_STRSIZE(zfilename) == 0) { return 0; } - return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRLEN(zfilename) TSRMLS_CC); + return filename_is_in_cache(Z_STRVAL(zfilename), Z_STRSIZE(zfilename) TSRMLS_CC); } static void accel_file_exists(INTERNAL_FUNCTION_PARAMETERS) @@ -407,33 +407,33 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS) char buf[32]; php_info_print_table_row(2, "Startup", "OK"); php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model()); - snprintf(buf, sizeof(buf), "%ld", ZCSG(hits)); + snprintf(buf, sizeof(buf), ZEND_UINT_FMT, (zend_uint_t)ZCSG(hits)); php_info_print_table_row(2, "Cache hits", buf); - snprintf(buf, sizeof(buf), "%ld", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); + snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); php_info_print_table_row(2, "Cache misses", buf); snprintf(buf, sizeof(buf), "%ld", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); php_info_print_table_row(2, "Used memory", buf); - snprintf(buf, sizeof(buf), "%ld", zend_shared_alloc_get_free_memory()); + snprintf(buf, sizeof(buf), "%pd", zend_shared_alloc_get_free_memory()); php_info_print_table_row(2, "Free memory", buf); - snprintf(buf, sizeof(buf), "%ld", ZSMMG(wasted_shared_memory)); + snprintf(buf, sizeof(buf), "%pd", ZSMMG(wasted_shared_memory)); php_info_print_table_row(2, "Wasted memory", buf); if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) { - snprintf(buf, sizeof(buf), "%ld", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); + snprintf(buf, sizeof(buf), "%pd", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); php_info_print_table_row(2, "Interned Strings Used memory", buf); - snprintf(buf, sizeof(buf), "%ld", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); + snprintf(buf, sizeof(buf), "%pd", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); php_info_print_table_row(2, "Interned Strings Free memory", buf); } snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_direct_entries); php_info_print_table_row(2, "Cached scripts", buf); snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_entries); php_info_print_table_row(2, "Cached keys", buf); - snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).max_num_entries); + snprintf(buf, sizeof(buf), "%pd", ZCSG(hash).max_num_entries); php_info_print_table_row(2, "Max keys", buf); - snprintf(buf, sizeof(buf), "%ld", ZCSG(oom_restarts)); + snprintf(buf, sizeof(buf), "%pd", ZCSG(oom_restarts)); php_info_print_table_row(2, "OOM restarts", buf); - snprintf(buf, sizeof(buf), "%ld", ZCSG(hash_restarts)); + snprintf(buf, sizeof(buf), "%pd", ZCSG(hash_restarts)); php_info_print_table_row(2, "Hash keys restarts", buf); - snprintf(buf, sizeof(buf), "%ld", ZCSG(manual_restarts)); + snprintf(buf, sizeof(buf), "%pd", ZCSG(manual_restarts)); php_info_print_table_row(2, "Manual restarts", buf); } } @@ -488,16 +488,16 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) array_init(&persistent_script_report); add_assoc_str(&persistent_script_report, "full_path", STR_DUP(script->full_path, 0)); - add_assoc_long(&persistent_script_report, "hits", script->dynamic_members.hits); - add_assoc_long(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); + add_assoc_int(&persistent_script_report, "hits", (zend_int_t)script->dynamic_members.hits); + add_assoc_int(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); ta = localtime(&script->dynamic_members.last_used); str = asctime(ta); len = strlen(str); if (len > 0 && str[len - 1] == '\n') len--; add_assoc_stringl(&persistent_script_report, "last_used", str, len); - add_assoc_long(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); + add_assoc_int(&persistent_script_report, "last_used_timestamp", script->dynamic_members.last_used); if (ZCG(accel_directives).validate_timestamps) { - add_assoc_long(&persistent_script_report, "timestamp", (long)script->timestamp); + add_assoc_int(&persistent_script_report, "timestamp", (zend_int_t)script->timestamp); } timerclear(&exec_time); timerclear(&fetch_time); @@ -514,7 +514,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC) Obtain statistics information regarding code acceleration */ static ZEND_FUNCTION(opcache_get_status) { - long reqs; + zend_int_t reqs; zval memory_usage, statistics, scripts; zend_bool fetch_scripts = 1; @@ -540,9 +540,9 @@ static ZEND_FUNCTION(opcache_get_status) /* Memory usage statistics */ array_init(&memory_usage); - add_assoc_long(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); - add_assoc_long(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); - add_assoc_long(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); + add_assoc_int(&memory_usage, "used_memory", ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); + add_assoc_int(&memory_usage, "free_memory", zend_shared_alloc_get_free_memory()); + add_assoc_int(&memory_usage, "wasted_memory", ZSMMG(wasted_shared_memory)); add_assoc_double(&memory_usage, "current_wasted_percentage", (((double) ZSMMG(wasted_shared_memory))/ZCG(accel_directives).memory_consumption)*100.0); add_assoc_zval(return_value, "memory_usage", &memory_usage); @@ -550,26 +550,26 @@ static ZEND_FUNCTION(opcache_get_status) zval interned_strings_usage; array_init(&interned_strings_usage); - add_assoc_long(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start)); - add_assoc_long(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); - add_assoc_long(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); - add_assoc_long(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements); + add_assoc_int(&interned_strings_usage, "buffer_size", ZCSG(interned_strings_end) - ZCSG(interned_strings_start)); + add_assoc_int(&interned_strings_usage, "used_memory", ZCSG(interned_strings_top) - ZCSG(interned_strings_start)); + add_assoc_int(&interned_strings_usage, "free_memory", ZCSG(interned_strings_end) - ZCSG(interned_strings_top)); + add_assoc_int(&interned_strings_usage, "number_of_strings", ZCSG(interned_strings).nNumOfElements); add_assoc_zval(return_value, "interned_strings_usage", &interned_strings_usage); } /* Accelerator statistics */ array_init(&statistics); - add_assoc_long(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); - add_assoc_long(&statistics, "num_cached_keys", ZCSG(hash).num_entries); - add_assoc_long(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); - add_assoc_long(&statistics, "hits", ZCSG(hits)); - add_assoc_long(&statistics, "start_time", ZCSG(start_time)); - add_assoc_long(&statistics, "last_restart_time", ZCSG(last_restart_time)); - add_assoc_long(&statistics, "oom_restarts", ZCSG(oom_restarts)); - add_assoc_long(&statistics, "hash_restarts", ZCSG(hash_restarts)); - add_assoc_long(&statistics, "manual_restarts", ZCSG(manual_restarts)); - add_assoc_long(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); - add_assoc_long(&statistics, "blacklist_misses", ZCSG(blacklist_misses)); + add_assoc_int(&statistics, "num_cached_scripts", ZCSG(hash).num_direct_entries); + add_assoc_int(&statistics, "num_cached_keys", ZCSG(hash).num_entries); + add_assoc_int(&statistics, "max_cached_keys", ZCSG(hash).max_num_entries); + add_assoc_int(&statistics, "hits", (zend_int_t)ZCSG(hits)); + add_assoc_int(&statistics, "start_time", ZCSG(start_time)); + add_assoc_int(&statistics, "last_restart_time", ZCSG(last_restart_time)); + add_assoc_int(&statistics, "oom_restarts", ZCSG(oom_restarts)); + add_assoc_int(&statistics, "hash_restarts", ZCSG(hash_restarts)); + add_assoc_int(&statistics, "manual_restarts", ZCSG(manual_restarts)); + add_assoc_int(&statistics, "misses", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); + add_assoc_int(&statistics, "blacklist_misses", ZCSG(blacklist_misses)); reqs = ZCSG(hits)+ZCSG(misses); add_assoc_double(&statistics, "blacklist_miss_ratio", reqs?(((double) ZCSG(blacklist_misses))/reqs)*100.0:0); add_assoc_double(&statistics, "opcache_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0); @@ -615,17 +615,17 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_bool(&directives, "opcache.dups_fix", ZCG(accel_directives).ignore_dups); add_assoc_bool(&directives, "opcache.revalidate_path", ZCG(accel_directives).revalidate_path); - add_assoc_long(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level); - add_assoc_long(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption); - add_assoc_long(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer); - add_assoc_long(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files); + add_assoc_int(&directives, "opcache.log_verbosity_level", ZCG(accel_directives).log_verbosity_level); + add_assoc_int(&directives, "opcache.memory_consumption", ZCG(accel_directives).memory_consumption); + add_assoc_int(&directives, "opcache.interned_strings_buffer",ZCG(accel_directives).interned_strings_buffer); + add_assoc_int(&directives, "opcache.max_accelerated_files", ZCG(accel_directives).max_accelerated_files); add_assoc_double(&directives, "opcache.max_wasted_percentage", ZCG(accel_directives).max_wasted_percentage); - add_assoc_long(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); - add_assoc_long(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); - add_assoc_long(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); + add_assoc_int(&directives, "opcache.consistency_checks", ZCG(accel_directives).consistency_checks); + add_assoc_int(&directives, "opcache.force_restart_timeout", ZCG(accel_directives).force_restart_timeout); + add_assoc_int(&directives, "opcache.revalidate_freq", ZCG(accel_directives).revalidate_freq); add_assoc_string(&directives, "opcache.preferred_memory_model", STRING_NOT_NULL(ZCG(accel_directives).memory_model)); add_assoc_string(&directives, "opcache.blacklist_filename", STRING_NOT_NULL(ZCG(accel_directives).user_blacklist_filename)); - add_assoc_long(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); + add_assoc_int(&directives, "opcache.max_file_size", ZCG(accel_directives).max_file_size); add_assoc_string(&directives, "opcache.error_log", STRING_NOT_NULL(ZCG(accel_directives).error_log)); add_assoc_bool(&directives, "opcache.protect_memory", ZCG(accel_directives).protect_memory); @@ -633,7 +633,7 @@ static ZEND_FUNCTION(opcache_get_configuration) add_assoc_bool(&directives, "opcache.load_comments", ZCG(accel_directives).load_comments); add_assoc_bool(&directives, "opcache.fast_shutdown", ZCG(accel_directives).fast_shutdown); add_assoc_bool(&directives, "opcache.enable_file_override", ZCG(accel_directives).file_override_enabled); - add_assoc_long(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); + add_assoc_int(&directives, "opcache.optimization_level", ZCG(accel_directives).optimization_level); add_assoc_zval(return_value, "directives", &directives); diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index fc16fbeb24..c6534ca6c1 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -29,13 +29,13 @@ static zend_uint zend_accel_refcount = ZEND_PROTECTED_REFCOUNT; -#if SIZEOF_SIZE_T <= SIZEOF_LONG +#if SIZEOF_SIZE_T <= SIZEOF_ZEND_INT /* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */ -# define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (ulong)(zend_uintptr_t)(old), (new)) -# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (ulong)(zend_uintptr_t)(old)) +# define accel_xlat_set(old, new) zend_hash_index_update_ptr(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old), (new)) +# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (zend_uint_t)(zend_uintptr_t)(old)) #else -# define accel_xlat_set(old, new) (zend_hash_str_add_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (ulong)(zend_uintptr_t)(old), (void**)&(new)) -# define accel_xlat_get(old, new) ((new) = zend_hash_str_find_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (ulong)(zend_uintptr_t)(old), (void**)&(new))) +# define accel_xlat_set(old, new) (zend_hash_str_add_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new)) +# define accel_xlat_get(old, new) ((new) = zend_hash_str_find_ptr(&ZCG(bind_hash), (char*)&(old), sizeof(void*), (zend_uint_t)(zend_uintptr_t)(old), (void**)&(new))) #endif typedef int (*id_function_t)(void *, void *); @@ -333,7 +333,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) { uint idx; Bucket *p, *q, *r; - ulong nIndex; + zend_uint_t nIndex; TSRMLS_FETCH(); ht->nTableSize = source->nTableSize; @@ -412,7 +412,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class { uint idx; Bucket *p, *q; - ulong nIndex; + zend_uint_t nIndex; zend_class_entry *new_ce; zend_function *new_prototype; zend_op_array *new_entry; @@ -490,7 +490,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla { uint idx; Bucket *p, *q; - ulong nIndex; + zend_uint_t nIndex; zend_class_entry *new_ce; zend_property_info *prop_info; @@ -883,7 +883,7 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script, name = zend_mangle_property_name(haltoff, sizeof(haltoff) - 1, persistent_script->full_path->val, persistent_script->full_path->len, 0); if (!zend_hash_exists(EG(zend_constants), name)) { - zend_register_long_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); + zend_register_int_constant(name->val, name->len, persistent_script->compiler_halt_offset, CONST_CS, 0 TSRMLS_CC); } STR_RELEASE(name); } diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index e87a942bfa..9ea33adff1 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -292,7 +292,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc fake_execute_data.func = (zend_function*)op_array; EG(current_execute_data) = &fake_execute_data; if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1 TSRMLS_CC)) != NULL) { - main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset); + main_persistent_script->compiler_halt_offset = Z_IVAL_P(offset); } EG(current_execute_data) = orig_execute_data; } diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 0faabee8b2..8a60d75736 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -288,7 +288,7 @@ static size_t zend_shared_alloc_get_largest_free_block(void) #define MIN_FREE_MEMORY 64*1024 #define SHARED_ALLOC_FAILED() do { \ - zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %ld bytes (%ld bytes free)", (long)size, (long)ZSMMG(shared_free)); \ + zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %pd bytes (%pd bytes free)", (zend_int_t)size, (zend_int_t)ZSMMG(shared_free)); \ if (zend_shared_alloc_get_largest_free_block() < MIN_FREE_MEMORY) { \ ZSMMG(memory_exhausted) = 1; \ } \ @@ -327,7 +327,7 @@ int zend_shared_memdup_size(void *source, size_t size) { void *old_p; - if ((old_p = zend_hash_index_find_ptr(&xlat_table, (ulong)source)) != NULL) { + if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)source)) != NULL) { /* we already duplicated this pointer */ return 0; } @@ -339,7 +339,7 @@ void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source TSRML { void *old_p, *retval; - if ((old_p = zend_hash_index_find_ptr(&xlat_table, (ulong)source)) != NULL) { + if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)source)) != NULL) { /* we already duplicated this pointer */ return old_p; } @@ -431,14 +431,14 @@ void zend_shared_alloc_clear_xlat_table(void) void zend_shared_alloc_register_xlat_entry(const void *old, const void *new) { - zend_hash_index_update_ptr(&xlat_table, (ulong)old, (void*)new); + zend_hash_index_update_ptr(&xlat_table, (zend_uint_t)old, (void*)new); } void *zend_shared_alloc_get_xlat_entry(const void *old) { void *retval; - if ((retval = zend_hash_index_find_ptr(&xlat_table, (ulong)old)) == NULL) { + if ((retval = zend_hash_index_find_ptr(&xlat_table, (zend_uint_t)old)) == NULL) { return NULL; } return retval; diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h index 57ea8d3fdd..b16b1a30dd 100644 --- a/ext/opcache/zend_shared_alloc.h +++ b/ext/opcache/zend_shared_alloc.h @@ -130,7 +130,7 @@ int zend_shared_memdup_size(void *p, size_t size); typedef union _align_test { void *ptr; double dbl; - long lng; + zend_int_t lng; } align_test; #if ZEND_GCC_VERSION >= 2000 diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 1d75ff08fc..527c1cc0e7 100755 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -844,12 +844,12 @@ static int add_oid_section(struct php_x509_request * req TSRMLS_DC) /* {{{ */ varname = defval #define SET_OPTIONAL_LONG_ARG(key, varname, defval) \ - if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_LONG) \ - varname = Z_LVAL_P(item); \ + if (optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), key, sizeof(key)-1)) != NULL && Z_TYPE_P(item) == IS_INT) \ + varname = Z_IVAL_P(item); \ else \ varname = defval -static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(long algo); +static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(php_int_t algo); int openssl_spki_cleanup(const char *src, char *dest); @@ -905,8 +905,8 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option } if (req->priv_key_encrypt && optional_args && (item = zend_hash_str_find(Z_ARRVAL_P(optional_args), "encrypt_key_cipher", sizeof("encrypt_key_cipher")-1)) != NULL - && Z_TYPE_P(item) == IS_LONG) { - long cipher_algo = Z_LVAL_P(item); + && Z_TYPE_P(item) == IS_INT) { + php_int_t cipher_algo = Z_IVAL_P(item); const EVP_CIPHER* cipher = php_openssl_get_evp_cipher_from_algo(cipher_algo); if (cipher == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm for private key."); @@ -1012,7 +1012,7 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see } /* }}} */ -static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */ +static EVP_MD * php_openssl_get_evp_md_from_algo(php_int_t algo) { /* {{{ */ EVP_MD *mdtype; switch (algo) { @@ -1058,7 +1058,7 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(long algo) { /* {{{ */ } /* }}} */ -static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(long algo) { /* {{{ */ +static const EVP_CIPHER * php_openssl_get_evp_cipher_from_algo(php_int_t algo) { /* {{{ */ switch (algo) { #ifndef OPENSSL_NO_RC2 case PHP_OPENSSL_CIPHER_RC2_40: @@ -1130,86 +1130,86 @@ PHP_MINIT_FUNCTION(openssl) ssl_stream_data_index = SSL_get_ex_new_index(0, "PHP stream index", NULL, NULL, NULL); REGISTER_STRING_CONSTANT("OPENSSL_VERSION_TEXT", OPENSSL_VERSION_TEXT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER, CONST_CS|CONST_PERSISTENT); /* purposes for cert purpose checking */ - REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT); #ifdef X509_PURPOSE_ANY - REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT); #endif /* signature algorithm constants */ - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA1", OPENSSL_ALGO_SHA1, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD5", OPENSSL_ALGO_MD5, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD4", OPENSSL_ALGO_MD4, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_OPENSSL_MD2_H - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090708fL - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA256", OPENSSL_ALGO_SHA256, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA384", OPENSSL_ALGO_SHA384, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_SHA512", OPENSSL_ALGO_SHA512, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ALGO_RMD160", OPENSSL_ALGO_RMD160, CONST_CS|CONST_PERSISTENT); #endif /* flags for S/MIME */ - REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); /* Informational stream wrapper constants */ REGISTER_STRING_CONSTANT("OPENSSL_DEFAULT_STREAM_CIPHERS", OPENSSL_DEFAULT_STREAM_CIPHERS, CONST_CS|CONST_PERSISTENT); /* Ciphers */ #ifndef OPENSSL_NO_RC2 - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_40", PHP_OPENSSL_CIPHER_RC2_40, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_128", PHP_OPENSSL_CIPHER_RC2_128, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_RC2_64", PHP_OPENSSL_CIPHER_RC2_64, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_DES - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_DES", PHP_OPENSSL_CIPHER_DES, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_3DES", PHP_OPENSSL_CIPHER_3DES, CONST_CS|CONST_PERSISTENT); #endif #ifndef OPENSSL_NO_AES - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_128_CBC", PHP_OPENSSL_CIPHER_AES_128_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_192_CBC", PHP_OPENSSL_CIPHER_AES_192_CBC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_CIPHER_AES_256_CBC", PHP_OPENSSL_CIPHER_AES_256_CBC, CONST_CS|CONST_PERSISTENT); #endif /* Values for key types */ - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_RSA", OPENSSL_KEYTYPE_RSA, CONST_CS|CONST_PERSISTENT); #ifndef NO_DSA - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DSA", OPENSSL_KEYTYPE_DSA, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_DH", OPENSSL_KEYTYPE_DH, CONST_CS|CONST_PERSISTENT); #ifdef HAVE_EVP_PKEY_EC - REGISTER_LONG_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_KEYTYPE_EC", OPENSSL_KEYTYPE_EC, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_RAW_DATA", OPENSSL_RAW_DATA, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_ZERO_PADDING", OPENSSL_ZERO_PADDING, CONST_CS|CONST_PERSISTENT); #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) /* SNI support included in OpenSSL >= 0.9.8j */ - REGISTER_LONG_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("OPENSSL_TLSEXT_SERVER_NAME", 1, CONST_CS|CONST_PERSISTENT); #endif /* Determine default SSL configuration file */ @@ -1361,7 +1361,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso /* force it to be a string and check if it refers to a file */ convert_to_string_ex(val); - if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { /* read cert from the named file */ BIO *in; @@ -1378,7 +1378,7 @@ static X509 * php_openssl_x509_from_zval(zval * val, int makeresource, zend_reso } else { BIO *in; - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); if (in == NULL) { return NULL; } @@ -1453,7 +1453,7 @@ PHP_FUNCTION(openssl_spki_new) zend_string * s = NULL; zend_resource *keyresource = NULL; const char *spkac = "SPKAC="; - long algo = OPENSSL_ALGO_MD5; + php_int_t algo = OPENSSL_ALGO_MD5; zval *method = NULL; zval * zpkey = NULL; @@ -1474,8 +1474,8 @@ PHP_FUNCTION(openssl_spki_new) } if (method != NULL) { - if (Z_TYPE_P(method) == IS_LONG) { - algo = Z_LVAL_P(method); + if (Z_TYPE_P(method) == IS_INT) { + algo = Z_IVAL_P(method); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Algorithm must be of supported type"); goto cleanup; @@ -1958,22 +1958,22 @@ PHP_FUNCTION(openssl_x509_parse) } add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames TSRMLS_CC); - add_assoc_long(return_value, "version", X509_get_version(cert)); + add_assoc_int(return_value, "version", X509_get_version(cert)); add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert))); add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert)); add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert)); - add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); - add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); + add_assoc_int(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); + add_assoc_int(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); tmpstr = (char *)X509_alias_get0(cert, NULL); if (tmpstr) { add_assoc_string(return_value, "alias", tmpstr); } /* - add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); + add_assoc_int(return_value, "signaturetypeLONG", X509_get_signature_type(cert)); add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert))); add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert))); */ @@ -2137,15 +2137,15 @@ PHP_FUNCTION(openssl_x509_checkpurpose) X509 * cert = NULL; zend_resource *certresource = NULL; STACK_OF(X509) * untrustedchain = NULL; - long purpose; + php_int_t purpose; char * untrusted = NULL; int untrusted_len = 0, ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zi|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) { return; } - RETVAL_LONG(-1); + RETVAL_INT(-1); if (untrusted) { untrustedchain = load_all_certs_from_file(untrusted); @@ -2165,7 +2165,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose) ret = check_cert(cainfo, cert, untrustedchain, purpose); if (ret != 0 && ret != 1) { - RETVAL_LONG(ret); + RETVAL_INT(ret); } else { RETVAL_BOOL(ret); } @@ -2193,7 +2193,7 @@ static X509_STORE * setup_verify(zval * calist TSRMLS_DC) X509_LOOKUP * dir_lookup, * file_lookup; int ndirs = 0, nfiles = 0; zval * item; - struct stat sb; + php_stat_t sb; store = X509_STORE_new(); @@ -2768,7 +2768,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r return NULL; } - if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { filename = Z_STRVAL_P(val) + (sizeof("file://") - 1); } if (filename) { @@ -2777,7 +2777,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval * val, int makeresource, zend_r } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); } csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL); BIO_free(in); @@ -2881,8 +2881,8 @@ PHP_FUNCTION(openssl_csr_export) PHP_FUNCTION(openssl_csr_sign) { zval * zcert = NULL, *zcsr, *zpkey, *args = NULL; - long num_days; - long serial = 0L; + php_int_t num_days; + php_int_t serial = Z_I(0); X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key = NULL; @@ -2890,7 +2890,7 @@ PHP_FUNCTION(openssl_csr_sign) int i; struct php_x509_request req; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zi|a!i", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) return; RETVAL_FALSE; @@ -2949,6 +2949,7 @@ PHP_FUNCTION(openssl_csr_sign) if (!X509_set_version(new_cert, 2)) goto cleanup; + ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial); X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr)); @@ -3259,7 +3260,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } convert_to_string_ex(val); - if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { + if (Z_STRSIZE_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) { filename = Z_STRVAL_P(val) + (sizeof("file://") - 1); } /* it's an X509 file/cert of some kind, and we need to extract the data from that */ @@ -3273,7 +3274,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p if (filename) { in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); } if (in == NULL) { TMP_CLEAN; @@ -3291,7 +3292,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval * val, int public_key, char * p } in = BIO_new_file(filename, "r"); } else { - in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRLEN_P(val)); + in = BIO_new_mem_buf(Z_STRVAL_P(val), Z_STRSIZE_P(val)); } if (in == NULL) { @@ -3467,7 +3468,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC) Z_TYPE_P(bn) == IS_STRING) { \ _type->_name = BN_bin2bn( \ (unsigned char*)Z_STRVAL_P(bn), \ - Z_STRLEN_P(bn), NULL); \ + Z_STRSIZE_P(bn), NULL); \ } \ } while (0); @@ -3770,7 +3771,7 @@ PHP_FUNCTION(openssl_pkey_get_details) BIO *out; unsigned int pbio_len; char *pbio; - long ktype; + php_int_t ktype; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &key) == FAILURE) { return; @@ -3784,7 +3785,7 @@ PHP_FUNCTION(openssl_pkey_get_details) pbio_len = BIO_get_mem_data(out, &pbio); array_init(return_value); - add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey)); + add_assoc_int(return_value, "bits", EVP_PKEY_bits(pkey)); add_assoc_stringl(return_value, "key", pbio, pbio_len); /*TODO: Use the real values once the openssl constants are used * See the enum at the top of this file @@ -3853,7 +3854,7 @@ PHP_FUNCTION(openssl_pkey_get_details) ktype = -1; break; } - add_assoc_long(return_value, "type", ktype); + add_assoc_int(return_value, "type", ktype); BIO_free(out); } @@ -3867,7 +3868,7 @@ PHP_FUNCTION(openssl_pkey_get_details) Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */ PHP_FUNCTION(openssl_pbkdf2) { - long key_length = 0, iterations = 0; + php_int_t key_length = 0, iterations = 0; char *password; int password_len; char *salt; int salt_len; char *method; int method_len = 0; @@ -3875,7 +3876,7 @@ PHP_FUNCTION(openssl_pbkdf2) const EVP_MD *digest; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssll|s", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssii|s", &password, &password_len, &salt, &salt_len, &key_length, &iterations, @@ -3924,15 +3925,15 @@ PHP_FUNCTION(openssl_pkcs7_verify) STACK_OF(X509) *others = NULL; PKCS7 * p7 = NULL; BIO * in = NULL, * datain = NULL, * dataout = NULL; - long flags = 0; + php_int_t flags = 0; char * filename; int filename_len; char * extracerts = NULL; int extracerts_len = 0; char * signersfilename = NULL; int signersfilename_len = 0; char * datafilename = NULL; int datafilename_len = 0; - RETVAL_LONG(-1); + RETVAL_INT(-1); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|papp", &filename, &filename_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi|papp", &filename, &filename_len, &flags, &signersfilename, &signersfilename_len, &cainfo, &extracerts, &extracerts_len, &datafilename, &datafilename_len) == FAILURE) { return; @@ -4006,7 +4007,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) sk_X509_free(signers); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "signature OK, but cannot open %s for writing", signersfilename); - RETVAL_LONG(-1); + RETVAL_INT(-1); } } goto clean_exit; @@ -4030,19 +4031,19 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) zval * zrecipcerts, * zheaders = NULL; STACK_OF(X509) * recipcerts = NULL; BIO * infile = NULL, * outfile = NULL; - long flags = 0; + php_int_t flags = 0; PKCS7 * p7 = NULL; zval * zcertval; X509 * cert; const EVP_CIPHER *cipher = NULL; - long cipherid = PHP_OPENSSL_CIPHER_DEFAULT; + php_int_t cipherid = PHP_OPENSSL_CIPHER_DEFAULT; zend_string * strindex; char * infilename = NULL; int infilename_len; char * outfilename = NULL; int outfilename_len; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppza!|ll", &infilename, &infilename_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppza!|ii", &infilename, &infilename_len, &outfilename, &outfilename_len, &zrecipcerts, &zheaders, &flags, &cipherid) == FAILURE) return; @@ -4156,7 +4157,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) zval * hval; X509 * cert = NULL; EVP_PKEY * privkey = NULL; - long flags = PKCS7_DETACHED; + php_int_t flags = PKCS7_DETACHED; PKCS7 * p7 = NULL; BIO * infile = NULL, * outfile = NULL; STACK_OF(X509) *others = NULL; @@ -4166,7 +4167,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) char * outfilename; int outfilename_len; char * extracertsfilename = NULL; int extracertsfilename_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppzza!|lp", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ppzza!|ip", &infilename, &infilename_len, &outfilename, &outfilename_len, &zcert, &zprivkey, &zheaders, &flags, &extracertsfilename, &extracertsfilename_len) == FAILURE) { @@ -4333,9 +4334,9 @@ PHP_FUNCTION(openssl_private_encrypt) zend_resource *keyresource = NULL; char * data; int data_len; - long padding = RSA_PKCS1_PADDING; + php_int_t padding = RSA_PKCS1_PADDING; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; @@ -4389,12 +4390,12 @@ PHP_FUNCTION(openssl_private_decrypt) zend_string *cryptedbuf = NULL; unsigned char *crypttemp; int successful = 0; - long padding = RSA_PKCS1_PADDING; + php_int_t padding = RSA_PKCS1_PADDING; zend_resource *keyresource = NULL; char * data; int data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; @@ -4455,11 +4456,11 @@ PHP_FUNCTION(openssl_public_encrypt) zend_string *cryptedbuf; int successful = 0; zend_resource *keyresource = NULL; - long padding = RSA_PKCS1_PADDING; + php_int_t padding = RSA_PKCS1_PADDING; char * data; int data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) return; RETVAL_FALSE; @@ -4513,11 +4514,11 @@ PHP_FUNCTION(openssl_public_decrypt) unsigned char *crypttemp; int successful = 0; zend_resource *keyresource = NULL; - long padding = RSA_PKCS1_PADDING; + php_int_t padding = RSA_PKCS1_PADDING; char * data; int data_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|i", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; @@ -4603,7 +4604,7 @@ PHP_FUNCTION(openssl_sign) int data_len; EVP_MD_CTX md_ctx; zval *method = NULL; - long signature_algo = OPENSSL_ALGO_SHA1; + php_int_t signature_algo = OPENSSL_ALGO_SHA1; const EVP_MD *mdtype; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/z|z", &data, &data_len, &signature, &key, &method) == FAILURE) { @@ -4615,9 +4616,9 @@ PHP_FUNCTION(openssl_sign) RETURN_FALSE; } - if (method == NULL || Z_TYPE_P(method) == IS_LONG) { + if (method == NULL || Z_TYPE_P(method) == IS_INT) { if (method != NULL) { - signature_algo = Z_LVAL_P(method); + signature_algo = Z_IVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); } else if (Z_TYPE_P(method) == IS_STRING) { @@ -4666,15 +4667,15 @@ PHP_FUNCTION(openssl_verify) char * data; int data_len; char * signature; int signature_len; zval *method = NULL; - long signature_algo = OPENSSL_ALGO_SHA1; + php_int_t signature_algo = OPENSSL_ALGO_SHA1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz|z", &data, &data_len, &signature, &signature_len, &key, &method) == FAILURE) { return; } - if (method == NULL || Z_TYPE_P(method) == IS_LONG) { + if (method == NULL || Z_TYPE_P(method) == IS_INT) { if (method != NULL) { - signature_algo = Z_LVAL_P(method); + signature_algo = Z_IVAL_P(method); } mdtype = php_openssl_get_evp_md_from_algo(signature_algo); } else if (Z_TYPE_P(method) == IS_STRING) { @@ -4702,7 +4703,7 @@ PHP_FUNCTION(openssl_verify) if (keyresource == NULL) { EVP_PKEY_free(pkey); } - RETURN_LONG(err); + RETURN_INT(err); } /* }}} */ @@ -4814,7 +4815,7 @@ PHP_FUNCTION(openssl_seal) } else { efree(buf); } - RETVAL_LONG(len1 + len2); + RETVAL_INT(len1 + len2); EVP_CIPHER_CTX_cleanup(&ctx); clean_exit: @@ -5024,7 +5025,7 @@ static zend_bool php_openssl_validate_iv(char **piv, int *piv_len, int iv_requir Encrypts given data with given method and key, returns raw or base64 encoded string */ PHP_FUNCTION(openssl_encrypt) { - long options = 0; + php_int_t options = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0, max_iv_len; const EVP_CIPHER *cipher_type; @@ -5034,7 +5035,7 @@ PHP_FUNCTION(openssl_encrypt) unsigned char *key; zend_bool free_iv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|is", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } cipher_type = EVP_get_cipherbyname(method); @@ -5104,7 +5105,7 @@ PHP_FUNCTION(openssl_encrypt) Takes raw or base64 encoded string and dectupt it using given method and key */ PHP_FUNCTION(openssl_decrypt) { - long options = 0; + php_int_t options = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0; const EVP_CIPHER *cipher_type; @@ -5115,7 +5116,7 @@ PHP_FUNCTION(openssl_decrypt) zend_string *base64_str = NULL; zend_bool free_iv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|is", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } @@ -5208,7 +5209,7 @@ PHP_FUNCTION(openssl_cipher_iv_length) RETURN_FALSE; } - RETURN_LONG(EVP_CIPHER_iv_length(cipher_type)); + RETURN_INT(EVP_CIPHER_iv_length(cipher_type)); } /* }}} */ @@ -5255,12 +5256,12 @@ PHP_FUNCTION(openssl_dh_compute_key) Returns a string of the length specified filled with random pseudo bytes */ PHP_FUNCTION(openssl_random_pseudo_bytes) { - long buffer_length; + php_int_t buffer_length; zend_string *buffer = NULL; zval *zstrong_result_returned = NULL; int strong_result = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z/", &buffer_length, &zstrong_result_returned) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|z/", &buffer_length, &zstrong_result_returned) == FAILURE) { return; } diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index a2022dfb79..06810cdbd8 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -69,7 +69,7 @@ /* Simplify ssl context option retrieval */ #define GET_VER_OPT(name) (PHP_STREAM_CONTEXT(stream) && (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", name)) != NULL) #define GET_VER_OPT_STRING(name, str) if (GET_VER_OPT(name)) { convert_to_string_ex(val); str = Z_STRVAL_P(val); } -#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_long_ex(val); num = Z_LVAL_P(val); } +#define GET_VER_OPT_LONG(name, num) if (GET_VER_OPT(name)) { convert_to_int_ex(val); num = Z_IVAL_P(val); } /* Used for peer verification in windows */ #define PHP_X509_NAME_ENTRY_TO_UTF8(ne, i, out) ASN1_STRING_to_UTF8(&out, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(ne, i))) @@ -89,9 +89,9 @@ typedef struct _php_openssl_sni_cert_t { /* Provides leaky bucket handhsake renegotiation rate-limiting */ typedef struct _php_openssl_handshake_bucket_t { - long prev_handshake; - long limit; - long window; + php_int_t prev_handshake; + php_int_t limit; + php_int_t window; float tokens; unsigned should_close; } php_openssl_handshake_bucket_t; @@ -146,7 +146,7 @@ static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); char esbuf[512]; smart_str ebuf = {0}; - unsigned long ecode; + php_uint_t ecode; int retry = 1; switch(err) { @@ -230,7 +230,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ SSL *ssl; int err, depth, ret; zval *val; - unsigned long allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH; + php_uint_t allowed_depth = OPENSSL_DEFAULT_STREAM_VERIFY_DEPTH; TSRMLS_FETCH(); @@ -254,7 +254,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */ /* check the depth */ GET_VER_OPT_LONG("verify_depth", allowed_depth); - if ((unsigned long)depth > allowed_depth) { + if ((php_uint_t)depth > allowed_depth) { ret = 0; X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_CHAIN_TOO_LONG); } @@ -282,7 +282,7 @@ static zend_bool php_x509_fingerprint_match(X509 *peer, zval *val TSRMLS_DC) if (Z_TYPE_P(val) == IS_STRING) { const char *method = NULL; - switch (Z_STRLEN_P(val)) { + switch (Z_STRSIZE_P(val)) { case 32: method = "md5"; break; @@ -513,9 +513,9 @@ static int passwd_callback(char *buf, int num, int verify, void *data) /* {{{ */ GET_VER_OPT_STRING("passphrase", passphrase); if (passphrase) { - if (Z_STRLEN_P(val) < num - 1) { - memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)+1); - return Z_STRLEN_P(val); + if (Z_STRSIZE_P(val) < num - 1) { + memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)+1); + return Z_STRSIZE_P(val); } } return 0; @@ -880,7 +880,7 @@ static int set_local_cert(SSL_CTX *ctx, php_stream *stream TSRMLS_DC) /* {{{ */ } /* }}} */ -static const SSL_METHOD *php_select_crypto_method(long method_value, int is_client TSRMLS_DC) /* {{{ */ +static const SSL_METHOD *php_select_crypto_method(php_int_t method_value, int is_client TSRMLS_DC) /* {{{ */ { if (method_value == STREAM_CRYPTO_METHOD_SSLv2) { #ifndef OPENSSL_NO_SSL2 @@ -918,9 +918,9 @@ static const SSL_METHOD *php_select_crypto_method(long method_value, int is_clie } /* }}} */ -static long php_get_crypto_method_ctx_flags(long method_flags TSRMLS_DC) /* {{{ */ +static php_int_t php_get_crypto_method_ctx_flags(php_int_t method_flags TSRMLS_DC) /* {{{ */ { - long ssl_ctx_options = SSL_OP_ALL; + php_int_t ssl_ctx_options = SSL_OP_ALL; #ifndef OPENSSL_NO_SSL2 if (!(method_flags & STREAM_CRYPTO_METHOD_SSLv2)) { @@ -956,7 +956,7 @@ static void limit_handshake_reneg(const SSL *ssl) /* {{{ */ php_stream *stream; php_openssl_netstream_data_t *sslsock; struct timeval now; - long elapsed_time; + php_int_t elapsed_time; stream = php_openssl_get_stream_from_ssl_handle(ssl); sslsock = (php_openssl_netstream_data_t*)stream->abstract; @@ -1025,15 +1025,15 @@ static void info_callback(const SSL *ssl, int where, int ret) /* {{{ */ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_data_t *sslsock) /* {{{ */ { zval *val; - long limit = OPENSSL_DEFAULT_RENEG_LIMIT; - long window = OPENSSL_DEFAULT_RENEG_WINDOW; + php_int_t limit = OPENSSL_DEFAULT_RENEG_LIMIT; + php_int_t window = OPENSSL_DEFAULT_RENEG_WINDOW; if (PHP_STREAM_CONTEXT(stream) && NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_limit")) ) { - convert_to_long(val); - limit = Z_LVAL_P(val); + convert_to_int(val); + limit = Z_IVAL_P(val); } /* No renegotiation rate-limiting */ @@ -1045,8 +1045,8 @@ static void init_server_reneg_limit(php_stream *stream, php_openssl_netstream_da NULL != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "reneg_window")) ) { - convert_to_long(val); - window = Z_LVAL_P(val); + convert_to_int(val); + window = Z_IVAL_P(val); } sslsock->reneg = (void*)pemalloc(sizeof(php_openssl_handshake_bucket_t), @@ -1070,7 +1070,7 @@ static int set_server_rsa_key(php_stream *stream, SSL_CTX *ctx TSRMLS_DC) /* {{{ RSA* rsa; if ((val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "rsa_key_size")) != NULL) { - rsa_key_size = (int) Z_LVAL_P(val); + rsa_key_size = (int) Z_IVAL_P(val); if ((rsa_key_size != 1) && (rsa_key_size & (rsa_key_size - 1))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "RSA key size requires a power of 2: %d", rsa_key_size); rsa_key_size = 2048; @@ -1255,7 +1255,7 @@ static int enable_server_sni(php_stream *stream, php_openssl_netstream_data_t *s zval *val; zval *current; zend_string *key; - ulong key_index; + php_uint_t key_index; int i = 0; char resolved_path_buff[MAXPATHLEN]; SSL_CTX *ctx; @@ -1534,7 +1534,7 @@ static zend_array *capture_session_meta(SSL *ssl_handle) /* {{{ */ array_init(&meta_arr); add_assoc_string(&meta_arr, "protocol", proto_str); add_assoc_string(&meta_arr, "cipher_name", (char *) SSL_CIPHER_get_name(cipher)); - add_assoc_long(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); + add_assoc_int(&meta_arr, "cipher_bits", SSL_CIPHER_get_bits(cipher, NULL)); add_assoc_string(&meta_arr, "cipher_version", SSL_CIPHER_get_version(cipher)); return Z_ARR(meta_arr); @@ -2167,13 +2167,13 @@ php_stream_ops php_openssl_socket_ops = { php_openssl_sockop_set_option, }; -static long get_crypto_method(php_stream_context *ctx, long crypto_method) +static php_int_t get_crypto_method(php_stream_context *ctx, php_int_t crypto_method) { zval *val; if (ctx && (val = php_stream_context_get_option(ctx, "ssl", "crypto_method")) != NULL) { - convert_to_long_ex(val); - crypto_method = (long)Z_LVAL_P(val); + convert_to_int_ex(val); + crypto_method = (php_int_t)Z_IVAL_P(val); crypto_method |= STREAM_CRYPTO_IS_CLIENT; } diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 448e34b5cc..d0ca4deaa5 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -204,213 +204,213 @@ void php_register_signal_constants(INIT_FUNC_ARGS) /* Wait Constants */ #ifdef WNOHANG - REGISTER_LONG_CONSTANT("WNOHANG", (long) WNOHANG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WNOHANG", (php_int_t) WNOHANG, CONST_CS | CONST_PERSISTENT); #endif #ifdef WUNTRACED - REGISTER_LONG_CONSTANT("WUNTRACED", (long) WUNTRACED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WUNTRACED", (php_int_t) WUNTRACED, CONST_CS | CONST_PERSISTENT); #endif /* Signal Constants */ - REGISTER_LONG_CONSTANT("SIG_IGN", (long) SIG_IGN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_DFL", (long) SIG_DFL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_ERR", (long) SIG_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGHUP", (long) SIGHUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGINT", (long) SIGINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGQUIT", (long) SIGQUIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGILL", (long) SIGILL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTRAP", (long) SIGTRAP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGABRT", (long) SIGABRT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_IGN", (php_int_t) SIG_IGN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_DFL", (php_int_t) SIG_DFL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_ERR", (php_int_t) SIG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGHUP", (php_int_t) SIGHUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGINT", (php_int_t) SIGINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGQUIT", (php_int_t) SIGQUIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGILL", (php_int_t) SIGILL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTRAP", (php_int_t) SIGTRAP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGABRT", (php_int_t) SIGABRT, CONST_CS | CONST_PERSISTENT); #ifdef SIGIOT - REGISTER_LONG_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGKILL", (long) SIGKILL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGUSR1", (long) SIGUSR1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGSEGV", (long) SIGSEGV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGUSR2", (long) SIGUSR2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGPIPE", (long) SIGPIPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGALRM", (long) SIGALRM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGIOT", (php_int_t) SIGIOT, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SIGBUS", (php_int_t) SIGBUS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGFPE", (php_int_t) SIGFPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGKILL", (php_int_t) SIGKILL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGUSR1", (php_int_t) SIGUSR1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSEGV", (php_int_t) SIGSEGV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGUSR2", (php_int_t) SIGUSR2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPIPE", (php_int_t) SIGPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGALRM", (php_int_t) SIGALRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTERM", (php_int_t) SIGTERM, CONST_CS | CONST_PERSISTENT); #ifdef SIGSTKFLT - REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSTKFLT",(php_int_t) SIGSTKFLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGCLD - REGISTER_LONG_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGCLD", (php_int_t) SIGCLD, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGCHLD - REGISTER_LONG_CONSTANT("SIGCHLD", (long) SIGCHLD, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SIGCONT", (long) SIGCONT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGSTOP", (long) SIGSTOP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTSTP", (long) SIGTSTP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTTIN", (long) SIGTTIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGTTOU", (long) SIGTTOU, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGURG", (long) SIGURG , CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGXCPU", (long) SIGXCPU, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGXFSZ", (long) SIGXFSZ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGVTALRM",(long) SIGVTALRM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGPROF", (long) SIGPROF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGWINCH", (long) SIGWINCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGCHLD", (php_int_t) SIGCHLD, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SIGCONT", (php_int_t) SIGCONT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSTOP", (php_int_t) SIGSTOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTSTP", (php_int_t) SIGTSTP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTTIN", (php_int_t) SIGTTIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGTTOU", (php_int_t) SIGTTOU, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGURG", (php_int_t) SIGURG , CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGXCPU", (php_int_t) SIGXCPU, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGXFSZ", (php_int_t) SIGXFSZ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGVTALRM",(php_int_t) SIGVTALRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPROF", (php_int_t) SIGPROF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGWINCH", (php_int_t) SIGWINCH, CONST_CS | CONST_PERSISTENT); #ifdef SIGPOLL - REGISTER_LONG_CONSTANT("SIGPOLL", (long) SIGPOLL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPOLL", (php_int_t) SIGPOLL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SIGIO", (long) SIGIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGIO", (php_int_t) SIGIO, CONST_CS | CONST_PERSISTENT); #ifdef SIGPWR - REGISTER_LONG_CONSTANT("SIGPWR", (long) SIGPWR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGPWR", (php_int_t) SIGPWR, CONST_CS | CONST_PERSISTENT); #endif #ifdef SIGSYS - REGISTER_LONG_CONSTANT("SIGSYS", (long) SIGSYS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIGBABY", (long) SIGSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGSYS", (php_int_t) SIGSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIGBABY", (php_int_t) SIGSYS, CONST_CS | CONST_PERSISTENT); #endif #if HAVE_GETPRIORITY || HAVE_SETPRIORITY - REGISTER_LONG_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT); #endif /* {{{ "how" argument for sigprocmask */ #ifdef HAVE_SIGPROCMASK - REGISTER_LONG_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_BLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT); #endif /* }}} */ /* {{{ si_code */ #if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT - REGISTER_LONG_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_USER", SI_USER, CONST_CS | CONST_PERSISTENT); #ifdef SI_NOINFO - REGISTER_LONG_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_NOINFO", SI_NOINFO, CONST_CS | CONST_PERSISTENT); #endif #ifdef SI_KERNEL - REGISTER_LONG_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_KERNEL", SI_KERNEL, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_QUEUE", SI_QUEUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_TIMER", SI_TIMER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_MESGQ", SI_MESGQ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT); #ifdef SI_SIGIO - REGISTER_LONG_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_SIGIO", SI_SIGIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef SI_TKILL - REGISTER_LONG_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SI_TKILL", SI_TKILL, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGCHILD */ #ifdef CLD_EXITED - REGISTER_LONG_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_EXITED", CLD_EXITED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_KILLED - REGISTER_LONG_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_KILLED", CLD_KILLED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_DUMPED - REGISTER_LONG_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_DUMPED", CLD_DUMPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_TRAPPED - REGISTER_LONG_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_TRAPPED", CLD_TRAPPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_STOPPED - REGISTER_LONG_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_STOPPED", CLD_STOPPED, CONST_CS | CONST_PERSISTENT); #endif #ifdef CLD_CONTINUED - REGISTER_LONG_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGTRAP */ #ifdef TRAP_BRKPT - REGISTER_LONG_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef TRAP_TRACE - REGISTER_LONG_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT); #endif /* si_code for SIGPOLL */ #ifdef POLL_IN - REGISTER_LONG_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_IN", POLL_IN, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_OUT - REGISTER_LONG_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_MSG - REGISTER_LONG_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_ERR - REGISTER_LONG_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_PRI - REGISTER_LONG_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT); #endif #ifdef POLL_HUP - REGISTER_LONG_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLOPC - REGISTER_LONG_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLOPN - REGISTER_LONG_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLADR - REGISTER_LONG_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_ILLTRP - REGISTER_LONG_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_PRVOPC - REGISTER_LONG_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_PRVREG - REGISTER_LONG_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_COPROC - REGISTER_LONG_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ILL_BADSTK - REGISTER_LONG_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_INTDIV - REGISTER_LONG_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_INTOVF - REGISTER_LONG_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTDIV - REGISTER_LONG_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTOVF - REGISTER_LONG_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTUND - REGISTER_LONG_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTRES - REGISTER_LONG_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTINV - REGISTER_LONG_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT); #endif #ifdef FPE_FLTSUB - REGISTER_LONG_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT); #endif #ifdef SEGV_MAPERR - REGISTER_LONG_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef SEGV_ACCERR - REGISTER_LONG_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_ADRALN - REGISTER_LONG_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_ADRERR - REGISTER_LONG_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT); #endif #ifdef BUS_OBJERR - REGISTER_LONG_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT); #endif #endif /* HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT */ /* }}} */ @@ -548,7 +548,7 @@ PHP_FUNCTION(pcntl_fork) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno); } - RETURN_LONG((long) id); + RETURN_INT((long) id); } /* }}} */ @@ -556,12 +556,12 @@ PHP_FUNCTION(pcntl_fork) Set an alarm clock for delivery of a signal*/ PHP_FUNCTION(pcntl_alarm) { - long seconds; + php_int_t seconds; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &seconds) == FAILURE) return; - RETURN_LONG ((long) alarm(seconds)); + RETURN_INT ((php_int_t) alarm(seconds)); } /* }}} */ @@ -569,17 +569,17 @@ PHP_FUNCTION(pcntl_alarm) Waits on or returns the status of a forked child as defined by the waitpid() system call */ PHP_FUNCTION(pcntl_waitpid) { - long pid, options = 0; + php_int_t pid, options = 0; zval *z_status = NULL; int status; pid_t child_id; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &pid, &z_status, &options) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz/|i", &pid, &z_status, &options) == FAILURE) return; - convert_to_long_ex(z_status); + convert_to_int_ex(z_status); - status = Z_LVAL_P(z_status); + status = Z_IVAL_P(z_status); child_id = waitpid((pid_t) pid, &status, options); @@ -587,9 +587,9 @@ PHP_FUNCTION(pcntl_waitpid) PCNTL_G(last_error) = errno; } - Z_LVAL_P(z_status) = status; + Z_IVAL_P(z_status) = status; - RETURN_LONG((long) child_id); + RETURN_INT((php_int_t) child_id); } /* }}} */ @@ -597,17 +597,17 @@ PHP_FUNCTION(pcntl_waitpid) Waits on or returns the status of a forked child as defined by the waitpid() system call */ PHP_FUNCTION(pcntl_wait) { - long options = 0; + php_int_t options = 0; zval *z_status = NULL; int status; pid_t child_id; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|l", &z_status, &options) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|i", &z_status, &options) == FAILURE) return; - convert_to_long_ex(z_status); + convert_to_int_ex(z_status); - status = Z_LVAL_P(z_status); + status = Z_IVAL_P(z_status); #ifdef HAVE_WAIT3 if(options) { child_id = wait3(&status, options, NULL); @@ -622,9 +622,9 @@ PHP_FUNCTION(pcntl_wait) PCNTL_G(last_error) = errno; } - Z_LVAL_P(z_status) = status; + Z_IVAL_P(z_status) = status; - RETURN_LONG((long) child_id); + RETURN_INT((php_int_t) child_id); } /* }}} */ @@ -633,9 +633,9 @@ PHP_FUNCTION(pcntl_wait) PHP_FUNCTION(pcntl_wifexited) { #ifdef WIFEXITED - long status_word; + php_int_t status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { return; } @@ -651,9 +651,9 @@ PHP_FUNCTION(pcntl_wifexited) PHP_FUNCTION(pcntl_wifstopped) { #ifdef WIFSTOPPED - long status_word; + php_int_t status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { return; } @@ -669,9 +669,9 @@ PHP_FUNCTION(pcntl_wifstopped) PHP_FUNCTION(pcntl_wifsignaled) { #ifdef WIFSIGNALED - long status_word; + php_int_t status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { return; } @@ -687,13 +687,13 @@ PHP_FUNCTION(pcntl_wifsignaled) PHP_FUNCTION(pcntl_wexitstatus) { #ifdef WEXITSTATUS - long status_word; + php_int_t status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { return; } - RETURN_LONG(WEXITSTATUS(status_word)); + RETURN_INT(WEXITSTATUS(status_word)); #else RETURN_FALSE; #endif @@ -705,13 +705,13 @@ PHP_FUNCTION(pcntl_wexitstatus) PHP_FUNCTION(pcntl_wtermsig) { #ifdef WTERMSIG - long status_word; + php_int_t status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { return; } - RETURN_LONG(WTERMSIG(status_word)); + RETURN_INT(WTERMSIG(status_word)); #else RETURN_FALSE; #endif @@ -723,13 +723,13 @@ PHP_FUNCTION(pcntl_wtermsig) PHP_FUNCTION(pcntl_wstopsig) { #ifdef WSTOPSIG - long status_word; + php_int_t status_word; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &status_word) == FAILURE) { return; } - RETURN_LONG(WSTOPSIG(status_word)); + RETURN_INT(WSTOPSIG(status_word)); #else RETURN_FALSE; #endif @@ -751,7 +751,7 @@ PHP_FUNCTION(pcntl_exec) zend_string *key; char *path; int path_len; - ulong key_num; + php_uint_t key_num; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) { return; @@ -788,7 +788,7 @@ PHP_FUNCTION(pcntl_exec) ZEND_HASH_FOREACH_KEY_VAL(envs_hash, key_num, key, element) { if (envi >= envc) break; if (!key) { - key = zend_long_to_str(key_num); + key = zend_int_to_str(key_num); } else { STR_ADDREF(key); } @@ -796,7 +796,7 @@ PHP_FUNCTION(pcntl_exec) convert_to_string_ex(element); /* Length of element + equal sign + length of key + null */ - pair_length = Z_STRLEN_P(element) + key->len + 2; + pair_length = Z_STRSIZE_P(element) + key->len + 2; *pair = emalloc(pair_length); strlcpy(*pair, key->val, key->len + 1); strlcat(*pair, "=", pair_length); @@ -837,10 +837,10 @@ PHP_FUNCTION(pcntl_signal) { zval *handle; zend_string *func_name; - long signo; + php_int_t signo; zend_bool restart_syscalls = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz|b", &signo, &handle, &restart_syscalls) == FAILURE) { return; } @@ -863,12 +863,12 @@ PHP_FUNCTION(pcntl_signal) } /* Special long value case for SIG_DFL and SIG_IGN */ - if (Z_TYPE_P(handle) == IS_LONG) { - if (Z_LVAL_P(handle) != (long) SIG_DFL && Z_LVAL_P(handle) != (long) SIG_IGN) { + if (Z_TYPE_P(handle) == IS_INT) { + if (Z_IVAL_P(handle) != (php_int_t) SIG_DFL && Z_IVAL_P(handle) != (php_int_t) SIG_IGN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified"); RETURN_FALSE; } - if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) { + if (php_signal(signo, (Sigfunc *) Z_IVAL_P(handle), (int) restart_syscalls) == SIG_ERR) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal"); RETURN_FALSE; @@ -912,11 +912,11 @@ PHP_FUNCTION(pcntl_signal_dispatch) Examine and change blocked signals */ PHP_FUNCTION(pcntl_sigprocmask) { - long how, signo; + php_int_t how, signo; zval *user_set, *user_oldset = NULL, *user_signo; sigset_t set, oldset; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|z/", &how, &user_set, &user_oldset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ia|z/", &how, &user_set, &user_oldset) == FAILURE) { return; } @@ -927,11 +927,11 @@ PHP_FUNCTION(pcntl_sigprocmask) } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) { - if (Z_TYPE_P(user_signo) != IS_LONG) { + if (Z_TYPE_P(user_signo) != IS_INT) { SEPARATE_ZVAL(user_signo); - convert_to_long_ex(user_signo); + convert_to_int_ex(user_signo); } - signo = Z_LVAL_P(user_signo); + signo = Z_IVAL_P(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); @@ -956,7 +956,7 @@ PHP_FUNCTION(pcntl_sigprocmask) if (sigismember(&oldset, signo) != 1) { continue; } - add_next_index_long(user_oldset, signo); + add_next_index_int(user_oldset, signo); } } @@ -969,14 +969,14 @@ PHP_FUNCTION(pcntl_sigprocmask) static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{{ */ { zval *user_set, *user_signo, *user_siginfo = NULL; - long tv_sec = 0, tv_nsec = 0; + php_int_t tv_sec = 0, tv_nsec = 0; sigset_t set; int signo; siginfo_t siginfo; struct timespec timeout; if (timedwait) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ii", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) { return; } } else { @@ -992,11 +992,11 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(user_set), user_signo) { - if (Z_TYPE_P(user_signo) != IS_LONG) { + if (Z_TYPE_P(user_signo) != IS_INT) { SEPARATE_ZVAL(user_signo); - convert_to_long_ex(user_signo); + convert_to_int_ex(user_signo); } - signo = Z_LVAL_P(user_signo); + signo = Z_IVAL_P(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); @@ -1031,41 +1031,41 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{ } else { zend_hash_clean(Z_ARRVAL_P(user_siginfo)); } - add_assoc_long_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo); - add_assoc_long_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno); - add_assoc_long_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code); + add_assoc_int_ex(user_siginfo, "signo", sizeof("signo")-1, siginfo.si_signo); + add_assoc_int_ex(user_siginfo, "errno", sizeof("errno")-1, siginfo.si_errno); + add_assoc_int_ex(user_siginfo, "code", sizeof("code")-1, siginfo.si_code); switch(signo) { #ifdef SIGCHLD case SIGCHLD: - add_assoc_long_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status); + add_assoc_int_ex(user_siginfo, "status", sizeof("status")-1, siginfo.si_status); # ifdef si_utime add_assoc_double_ex(user_siginfo, "utime", sizeof("utime")-1, siginfo.si_utime); # endif # ifdef si_stime add_assoc_double_ex(user_siginfo, "stime", sizeof("stime")-1, siginfo.si_stime); # endif - add_assoc_long_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid); - add_assoc_long_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid); + add_assoc_int_ex(user_siginfo, "pid", sizeof("pid")-1, siginfo.si_pid); + add_assoc_int_ex(user_siginfo, "uid", sizeof("uid")-1, siginfo.si_uid); break; #endif case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: - add_assoc_double_ex(user_siginfo, "addr", sizeof("addr")-1, (long)siginfo.si_addr); + add_assoc_double_ex(user_siginfo, "addr", sizeof("addr")-1, (php_int_t)siginfo.si_addr); break; #ifdef SIGPOLL case SIGPOLL: - add_assoc_long_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band); + add_assoc_int_ex(user_siginfo, "band", sizeof("band")-1, siginfo.si_band); # ifdef si_fd - add_assoc_long_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd); + add_assoc_int_ex(user_siginfo, "fd", sizeof("fd")-1, siginfo.si_fd); # endif break; #endif } } - RETURN_LONG(signo); + RETURN_INT(signo); } /* }}} */ @@ -1091,11 +1091,11 @@ PHP_FUNCTION(pcntl_sigtimedwait) Get the priority of any process */ PHP_FUNCTION(pcntl_getpriority) { - long who = PRIO_PROCESS; - long pid = getpid(); + php_int_t who = PRIO_PROCESS; + php_int_t pid = getpid(); int pri; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &pid, &who) == FAILURE) { RETURN_FALSE; } @@ -1120,7 +1120,7 @@ PHP_FUNCTION(pcntl_getpriority) RETURN_FALSE; } - RETURN_LONG(pri); + RETURN_INT(pri); } /* }}} */ #endif @@ -1130,11 +1130,11 @@ PHP_FUNCTION(pcntl_getpriority) Change the priority of any process */ PHP_FUNCTION(pcntl_setpriority) { - long who = PRIO_PROCESS; - long pid = getpid(); - long pri; + php_int_t who = PRIO_PROCESS; + php_int_t pid = getpid(); + php_int_t pri; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &pri, &pid, &who) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &pri, &pid, &who) == FAILURE) { RETURN_FALSE; } @@ -1169,7 +1169,7 @@ PHP_FUNCTION(pcntl_setpriority) Retrieve the error number set by the last pcntl function which failed. */ PHP_FUNCTION(pcntl_get_last_error) { - RETURN_LONG(PCNTL_G(last_error)); + RETURN_INT(PCNTL_G(last_error)); } /* }}} */ @@ -1177,9 +1177,9 @@ PHP_FUNCTION(pcntl_get_last_error) Retrieve the system error message associated with the given errno. */ PHP_FUNCTION(pcntl_strerror) { - long error; + php_int_t error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &error) == FAILURE) { RETURN_FALSE; } @@ -1242,7 +1242,7 @@ void pcntl_signal_dispatch() while (queue) { if ((handle = zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo)) != NULL) { ZVAL_NULL(&retval); - ZVAL_LONG(¶m, queue->signo); + ZVAL_INT(¶m, queue->signo); /* Call php signal handler - Note that we do not report errors, and we ignore the return value */ /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */ diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index caafc10d19..ed1811f5d6 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -61,7 +61,7 @@ PHP_FUNCTION(pcntl_setpriority); struct php_pcntl_pending_signal { struct php_pcntl_pending_signal *next; - long signo; + php_int_t signo; }; ZEND_BEGIN_MODULE_GLOBALS(pcntl) @@ -77,7 +77,7 @@ ZEND_END_MODULE_GLOBALS(pcntl) #define PCNTL_G(v) (pcntl_globals.v) #endif -#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT) +#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_INT_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT) #endif /* PHP_PCNTL_H */ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 4731db21fb..d7c7c56a93 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -143,20 +143,20 @@ static PHP_MINIT_FUNCTION(pcre) { REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_SPLIT_OFFSET_CAPTURE", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_GREP_INVERT", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("PREG_NO_ERROR", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_INTERNAL_ERROR", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_BACKTRACK_LIMIT_ERROR", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_RECURSION_LIMIT_ERROR", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_BAD_UTF8_ERROR", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PREG_BAD_UTF8_OFFSET_ERROR", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("PCRE_VERSION", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT); return SUCCESS; @@ -527,7 +527,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset, /* Add (match, offset) to the return value */ add_next_index_stringl(&match_pair, str, len); - add_next_index_long(&match_pair, offset); + add_next_index_int(&match_pair, offset); if (name) { zval_add_ref(&match_pair); @@ -541,26 +541,25 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * { /* parameters */ zend_string *regex; /* Regular expression */ - char *subject; /* String to match against */ - int subject_len; + zend_string *subject; /* String to match against */ pcre_cache_entry *pce; /* Compiled regular expression */ zval *subpats = NULL; /* Array for subpatterns */ - long flags = 0; /* Match control flags */ - long start_offset = 0; /* Where the new search starts */ + php_int_t flags = 0; /* Match control flags */ + php_int_t start_offset = 0; /* Where the new search starts */ #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|z/ll", ®ex, - &subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/ii", ®ex, + &subject, &subpats, &flags, &start_offset) == FAILURE) { RETURN_FALSE; } #else ZEND_PARSE_PARAMETERS_START(2, 5) Z_PARAM_STR(regex) - Z_PARAM_STRING(subject, subject_len) + Z_PARAM_STR(subject) Z_PARAM_OPTIONAL Z_PARAM_ZVAL_EX(subpats, 0, 1) - Z_PARAM_LONG(flags) - Z_PARAM_LONG(start_offset) + Z_PARAM_INT(flags) + Z_PARAM_INT(start_offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); #endif @@ -569,7 +568,7 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ * RETURN_FALSE; } - php_pcre_match_impl(pce, subject, subject_len, return_value, subpats, + php_pcre_match_impl(pce, subject->val, subject->len, return_value, subpats, global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC); } /* }}} */ @@ -888,7 +887,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec /* Did we encounter an error? */ if (PCRE_G(error_code) == PHP_PCRE_NO_ERROR) { - RETVAL_LONG(matched); + RETVAL_INT(matched); } else { RETVAL_FALSE; } @@ -1142,7 +1141,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, } } else { replace = Z_STRVAL_P(replace_val); - replace_len = Z_STRLEN_P(replace_val); + replace_len = Z_STRSIZE_P(replace_val); replace_end = replace + replace_len; } @@ -1435,16 +1434,16 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl *subject_entry, *zcount = NULL; int limit_val = -1; - long limit = -1; + php_int_t limit = -1; zend_string *result; zend_string *string_key; - ulong num_key; + php_uint_t num_key; zend_string *callback_name; int replace_count=0, old_replace_count; - + #ifndef FAST_ZPP /* Get function parameters and do error-checking. */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|lz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz|iz/", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { return; } #else @@ -1453,7 +1452,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl Z_PARAM_ZVAL(replace) Z_PARAM_ZVAL(subject) Z_PARAM_OPTIONAL - Z_PARAM_LONG(limit) + Z_PARAM_INT(limit) Z_PARAM_ZVAL_EX(zcount, 0, 1) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1519,7 +1518,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl } if (ZEND_NUM_ARGS() > 4) { zval_dtor(zcount); - ZVAL_LONG(zcount, replace_count); + ZVAL_INT(zcount, replace_count); } } @@ -1554,25 +1553,24 @@ static PHP_FUNCTION(preg_filter) static PHP_FUNCTION(preg_split) { zend_string *regex; /* Regular expression */ - char *subject; /* String to match against */ - int subject_len; - long limit_val = -1;/* Integer value of limit */ - long flags = 0; /* Match control flags */ + zend_string *subject; /* String to match against */ + php_int_t limit_val = -1;/* Integer value of limit */ + php_int_t flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get function parameters and do error checking */ #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ss|ll", ®ex, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", ®ex, &subject, &subject_len, &limit_val, &flags) == FAILURE) { RETURN_FALSE; } #else ZEND_PARSE_PARAMETERS_START(2, 4) Z_PARAM_STR(regex) - Z_PARAM_STRING(subject, subject_len) + Z_PARAM_STR(subject) Z_PARAM_OPTIONAL - Z_PARAM_LONG(limit_val) - Z_PARAM_LONG(flags) + Z_PARAM_INT(limit_val) + Z_PARAM_INT(flags) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); #endif @@ -1581,7 +1579,7 @@ static PHP_FUNCTION(preg_split) RETURN_FALSE; } - php_pcre_split_impl(pce, subject, subject_len, return_value, limit_val, flags TSRMLS_CC); + php_pcre_split_impl(pce, subject->val, subject->len, return_value, limit_val, flags TSRMLS_CC); } /* }}} */ @@ -1864,12 +1862,12 @@ static PHP_FUNCTION(preg_grep) { zend_string *regex; /* Regular expression */ zval *input; /* Input array */ - long flags = 0; /* Match control flags */ + php_int_t flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get arguments and do error checking */ #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|l", ®ex, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sa|i", ®ex, &input, &flags) == FAILURE) { return; } @@ -1878,7 +1876,7 @@ static PHP_FUNCTION(preg_grep) Z_PARAM_STR(regex) Z_PARAM_ARRAY(input) Z_PARAM_OPTIONAL - Z_PARAM_LONG(flags) + Z_PARAM_INT(flags) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1900,7 +1898,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return int size_offsets; /* Size of the offsets array */ int count = 0; /* Count of matched subpatterns */ zend_string *string_key; - ulong num_key; + php_uint_t num_key; zend_bool invert; /* Whether to return non-matching entries */ ALLOCA_FLAG(use_heap); @@ -1988,7 +1986,7 @@ static PHP_FUNCTION(preg_last_error) ZEND_PARSE_PARAMETERS_END(); #endif - RETURN_LONG(PCRE_G(error_code)); + RETURN_INT(PCRE_G(error_code)); } /* }}} */ diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index 3e10a6d003..440f5a7e0c 100644 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -208,7 +208,7 @@ pdo_driver_t *pdo_find_driver(const char *name, int namelen) /* {{{ */ } /* }}} */ -PDO_API int php_pdo_parse_data_source(const char *data_source, unsigned long data_source_len, struct pdo_data_src_parser *parsed, int nparams) /* {{{ */ +PDO_API int php_pdo_parse_data_source(const char *data_source, php_uint_t data_source_len, struct pdo_data_src_parser *parsed, int nparams) /* {{{ */ { int i, j; int valstart = -1; @@ -314,7 +314,7 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */ char buffer[65]; char outbuf[65] = ""; register char *p; - long long_val; + php_int_t long_val; char *dst = outbuf; if (i64 < 0) { @@ -331,15 +331,15 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */ p = &buffer[sizeof(buffer)-1]; *p = '\0'; - while ((pdo_uint64_t)i64 > (pdo_uint64_t)LONG_MAX) { + while ((pdo_uint64_t)i64 > (pdo_uint64_t)PHP_INT_MAX) { pdo_uint64_t quo = (pdo_uint64_t)i64 / (unsigned int)10; unsigned int rem = (unsigned int)(i64 - quo*10U); *--p = digit_vec[rem]; i64 = (pdo_int64_t)quo; } - long_val = (long)i64; + long_val = (php_int_t)i64; while (long_val != 0) { - long quo = long_val / 10; + php_int_t quo = long_val / 10; *--p = digit_vec[(unsigned int)(long_val - quo * 10)]; long_val = quo; } diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index cdf639a72d..576b81762e 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -36,7 +36,7 @@ #include "zend_object_handlers.h" #include "zend_hash.h" -static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_DC); +static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSRMLS_DC); void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp TSRMLS_DC) /* {{{ */ { @@ -85,7 +85,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate array_init(&info); add_next_index_string(&info, *pdo_err); - add_next_index_long(&info, 0); + add_next_index_int(&info, 0); zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo")-1, &info TSRMLS_CC); zval_ptr_dtor(&info); @@ -103,7 +103,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ pdo_error_type *pdo_err = &dbh->error_code; const char *msg = "<<Unknown>>"; char *supp = NULL; - long native_code = 0; + php_int_t native_code = 0; zend_string *message = NULL; zval info; @@ -131,11 +131,11 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ zval *item; if ((item = zend_hash_index_find(Z_ARRVAL(info), 1)) != NULL) { - native_code = Z_LVAL_P(item); + native_code = Z_IVAL_P(item); } if ((item = zend_hash_index_find(Z_ARRVAL(info), 2)) != NULL) { - supp = estrndup(Z_STRVAL_P(item), Z_STRLEN_P(item)); + supp = estrndup(Z_STRVAL_P(item), Z_STRSIZE_P(item)); } } } @@ -277,7 +277,7 @@ static PHP_METHOD(PDO, dbh_constructor) if ((v = zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_PERSISTENT)) != NULL) { if (Z_TYPE_P(v) == IS_STRING && - !is_numeric_string(Z_STRVAL_P(v), Z_STRLEN_P(v), NULL, NULL, 0) && Z_STRLEN_P(v) > 0) { + !is_numeric_string(Z_STRVAL_P(v), Z_STRSIZE_P(v), NULL, NULL, 0) && Z_STRSIZE_P(v) > 0) { /* user specified key */ plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s:%s", data_source, username ? username : "", @@ -285,8 +285,8 @@ static PHP_METHOD(PDO, dbh_constructor) Z_STRVAL_P(v)); is_persistent = 1; } else { - convert_to_long_ex(v); - is_persistent = Z_LVAL_P(v) ? 1 : 0; + convert_to_int_ex(v); + is_persistent = Z_IVAL_P(v) ? 1 : 0; plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source, username ? username : "", password ? password : ""); @@ -350,7 +350,7 @@ static PHP_METHOD(PDO, dbh_constructor) dbh->default_fetch_type = PDO_FETCH_BOTH; } - dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); + dbh->auto_commit = pdo_attr_ival(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); if (!dbh->data_source || (username && !dbh->username) || (password && !dbh->password)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory"); @@ -385,7 +385,7 @@ static PHP_METHOD(PDO, dbh_constructor) options: if (options) { zval *attr_value; - ulong long_key; + php_uint_t long_key; zend_string *str_key = NULL; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(options), long_key, str_key, attr_value) { @@ -675,11 +675,11 @@ static PHP_METHOD(PDO, inTransaction) } /* }}} */ -static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_DC) /* {{{ */ +static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, php_int_t attr, zval *value TSRMLS_DC) /* {{{ */ { -#define PDO_LONG_PARAM_CHECK \ - if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ +#define PDO_INT_PARAM_CHECK \ + if (Z_TYPE_P(value) != IS_INT && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \ PDO_HANDLE_DBH_ERR(); \ return FAILURE; \ @@ -687,13 +687,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D switch (attr) { case PDO_ATTR_ERRMODE: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - switch (Z_LVAL_P(value)) { + PDO_INT_PARAM_CHECK; + convert_to_int(value); + switch (Z_IVAL_P(value)) { case PDO_ERRMODE_SILENT: case PDO_ERRMODE_WARNING: case PDO_ERRMODE_EXCEPTION: - dbh->error_mode = Z_LVAL_P(value); + dbh->error_mode = Z_IVAL_P(value); return SUCCESS; default: pdo_raise_impl_error(dbh, NULL, "HY000", "invalid error mode" TSRMLS_CC); @@ -703,13 +703,13 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D return FAILURE; case PDO_ATTR_CASE: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - switch (Z_LVAL_P(value)) { + PDO_INT_PARAM_CHECK; + convert_to_int(value); + switch (Z_IVAL_P(value)) { case PDO_CASE_NATURAL: case PDO_CASE_UPPER: case PDO_CASE_LOWER: - dbh->desired_case = Z_LVAL_P(value); + dbh->desired_case = Z_IVAL_P(value); return SUCCESS; default: pdo_raise_impl_error(dbh, NULL, "HY000", "invalid case folding mode" TSRMLS_CC); @@ -719,35 +719,35 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, long attr, zval *value TSRMLS_D return FAILURE; case PDO_ATTR_ORACLE_NULLS: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - dbh->oracle_nulls = Z_LVAL_P(value); + PDO_INT_PARAM_CHECK; + convert_to_int(value); + dbh->oracle_nulls = Z_IVAL_P(value); return SUCCESS; case PDO_ATTR_DEFAULT_FETCH_MODE: if (Z_TYPE_P(value) == IS_ARRAY) { zval *tmp; - if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { - if (Z_LVAL_P(tmp) == PDO_FETCH_INTO || Z_LVAL_P(tmp) == PDO_FETCH_CLASS) { + if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_INT) { + if (Z_IVAL_P(tmp) == PDO_FETCH_INTO || Z_IVAL_P(tmp) == PDO_FETCH_CLASS) { pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes" TSRMLS_CC); return FAILURE; } } } else { - PDO_LONG_PARAM_CHECK; + PDO_INT_PARAM_CHECK; } - convert_to_long(value); - if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) { + convert_to_int(value); + if (Z_IVAL_P(value) == PDO_FETCH_USE_DEFAULT) { pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type" TSRMLS_CC); return FAILURE; } - dbh->default_fetch_type = Z_LVAL_P(value); + dbh->default_fetch_type = Z_IVAL_P(value); return SUCCESS; case PDO_ATTR_STRINGIFY_FETCHES: - PDO_LONG_PARAM_CHECK; - convert_to_long(value); - dbh->stringify = Z_LVAL_P(value) ? 1 : 0; + PDO_INT_PARAM_CHECK; + convert_to_int(value); + dbh->stringify = Z_IVAL_P(value) ? 1 : 0; return SUCCESS; case PDO_ATTR_STATEMENT_CLASS: { @@ -835,10 +835,10 @@ fail: static PHP_METHOD(PDO, setAttribute) { pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); - long attr; + php_int_t attr; zval *value; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &attr, &value)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz", &attr, &value)) { RETURN_FALSE; } @@ -857,9 +857,9 @@ static PHP_METHOD(PDO, setAttribute) static PHP_METHOD(PDO, getAttribute) { pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); - long attr; + php_int_t attr; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr)) { RETURN_FALSE; } @@ -872,13 +872,13 @@ static PHP_METHOD(PDO, getAttribute) RETURN_BOOL(dbh->is_persistent); case PDO_ATTR_CASE: - RETURN_LONG(dbh->desired_case); + RETURN_INT(dbh->desired_case); case PDO_ATTR_ORACLE_NULLS: - RETURN_LONG(dbh->oracle_nulls); + RETURN_INT(dbh->oracle_nulls); case PDO_ATTR_ERRMODE: - RETURN_LONG(dbh->error_mode); + RETURN_INT(dbh->error_mode); case PDO_ATTR_DRIVER_NAME: RETURN_STRINGL((char*)dbh->driver->driver_name, dbh->driver->driver_name_len); @@ -892,7 +892,7 @@ static PHP_METHOD(PDO, getAttribute) } return; case PDO_ATTR_DEFAULT_FETCH_MODE: - RETURN_LONG(dbh->default_fetch_type); + RETURN_INT(dbh->default_fetch_type); default: break; } @@ -924,7 +924,7 @@ static PHP_METHOD(PDO, exec) pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); char *statement; int statement_len; - long ret; + php_int_t ret; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &statement, &statement_len)) { RETURN_FALSE; @@ -941,7 +941,7 @@ static PHP_METHOD(PDO, exec) PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } else { - RETURN_LONG(ret); + RETURN_INT(ret); } } /* }}} */ @@ -1136,11 +1136,11 @@ static PHP_METHOD(PDO, quote) pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); char *str; int str_len; - long paramtype = PDO_PARAM_STR; + php_int_t paramtype = PDO_PARAM_STR; char *qstr; int qlen; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, ¶mtype)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, ¶mtype)) { RETURN_FALSE; } @@ -1382,99 +1382,100 @@ void pdo_dbh_init(TSRMLS_D) pdo_dbh_object_handlers.get_method = dbh_method_get; pdo_dbh_object_handlers.compare_objects = dbh_compare; - REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (long)PDO_PARAM_BOOL); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_NULL", (long)PDO_PARAM_NULL); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_INT", (long)PDO_PARAM_INT); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_STR", (long)PDO_PARAM_STR); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_LOB", (long)PDO_PARAM_LOB); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_STMT", (long)PDO_PARAM_STMT); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT); - - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_ALLOC", (long)PDO_PARAM_EVT_ALLOC); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FREE", (long)PDO_PARAM_EVT_FREE); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_PRE", (long)PDO_PARAM_EVT_EXEC_PRE); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_EXEC_POST", (long)PDO_PARAM_EVT_EXEC_POST); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_PRE", (long)PDO_PARAM_EVT_FETCH_PRE); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_FETCH_POST", (long)PDO_PARAM_EVT_FETCH_POST); - REGISTER_PDO_CLASS_CONST_LONG("PARAM_EVT_NORMALIZE", (long)PDO_PARAM_EVT_NORMALIZE); - - REGISTER_PDO_CLASS_CONST_LONG("FETCH_LAZY", (long)PDO_FETCH_LAZY); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ASSOC",(long)PDO_FETCH_ASSOC); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_NUM", (long)PDO_FETCH_NUM); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOTH", (long)PDO_FETCH_BOTH); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_OBJ", (long)PDO_FETCH_OBJ); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOUND",(long)PDO_FETCH_BOUND); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_COLUMN",(long)PDO_FETCH_COLUMN); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASS",(long)PDO_FETCH_CLASS); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_INTO", (long)PDO_FETCH_INTO); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_FUNC", (long)PDO_FETCH_FUNC); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_GROUP",(long)PDO_FETCH_GROUP); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_KEY_PAIR",(long)PDO_FETCH_KEY_PAIR); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_BOOL", (php_int_t)PDO_PARAM_BOOL); + REGISTER_PDO_CLASS_CONST_INT("PARAM_NULL", (php_int_t)PDO_PARAM_NULL); + REGISTER_PDO_CLASS_CONST_INT("PARAM_INT", (php_int_t)PDO_PARAM_INT); + REGISTER_PDO_CLASS_CONST_INT("PARAM_STR", (php_int_t)PDO_PARAM_STR); + REGISTER_PDO_CLASS_CONST_INT("PARAM_LOB", (php_int_t)PDO_PARAM_LOB); + REGISTER_PDO_CLASS_CONST_INT("PARAM_STMT", (php_int_t)PDO_PARAM_STMT); + REGISTER_PDO_CLASS_CONST_INT("PARAM_INPUT_OUTPUT", (php_int_t)PDO_PARAM_INPUT_OUTPUT); + + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_ALLOC", (php_int_t)PDO_PARAM_EVT_ALLOC); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FREE", (php_int_t)PDO_PARAM_EVT_FREE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_PRE", (php_int_t)PDO_PARAM_EVT_EXEC_PRE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_EXEC_POST", (php_int_t)PDO_PARAM_EVT_EXEC_POST); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_PRE", (php_int_t)PDO_PARAM_EVT_FETCH_PRE); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_FETCH_POST", (php_int_t)PDO_PARAM_EVT_FETCH_POST); + REGISTER_PDO_CLASS_CONST_INT("PARAM_EVT_NORMALIZE", (php_int_t)PDO_PARAM_EVT_NORMALIZE); + + REGISTER_PDO_CLASS_CONST_INT("FETCH_LAZY", (php_int_t)PDO_FETCH_LAZY); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ASSOC", (php_int_t)PDO_FETCH_ASSOC); + REGISTER_PDO_CLASS_CONST_INT("FETCH_NUM", (php_int_t)PDO_FETCH_NUM); + REGISTER_PDO_CLASS_CONST_INT("FETCH_BOTH", (php_int_t)PDO_FETCH_BOTH); + REGISTER_PDO_CLASS_CONST_INT("FETCH_OBJ", (php_int_t)PDO_FETCH_OBJ); + REGISTER_PDO_CLASS_CONST_INT("FETCH_BOUND", (php_int_t)PDO_FETCH_BOUND); + REGISTER_PDO_CLASS_CONST_INT("FETCH_COLUMN", (php_int_t)PDO_FETCH_COLUMN); + REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASS", (php_int_t)PDO_FETCH_CLASS); + REGISTER_PDO_CLASS_CONST_INT("FETCH_INTO", (php_int_t)PDO_FETCH_INTO); + REGISTER_PDO_CLASS_CONST_INT("FETCH_FUNC", (php_int_t)PDO_FETCH_FUNC); + REGISTER_PDO_CLASS_CONST_INT("FETCH_GROUP", (php_int_t)PDO_FETCH_GROUP); + REGISTER_PDO_CLASS_CONST_INT("FETCH_UNIQUE", (php_int_t)PDO_FETCH_UNIQUE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_KEY_PAIR", (php_int_t)PDO_FETCH_KEY_PAIR); + REGISTER_PDO_CLASS_CONST_INT("FETCH_CLASSTYPE", (php_int_t)PDO_FETCH_CLASSTYPE); + #if PHP_VERSION_ID >= 50100 - REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_SERIALIZE",(php_int_t)PDO_FETCH_SERIALIZE); #endif - REGISTER_PDO_CLASS_CONST_LONG("FETCH_PROPS_LATE",(long)PDO_FETCH_PROPS_LATE); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_NAMED",(long)PDO_FETCH_NAMED); - - REGISTER_PDO_CLASS_CONST_LONG("ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_PREFETCH", (long)PDO_ATTR_PREFETCH); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_TIMEOUT", (long)PDO_ATTR_TIMEOUT); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_ERRMODE", (long)PDO_ATTR_ERRMODE); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_VERSION", (long)PDO_ATTR_SERVER_VERSION); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CLIENT_VERSION", (long)PDO_ATTR_CLIENT_VERSION); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_INFO", (long)PDO_ATTR_SERVER_INFO); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CONNECTION_STATUS", (long)PDO_ATTR_CONNECTION_STATUS); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CASE", (long)PDO_ATTR_CASE); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR_NAME", (long)PDO_ATTR_CURSOR_NAME); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR", (long)PDO_ATTR_CURSOR); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_ORACLE_NULLS", (long)PDO_ATTR_ORACLE_NULLS); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_PERSISTENT", (long)PDO_ATTR_PERSISTENT); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_STATEMENT_CLASS", (long)PDO_ATTR_STATEMENT_CLASS); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_TABLE_NAMES", (long)PDO_ATTR_FETCH_TABLE_NAMES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_CATALOG_NAMES", (long)PDO_ATTR_FETCH_CATALOG_NAMES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_DRIVER_NAME", (long)PDO_ATTR_DRIVER_NAME); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_STRINGIFY_FETCHES",(long)PDO_ATTR_STRINGIFY_FETCHES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_MAX_COLUMN_LEN",(long)PDO_ATTR_MAX_COLUMN_LEN); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_EMULATE_PREPARES",(long)PDO_ATTR_EMULATE_PREPARES); - REGISTER_PDO_CLASS_CONST_LONG("ATTR_DEFAULT_FETCH_MODE",(long)PDO_ATTR_DEFAULT_FETCH_MODE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_PROPS_LATE", (php_int_t)PDO_FETCH_PROPS_LATE); + REGISTER_PDO_CLASS_CONST_INT("FETCH_NAMED", (php_int_t)PDO_FETCH_NAMED); + + REGISTER_PDO_CLASS_CONST_INT("ATTR_AUTOCOMMIT", (php_int_t)PDO_ATTR_AUTOCOMMIT); + REGISTER_PDO_CLASS_CONST_INT("ATTR_PREFETCH", (php_int_t)PDO_ATTR_PREFETCH); + REGISTER_PDO_CLASS_CONST_INT("ATTR_TIMEOUT", (php_int_t)PDO_ATTR_TIMEOUT); + REGISTER_PDO_CLASS_CONST_INT("ATTR_ERRMODE", (php_int_t)PDO_ATTR_ERRMODE); + REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_VERSION", (php_int_t)PDO_ATTR_SERVER_VERSION); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CLIENT_VERSION", (php_int_t)PDO_ATTR_CLIENT_VERSION); + REGISTER_PDO_CLASS_CONST_INT("ATTR_SERVER_INFO", (php_int_t)PDO_ATTR_SERVER_INFO); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CONNECTION_STATUS", (php_int_t)PDO_ATTR_CONNECTION_STATUS); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CASE", (php_int_t)PDO_ATTR_CASE); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR_NAME", (php_int_t)PDO_ATTR_CURSOR_NAME); + REGISTER_PDO_CLASS_CONST_INT("ATTR_CURSOR", (php_int_t)PDO_ATTR_CURSOR); + REGISTER_PDO_CLASS_CONST_INT("ATTR_ORACLE_NULLS", (php_int_t)PDO_ATTR_ORACLE_NULLS); + REGISTER_PDO_CLASS_CONST_INT("ATTR_PERSISTENT", (php_int_t)PDO_ATTR_PERSISTENT); + REGISTER_PDO_CLASS_CONST_INT("ATTR_STATEMENT_CLASS", (php_int_t)PDO_ATTR_STATEMENT_CLASS); + REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_TABLE_NAMES", (php_int_t)PDO_ATTR_FETCH_TABLE_NAMES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_FETCH_CATALOG_NAMES", (php_int_t)PDO_ATTR_FETCH_CATALOG_NAMES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_DRIVER_NAME", (php_int_t)PDO_ATTR_DRIVER_NAME); + REGISTER_PDO_CLASS_CONST_INT("ATTR_STRINGIFY_FETCHES", (php_int_t)PDO_ATTR_STRINGIFY_FETCHES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_MAX_COLUMN_LEN", (php_int_t)PDO_ATTR_MAX_COLUMN_LEN); + REGISTER_PDO_CLASS_CONST_INT("ATTR_EMULATE_PREPARES", (php_int_t)PDO_ATTR_EMULATE_PREPARES); + REGISTER_PDO_CLASS_CONST_INT("ATTR_DEFAULT_FETCH_MODE", (php_int_t)PDO_ATTR_DEFAULT_FETCH_MODE); - REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT); - REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING); - REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_EXCEPTION", (long)PDO_ERRMODE_EXCEPTION); + REGISTER_PDO_CLASS_CONST_INT("ERRMODE_SILENT", (php_int_t)PDO_ERRMODE_SILENT); + REGISTER_PDO_CLASS_CONST_INT("ERRMODE_WARNING", (php_int_t)PDO_ERRMODE_WARNING); + REGISTER_PDO_CLASS_CONST_INT("ERRMODE_EXCEPTION", (php_int_t)PDO_ERRMODE_EXCEPTION); - REGISTER_PDO_CLASS_CONST_LONG("CASE_NATURAL", (long)PDO_CASE_NATURAL); - REGISTER_PDO_CLASS_CONST_LONG("CASE_LOWER", (long)PDO_CASE_LOWER); - REGISTER_PDO_CLASS_CONST_LONG("CASE_UPPER", (long)PDO_CASE_UPPER); + REGISTER_PDO_CLASS_CONST_INT("CASE_NATURAL", (php_int_t)PDO_CASE_NATURAL); + REGISTER_PDO_CLASS_CONST_INT("CASE_LOWER", (php_int_t)PDO_CASE_LOWER); + REGISTER_PDO_CLASS_CONST_INT("CASE_UPPER", (php_int_t)PDO_CASE_UPPER); - REGISTER_PDO_CLASS_CONST_LONG("NULL_NATURAL", (long)PDO_NULL_NATURAL); - REGISTER_PDO_CLASS_CONST_LONG("NULL_EMPTY_STRING", (long)PDO_NULL_EMPTY_STRING); - REGISTER_PDO_CLASS_CONST_LONG("NULL_TO_STRING", (long)PDO_NULL_TO_STRING); + REGISTER_PDO_CLASS_CONST_INT("NULL_NATURAL", (php_int_t)PDO_NULL_NATURAL); + REGISTER_PDO_CLASS_CONST_INT("NULL_EMPTY_STRING", (php_int_t)PDO_NULL_EMPTY_STRING); + REGISTER_PDO_CLASS_CONST_INT("NULL_TO_STRING", (php_int_t)PDO_NULL_TO_STRING); REGISTER_PDO_CLASS_CONST_STRING("ERR_NONE", PDO_ERR_NONE); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_NEXT", (long)PDO_FETCH_ORI_NEXT); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_PRIOR", (long)PDO_FETCH_ORI_PRIOR); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_FIRST", (long)PDO_FETCH_ORI_FIRST); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_LAST", (long)PDO_FETCH_ORI_LAST); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_ABS", (long)PDO_FETCH_ORI_ABS); - REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_REL", (long)PDO_FETCH_ORI_REL); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_NEXT", (php_int_t)PDO_FETCH_ORI_NEXT); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_PRIOR", (php_int_t)PDO_FETCH_ORI_PRIOR); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_FIRST", (php_int_t)PDO_FETCH_ORI_FIRST); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_LAST", (php_int_t)PDO_FETCH_ORI_LAST); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_ABS", (php_int_t)PDO_FETCH_ORI_ABS); + REGISTER_PDO_CLASS_CONST_INT("FETCH_ORI_REL", (php_int_t)PDO_FETCH_ORI_REL); - REGISTER_PDO_CLASS_CONST_LONG("CURSOR_FWDONLY", (long)PDO_CURSOR_FWDONLY); - REGISTER_PDO_CLASS_CONST_LONG("CURSOR_SCROLL", (long)PDO_CURSOR_SCROLL); + REGISTER_PDO_CLASS_CONST_INT("CURSOR_FWDONLY", (php_int_t)PDO_CURSOR_FWDONLY); + REGISTER_PDO_CLASS_CONST_INT("CURSOR_SCROLL", (php_int_t)PDO_CURSOR_SCROLL); #if 0 - REGISTER_PDO_CLASS_CONST_LONG("ERR_CANT_MAP", (long)PDO_ERR_CANT_MAP); - REGISTER_PDO_CLASS_CONST_LONG("ERR_SYNTAX", (long)PDO_ERR_SYNTAX); - REGISTER_PDO_CLASS_CONST_LONG("ERR_CONSTRAINT", (long)PDO_ERR_CONSTRAINT); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_FOUND", (long)PDO_ERR_NOT_FOUND); - REGISTER_PDO_CLASS_CONST_LONG("ERR_ALREADY_EXISTS", (long)PDO_ERR_ALREADY_EXISTS); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_IMPLEMENTED", (long)PDO_ERR_NOT_IMPLEMENTED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_MISMATCH", (long)PDO_ERR_MISMATCH); - REGISTER_PDO_CLASS_CONST_LONG("ERR_TRUNCATED", (long)PDO_ERR_TRUNCATED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_DISCONNECTED", (long)PDO_ERR_DISCONNECTED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NO_PERM", (long)PDO_ERR_NO_PERM); + REGISTER_PDO_CLASS_CONST_INT("ERR_CANT_MAP", (php_int_t)PDO_ERR_CANT_MAP); + REGISTER_PDO_CLASS_CONST_INT("ERR_SYNTAX", (php_int_t)PDO_ERR_SYNTAX); + REGISTER_PDO_CLASS_CONST_INT("ERR_CONSTRAINT", (php_int_t)PDO_ERR_CONSTRAINT); + REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_FOUND", (php_int_t)PDO_ERR_NOT_FOUND); + REGISTER_PDO_CLASS_CONST_INT("ERR_ALREADY_EXISTS", (php_int_t)PDO_ERR_ALREADY_EXISTS); + REGISTER_PDO_CLASS_CONST_INT("ERR_NOT_IMPLEMENTED", (php_int_t)PDO_ERR_NOT_IMPLEMENTED); + REGISTER_PDO_CLASS_CONST_INT("ERR_MISMATCH", (php_int_t)PDO_ERR_MISMATCH); + REGISTER_PDO_CLASS_CONST_INT("ERR_TRUNCATED", (php_int_t)PDO_ERR_TRUNCATED); + REGISTER_PDO_CLASS_CONST_INT("ERR_DISCONNECTED", (php_int_t)PDO_ERR_DISCONNECTED); + REGISTER_PDO_CLASS_CONST_INT("ERR_NO_PERM", (php_int_t)PDO_ERR_NO_PERM); #endif } diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index 9cd205f4eb..6530e2222c 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -1,5 +1,4 @@ /* Generated by re2c 0.13.5 */ -#line 1 "ext/pdo/pdo_sql_parser.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -47,11 +46,9 @@ static int scan(Scanner *s) char *cursor = s->cur; s->tok = cursor; - #line 55 "ext/pdo/pdo_sql_parser.re" -#line 55 "ext/pdo/pdo_sql_parser.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -79,9 +76,7 @@ yy3: yych = *(YYMARKER = ++YYCURSOR); if (yych >= 0x01) goto yy43; yy4: -#line 63 "ext/pdo/pdo_sql_parser.re" { SKIP_ONE(PDO_PARSER_TEXT); } -#line 85 "ext/pdo/pdo_sql_parser.c" yy5: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); @@ -163,9 +158,7 @@ yy7: default: goto yy8; } yy8: -#line 62 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_BIND_POS); } -#line 169 "ext/pdo/pdo_sql_parser.c" yy9: ++YYCURSOR; switch ((yych = *YYCURSOR)) { @@ -173,9 +166,7 @@ yy9: default: goto yy13; } yy10: -#line 65 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 179 "ext/pdo/pdo_sql_parser.c" yy11: yych = *++YYCURSOR; switch (yych) { @@ -210,9 +201,7 @@ yy14: default: goto yy14; } yy16: -#line 64 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 216 "ext/pdo/pdo_sql_parser.c" yy17: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -290,9 +279,7 @@ yy29: default: goto yy31; } yy31: -#line 60 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 296 "ext/pdo/pdo_sql_parser.c" yy32: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -364,9 +351,7 @@ yy32: default: goto yy34; } yy34: -#line 61 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_BIND); } -#line 370 "ext/pdo/pdo_sql_parser.c" yy35: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -394,9 +379,7 @@ yy39: goto yy37; yy40: ++YYCURSOR; -#line 59 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 400 "ext/pdo/pdo_sql_parser.c" yy42: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -416,11 +399,8 @@ yy44: goto yy42; yy45: ++YYCURSOR; -#line 58 "ext/pdo/pdo_sql_parser.re" { RET(PDO_PARSER_TEXT); } -#line 422 "ext/pdo/pdo_sql_parser.c" } -#line 66 "ext/pdo/pdo_sql_parser.re" } @@ -606,12 +586,12 @@ safe: case IS_FALSE: case IS_TRUE: - convert_to_long(&tmp_param); + convert_to_int(&tmp_param); /* fall through */ - case IS_LONG: + case IS_INT: case IS_DOUBLE: convert_to_string(&tmp_param); - plc->qlen = Z_STRLEN(tmp_param); + plc->qlen = Z_STRSIZE(tmp_param); plc->quoted = estrdup(Z_STRVAL(tmp_param)); plc->freeq = 1; break; @@ -619,7 +599,7 @@ safe: default: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), - Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, + Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -638,7 +618,7 @@ safe: parameter = ¶m->parameter; } plc->quoted = Z_STRVAL_P(parameter); - plc->qlen = Z_STRLEN_P(parameter); + plc->qlen = Z_STRSIZE_P(parameter); } newbuffer_len += plc->qlen; } @@ -789,7 +769,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char bind placeholders are at least 2 characters, so the accommodate their own "'s */ - newbuffer_len += padding * Z_STRLEN_P(param->parameter); + newbuffer_len += padding * Z_STRSIZE_P(param->parameter); } zend_hash_move_forward(params); } @@ -825,16 +805,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { @@ -861,16 +841,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 76ac3d115a..8effb4f5e7 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -248,12 +248,12 @@ safe: case IS_FALSE: case IS_TRUE: - convert_to_long(&tmp_param); + convert_to_int(&tmp_param); /* fall through */ - case IS_LONG: + case IS_INT: case IS_DOUBLE: convert_to_string(&tmp_param); - plc->qlen = Z_STRLEN(tmp_param); + plc->qlen = Z_STRSIZE(tmp_param); plc->quoted = estrdup(Z_STRVAL(tmp_param)); plc->freeq = 1; break; @@ -261,7 +261,7 @@ safe: default: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), - Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, + Z_STRSIZE(tmp_param), &plc->quoted, &plc->qlen, param->param_type TSRMLS_CC)) { /* bork */ ret = -1; @@ -280,7 +280,7 @@ safe: parameter = ¶m->parameter; } plc->quoted = Z_STRVAL_P(parameter); - plc->qlen = Z_STRLEN_P(parameter); + plc->qlen = Z_STRSIZE_P(parameter); } newbuffer_len += plc->qlen; } @@ -431,7 +431,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char bind placeholders are at least 2 characters, so the accommodate their own "'s */ - newbuffer_len += padding * Z_STRLEN_P(param->parameter); + newbuffer_len += padding * Z_STRSIZE_P(param->parameter); } zend_hash_move_forward(params); } @@ -467,16 +467,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { @@ -503,16 +503,16 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRSIZE_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; *outquery_len += quotedstrlen; efree(quotedstr); } else { - memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter)); - ptr += Z_STRLEN_P(param->parameter); - *outquery_len += (Z_STRLEN_P(param->parameter)); + memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRSIZE_P(param->parameter)); + ptr += Z_STRSIZE_P(param->parameter); + *outquery_len += (Z_STRSIZE_P(param->parameter)); } } else { diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 96407c3127..8402491f3c 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -328,8 +328,8 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s convert_to_string(parameter); } } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) { - convert_to_long(parameter); - } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_LONG) { + convert_to_int(parameter); + } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && Z_TYPE_P(parameter) == IS_INT) { convert_to_boolean(parameter); } @@ -447,7 +447,7 @@ static PHP_METHOD(PDOStatement, execute) struct pdo_bound_param_data param; zval *tmp; zend_string *key = NULL; - ulong num_index; + php_uint_t num_index; if (stmt->bound_params) { zend_hash_destroy(stmt->bound_params); @@ -544,7 +544,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ { struct pdo_column_data *col; char *value = NULL; - unsigned long value_len = 0; + php_size_t value_len = 0; int caller_frees = 0; int type, new_type; @@ -571,8 +571,8 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ break; case PDO_PARAM_INT: - if (value && value_len == sizeof(long)) { - ZVAL_LONG(dest, *(long*)value); + if (value && value_len == sizeof(php_int_t)) { + ZVAL_INT(dest, *(php_int_t*)value); break; } ZVAL_NULL(dest); @@ -639,7 +639,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ if (type != new_type) { switch (new_type) { case PDO_PARAM_INT: - convert_to_long_ex(dest); + convert_to_int_ex(dest); break; case PDO_PARAM_BOOL: convert_to_boolean_ex(dest); @@ -661,7 +661,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ if (stmt->dbh->stringify) { switch (Z_TYPE_P(dest)) { - case IS_LONG: + case IS_INT: case IS_DOUBLE: convert_to_string(dest); break; @@ -674,7 +674,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ } /* }}} */ -static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, long offset, int do_bind TSRMLS_DC) /* {{{ */ +static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, php_int_t offset, int do_bind TSRMLS_DC) /* {{{ */ { if (!stmt->executed) { return 0; @@ -832,7 +832,7 @@ static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs TSRMLS_DC) / /* perform a fetch. If do_bind is true, update any bound columns. * If return_value is not null, store values into it according to HOW. */ -static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, long offset, zval *return_all TSRMLS_DC) /* {{{ */ +static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, php_int_t offset, zval *return_all TSRMLS_DC) /* {{{ */ { int flags, idx, old_arg_count = 0; zend_class_entry *ce = NULL, *old_ce = NULL; @@ -1032,8 +1032,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ zval tmp; fetch_value(stmt, &tmp, ++i, NULL TSRMLS_CC); - if (Z_TYPE(val) == IS_LONG) { - zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_LVAL(val), &tmp); + if (Z_TYPE(val) == IS_INT) { + zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_IVAL(val), &tmp); } else { convert_to_string(&val); zend_symtable_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_STR(val), &tmp); @@ -1110,7 +1110,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ php_unserialize_data_t var_hash; PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRLEN(val), NULL TSRMLS_CC) == FAILURE) { + if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRSIZE(val), NULL TSRMLS_CC) == FAILURE) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize data" TSRMLS_CC); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return 0; @@ -1121,7 +1121,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); return 0; - } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRLEN(val) : 0, NULL TSRMLS_CC) == FAILURE) { + } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRSIZE(val) : 0, NULL TSRMLS_CC) == FAILURE) { zval_ptr_dtor(&val); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); zval_dtor(return_value); @@ -1213,7 +1213,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ } /* }}} */ -static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, long mode, int fetch_all TSRMLS_DC) /* {{{ */ +static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, php_int_t mode, int fetch_all TSRMLS_DC) /* {{{ */ { int flags = mode & PDO_FETCH_FLAGS; @@ -1269,12 +1269,12 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, long mode, int fetch_all TSRML Fetches the next row and returns it, or false if there are no more rows */ static PHP_METHOD(PDOStatement, fetch) { - long how = PDO_FETCH_USE_DEFAULT; - long ori = PDO_FETCH_ORI_NEXT; - long off = 0; + php_int_t how = PDO_FETCH_USE_DEFAULT; + php_int_t ori = PDO_FETCH_ORI_NEXT; + php_int_t off = 0; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lll", &how, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iii", &how, &ori, &off)) { RETURN_FALSE; } @@ -1296,9 +1296,9 @@ static PHP_METHOD(PDOStatement, fetch) Fetches the next row and returns it as an object. */ static PHP_METHOD(PDOStatement, fetchObject) { - long how = PDO_FETCH_CLASS; - long ori = PDO_FETCH_ORI_NEXT; - long off = 0; + php_int_t how = PDO_FETCH_CLASS; + php_int_t ori = PDO_FETCH_ORI_NEXT; + php_int_t off = 0; zend_string *class_name = NULL; zend_class_entry *old_ce; zval old_ctor_args, *ctor_args = NULL; @@ -1361,10 +1361,10 @@ static PHP_METHOD(PDOStatement, fetchObject) Returns a data of the specified column in the result set. */ static PHP_METHOD(PDOStatement, fetchColumn) { - long col_n = 0; + php_int_t col_n = 0; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &col_n)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &col_n)) { RETURN_FALSE; } @@ -1383,7 +1383,7 @@ static PHP_METHOD(PDOStatement, fetchColumn) Returns an array of all of the results. */ static PHP_METHOD(PDOStatement, fetchAll) { - long how = PDO_FETCH_USE_DEFAULT; + php_int_t how = PDO_FETCH_USE_DEFAULT; zval data, *return_all; zval *arg2; zend_class_entry *old_ce; @@ -1391,7 +1391,7 @@ static PHP_METHOD(PDOStatement, fetchAll) int error = 0, flags, old_arg_count; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lzz", &how, &arg2, &ctor_args)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|izz", &how, &arg2, &ctor_args)) { RETURN_FALSE; } @@ -1470,8 +1470,8 @@ static PHP_METHOD(PDOStatement, fetchAll) stmt->fetch.column = how & PDO_FETCH_GROUP ? -1 : 0; break; case 2: - convert_to_long(arg2); - stmt->fetch.column = Z_LVAL_P(arg2); + convert_to_int(arg2); + stmt->fetch.column = Z_IVAL_P(arg2); break; case 3: pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN" TSRMLS_CC); @@ -1545,15 +1545,15 @@ static PHP_METHOD(PDOStatement, fetchAll) static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param) /* {{{ */ { struct pdo_bound_param_data param = {0}; - long param_type = PDO_PARAM_STR; + php_int_t param_type = PDO_PARAM_STR; zval *parameter; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "lz|llz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, + "iz|iiz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, ¶m.driver_params)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|llz!", ¶m.name, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|iiz!", ¶m.name, ¶meter, ¶m_type, ¶m.max_value_len, ¶m.driver_params)) { return 0; @@ -1584,15 +1584,15 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, static PHP_METHOD(PDOStatement, bindValue) { struct pdo_bound_param_data param = {0}; - long param_type = PDO_PARAM_STR; + php_int_t param_type = PDO_PARAM_STR; zval *parameter; PHP_STMT_GET_OBJ; param.paramno = -1; if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, - "lz/|l", ¶m.paramno, ¶meter, ¶m_type)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", ¶m.name, + "iz/|i", ¶m.paramno, ¶meter, ¶m_type)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|i", ¶m.name, ¶meter, ¶m_type)) { RETURN_FALSE; } @@ -1643,7 +1643,7 @@ static PHP_METHOD(PDOStatement, rowCount) { PHP_STMT_GET_OBJ; - RETURN_LONG(stmt->row_count); + RETURN_INT(stmt->row_count); } /* }}} */ @@ -1703,11 +1703,11 @@ static PHP_METHOD(PDOStatement, errorInfo) Set an attribute */ static PHP_METHOD(PDOStatement, setAttribute) { - long attr; + php_int_t attr; zval *value = NULL; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iz!", &attr, &value)) { RETURN_FALSE; } @@ -1733,7 +1733,7 @@ fail: /* {{{ proto mixed PDOStatement::getAttribute(long attribute) Get an attribute */ -static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, long attr) +static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, php_int_t attr) { switch (attr) { case PDO_ATTR_EMULATE_PREPARES: @@ -1745,10 +1745,10 @@ static int generic_stmt_attr_get(pdo_stmt_t *stmt, zval *return_value, long attr static PHP_METHOD(PDOStatement, getAttribute) { - long attr; + php_int_t attr; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr)) { RETURN_FALSE; } @@ -1790,7 +1790,7 @@ static PHP_METHOD(PDOStatement, columnCount) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(stmt->column_count); + RETURN_INT(stmt->column_count); } /* }}} */ @@ -1798,11 +1798,11 @@ static PHP_METHOD(PDOStatement, columnCount) Returns meta data for a numbered column */ static PHP_METHOD(PDOStatement, getColumnMeta) { - long colno; + php_int_t colno; struct pdo_column_data *col; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colno)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &colno)) { RETURN_FALSE; } if(colno < 0) { @@ -1824,11 +1824,11 @@ static PHP_METHOD(PDOStatement, getColumnMeta) /* add stock items */ col = &stmt->columns[colno]; add_assoc_string(return_value, "name", col->name); - add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ - add_assoc_long(return_value, "precision", col->precision); + add_assoc_int(return_value, "len", col->maxlen); /* FIXME: unsigned ? */ + add_assoc_int(return_value, "precision", col->precision); if (col->param_type != PDO_PARAM_ZVAL) { /* if param_type is PDO_PARAM_ZVAL the driver has to provide correct data */ - add_assoc_long(return_value, "pdo_type", col->param_type); + add_assoc_int(return_value, "pdo_type", col->param_type); } } /* }}} */ @@ -1838,7 +1838,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta) int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip) { - long mode = PDO_FETCH_BOTH; + php_int_t mode = PDO_FETCH_BOTH; int flags = 0, argc = ZEND_NUM_ARGS() - skip; zval *args; zend_class_entry *cep; @@ -1868,11 +1868,11 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args); if (SUCCESS == retval) { - if (Z_TYPE(args[skip]) != IS_LONG) { + if (Z_TYPE(args[skip]) != IS_INT) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer" TSRMLS_CC); retval = FAILURE; } else { - mode = Z_LVAL(args[skip]); + mode = Z_IVAL(args[skip]); flags = mode & PDO_FETCH_FLAGS; retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC); @@ -1906,10 +1906,10 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in case PDO_FETCH_COLUMN: if (argc != 2) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the colno argument" TSRMLS_CC); - } else if (Z_TYPE(args[skip+1]) != IS_LONG) { + } else if (Z_TYPE(args[skip+1]) != IS_INT) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "colno must be an integer" TSRMLS_CC); } else { - stmt->fetch.column = Z_LVAL(args[skip+1]); + stmt->fetch.column = Z_IVAL(args[skip+1]); retval = SUCCESS; } break; @@ -2119,7 +2119,7 @@ static PHP_METHOD(PDOStatement, debugDumpParams) stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0); if (stmt->bound_params) { - ulong num; + php_uint_t num; zend_string *key = NULL; ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) { if (key) { @@ -2372,7 +2372,7 @@ zend_object *pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC) struct php_pdo_iterator { zend_object_iterator iter; - ulong key; + php_uint_t key; zval fetch_ahead; }; @@ -2413,7 +2413,7 @@ static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_D if (I->key == (ulong)-1) { ZVAL_NULL(key); } else { - ZVAL_LONG(key, I->key); + ZVAL_INT(key, I->key); } } @@ -2489,9 +2489,9 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl ZVAL_NULL(rv); if (stmt) { - if (Z_TYPE_P(member) == IS_LONG) { - if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) { - fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC); + if (Z_TYPE_P(member) == IS_INT) { + if (Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count) { + fetch_value(stmt, rv, Z_IVAL_P(member), NULL TSRMLS_CC); } } else { convert_to_string(member); @@ -2543,8 +2543,8 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c int colno = -1; if (stmt) { - if (Z_TYPE_P(member) == IS_LONG) { - return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count; + if (Z_TYPE_P(member) == IS_INT) { + return Z_IVAL_P(member) >= 0 && Z_IVAL_P(member) < stmt->column_count; } else { convert_to_string(member); diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h index 0de6743ad4..2072dd3469 100644 --- a/ext/pdo/php_pdo.h +++ b/ext/pdo/php_pdo.h @@ -49,7 +49,7 @@ PHP_MSHUTDOWN_FUNCTION(pdo); PHP_MINFO_FUNCTION(pdo); ZEND_BEGIN_MODULE_GLOBALS(pdo) - long global_value; + php_int_t global_value; ZEND_END_MODULE_GLOBALS(pdo) #ifdef ZTS @@ -58,13 +58,13 @@ ZEND_END_MODULE_GLOBALS(pdo) # define PDOG(v) (pdo_globals.v) #endif -#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_PDO_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); #define REGISTER_PDO_CONST_LONG(const_name, value) { \ zend_class_entry **pce; \ if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \ - zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \ + zend_declare_class_constant_int(*pce, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); \ } \ #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \ diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index 4818bc6232..b7f7f46250 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -194,13 +194,13 @@ enum pdo_null_handling { }; /* {{{ utils for reading attributes set as driver_options */ -static inline long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, long defval TSRMLS_DC) +static inline php_int_t pdo_attr_ival(zval *options, enum pdo_attribute_type option_name, php_int_t defval TSRMLS_DC) { zval *v; if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) { - convert_to_long_ex(v); - return Z_LVAL_P(v); + convert_to_int_ex(v); + return Z_IVAL_P(v); } return defval; } @@ -210,7 +210,7 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio if (options && (v = zend_hash_index_find(Z_ARRVAL_P(options), option_name))) { convert_to_string_ex(v); - return estrndup(Z_STRVAL_P(v), Z_STRLEN_P(v)); + return estrndup(Z_STRVAL_P(v), Z_STRSIZE_P(v)); } return defval ? estrdup(defval) : NULL; } @@ -220,8 +220,8 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio * initialized */ typedef struct { const char *driver_name; - unsigned long driver_name_len; - unsigned long api_version; /* needs to be compatible with PDO */ + php_uint_t driver_name_len; + php_uint_t api_version; /* needs to be compatible with PDO */ #define PDO_DRIVER_HEADER(name) \ #name, sizeof(#name)-1, \ @@ -244,10 +244,10 @@ typedef struct { typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh TSRMLS_DC); /* prepare a statement and stash driver specific portion into stmt */ -typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC); +typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC); /* execute a statement (that does not return a result set) */ -typedef long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC); +typedef php_int_t (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC); /* quote a string */ typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC); @@ -256,7 +256,7 @@ typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unqu typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh TSRMLS_DC); /* setting of attributes */ -typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC); +typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC); /* return last insert id. NULL indicates error condition, otherwise, the return value * MUST be an emalloc'd NULL terminated string. */ @@ -271,7 +271,7 @@ typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC); /* fetching of attributes */ -typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC); +typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC); /* checking/pinging persistent connections; return SUCCESS if the connection * is still alive and ready to be used, FAILURE otherwise. @@ -329,7 +329,7 @@ typedef int (*pdo_stmt_execute_func)(pdo_stmt_t *stmt TSRMLS_DC); * more rows. The ori and offset params modify which row should be returned, * if the stmt represents a scrollable cursor */ typedef int (*pdo_stmt_fetch_func)(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, long offset TSRMLS_DC); + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC); /* queries information about the type of a column, by index (0 based). * Driver should populate stmt->columns[colno] with appropriate info */ @@ -341,7 +341,7 @@ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC) * If the driver sets caller_frees, ptr should point to emalloc'd memory * and PDO will free it as soon as it is done using it. */ -typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC); +typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC); /* hook for bound params */ enum pdo_param_event { @@ -357,10 +357,10 @@ enum pdo_param_event { typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC); /* setting of attributes */ -typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC); +typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC); /* fetching of attributes */ -typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC); +typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC); /* retrieves meta data for a numbered column. * Returns SUCCESS/FAILURE. @@ -390,7 +390,7 @@ typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, long attr, zval *val TSR * or * 'flags' => array('not_null', 'mysql:some_flag'); // to add data to an existing key */ -typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC); +typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC); /* advances the statement to the next rowset of the batch. * If it returns 1, PDO will tear down its idea of columns @@ -469,7 +469,7 @@ struct _pdo_dbh_t { /* data source string used to open this handle */ const char *data_source; - unsigned long data_source_len; + php_uint_t data_source_len; /* the global error code. */ pdo_error_type error_code; @@ -529,9 +529,9 @@ static inline pdo_dbh_object_t *php_pdo_dbh_fetch_object(zend_object *obj) { struct pdo_column_data { char *name; int namelen; - unsigned long maxlen; + php_uint_t maxlen; enum pdo_param_type param_type; - unsigned long precision; + php_uint_t precision; /* don't touch this unless your name is dbdo */ void *dbdo_data; @@ -539,10 +539,10 @@ struct pdo_column_data { /* describes a bound parameter */ struct pdo_bound_param_data { - long paramno; /* if -1, then it has a name, and we don't know the index *yet* */ + php_int_t paramno; /* if -1, then it has a name, and we don't know the index *yet* */ zend_string *name; - long max_value_len; /* as a hint for pre-allocation */ + php_int_t max_value_len; /* as a hint for pre-allocation */ zval parameter; /* the variable itself */ enum pdo_param_type param_type; /* desired or suggested type */ @@ -591,7 +591,7 @@ struct _pdo_stmt_t { HashTable *bound_columns; /* not always meaningful */ - long row_count; + php_int_t row_count; /* used to hold the statement's current query */ char *query_string; @@ -607,7 +607,7 @@ struct _pdo_stmt_t { /* for lazy fetches, we always return the same lazy object handle. * Let's keep it here. */ zval lazy_object_ref; - unsigned long refcount; + php_uint_t refcount; /* defaults for fetches */ enum pdo_fetch_type default_fetch_type; @@ -669,7 +669,7 @@ struct pdo_data_src_parser { }; PDO_API int php_pdo_parse_data_source(const char *data_source, - unsigned long data_source_len, struct pdo_data_src_parser *parsed, + php_uint_t data_source_len, struct pdo_data_src_parser *parsed, int nparams); PDO_API zend_class_entry *php_pdo_get_dbh_ce(void); diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 350a3c670d..f329435e23 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -60,12 +60,12 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS spprintf(&message, 0, "%s [%d] (severity %d) [%s]", msg, einfo->dberr, einfo->severity, stmt ? stmt->active_query_string : ""); - add_next_index_long(info, einfo->dberr); + add_next_index_int(info, einfo->dberr); // TODO: avoid reallocation ??? add_next_index_string(info, message); efree(message); - add_next_index_long(info, einfo->oserr); - add_next_index_long(info, einfo->severity); + add_next_index_int(info, einfo->oserr); + add_next_index_int(info, einfo->severity); if (einfo->oserrstr) { add_next_index_string(info, einfo->oserrstr); } @@ -93,7 +93,7 @@ static int dblib_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) return 0; } -static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; pdo_dblib_stmt *S = ecalloc(1, sizeof(*S)); @@ -107,7 +107,7 @@ static int dblib_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, return 1; } -static long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) +static php_int_t dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) { pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; RETCODE ret, resret; diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index c13d58bd57..fa071c0e26 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -171,7 +171,7 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) } static int pdo_dblib_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { RETCODE ret; @@ -213,7 +213,7 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) } static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, - unsigned long *len, int *caller_frees TSRMLS_DC) + php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data; @@ -287,7 +287,7 @@ static int pdo_dblib_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da return 1; } -static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC) +static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) { pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data; pdo_dblib_db_handle *H = S->H; @@ -303,13 +303,13 @@ static int pdo_dblib_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *re if(!dbtypeinfo) return FAILURE; - add_assoc_long(return_value, "max_length", dbcollen(H->link, colno+1) ); - add_assoc_long(return_value, "precision", (int) dbtypeinfo->precision ); - add_assoc_long(return_value, "scale", (int) dbtypeinfo->scale ); + add_assoc_int(return_value, "max_length", dbcollen(H->link, colno+1) ); + add_assoc_int(return_value, "precision", (int) dbtypeinfo->precision ); + add_assoc_int(return_value, "scale", (int) dbtypeinfo->scale ); add_assoc_string(return_value, "column_source", dbcolsource(H->link, colno+1)); add_assoc_string(return_value, "native_type", pdo_dblib_get_field_name(dbcoltype(H->link, colno+1))); - add_assoc_long(return_value, "native_type_id", dbcoltype(H->link, colno+1)); - add_assoc_long(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); + add_assoc_int(return_value, "native_type_id", dbcoltype(H->link, colno+1)); + add_assoc_int(return_value, "native_usertype_id", dbcolutype(H->link, colno+1)); return 1; } diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 20a41bbb9b..fb3979863b 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -33,11 +33,11 @@ #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" -static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, long, XSQLDA*, isc_stmt_handle*, +static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, php_int_t, XSQLDA*, isc_stmt_handle*, HashTable* TSRMLS_DC); /* map driver specific error message to PDO error */ -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC) /* {{{ */ +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC) /* {{{ */ { #if 0 pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H @@ -132,7 +132,7 @@ static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* called by PDO to prepare an SQL query */ -static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ +static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, /* {{{ */ pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -218,7 +218,7 @@ static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_le /* }}} */ /* called by PDO to execute a statement that doesn't produce a result set */ -static long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) /* {{{ */ +static php_int_t firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; isc_stmt_handle stmt = NULL; @@ -391,12 +391,12 @@ static int firebird_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ /* }}} */ /* used by prepare and exec to allocate a statement handle and prepare the SQL */ -static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ +static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, /* {{{ */ XSQLDA *out_sqlda, isc_stmt_handle *s, HashTable *named_params TSRMLS_DC) { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; char *c, *new_sql, in_quote, in_param, pname[64], *ppname; - long l, pindex = -1; + php_int_t l, pindex = -1; /* Firebird allows SQL statements up to 64k, so bail if it doesn't fit */ if (sql_len > 65536) { @@ -448,7 +448,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql *ppname++ = 0; if (named_params) { zval tmp; - ZVAL_LONG(&tmp, pindex); + ZVAL_INT(&tmp, pindex); zend_hash_str_update(named_params, pname, (unsigned int)(ppname - pname - 1), &tmp); } } @@ -470,7 +470,7 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql /* }}} */ /* called by PDO to set a driver-specific dbh attribute */ -static int firebird_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -545,7 +545,7 @@ static void firebird_info_cb(void *arg, char const *s) /* {{{ */ /* }}} */ /* called by PDO to get a driver-specific dbh attribute */ -static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_handle_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; @@ -553,7 +553,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS char tmp[512]; case PDO_ATTR_AUTOCOMMIT: - ZVAL_LONG(val,dbh->auto_commit); + ZVAL_INT(val,dbh->auto_commit); return 1; case PDO_ATTR_CONNECTION_STATUS: @@ -606,10 +606,10 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; const ISC_STATUS *s = H->isc_status; char buf[400]; - long i = 0, l, sqlcode = isc_sqlcode(s); + php_int_t i = 0, l, sqlcode = isc_sqlcode(s); if (sqlcode) { - add_next_index_long(info, sqlcode); + add_next_index_int(info, sqlcode); while ((sizeof(buf)>(i+2))&&(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s))) { i += l; @@ -617,7 +617,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval } add_next_index_string(info, buf); } else if (H->last_app_error) { - add_next_index_long(info, -999); + add_next_index_int(info, -999); add_next_index_string(info, const_cast(H->last_app_error)); } return 1; diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index d21273366b..bf6431c09e 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -88,7 +88,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; - unsigned long affected_rows = 0; + php_uint_t affected_rows = 0; static char info_count[] = {isc_info_sql_records}; char result[64]; @@ -153,7 +153,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ /* called by PDO to fetch the next row from a statement */ static int firebird_stmt_fetch(pdo_stmt_t *stmt, /* {{{ */ - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -219,7 +219,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ /* fetch a blob into a fetch buffer */ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - unsigned long *len, ISC_QUAD *blob_id TSRMLS_DC) + php_uint_t *len, ISC_QUAD *blob_id TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; @@ -263,7 +263,7 @@ static int firebird_fetch_blob(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ * /* we've found the blob's length, now fetch! */ if (*len) { - unsigned long cur_len; + php_uint_t cur_len; unsigned short seg_len; ISC_STATUS stat; @@ -296,7 +296,7 @@ fetch_blob_end: /* }}} */ static int firebird_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, /* {{{ */ - unsigned long *len, int *caller_frees TSRMLS_DC) + php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; XSQLVAR const *var = &S->out_sqlda.sqlvar[colno]; @@ -413,7 +413,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; pdo_firebird_db_handle *H = S->H; isc_blob_handle h = NULL; - unsigned long put_cnt = 0, rem_cnt; + php_uint_t put_cnt = 0, rem_cnt; unsigned short chunk_size; int result = 1; @@ -425,7 +425,7 @@ static int firebird_bind_blob(pdo_stmt_t *stmt, ISC_QUAD *blob_id, zval *param T SEPARATE_ZVAL(param); convert_to_string_ex(param); - for (rem_cnt = Z_STRLEN_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { + for (rem_cnt = Z_STRSIZE_P(param); rem_cnt > 0; rem_cnt -= chunk_size) { chunk_size = rem_cnt > USHRT_MAX ? USHRT_MAX : (unsigned short)rem_cnt; @@ -467,7 +467,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat /* try to determine the index by looking in the named_params hash */ if ((index = zend_hash_find(S->named_params, param->name)) != NULL) { - param->paramno = Z_LVAL_P(index); + param->paramno = Z_IVAL_P(index); } else { /* ... or by looking in the input descriptor */ int i; @@ -495,7 +495,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (event_type) { char *value; - unsigned long value_len; + php_uint_t value_len; int caller_frees; zval *parameter; @@ -549,11 +549,11 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat switch (Z_TYPE_P(parameter)) { int force_null; - case IS_LONG: + case IS_INT: /* keep the allow-NULL flag */ - var->sqltype = (sizeof(long) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); - var->sqldata = (void*)&Z_LVAL_P(parameter); - var->sqllen = sizeof(long); + var->sqltype = (sizeof(php_int_t) == 8 ? SQL_INT64 : SQL_LONG) | (var->sqltype & 1); + var->sqldata = (void*)&Z_IVAL_P(parameter); + var->sqllen = sizeof(php_int_t); break; case IS_DOUBLE: /* keep the allow-NULL flag */ @@ -574,13 +574,13 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: - force_null = (Z_STRLEN_P(parameter) == 0); + force_null = (Z_STRSIZE_P(parameter) == 0); } if (!force_null) { /* keep the allow-NULL flag */ var->sqltype = SQL_TEXT | (var->sqltype & 1); var->sqldata = Z_STRVAL_P(parameter); - var->sqllen = Z_STRLEN_P(parameter); + var->sqllen = Z_STRSIZE_P(parameter); break; } case IS_NULL: @@ -626,7 +626,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } case PDO_PARAM_INT: if (value) { - ZVAL_LONG(parameter, *(long*)value); + ZVAL_INT(parameter, *(php_int_t*)value); break; } case PDO_PARAM_EVT_NORMALIZE: @@ -654,7 +654,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } /* }}} */ -static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; @@ -675,7 +675,7 @@ static int firebird_stmt_set_attribute(pdo_stmt_t *stmt, long attr, zval *val TS } /* }}} */ -static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) /* {{{ */ +static int firebird_stmt_get_attribute(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) /* {{{ */ { pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index d59aa53fa3..e81b7c553f 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -62,9 +62,9 @@ ZEND_GET_MODULE(pdo_firebird) PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */ { - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (long) PDO_FB_ATTR_DATE_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (long) PDO_FB_ATTR_TIME_FORMAT); - REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (long) PDO_FB_ATTR_TIMESTAMP_FORMAT); + REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_DATE_FORMAT", (php_int_t) PDO_FB_ATTR_DATE_FORMAT); + REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIME_FORMAT", (php_int_t) PDO_FB_ATTR_TIME_FORMAT); + REGISTER_PDO_CLASS_CONST_INT("FB_ATTR_TIMESTAMP_FORMAT", (php_int_t) PDO_FB_ATTR_TIMESTAMP_FORMAT); php_pdo_register_driver(&pdo_firebird_driver); diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index 15004b8d33..831fa59726 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -35,7 +35,7 @@ #define SHORT_MAX (1 << (8*sizeof(short)-1)) -#if SIZEOF_LONG == 8 +#if SIZEOF_ZEND_INT == 8 && !defined(PHP_WIN32) # define LL_MASK "l" # define LL_LIT(lit) lit ## L #else @@ -128,7 +128,7 @@ extern pdo_driver_t pdo_firebird_driver; extern struct pdo_stmt_methods firebird_stmt_methods; -void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC); +void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, php_int_t line TSRMLS_DC); enum { PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC, diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index b39fdfaaa2..8dd981f42e 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -129,7 +129,7 @@ static int pdo_mysql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in } if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -161,7 +161,7 @@ static int mysql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* }}} */ /* {{{ mysql_handle_preparer */ -static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt)); @@ -235,12 +235,12 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, #else S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND)); S->in_null = ecalloc(S->num_params, sizeof(my_bool)); - S->in_length = ecalloc(S->num_params, sizeof(unsigned long)); + S->in_length = ecalloc(S->num_params, sizeof(php_uint_t)); #endif } dbh->alloc_own_columns = 1; - S->max_length = pdo_attr_lval(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC); + S->max_length = pdo_attr_ival(driver_options, PDO_ATTR_MAX_COLUMN_LEN, 0 TSRMLS_CC); PDO_DBG_RETURN(1); @@ -253,7 +253,7 @@ end: /* }}} */ /* {{{ mysql_handle_doer */ -static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) +static php_int_t mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; PDO_DBG_ENTER("mysql_handle_doer"); @@ -368,7 +368,7 @@ static inline int mysql_handle_autocommit(pdo_dbh_t *dbh TSRMLS_DC) /* }}} */ /* {{{ pdo_mysql_set_attribute */ -static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) +static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) { PDO_DBG_ENTER("pdo_mysql_set_attribute"); PDO_DBG_INF_FMT("dbh=%p", dbh); @@ -400,13 +400,13 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_D PDO_DBG_RETURN(1); #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: - convert_to_long(val); - if (Z_LVAL_P(val) < 0) { + convert_to_int(val); + if (Z_IVAL_P(val) < 0) { /* TODO: Johannes, can we throw a warning here? */ ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = 1024*1024; PDO_DBG_INF_FMT("Adjusting invalid buffer size to =%l", ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size); } else { - ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_LVAL_P(val); + ((pdo_mysql_db_handle *)dbh->driver_data)->max_buffer_size = Z_IVAL_P(val); } PDO_DBG_RETURN(1); break; @@ -419,7 +419,7 @@ static int pdo_mysql_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_D /* }}} */ /* {{{ pdo_mysql_get_attribute */ -static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC) +static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC) { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; @@ -456,20 +456,20 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value } break; case PDO_ATTR_AUTOCOMMIT: - ZVAL_LONG(return_value, dbh->auto_commit); + ZVAL_INT(return_value, dbh->auto_commit); break; case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY: - ZVAL_LONG(return_value, H->buffered); + ZVAL_INT(return_value, H->buffered); break; case PDO_MYSQL_ATTR_DIRECT_QUERY: - ZVAL_LONG(return_value, H->emulate_prepare); + ZVAL_INT(return_value, H->emulate_prepare); break; #ifndef PDO_USE_MYSQLND case PDO_MYSQL_ATTR_MAX_BUFFER_SIZE: - ZVAL_LONG(return_value, H->max_buffer_size); + ZVAL_INT(return_value, H->max_buffer_size); break; #endif @@ -596,30 +596,30 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ /* handle MySQL options */ if (driver_options) { - long connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); - long local_infile = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC); + php_int_t connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); + php_int_t local_infile = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_LOCAL_INFILE, 0 TSRMLS_CC); char *init_cmd = NULL; #ifndef PDO_USE_MYSQLND char *default_file = NULL, *default_group = NULL; #endif - long compress = 0; + php_int_t compress = 0; char *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL; - H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC); + H->buffered = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC); - H->emulate_prepare = pdo_attr_lval(driver_options, + H->emulate_prepare = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_DIRECT_QUERY, H->emulate_prepare TSRMLS_CC); - H->emulate_prepare = pdo_attr_lval(driver_options, + H->emulate_prepare = pdo_attr_ival(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepare TSRMLS_CC); #ifndef PDO_USE_MYSQLND - H->max_buffer_size = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC); + H->max_buffer_size = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_MAX_BUFFER_SIZE, H->max_buffer_size TSRMLS_CC); #endif - if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) { + if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_FOUND_ROWS, 0 TSRMLS_CC)) { connect_opts |= CLIENT_FOUND_ROWS; } - if (pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) { + if (pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_IGNORE_SPACE, 0 TSRMLS_CC)) { connect_opts |= CLIENT_IGNORE_SPACE; } @@ -648,7 +648,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ * mysqlnd doesn't support reconnect, thus we don't have "|| defined(PDO_USE_MYSQLND)" */ { - long reconnect = 1; + php_int_t reconnect = 1; mysql_options(H->server, MYSQL_OPT_RECONNECT, (const char*)&reconnect); } #endif @@ -682,7 +682,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ efree(default_group); } #endif - compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC); + compress = pdo_attr_ival(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC); if (compress) { if (mysql_options(H->server, MYSQL_OPT_COMPRESS, 0)) { pdo_mysql_error(dbh); diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index 30a2f04f98..17a6345432 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -116,10 +116,10 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ { - long row_count; + php_int_t row_count; pdo_mysql_stmt *S = stmt->driver_data; - row_count = (long) mysql_stmt_affected_rows(S->stmt); - if (row_count != (long)-1) { + row_count = (php_int_t) mysql_stmt_affected_rows(S->stmt); + if (row_count != (php_int_t)-1) { stmt->row_count = row_count; } } @@ -146,12 +146,12 @@ static int pdo_mysql_fill_stmt_from_result(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ PDO_DBG_RETURN(0); } - stmt->row_count = (long) mysql_num_rows(S->result); + stmt->row_count = (php_int_t) mysql_num_rows(S->result); stmt->column_count = (int) mysql_num_fields(S->result); S->fields = mysql_fetch_fields(S->result); } else { /* this was a DML or DDL query (INSERT, UPDATE, DELETE, ... */ - stmt->row_count = (long) row_count; + stmt->row_count = (php_int_t) row_count; } PDO_DBG_RETURN(1); @@ -200,7 +200,7 @@ static int pdo_mysql_stmt_execute_prepared_libmysql(pdo_stmt_t *stmt TSRMLS_DC) stmt->column_count = (int)mysql_num_fields(S->result); S->bound_result = ecalloc(stmt->column_count, sizeof(MYSQL_BIND)); S->out_null = ecalloc(stmt->column_count, sizeof(my_bool)); - S->out_length = ecalloc(stmt->column_count, sizeof(unsigned long)); + S->out_length = ecalloc(stmt->column_count, sizeof(php_uint_t)); /* summon memory to hold the row */ for (i = 0; i < stmt->column_count; i++) { @@ -343,7 +343,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; pdo_mysql_db_handle *H = S->H; #if PDO_USE_MYSQLND - long row_count; + php_int_t row_count; #endif PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset"); PDO_DBG_INF_FMT("stmt=%p", S->stmt); @@ -393,8 +393,8 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } } } - row_count = (long) mysql_stmt_affected_rows(S->stmt); - if (row_count != (long)-1) { + row_count = (php_int_t) mysql_stmt_affected_rows(S->stmt); + if (row_count != (php_int_t)-1) { stmt->row_count = row_count; } PDO_DBG_RETURN(1); @@ -550,10 +550,10 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da case IS_STRING: mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_VAR_STRING); break; - case IS_LONG: -#if SIZEOF_LONG==8 + case IS_INT: +#if SIZEOF_ZEND_INT==8 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONGLONG); -#elif SIZEOF_LONG==4 +#elif SIZEOF_ZEND_INT==4 mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_LONG); #endif /* SIZEOF_LONG */ break; @@ -576,13 +576,13 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da case IS_STRING: b->buffer_type = MYSQL_TYPE_STRING; b->buffer = Z_STRVAL_P(parameter); - b->buffer_length = Z_STRLEN_P(parameter); - *b->length = Z_STRLEN_P(parameter); + b->buffer_length = Z_STRSIZE_P(parameter); + *b->length = Z_STRSIZE_P(parameter); PDO_DBG_RETURN(1); - case IS_LONG: + case IS_INT: b->buffer_type = MYSQL_TYPE_LONG; - b->buffer = &Z_LVAL_P(parameter); + b->buffer = &Z_IVAL_P(parameter); PDO_DBG_RETURN(1); case IS_DOUBLE: @@ -608,7 +608,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da } /* }}} */ -static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, long offset TSRMLS_DC) /* {{{ */ +static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; #if PDO_USE_MYSQLND @@ -722,7 +722,7 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ } /* }}} */ -static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC) /* {{{ */ +static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; @@ -823,7 +823,7 @@ static char *type_to_name_native(int type) /* {{{ */ #undef PDO_MYSQL_NATIVE_TYPE_NAME } /* }}} */ -static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC) /* {{{ */ +static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) /* {{{ */ { pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data; const MYSQL_FIELD *F; @@ -879,10 +879,10 @@ static int pdo_mysql_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_va #if SIZEOF_LONG==8 case MYSQL_TYPE_LONGLONG: #endif - add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT); + add_assoc_int(return_value, "pdo_type", PDO_PARAM_INT); break; default: - add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR); + add_assoc_int(return_value, "pdo_type", PDO_PARAM_STR); break; } #endif diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index c3a90fedac..f57e06ca37 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -106,25 +106,25 @@ static PHP_MINIT_FUNCTION(pdo_mysql) { REGISTER_INI_ENTRIES(); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_USE_BUFFERED_QUERY", (long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_LOCAL_INFILE", (long)PDO_MYSQL_ATTR_LOCAL_INFILE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_INIT_COMMAND", (long)PDO_MYSQL_ATTR_INIT_COMMAND); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_USE_BUFFERED_QUERY", (php_int_t)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_LOCAL_INFILE", (php_int_t)PDO_MYSQL_ATTR_LOCAL_INFILE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_INIT_COMMAND", (php_int_t)PDO_MYSQL_ATTR_INIT_COMMAND); #ifndef PDO_USE_MYSQLND - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_MAX_BUFFER_SIZE", (long)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_FILE", (long)PDO_MYSQL_ATTR_READ_DEFAULT_FILE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_READ_DEFAULT_GROUP", (long)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_MAX_BUFFER_SIZE", (php_int_t)PDO_MYSQL_ATTR_MAX_BUFFER_SIZE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_FILE", (php_int_t)PDO_MYSQL_ATTR_READ_DEFAULT_FILE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_READ_DEFAULT_GROUP", (php_int_t)PDO_MYSQL_ATTR_READ_DEFAULT_GROUP); #endif - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_COMPRESS", (long)PDO_MYSQL_ATTR_COMPRESS); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_DIRECT_QUERY", (long)PDO_MYSQL_ATTR_DIRECT_QUERY); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_FOUND_ROWS", (long)PDO_MYSQL_ATTR_FOUND_ROWS); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_IGNORE_SPACE", (long)PDO_MYSQL_ATTR_IGNORE_SPACE); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_KEY", (long)PDO_MYSQL_ATTR_SSL_KEY); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CERT", (long)PDO_MYSQL_ATTR_SSL_CERT); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CA", (long)PDO_MYSQL_ATTR_SSL_CA); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CAPATH", (long)PDO_MYSQL_ATTR_SSL_CAPATH); - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SSL_CIPHER", (long)PDO_MYSQL_ATTR_SSL_CIPHER); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_COMPRESS", (php_int_t)PDO_MYSQL_ATTR_COMPRESS); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_DIRECT_QUERY", (php_int_t)PDO_MYSQL_ATTR_DIRECT_QUERY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_FOUND_ROWS", (php_int_t)PDO_MYSQL_ATTR_FOUND_ROWS); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_IGNORE_SPACE", (php_int_t)PDO_MYSQL_ATTR_IGNORE_SPACE); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_KEY", (php_int_t)PDO_MYSQL_ATTR_SSL_KEY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CERT", (php_int_t)PDO_MYSQL_ATTR_SSL_CERT); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CA", (php_int_t)PDO_MYSQL_ATTR_SSL_CA); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CAPATH", (php_int_t)PDO_MYSQL_ATTR_SSL_CAPATH); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SSL_CIPHER", (php_int_t)PDO_MYSQL_ATTR_SSL_CIPHER); #if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND) - REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_SERVER_PUBLIC_KEY", (long)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); + REGISTER_PDO_CLASS_CONST_INT("MYSQL_ATTR_SERVER_PUBLIC_KEY", (php_int_t)PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY); #endif diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index 4455dcbeb6..fe2d216a5f 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -106,7 +106,7 @@ typedef struct { unsigned fetch_table_names:1; unsigned _reserved:31; #if !PDO_USE_MYSQLND - unsigned long max_buffer_size; + php_uint_t max_buffer_size; #endif pdo_mysql_error_info einfo; @@ -122,9 +122,9 @@ typedef struct { const MYSQL_FIELD *fields; MYSQL_ROW current_data; #if PDO_USE_MYSQLND - unsigned long *current_lengths; + php_uint_t *current_lengths; #else - long *current_lengths; + php_int_t *current_lengths; #endif pdo_mysql_error_info einfo; #if PDO_USE_MYSQLND @@ -136,11 +136,11 @@ typedef struct { PDO_MYSQL_PARAM_BIND *params; #ifndef PDO_USE_MYSQLND my_bool *in_null; - unsigned long *in_length; + php_uint_t *in_length; #endif PDO_MYSQL_PARAM_BIND *bound_result; my_bool *out_null; - unsigned long *out_length; + php_uint_t *out_length; unsigned int params_given; unsigned max_length:1; } pdo_mysql_stmt; diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index a8e7913fa7..279fda7439 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -49,7 +49,7 @@ static int pdo_oci_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info } if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -258,7 +258,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd int ret; #if HAVE_OCISTMTFETCH2 - S->exec_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, + S->exec_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL ? OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT; #else @@ -302,7 +302,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pd } - prefetch = pdo_oci_sanitize_prefetch(pdo_attr_lval(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC)); + prefetch = pdo_oci_sanitize_prefetch(pdo_attr_ival(driver_options, PDO_ATTR_PREFETCH, PDO_OCI_PREFETCH_DEFAULT TSRMLS_CC)); if (prefetch) { H->last_err = OCIAttrSet(S->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, H->err); @@ -456,9 +456,9 @@ static int oci_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_ dbh->in_txn = 0; } - convert_to_long(val); + convert_to_int(val); - dbh->auto_commit = Z_LVAL_P(val); + dbh->auto_commit = Z_IVAL_P(val); return 1; } else { return 0; diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 4e341c08be..226e3ee493 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -209,7 +209,7 @@ static sb4 oci_bind_input_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, dv /* regular string bind */ convert_to_string(param->parameter); *bufpp = Z_STRVAL_P(param->parameter); - *alenp = Z_STRLEN_P(param->parameter); + *alenp = Z_STRSIZE_P(param->parameter); } *piecep = OCI_ONE_PIECE; @@ -244,11 +244,11 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d convert_to_string(param->parameter); zval_dtor(param->parameter); - Z_STRLEN_P(param->parameter) = param->max_value_len; - Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRLEN_P(param->parameter)+1); + Z_STRSIZE_P(param->parameter) = param->max_value_len; + Z_STRVAL_P(param->parameter) = ecalloc(1, Z_STRSIZE_P(param->parameter)+1); P->used_for_output = 1; - P->actual_len = Z_STRLEN_P(param->parameter); + P->actual_len = Z_STRSIZE_P(param->parameter); *alenpp = &P->actual_len; *bufpp = Z_STRVAL_P(param->parameter); *piecep = OCI_ONE_PIECE; @@ -360,7 +360,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa && Z_STRVAL_P(param->parameter) != empty_string #endif ) { - Z_STRLEN_P(param->parameter) = P->actual_len; + Z_STRSIZE_P(param->parameter) = P->actual_len; Z_STRVAL_P(param->parameter) = erealloc(Z_STRVAL_P(param->parameter), P->actual_len+1); Z_STRVAL_P(param->parameter)[P->actual_len] = '\0'; } @@ -410,7 +410,7 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa } else if (Z_TYPE_P(param->parameter) == IS_STRING) { /* stick the string into the LOB */ consume = Z_STRVAL_P(param->parameter); - n = Z_STRLEN_P(param->parameter); + n = Z_STRSIZE_P(param->parameter); if (n) { OCILobOpen(S->H->svc, S->err, (OCILobLocator*)P->thing, OCI_LOB_READWRITE); while (n) { diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 2828b96e81..3a7bf0a37b 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -48,7 +48,7 @@ static int pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *inf einfo->what, einfo->last_error, einfo->file, einfo->line); - add_next_index_long(info, einfo->last_error); + add_next_index_int(info, einfo->last_error); add_next_index_str(info, message); add_next_index_string(info, einfo->last_state); @@ -142,7 +142,7 @@ static int odbc_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) return 0; } -static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { RETCODE rc; pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; @@ -181,7 +181,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, p return 0; } - cursor_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC); + cursor_type = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC); if (cursor_type != PDO_CURSOR_FWDONLY) { rc = SQLSetStmtAttr(S->stmt, SQL_ATTR_CURSOR_SCROLLABLE, (void*)SQL_SCROLLABLE, 0); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { @@ -220,7 +220,7 @@ static int odbc_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, p return 1; } -static long odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) +static php_int_t odbc_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; RETCODE rc; @@ -336,7 +336,7 @@ static int odbc_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) return 1; } -static int odbc_handle_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) +static int odbc_handle_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; switch (attr) { @@ -351,7 +351,7 @@ static int odbc_handle_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) } } -static int odbc_handle_get_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) +static int odbc_handle_get_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) { pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data; switch (attr) { @@ -431,7 +431,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D } /* set up the cursor library, if needed, or if configured explicitly */ - cursor_lib = pdo_attr_lval(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC); + cursor_lib = pdo_attr_ival(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC); rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_INTEGER); if (rc != SQL_SUCCESS && cursor_lib != SQL_CUR_USE_IF_NEEDED) { pdo_odbc_drv_error("SQLSetConnectAttr SQL_ODBC_CURSORS"); diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index ea5650923c..7e2b958a53 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -58,7 +58,7 @@ static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype) } static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf, - unsigned long buflen, unsigned long *outlen) + php_uint_t buflen, php_uint_t *outlen) { #ifdef PHP_WIN32 if (is_unicode && buflen) { @@ -93,7 +93,7 @@ static int pdo_odbc_utf82ucs2(pdo_stmt_t *stmt, int is_unicode, const char *buf, } static int pdo_odbc_ucs22utf8(pdo_stmt_t *stmt, int is_unicode, const char *buf, - unsigned long buflen, unsigned long *outlen) + php_uint_t buflen, php_uint_t *outlen) { #ifdef PHP_WIN32 if (is_unicode && buflen) { @@ -190,16 +190,16 @@ static int odbc_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) } if (Z_TYPE_P(parameter) != IS_RESOURCE) { /* they passed in a string */ - unsigned long ulen; + php_uint_t ulen; convert_to_string(parameter); switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), &ulen)) { case PDO_ODBC_CONV_NOT_REQUIRED: SQLPutData(S->stmt, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter)); + Z_STRSIZE_P(parameter)); break; case PDO_ODBC_CONV_OK: SQLPutData(S->stmt, S->convbuf, ulen); @@ -447,10 +447,10 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } else { convert_to_string(parameter); if (P->outbuf) { - P->len = Z_STRLEN_P(parameter); + P->len = Z_STRSIZE_P(parameter); memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len); } else { - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter)); + P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter)); } } } else if (Z_TYPE_P(parameter) == IS_NULL || PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL) { @@ -458,14 +458,14 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } else { convert_to_string(parameter); if (P->outbuf) { - unsigned long ulen; + php_uint_t ulen; switch (pdo_odbc_utf82ucs2(stmt, P->is_unicode, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), &ulen)) { case PDO_ODBC_CONV_FAIL: case PDO_ODBC_CONV_NOT_REQUIRED: - P->len = Z_STRLEN_P(parameter); + P->len = Z_STRSIZE_P(parameter); memcpy(P->outbuf, Z_STRVAL_P(parameter), P->len); break; case PDO_ODBC_CONV_OK: @@ -474,7 +474,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p break; } } else { - P->len = SQL_LEN_DATA_AT_EXEC(Z_STRLEN_P(parameter)); + P->len = SQL_LEN_DATA_AT_EXEC(Z_STRSIZE_P(parameter)); } } return 1; @@ -483,9 +483,9 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p P = param->driver_data; if (P->outbuf) { - unsigned long ulen; + php_uint_t ulen; char *srcbuf; - unsigned long srclen = 0; + php_uint_t srclen = 0; if (Z_ISREF(param->parameter)) { parameter = Z_REFVAL(param->parameter); @@ -514,7 +514,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p ZVAL_NEW_STR(parameter, STR_ALLOC(srclen, 0)); memcpy(Z_STRVAL_P(parameter), srcbuf, srclen); - Z_STRVAL_P(parameter)[Z_STRLEN_P(parameter)] = '\0'; + Z_STRVAL_P(parameter)[Z_STRSIZE_P(parameter)] = '\0'; } } return 1; @@ -524,7 +524,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p } static int odbc_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { RETCODE rc; SQLSMALLINT odbcori; @@ -628,15 +628,15 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) return 1; } -static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC) +static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; pdo_odbc_column *C = &S->cols[colno]; - unsigned long ulen; + php_uint_t ulen; /* if it is a column containing "long" data, perform late binding now */ if (C->is_long) { - unsigned long used = 0; + php_uint_t used = 0; char *buf; RETCODE rc; @@ -755,7 +755,7 @@ in_data: return 1; } -static int odbc_stmt_set_param(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) +static int odbc_stmt_set_param(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) { SQLRETURN rc; pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; @@ -763,7 +763,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) switch (attr) { case PDO_ATTR_CURSOR_NAME: convert_to_string(val); - rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRLEN_P(val)); + rc = SQLSetCursorName(S->stmt, Z_STRVAL_P(val), Z_STRSIZE_P(val)); if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) { return 1; @@ -782,7 +782,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) } } -static int odbc_stmt_get_attr(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC) +static int odbc_stmt_get_attr(pdo_stmt_t *stmt, php_int_t attr, zval *val TSRMLS_DC) { SQLRETURN rc; pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data; diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index 1fe17c1c30..f78b1af8ec 100644 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.c @@ -136,11 +136,11 @@ PHP_MINIT_FUNCTION(pdo_odbc) } #endif - REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); - REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); + REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY); + REGISTER_PDO_CLASS_CONST_INT("ODBC_ATTR_ASSUME_UTF8", PDO_ODBC_ATTR_ASSUME_UTF8); + REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED); + REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); + REGISTER_PDO_CLASS_CONST_INT("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); return SUCCESS; } diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h index 5e42951f86..c467ecf83a 100644 --- a/ext/pdo_odbc/php_pdo_odbc_int.h +++ b/ext/pdo_odbc/php_pdo_odbc_int.h @@ -135,7 +135,7 @@ typedef struct { typedef struct { char *data; - unsigned long datalen; + php_uint_t datalen; SQLLEN fetched_len; SWORD coltype; char colname[128]; @@ -150,7 +150,7 @@ typedef struct { pdo_odbc_db_handle *H; pdo_odbc_errinfo einfo; char *convbuf; - unsigned long convbufsize; + php_uint_t convbufsize; unsigned going_long:1; unsigned assume_utf8:1; unsigned _spare:30; diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c index fe003f8ab9..fc7aa827ab 100644 --- a/ext/pdo_pgsql/pdo_pgsql.c +++ b/ext/pdo_pgsql/pdo_pgsql.c @@ -85,13 +85,13 @@ ZEND_GET_MODULE(pdo_pgsql) */ PHP_MINIT_FUNCTION(pdo_pgsql) { - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (long)PGSQL_TRANSACTION_IDLE); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (long)PGSQL_TRANSACTION_ACTIVE); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (long)PGSQL_TRANSACTION_INTRANS); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (long)PGSQL_TRANSACTION_INERROR); - REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (long)PGSQL_TRANSACTION_UNKNOWN); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_IDLE", (php_int_t)PGSQL_TRANSACTION_IDLE); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_ACTIVE", (php_int_t)PGSQL_TRANSACTION_ACTIVE); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INTRANS", (php_int_t)PGSQL_TRANSACTION_INTRANS); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_INERROR", (php_int_t)PGSQL_TRANSACTION_INERROR); + REGISTER_PDO_CLASS_CONST_INT("PGSQL_TRANSACTION_UNKNOWN", (php_int_t)PGSQL_TRANSACTION_UNKNOWN); php_pdo_register_driver(&pdo_pgsql_driver); return SUCCESS; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 4ab3bdb6d6..809ee34f7c 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -113,7 +113,7 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in pdo_pgsql_error_info *einfo = &H->einfo; if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -151,8 +151,8 @@ static int pgsql_lob_flush(php_stream *stream TSRMLS_DC) return 0; } -static int pgsql_lob_seek(php_stream *stream, off_t offset, int whence, - off_t *newoffset TSRMLS_DC) +static int pgsql_lob_seek(php_stream *stream, php_off_t offset, int whence, + php_off_t *newoffset TSRMLS_DC) { struct pdo_pgsql_lob_self *self = (struct pdo_pgsql_lob_self*)stream->abstract; int pos = lo_lseek(self->conn, self->lfd, offset, whence); @@ -214,7 +214,7 @@ static int pgsql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ } /* }}} */ -static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt)); @@ -229,7 +229,7 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, stmt->driver_data = S; stmt->methods = &pgsql_stmt_methods; - scrollable = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, + scrollable = pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL; if (scrollable) { @@ -239,14 +239,14 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, spprintf(&S->cursor_name, 0, "pdo_crsr_%08x", ++H->stmt_counter); emulate = 1; } else if (driver_options) { - if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) { + if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H->disable_native_prepares TSRMLS_CC) == 1) { php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead"); emulate = 1; } - if (pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) { + if (pdo_attr_ival(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares TSRMLS_CC) == 1) { emulate = 1; } - if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) { + if (pdo_attr_ival(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares TSRMLS_CC) == 1) { execute_only = 1; } } else { @@ -287,11 +287,11 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, return 1; } -static long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) +static php_int_t pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; PGresult *res; - long ret = 1; + php_int_t ret = 1; ExecStatusType qs; if (!(res = PQexec(H->server, sql))) { @@ -306,7 +306,11 @@ static long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM return -1; } H->pgoid = PQoidValue(res); - ret = (qs == PGRES_COMMAND_OK) ? atol(PQcmdTuples(res)) : 0L; + if (qs == PGRES_COMMAND_OK) { + ZEND_ATOI(ret, PQcmdTuples(res)); + } else { + ret = Z_I(0); + } PQclear(res); return ret; @@ -350,7 +354,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned if (H->pgoid == InvalidOid) { return NULL; } - *len = spprintf(&id, 0, "%ld", (long) H->pgoid); + *len = spprintf(&id, 0, ZEND_INT_FMT, (php_int_t) H->pgoid); } else { PGresult *res; ExecStatusType status; @@ -373,7 +377,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned return id; } -static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC) +static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; @@ -573,12 +577,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray) int query_len; convert_to_string_ex(tmp); - if (buffer_len < Z_STRLEN_P(tmp)) { - buffer_len = Z_STRLEN_P(tmp); + if (buffer_len < Z_STRSIZE_P(tmp)) { + buffer_len = Z_STRSIZE_P(tmp); query = erealloc(query, buffer_len + 2); /* room for \n\0 */ } - memcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); - query_len = Z_STRLEN_P(tmp); + memcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); + query_len = Z_STRSIZE_P(tmp); if (query[query_len - 1] != '\n') { query[query_len++] = '\n'; } @@ -906,7 +910,7 @@ static PHP_METHOD(PDO, pgsqlLOBCreate) lfd = lo_creat(H->server, INV_READ|INV_WRITE); if (lfd != InvalidOid) { - zend_string *buf = strpprintf(0, "%lu", (long) lfd); + zend_string *buf = strpprintf(0, ZEND_UINT_FMT, (php_int_t) lfd); RETURN_STR(buf); } @@ -1011,11 +1015,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) { pdo_dbh_t *dbh; pdo_pgsql_db_handle *H; - long result_type = PDO_FETCH_USE_DEFAULT; - long ms_timeout = 0; + php_int_t result_type = PDO_FETCH_USE_DEFAULT; + php_int_t ms_timeout = 0; PGnotify *pgsql_notify; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ii", &result_type, &ms_timeout)) { RETURN_FALSE; } @@ -1056,11 +1060,11 @@ static PHP_METHOD(PDO, pgsqlGetNotify) array_init(return_value); if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) { add_index_string(return_value, 0, pgsql_notify->relname); - add_index_long(return_value, 1, pgsql_notify->be_pid); + add_index_int(return_value, 1, pgsql_notify->be_pid); } if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) { add_assoc_string(return_value, "message", pgsql_notify->relname); - add_assoc_long(return_value, "pid", pgsql_notify->be_pid); + add_assoc_int(return_value, "pid", pgsql_notify->be_pid); } PQfreemem(pgsql_notify); @@ -1079,7 +1083,7 @@ static PHP_METHOD(PDO, pgsqlGetPid) H = (pdo_pgsql_db_handle *)dbh->driver_data; - RETURN_LONG(PQbackendPID(H->server)); + RETURN_INT(PQbackendPID(H->server)); } /* }}} */ @@ -1107,23 +1111,23 @@ static const zend_function_entry *pdo_pgsql_get_driver_methods(pdo_dbh_t *dbh, i } } -static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) +static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) { pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; switch (attr) { case PDO_ATTR_EMULATE_PREPARES: - convert_to_long(val); - H->emulate_prepares = Z_LVAL_P(val); + convert_to_int(val); + H->emulate_prepares = Z_IVAL_P(val); return 1; case PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT: - convert_to_long(val); + convert_to_int(val); php_error_docref(NULL TSRMLS_CC, E_DEPRECATED, "PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT is deprecated, use PDO::ATTR_EMULATE_PREPARES instead"); - H->disable_native_prepares = Z_LVAL_P(val); + H->disable_native_prepares = Z_IVAL_P(val); return 1; case PDO_PGSQL_ATTR_DISABLE_PREPARES: - convert_to_long(val); - H->disable_prepares = Z_LVAL_P(val); + convert_to_int(val); + H->disable_prepares = Z_IVAL_P(val); return 1; default: return 0; @@ -1154,7 +1158,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ int ret = 0; char *conn_str, *p, *e; char *tmp_pass; - long connect_timeout = 30; + php_int_t connect_timeout = 30; H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent); dbh->driver_data = H; @@ -1172,7 +1176,7 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ } if (driver_options) { - connect_timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); + connect_timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, 30 TSRMLS_CC); } if (dbh->password) { diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 10e775d899..eb13548558 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -230,10 +230,10 @@ stmt_retry: } if (status == PGRES_COMMAND_OK) { - stmt->row_count = (long)atoi(PQcmdTuples(S->result)); + ZEND_ATOI(stmt->row_count, PQcmdTuples(S->result)); H->pgoid = PQoidValue(S->result); } else { - stmt->row_count = (long)PQntuples(S->result); + stmt->row_count = (php_int_t)PQntuples(S->result); } return 1; @@ -256,14 +256,15 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * /* decode name from $1, $2 into 0, 1 etc. */ if (param->name) { if (param->name->val[0] == '$') { - param->paramno = atoi(param->name->val + 1); + ZEND_ATOI(param->paramno, param->name->val + 1); } else { /* resolve parameter name to rewritten name */ char *namevar; if (stmt->bound_param_map && (namevar = zend_hash_find_ptr(stmt->bound_param_map, param->name)) != NULL) { - param->paramno = atoi(namevar + 1) - 1; + ZEND_ATOI(param->paramno, namevar + 1); + param->paramno--; } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", param->name->val TSRMLS_CC); return 0; @@ -358,7 +359,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * //SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter); convert_to_string_ex(parameter); S->param_values[param->paramno] = Z_STRVAL_P(parameter); - S->param_lengths[param->paramno] = Z_STRLEN_P(parameter); + S->param_lengths[param->paramno] = Z_STRSIZE_P(parameter); S->param_formats[param->paramno] = 0; } @@ -390,7 +391,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * } static int pgsql_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; @@ -404,8 +405,8 @@ static int pgsql_stmt_fetch(pdo_stmt_t *stmt, case PDO_FETCH_ORI_PRIOR: spprintf(&ori_str, 0, "BACKWARD"); break; case PDO_FETCH_ORI_FIRST: spprintf(&ori_str, 0, "FIRST"); break; case PDO_FETCH_ORI_LAST: spprintf(&ori_str, 0, "LAST"); break; - case PDO_FETCH_ORI_ABS: spprintf(&ori_str, 0, "ABSOLUTE %ld", offset); break; - case PDO_FETCH_ORI_REL: spprintf(&ori_str, 0, "RELATIVE %ld", offset); break; + case PDO_FETCH_ORI_ABS: spprintf(&ori_str, 0, "ABSOLUTE %pd", offset); break; + case PDO_FETCH_ORI_REL: spprintf(&ori_str, 0, "RELATIVE %pd", offset); break; default: return 0; } @@ -479,7 +480,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) break; case INT8OID: - if (sizeof(long)>=8) { + if (sizeof(php_int_t)>=8) { cols[colno].param_type = PDO_PARAM_INT; } else { cols[colno].param_type = PDO_PARAM_STR; @@ -497,7 +498,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) return 1; } -static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC) +static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; struct pdo_column_data *cols = stmt->columns; @@ -518,9 +519,9 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned switch (cols[colno].param_type) { case PDO_PARAM_INT: - S->cols[colno].intval = atol(*ptr); + ZEND_ATOI(S->cols[colno].intval, *ptr); *ptr = (char *) &(S->cols[colno].intval); - *len = sizeof(long); + *len = sizeof(php_int_t); break; case PDO_PARAM_BOOL: @@ -576,7 +577,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned return 1; } -static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC) +static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; PGresult *res; @@ -592,7 +593,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return } array_init(return_value); - add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); + add_assoc_int(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 4d0652049e..0462daff1f 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -54,7 +54,7 @@ typedef struct { typedef struct { char *def; Oid pgsql_type; - long intval; + php_int_t intval; zend_bool boolval; } pdo_pgsql_column; diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 9b47af562c..50887b4bb3 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -92,7 +92,7 @@ static int pdo_sqlite_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *i pdo_sqlite_error_info *einfo = &H->einfo; if (einfo->errcode) { - add_next_index_long(info, einfo->errcode); + add_next_index_int(info, einfo->errcode); add_next_index_string(info, einfo->errmsg); } @@ -175,7 +175,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ } /* }}} */ -static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) +static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; pdo_sqlite_stmt *S = ecalloc(1, sizeof(pdo_sqlite_stmt)); @@ -187,7 +187,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, stmt->methods = &sqlite_stmt_methods; stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL|PDO_PLACEHOLDER_NAMED; - if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) { + if (PDO_CURSOR_FWDONLY != pdo_attr_ival(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) { H->einfo.errcode = SQLITE_ERROR; pdo_sqlite_error(dbh); return 0; @@ -203,7 +203,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, return 0; } -static long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) +static php_int_t sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, php_int_t sql_len TSRMLS_DC) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; char *errmsg = NULL; @@ -280,7 +280,7 @@ static int sqlite_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) return 1; } -static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC) +static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, php_int_t attr, zval *return_value TSRMLS_DC) { switch (attr) { case PDO_ATTR_CLIENT_VERSION: @@ -295,14 +295,14 @@ static int pdo_sqlite_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_valu return 1; } -static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) +static int pdo_sqlite_set_attr(pdo_dbh_t *dbh, php_int_t attr, zval *val TSRMLS_DC) { pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; switch (attr) { case PDO_ATTR_TIMEOUT: - convert_to_long(val); - sqlite3_busy_timeout(H->db, Z_LVAL_P(val) * 1000); + convert_to_int(val); + sqlite3_busy_timeout(H->db, Z_IVAL_P(val) * 1000); return 1; } return 0; @@ -351,14 +351,14 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, } ZVAL_REF(&zargs[0], agg_context); } - ZVAL_LONG(&zargs[1], sqlite3_aggregate_count(context)); + ZVAL_INT(&zargs[1], sqlite3_aggregate_count(context)); } for (i = 0; i < argc; i++) { /* get the value */ switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: - ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); + ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i])); break; case SQLITE_FLOAT: @@ -399,8 +399,8 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { - case IS_LONG: - sqlite3_result_int(context, Z_LVAL(retval)); + case IS_INT: + sqlite3_result_int(context, Z_IVAL(retval)); break; case IS_NULL: @@ -413,7 +413,7 @@ static int do_callback(struct pdo_sqlite_fci *fc, zval *cb, default: convert_to_string_ex(&retval); - sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); + sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT); break; } } else { @@ -496,13 +496,13 @@ static int php_sqlite3_collation_callback(void *context, if ((ret = zend_call_function(&collation->fc.fci, &collation->fc.fcc TSRMLS_CC)) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the callback"); } else if (!Z_ISUNDEF(retval)) { - if (Z_TYPE(retval) != IS_LONG) { - convert_to_long_ex(&retval); + if (Z_TYPE(retval) != IS_INT) { + convert_to_int_ex(&retval); } ret = 0; - if (Z_LVAL(retval) > 0) { + if (Z_IVAL(retval) > 0) { ret = 1; - } else if (Z_LVAL(retval) < 0) { + } else if (Z_IVAL(retval) < 0) { ret = -1; } zval_ptr_dtor(&retval); @@ -522,13 +522,13 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) zval *callback; char *func_name; int func_name_len; - long argc = -1; + php_int_t argc = -1; zend_string *cbname = NULL; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|i", &func_name, &func_name_len, &callback, &argc)) { RETURN_FALSE; } @@ -592,13 +592,13 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) zval *step_callback, *fini_callback; char *func_name; int func_name_len; - long argc = -1; + php_int_t argc = -1; zend_string *cbname = NULL; pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|i", &func_name, &func_name_len, &step_callback, &fini_callback, &argc)) { RETURN_FALSE; } @@ -792,7 +792,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS { pdo_sqlite_db_handle *H; int i, ret = 0; - long timeout = 60; + php_int_t timeout = 60; char *filename; H = pecalloc(1, sizeof(pdo_sqlite_db_handle), dbh->is_persistent); @@ -823,7 +823,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS } if (driver_options) { - timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC); + timeout = pdo_attr_ival(driver_options, PDO_ATTR_TIMEOUT, timeout TSRMLS_CC); } sqlite3_busy_timeout(H->db, timeout * 1000); diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index 5f18c8a0cf..ee6879544a 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -117,13 +117,13 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d return 1; } } else { - convert_to_long(parameter); -#if LONG_MAX > 2147483647 - if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { + convert_to_int(parameter); +#if PHP_INT_MAX > 2147483647 + if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) { return 1; } #else - if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { + if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_IVAL_P(parameter))) { return 1; } #endif @@ -159,7 +159,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d if (SQLITE_OK == sqlite3_bind_blob(S->stmt, param->paramno + 1, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), SQLITE_STATIC)) { return 1; } @@ -180,7 +180,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d convert_to_string(parameter); if (SQLITE_OK == sqlite3_bind_text(S->stmt, param->paramno + 1, Z_STRVAL_P(parameter), - Z_STRLEN_P(parameter), + Z_STRSIZE_P(parameter), SQLITE_STATIC)) { return 1; } @@ -198,7 +198,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d } static int pdo_sqlite_stmt_fetch(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, long offset TSRMLS_DC) + enum pdo_fetch_orientation ori, php_int_t offset TSRMLS_DC) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; int i; @@ -259,7 +259,7 @@ static int pdo_sqlite_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) return 1; } -static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len, int *caller_frees TSRMLS_DC) +static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, php_uint_t *len, int *caller_frees TSRMLS_DC) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; if (!S->stmt) { @@ -288,7 +288,7 @@ static int pdo_sqlite_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsi } } -static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC) +static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, php_int_t colno, zval *return_value TSRMLS_DC) { pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data; const char *str; diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 40f24ff940..d1fc89d69e 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -63,21 +63,21 @@ #define PGSQL_STATUS_LONG 1 #define PGSQL_STATUS_STRING 2 -#define PGSQL_MAX_LENGTH_OF_LONG 30 +#define PGSQL_MAX_LENGTH_OF_ZEND_INT 30 #define PGSQL_MAX_LENGTH_OF_DOUBLE 60 -#if LONG_MAX < UINT_MAX +#if PHP_INT_MAX < UINT_MAX #define PGSQL_RETURN_OID(oid) do { \ - if (oid > LONG_MAX) { \ + if (oid > PHP_INT_MAX) { \ smart_str s = {0}; \ smart_str_append_unsigned(&s, oid); \ smart_str_0(&s); \ RETURN_STR(s.s); \ } \ - RETURN_LONG((long)oid); \ + RETURN_INT((php_int_t)oid); \ } while(0) #else -#define PGSQL_RETURN_OID(oid) (RETURN_LONG((long)oid)) +#define PGSQL_RETURN_OID(oid) RETURN_INT((php_int_t)oid) #endif #if HAVE_PQSETNONBLOCKING @@ -968,7 +968,7 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message) if (PGG(log_notices)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message); } - zend_hash_index_update_ptr(&PGG(notices), (ulong)resource_id, notice); + zend_hash_index_update_ptr(&PGG(notices), (php_uint_t)resource_id, notice); } } /* }}} */ @@ -1113,88 +1113,88 @@ PHP_MINIT_FUNCTION(pgsql) REGISTER_STRING_CONSTANT("PGSQL_LIBPQ_VERSION_STR", PG_VERSION_STR, CONST_CS | CONST_PERSISTENT); #endif /* For connection option */ - REGISTER_LONG_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECT_FORCE_NEW", PGSQL_CONNECT_FORCE_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECT_ASYNC", PGSQL_CONNECT_ASYNC, CONST_CS | CONST_PERSISTENT); /* For pg_fetch_array() */ - REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT); /* For pg_connection_status() */ - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_BAD", CONNECTION_BAD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_OK", CONNECTION_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_STARTED", CONNECTION_STARTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_MADE", CONNECTION_MADE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AWAITING_RESPONSE", CONNECTION_AWAITING_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_AUTH_OK", CONNECTION_AUTH_OK, CONST_CS | CONST_PERSISTENT); #ifdef CONNECTION_SSL_STARTUP - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SSL_STARTUP", CONNECTION_SSL_STARTUP, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONNECTION_SETENV", CONNECTION_SETENV, CONST_CS | CONST_PERSISTENT); /* For pg_connect_poll() */ - REGISTER_LONG_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_FAILED", PGRES_POLLING_FAILED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_READING", PGRES_POLLING_READING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_WRITING", PGRES_POLLING_WRITING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_OK", PGRES_POLLING_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_POLLING_ACTIVE", PGRES_POLLING_ACTIVE, CONST_CS | CONST_PERSISTENT); #if HAVE_PGTRANSACTIONSTATUS /* For pg_transaction_status() */ - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_IDLE", PQTRANS_IDLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_ACTIVE", PQTRANS_ACTIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INTRANS", PQTRANS_INTRANS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_INERROR", PQTRANS_INERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TRANSACTION_UNKNOWN", PQTRANS_UNKNOWN, CONST_CS | CONST_PERSISTENT); #endif #if HAVE_PQSETERRORVERBOSITY /* For pg_set_error_verbosity() */ - REGISTER_LONG_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ERRORS_TERSE", PQERRORS_TERSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ERRORS_DEFAULT", PQERRORS_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_ERRORS_VERBOSE", PQERRORS_VERBOSE, CONST_CS | CONST_PERSISTENT); #endif /* For lo_seek() */ - REGISTER_LONG_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); /* For pg_result_status() return value type */ - REGISTER_LONG_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_STATUS_LONG", PGSQL_STATUS_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_STATUS_STRING", PGSQL_STATUS_STRING, CONST_CS | CONST_PERSISTENT); /* For pg_result_status() return value */ - REGISTER_LONG_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_EMPTY_QUERY", PGRES_EMPTY_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_COMMAND_OK", PGRES_COMMAND_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_TUPLES_OK", PGRES_TUPLES_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_COPY_OUT", PGRES_COPY_OUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_COPY_IN", PGRES_COPY_IN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_BAD_RESPONSE", PGRES_BAD_RESPONSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_NONFATAL_ERROR", PGRES_NONFATAL_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_FATAL_ERROR", PGRES_FATAL_ERROR, CONST_CS | CONST_PERSISTENT); #if HAVE_PQRESULTERRORFIELD /* For pg_result_error_field() field codes */ - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SEVERITY", PG_DIAG_SEVERITY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SQLSTATE", PG_DIAG_SQLSTATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_PRIMARY", PG_DIAG_MESSAGE_PRIMARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_DETAIL", PG_DIAG_MESSAGE_DETAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_MESSAGE_HINT", PG_DIAG_MESSAGE_HINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_STATEMENT_POSITION", PG_DIAG_STATEMENT_POSITION, CONST_CS | CONST_PERSISTENT); #ifdef PG_DIAG_INTERNAL_POSITION - REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_POSITION", PG_DIAG_INTERNAL_POSITION, CONST_CS | CONST_PERSISTENT); #endif #ifdef PG_DIAG_INTERNAL_QUERY - REGISTER_LONG_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_INTERNAL_QUERY", PG_DIAG_INTERNAL_QUERY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_CONTEXT", PG_DIAG_CONTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FILE", PG_DIAG_SOURCE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_LINE", PG_DIAG_SOURCE_LINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DIAG_SOURCE_FUNCTION", PG_DIAG_SOURCE_FUNCTION, CONST_CS | CONST_PERSISTENT); #endif /* pg_convert options */ - REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_DEFAULT", PGSQL_CONV_IGNORE_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONV_FORCE_NULL", PGSQL_CONV_FORCE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_CONV_IGNORE_NOT_NULL", PGSQL_CONV_IGNORE_NOT_NULL, CONST_CS | CONST_PERSISTENT); /* pg_insert/update/delete/select options */ - REGISTER_LONG_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_ESCAPE", PGSQL_DML_ESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_NO_CONV", PGSQL_DML_NO_CONV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_EXEC", PGSQL_DML_EXEC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_ASYNC", PGSQL_DML_ASYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PGSQL_DML_STRING", PGSQL_DML_STRING, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -1254,9 +1254,9 @@ PHP_MINFO_FUNCTION(pgsql) php_info_print_table_row(2, "SSL support", "disabled"); #endif #endif /* HAVE_PG_CONFIG_H */ - snprintf(buf, sizeof(buf), "%ld", PGG(num_persistent)); + snprintf(buf, sizeof(buf), "%pd", PGG(num_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), "%ld", PGG(num_links)); + snprintf(buf, sizeof(buf), "%pd", PGG(num_links)); php_info_print_table_row(2, "Active Links", buf); php_info_print_table_end(); @@ -1288,16 +1288,16 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* make sure that the PGSQL_CONNECT_FORCE_NEW bit is not part of the hash so that subsequent connections * can re-use this connection. Bug #39979 */ - if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_LONG) { - if (Z_LVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { + if (i == 1 && ZEND_NUM_ARGS() == 2 && Z_TYPE(args[i]) == IS_INT) { + if (Z_IVAL(args[1]) == PGSQL_CONNECT_FORCE_NEW) { continue; - } else if (Z_LVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { - smart_str_append_long(&str, Z_LVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); + } else if (Z_IVAL(args[1]) & PGSQL_CONNECT_FORCE_NEW) { + smart_str_append_int(&str, Z_IVAL(args[1]) ^ PGSQL_CONNECT_FORCE_NEW); } } convert_to_string_ex(&args[i]); smart_str_appendc(&str, '_'); - smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRLEN(args[i])); + smart_str_appendl(&str, Z_STRVAL(args[i]), Z_STRSIZE(args[i])); } smart_str_0(&str); @@ -1306,8 +1306,8 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) connstring = Z_STRVAL(args[0]); } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */ connstring = Z_STRVAL(args[0]); - convert_to_long_ex(&args[1]); - connect_type = Z_LVAL(args[1]); + convert_to_int_ex(&args[1]); + connect_type = Z_IVAL(args[1]); } else { host = Z_STRVAL(args[0]); port = Z_STRVAL(args[1]); @@ -1333,12 +1333,12 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, - "Cannot create new link. Too many open links (%ld)", PGG(num_links)); + "Cannot create new link. Too many open links (%pd)", PGG(num_links)); goto err; } if (PGG(max_persistent) != -1 && PGG(num_persistent) >= PGG(max_persistent)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, - "Cannot create new link. Too many open persistent links (%ld)", PGG(num_persistent)); + "Cannot create new link. Too many open persistent links (%pd)", PGG(num_persistent)); goto err; } @@ -1431,7 +1431,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } } if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create new link. Too many open links (%ld)", PGG(num_links)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create new link. Too many open links (%pd)", PGG(num_links)); goto err; } @@ -1535,7 +1535,7 @@ PHP_FUNCTION(pg_connect_poll) ret = PQconnectPoll(pgsql); - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1642,7 +1642,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type array_init(return_value); add_assoc_string(return_value, "client", PG_VERSION); #if HAVE_PQPROTOCOLVERSION - add_assoc_long(return_value, "protocol", PQprotocolVersion(pgsql)); + add_assoc_int(return_value, "protocol", PQprotocolVersion(pgsql)); #if HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3) { /* 8.0 or grater supports protorol version 3 */ @@ -1977,7 +1977,7 @@ PHP_FUNCTION(pg_query_params) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } i++; @@ -2178,7 +2178,7 @@ PHP_FUNCTION(pg_execute) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -2252,17 +2252,17 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty switch (entry_type) { case PHP_PG_NUM_ROWS: - RETVAL_LONG(PQntuples(pgsql_result)); + RETVAL_INT(PQntuples(pgsql_result)); break; case PHP_PG_NUM_FIELDS: - RETVAL_LONG(PQnfields(pgsql_result)); + RETVAL_INT(PQnfields(pgsql_result)); break; case PHP_PG_CMD_TUPLES: #if HAVE_PQCMDTUPLES - RETVAL_LONG(atoi(PQcmdTuples(pgsql_result))); + RETVAL_INT(atoi(PQcmdTuples(pgsql_result))); #else php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build"); - RETVAL_LONG(0); + RETVAL_INT(0); #endif break; default: @@ -2387,14 +2387,14 @@ PHP_FUNCTION(pg_field_table) { zval *result; pgsql_result_handle *pg_result; - long fnum = -1; + php_int_t fnum = -1; zend_bool return_oid = 0; Oid oid; smart_str hash_key = {0}; char *table_name; zend_resource *field_table; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b", &result, &fnum, &return_oid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|b", &result, &fnum, &return_oid) == FAILURE) { return; } @@ -2412,15 +2412,15 @@ PHP_FUNCTION(pg_field_table) } if (return_oid) { -#if UINT_MAX > LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ - if (oid > LONG_MAX) { +#if UINT_MAX > PHP_INT_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ + if (oid > PHP_INT_MAX) { smart_str oidstr = {0}; smart_str_append_unsigned(&oidstr, oid); smart_str_0(&oidstr); RETURN_STR(oidstr.s); } else #endif - RETURN_LONG((long)oid); + RETURN_INT((php_int_t)oid); } /* try to lookup the table name in the resource list */ @@ -2480,12 +2480,12 @@ PHP_FUNCTION(pg_field_table) static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result; - long field; + php_int_t field; PGresult *pgsql_result; pgsql_result_handle *pg_result; Oid oid; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) { return; } @@ -2503,7 +2503,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ RETURN_STRING(PQfname(pgsql_result, field)); break; case PHP_PG_FIELD_SIZE: - RETURN_LONG(PQfsize(pgsql_result, field)); + RETURN_INT(PQfsize(pgsql_result, field)); break; case PHP_PG_FIELD_TYPE: { char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, field), &EG(regular_list) TSRMLS_CC); @@ -2514,8 +2514,8 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ case PHP_PG_FIELD_TYPE_OID: oid = PQftype(pgsql_result, field); -#if UINT_MAX > LONG_MAX - if (oid > LONG_MAX) { +#if UINT_MAX > PHP_INT_MAX + if (oid > PHP_INT_MAX) { smart_str s = {0}; smart_str_append_unsigned(&s, oid); smart_str_0(&s); @@ -2523,7 +2523,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ } else #endif { - RETURN_LONG((long)oid); + RETURN_INT((long)oid); } break; default: @@ -2582,7 +2582,7 @@ PHP_FUNCTION(pg_field_num) pgsql_result = pg_result->result; - RETURN_LONG(PQfnumber(pgsql_result, field)); + RETURN_INT(PQfnumber(pgsql_result, field)); } /* }}} */ @@ -2591,7 +2591,7 @@ PHP_FUNCTION(pg_field_num) PHP_FUNCTION(pg_fetch_result) { zval *result, *field=NULL; - long row; + php_int_t row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); @@ -2601,7 +2601,7 @@ PHP_FUNCTION(pg_fetch_result) return; } } else { - if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "riz", &result, &row, &field) == FAILURE) { return; } } @@ -2620,8 +2620,8 @@ PHP_FUNCTION(pg_fetch_result) } else { pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on PostgreSQL result index %ld", - row, Z_LVAL_P(result)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd", + row, Z_IVAL_P(result)); RETURN_FALSE; } } @@ -2630,8 +2630,8 @@ PHP_FUNCTION(pg_fetch_result) field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field)); break; default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_P(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { @@ -2649,13 +2649,13 @@ PHP_FUNCTION(pg_fetch_result) /* }}} */ /* {{{ void php_pgsql_fetch_hash */ -static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, int into_object) +static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int into_object) { zval *result, *zrow = NULL; PGresult *pgsql_result; pgsql_result_handle *pg_result; int i, num_fields, pgsql_row, use_row; - long row = -1; + php_int_t row = -1; char *field_name; zval *ctor_params = NULL; zend_class_entry *ce = NULL; @@ -2677,15 +2677,15 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, } result_type = PGSQL_ASSOC; } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!l", &result, &zrow, &result_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!i", &result, &zrow, &result_type) == FAILURE) { return; } } if (zrow == NULL) { row = -1; } else { - convert_to_long(zrow); - row = Z_LVAL_P(zrow); + convert_to_int(zrow); + row = Z_IVAL_P(zrow); if (row < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The row parameter must be greater or equal to zero"); RETURN_FALSE; @@ -2706,8 +2706,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, pgsql_row = row; pg_result->row = pgsql_row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on PostgreSQL result index %ld", - row, Z_LVAL_P(result)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd", + row, Z_IVAL_P(result)); RETURN_FALSE; } } else { @@ -2876,11 +2876,11 @@ PHP_FUNCTION(pg_fetch_all_columns) zval *result; PGresult *pgsql_result; pgsql_result_handle *pg_result; - unsigned long colno=0; + php_int_t colno=0; int pg_numrows, pg_row; size_t num_fields; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &colno) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &colno) == FAILURE) { RETURN_FALSE; } @@ -2890,7 +2890,7 @@ PHP_FUNCTION(pg_fetch_all_columns) num_fields = PQnfields(pgsql_result); if (colno >= num_fields || colno < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column number '%ld'", colno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column number '%pd'", colno); RETURN_FALSE; } @@ -2915,10 +2915,10 @@ PHP_FUNCTION(pg_fetch_all_columns) PHP_FUNCTION(pg_result_seek) { zval *result; - long row; + php_int_t row; pgsql_result_handle *pg_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &row) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &row) == FAILURE) { return; } @@ -2942,7 +2942,7 @@ PHP_FUNCTION(pg_result_seek) static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) { zval *result, *field; - long row; + php_int_t row; PGresult *pgsql_result; pgsql_result_handle *pg_result; int field_offset, pgsql_row, argc = ZEND_NUM_ARGS(); @@ -2952,7 +2952,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) return; } } else { - if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "riz", &result, &row, &field) == FAILURE) { return; } } @@ -2971,8 +2971,8 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) } else { pgsql_row = row; if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %ld on PostgreSQL result index %ld", - row, Z_LVAL_P(result)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd", + row, Z_IVAL_P(result)); RETURN_FALSE; } } @@ -2983,8 +2983,8 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field)); break; default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); + convert_to_int_ex(field); + field_offset = Z_IVAL_P(field); break; } if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) { @@ -2994,10 +2994,10 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch (entry_type) { case PHP_PG_DATA_LENGTH: - RETVAL_LONG(PQgetlength(pgsql_result, pgsql_row, field_offset)); + RETVAL_INT(PQgetlength(pgsql_result, pgsql_row, field_offset)); break; case PHP_PG_DATA_ISNULL: - RETVAL_LONG(PQgetisnull(pgsql_result, pgsql_row, field_offset)) + RETVAL_INT(PQgetisnull(pgsql_result, pgsql_row, field_offset)) break; } } @@ -3179,19 +3179,19 @@ PHP_FUNCTION(pg_lo_create) { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); - if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { + if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } } break; - case IS_LONG: - if (Z_LVAL_P(oid) < (long)InvalidOid) { + case IS_INT: + if (Z_IVAL_P(oid) < (php_int_t)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } - wanted_oid = (Oid)Z_LVAL_P(oid); + wanted_oid = (Oid)Z_IVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); @@ -3220,7 +3220,7 @@ PHP_FUNCTION(pg_lo_create) PHP_FUNCTION(pg_lo_unlink) { zval *pgsql_link = NULL; - long oid_long; + php_int_t oid_long; char *oid_string, *end_ptr; int oid_strlen; PGconn *pgsql; @@ -3239,7 +3239,7 @@ PHP_FUNCTION(pg_lo_unlink) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "rl", &pgsql_link, &oid_long) == SUCCESS) { + "ri", &pgsql_link, &oid_long) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3290,7 +3290,7 @@ PHP_FUNCTION(pg_lo_unlink) PHP_FUNCTION(pg_lo_open) { zval *pgsql_link = NULL; - long oid_long; + php_int_t oid_long; char *oid_string, *end_ptr, *mode_string; int oid_strlen, mode_strlen; PGconn *pgsql; @@ -3311,7 +3311,7 @@ PHP_FUNCTION(pg_lo_open) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "rls", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) { + "ris", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3437,12 +3437,12 @@ PHP_FUNCTION(pg_lo_close) PHP_FUNCTION(pg_lo_read) { zval *pgsql_id; - long len; + php_int_t len; int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes, argc = ZEND_NUM_ARGS(); zend_string *buf; pgLofp *pgsql; - if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &pgsql_id, &len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "r|i", &pgsql_id, &len) == FAILURE) { return; } @@ -3470,13 +3470,13 @@ PHP_FUNCTION(pg_lo_write) { zval *pgsql_id; char *str; - long z_len; + php_int_t z_len; int str_len, nbytes; int len; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pgsql_id, &str, &str_len, &z_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rs|i", &pgsql_id, &str, &str_len, &z_len) == FAILURE) { return; } @@ -3501,7 +3501,7 @@ PHP_FUNCTION(pg_lo_write) RETURN_FALSE; } - RETURN_LONG(nbytes); + RETURN_INT(nbytes); } /* }}} */ @@ -3526,7 +3526,7 @@ PHP_FUNCTION(pg_lo_read_all) PHPWRITE(buf, nbytes); tbytes += nbytes; } - RETURN_LONG(tbytes); + RETURN_INT(tbytes); } /* }}} */ @@ -3579,19 +3579,19 @@ PHP_FUNCTION(pg_lo_import) { char *end_ptr; wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10); - if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { + if ((Z_STRVAL_P(oid)+Z_STRSIZE_P(oid)) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } } break; - case IS_LONG: - if (Z_LVAL_P(oid) < (long)InvalidOid) { + case IS_INT: + if (Z_IVAL_P(oid) < (php_int_t)InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); RETURN_FALSE; } - wanted_oid = (Oid)Z_LVAL_P(oid); + wanted_oid = (Oid)Z_IVAL_P(oid); break; default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed"); @@ -3625,14 +3625,14 @@ PHP_FUNCTION(pg_lo_export) char *file_out, *oid_string, *end_ptr; int oid_strlen; int id = -1, name_len; - long oid_long; + php_int_t oid_long; Oid oid; PGconn *pgsql; int argc = ZEND_NUM_ARGS(); /* allow string to handle large OID value correctly */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "rlp", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) { + "rip", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3649,7 +3649,7 @@ PHP_FUNCTION(pg_lo_export) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "lp", &oid_long, &file_out, &name_len) == SUCCESS) { + "ip", &oid_long, &file_out, &name_len) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); RETURN_FALSE; @@ -3679,7 +3679,7 @@ PHP_FUNCTION(pg_lo_export) } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, - "lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) { + "ipr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used"); if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified"); @@ -3714,11 +3714,11 @@ PHP_FUNCTION(pg_lo_export) PHP_FUNCTION(pg_lo_seek) { zval *pgsql_id = NULL; - long result, offset = 0, whence = SEEK_CUR; + php_int_t result, offset = 0, whence = SEEK_CUR; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &pgsql_id, &offset, &whence) == FAILURE) { return; } if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) { @@ -3769,7 +3769,7 @@ PHP_FUNCTION(pg_lo_tell) #else offset = lo_tell((PGconn *)pgsql->conn, pgsql->lofd); #endif - RETURN_LONG(offset); + RETURN_INT(offset); } /* }}} */ @@ -3784,7 +3784,7 @@ PHP_FUNCTION(pg_lo_truncate) int argc = ZEND_NUM_ARGS(); int result; - if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_id, &size) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ri", &pgsql_id, &size) == FAILURE) { return; } @@ -3814,18 +3814,18 @@ PHP_FUNCTION(pg_lo_truncate) PHP_FUNCTION(pg_set_error_verbosity) { zval *pgsql_link = NULL; - long verbosity; + php_int_t verbosity; int id = -1, argc = ZEND_NUM_ARGS(); PGconn *pgsql; if (argc == 1) { - if (zend_parse_parameters(argc TSRMLS_CC, "l", &verbosity) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "i", &verbosity) == FAILURE) { return; } id = PGG(default_link)? PGG(default_link)->handle : -1; CHECK_DEFAULT_LINK(id); } else { - if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_link, &verbosity) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ri", &pgsql_link, &verbosity) == FAILURE) { return; } } @@ -3837,7 +3837,7 @@ PHP_FUNCTION(pg_set_error_verbosity) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) { - RETURN_LONG(PQsetErrorVerbosity(pgsql, verbosity)); + RETURN_INT(PQsetErrorVerbosity(pgsql, verbosity)); } else { RETURN_FALSE; } @@ -3874,7 +3874,7 @@ PHP_FUNCTION(pg_set_client_encoding) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQsetClientEncoding(pgsql, encoding)); + RETURN_INT(PQsetClientEncoding(pgsql, encoding)); } /* }}} */ @@ -4175,10 +4175,10 @@ PHP_FUNCTION(pg_copy_from) #if HAVE_PQPUTCOPYDATA ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRLEN_P(tmp) + 2); - strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2); - if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') { - strlcat(query, "\n", Z_STRLEN_P(tmp) + 2); + query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2); + strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2); + if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2); } if (PQputCopyData(pgsql, query, strlen(query)) != 1) { efree(query); @@ -4194,10 +4194,10 @@ PHP_FUNCTION(pg_copy_from) #else ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { convert_to_string_ex(tmp); - query = (char *)emalloc(Z_STRLEN_P(tmp) + 2); - strlcpy(query, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp) + 2); - if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') { - strlcat(query, "\n", Z_STRLEN_P(tmp) + 2); + query = (char *)emalloc(Z_STRSIZE_P(tmp) + 2); + strlcpy(query, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp) + 2); + if(Z_STRSIZE_P(tmp) > 0 && *(query + Z_STRSIZE_P(tmp) - 1) != '\n') { + strlcat(query, "\n", Z_STRSIZE_P(tmp) + 2); } if (PQputline(pgsql, query)==EOF) { efree(query); @@ -4559,12 +4559,12 @@ PHP_FUNCTION(pg_result_error) PHP_FUNCTION(pg_result_error_field) { zval *result; - long fieldcode; + php_int_t fieldcode; PGresult *pgsql_result; pgsql_result_handle *pg_result; char *field = NULL; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rl", + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &fieldcode) == FAILURE) { RETURN_FALSE; } @@ -4613,7 +4613,7 @@ PHP_FUNCTION(pg_connection_status) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQstatus(pgsql)); + RETURN_INT(PQstatus(pgsql)); } /* }}} */ @@ -4634,7 +4634,7 @@ PHP_FUNCTION(pg_transaction_status) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQtransactionStatus(pgsql)); + RETURN_INT(PQtransactionStatus(pgsql)); } #endif @@ -4709,10 +4709,10 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type) switch(entry_type) { case PHP_PG_ASYNC_IS_BUSY: PQconsumeInput(pgsql); - RETVAL_LONG(PQisBusy(pgsql)); + RETVAL_INT(PQisBusy(pgsql)); break; case PHP_PG_ASYNC_REQUEST_CANCEL: - RETVAL_LONG(PQrequestCancel(pgsql)); + RETVAL_INT(PQrequestCancel(pgsql)); while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); } @@ -4819,7 +4819,7 @@ PHP_FUNCTION(pg_send_query) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -4879,7 +4879,7 @@ PHP_FUNCTION(pg_send_query_params) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -4924,7 +4924,7 @@ PHP_FUNCTION(pg_send_query_params) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -4998,7 +4998,7 @@ PHP_FUNCTION(pg_send_prepare) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -5060,7 +5060,7 @@ PHP_FUNCTION(pg_send_execute) _php_pgsql_free_params(params, num_params); RETURN_FALSE; } - params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRSIZE(tmp_val)); zval_ptr_dtor(&tmp_val); } @@ -5104,7 +5104,7 @@ PHP_FUNCTION(pg_send_execute) } else if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(0); + RETURN_INT(0); } } /* }}} */ @@ -5144,12 +5144,12 @@ PHP_FUNCTION(pg_get_result) PHP_FUNCTION(pg_result_status) { zval *result; - long result_type = PGSQL_STATUS_LONG; + php_int_t result_type = PGSQL_STATUS_LONG; ExecStatusType status; PGresult *pgsql_result; pgsql_result_handle *pg_result; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &result_type) == FAILURE) { RETURN_FALSE; } @@ -5159,7 +5159,7 @@ PHP_FUNCTION(pg_result_status) pgsql_result = pg_result->result; if (result_type == PGSQL_STATUS_LONG) { status = PQresultStatus(pgsql_result); - RETURN_LONG((int)status); + RETURN_INT((int)status); } else if (result_type == PGSQL_STATUS_STRING) { RETURN_STRING(PQcmdStatus(pgsql_result)); @@ -5177,11 +5177,11 @@ PHP_FUNCTION(pg_get_notify) { zval *pgsql_link; int id = -1; - long result_type = PGSQL_ASSOC; + php_int_t result_type = PGSQL_ASSOC; PGconn *pgsql; PGnotify *pgsql_notify; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &pgsql_link, &result_type) == FAILURE) { RETURN_FALSE; } @@ -5202,7 +5202,7 @@ PHP_FUNCTION(pg_get_notify) array_init(return_value); if (result_type & PGSQL_NUM) { add_index_string(return_value, 0, pgsql_notify->relname); - add_index_long(return_value, 1, pgsql_notify->be_pid); + add_index_int(return_value, 1, pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else @@ -5215,7 +5215,7 @@ PHP_FUNCTION(pg_get_notify) } if (result_type & PGSQL_ASSOC) { add_assoc_string(return_value, "message", pgsql_notify->relname); - add_assoc_long(return_value, "pid", pgsql_notify->be_pid); + add_assoc_int(return_value, "pid", pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else @@ -5245,7 +5245,7 @@ PHP_FUNCTION(pg_get_pid) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); - RETURN_LONG(PQbackendPID(pgsql)); + RETURN_INT(PQbackendPID(pgsql)); } /* }}} */ @@ -5384,7 +5384,7 @@ PHP_FUNCTION(pg_flush) switch (ret) { case 0: RETURN_TRUE; break; - case 1: RETURN_LONG(0); break; + case 1: RETURN_INT(0); break; default: RETURN_FALSE; } } @@ -5468,17 +5468,17 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z char *name; array_init(&elem); /* pg_attribute.attnum */ - add_assoc_long(&elem, "num", atoi(PQgetvalue(pg_result,i,1))); + add_assoc_int(&elem, "num", atoi(PQgetvalue(pg_result,i,1))); /* pg_type.typname */ add_assoc_string(&elem, "type", PQgetvalue(pg_result,i,2)); /* pg_attribute.attlen */ - add_assoc_long(&elem, "len", atoi(PQgetvalue(pg_result,i,3))); + add_assoc_int(&elem, "len", atoi(PQgetvalue(pg_result,i,3))); /* pg_attribute.attnonull */ add_assoc_bool(&elem, "not null", !strcmp(PQgetvalue(pg_result,i,4), "t")); /* pg_attribute.atthasdef */ add_assoc_bool(&elem, "has default", !strcmp(PQgetvalue(pg_result,i,5), "t")); /* pg_attribute.attndims */ - add_assoc_long(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); + add_assoc_int(&elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); /* pg_type.typtype */ add_assoc_bool(&elem, "is enum", !strcmp(PQgetvalue(pg_result,i,7), "e")); if (extended) { @@ -5678,7 +5678,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC) smart_str_appendc(&str, 'E'); smart_str_appendc(&str, '\''); - smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRLEN_P(src)); + smart_str_appendl(&str, Z_STRVAL_P(src), Z_STRSIZE_P(src)); smart_str_appendc(&str, '\''); smart_str_0(&str); @@ -5711,7 +5711,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC) PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC) { zend_string *field = NULL; - ulong num_idx = -1; + php_uint_t num_idx = -1; zval meta, *def, *type, *not_null, *has_default, *is_enum, *val, new_val; int err = 0, skip_field; php_pgsql_data_type data_type; @@ -5774,7 +5774,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con /* enums need to be treated like strings */ data_type = PG_TEXT; } else { - data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRLEN_P(type)); + data_type = php_pgsql_get_data_type(Z_STRVAL_P(type), Z_STRSIZE_P(type)); } switch(data_type) @@ -5782,7 +5782,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_BOOL: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -5807,8 +5807,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } break; - case IS_LONG: - if (Z_LVAL_P(val)) { + case IS_INT: + if (Z_IVAL_P(val)) { ZVAL_STRINGL(&new_val, "'t'", sizeof("'t'")-1); } else { @@ -5843,27 +5843,27 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INT8: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); } } break; case IS_DOUBLE: ZVAL_DOUBLE(&new_val, Z_DVAL_P(val)); - convert_to_long_ex(&new_val); + convert_to_int_ex(&new_val); break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); break; case IS_NULL: @@ -5885,12 +5885,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_FLOAT8: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { @@ -5899,8 +5899,8 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); break; case IS_DOUBLE: @@ -5941,7 +5941,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_UNKNOWN: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { if (opt & PGSQL_CONV_FORCE_NULL) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { @@ -5951,17 +5951,17 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con else { zend_string *str; /* PostgreSQL ignores \0 */ - str = STR_ALLOC(Z_STRLEN_P(val) * 2, 0); + str = STR_ALLOC(Z_STRSIZE_P(val) * 2, 0); /* better to use PGSQLescapeLiteral since PGescapeStringConn does not handle special \ */ - str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + str->len = (int)PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); str = STR_REALLOC(str, str->len, 0); ZVAL_STR(&new_val, str); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); convert_to_string_ex(&new_val); break; @@ -5988,28 +5988,28 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con /* these are the actallay a integer */ switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); - convert_to_long_ex(&new_val); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + convert_to_int_ex(&new_val); } } break; case IS_DOUBLE: ZVAL_DOUBLE(&new_val, Z_DVAL_P(val)); - convert_to_long_ex(&new_val); + convert_to_int_ex(&new_val); break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); break; case IS_NULL: @@ -6029,16 +6029,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INET: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* better regex? IPV6 and IPV4 */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6062,13 +6062,13 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_TIMESTAMP_WITH_TIMEZONE: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else if (!strcasecmp(Z_STRVAL_P(val), "now()")) { ZVAL_STRINGL(&new_val, "NOW()", sizeof("NOW()")-1); } else { /* better regex? */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(&new_val, Z_STRVAL_P(val)); @@ -6093,16 +6093,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_DATE: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6124,16 +6124,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_TIME: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { /* FIXME: better regex must be used */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6155,7 +6155,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_INTERVAL: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -6176,7 +6176,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10 sec'. */ - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^(@?[ \\t]+)?(" /* Textual time units and their abbreviations: */ @@ -6234,7 +6234,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_BYTEA: switch (Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRING(&new_val, "NULL"); } else { @@ -6242,22 +6242,22 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con size_t to_len; smart_str s = {0}; #ifdef HAVE_PQESCAPE_BYTEA_CONN - tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRLEN_P(val), &to_len); + tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRSIZE_P(val), &to_len); #else - tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRLEN_P(val), &to_len); + tmp = PQescapeBytea(Z_STRVAL_P(val), (unsigned char *)Z_STRSIZE_P(val), &to_len); #endif ZVAL_STRINGL(&new_val, (char *)tmp, to_len - 1); /* PQescapeBytea's to_len includes additional '\0' */ PQfreemem(tmp); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); - smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRLEN(new_val)); + smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRSIZE(new_val)); smart_str_0(&s); zval_ptr_dtor(&new_val); ZVAL_STR(&new_val, s.s); } break; - case IS_LONG: - ZVAL_LONG(&new_val, Z_LVAL_P(val)); + case IS_INT: + ZVAL_INT(&new_val, Z_IVAL_P(val)); convert_to_string_ex(&new_val); break; @@ -6283,15 +6283,15 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con case PG_MACADDR: switch(Z_TYPE_P(val)) { case IS_STRING: - if (Z_STRLEN_P(val) == 0) { + if (Z_STRSIZE_P(val) == 0) { ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1); } else { - if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) { + if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRSIZE_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { - ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val)); + ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRSIZE_P(val)); php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC); } } @@ -6352,12 +6352,12 @@ PHP_FUNCTION(pg_convert) zval *pgsql_link, *values; char *table_name; int table_name_len; - ulong option = 0; + php_uint_t option = 0; PGconn *pg_link; int id = -1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) { + "rsa|i", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) { return; } if (option & ~PGSQL_CONV_OPTS) { @@ -6441,14 +6441,14 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c /* {{{ php_pgsql_insert */ -PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, php_uint_t opt, zend_string **sql TSRMLS_DC) { zval *val, converted; char buf[256]; char *tmp; smart_str querystr = {0}; int ret = FAILURE; - ulong num_idx; + php_uint_t num_idx; zend_string *fld; assert(pg_link != NULL); @@ -6502,18 +6502,18 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var if (opt & PGSQL_DML_ESCAPE) { size_t new_len; char *tmp; - tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); - new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1); + new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); smart_str_appendc(&querystr, '\''); smart_str_appendl(&querystr, tmp, new_len); smart_str_appendc(&querystr, '\''); efree(tmp); } else { - smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); + smart_str_appendl(&querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val)); } break; - case IS_LONG: - smart_str_append_long(&querystr, Z_LVAL_P(val)); + case IS_INT: + smart_str_append_int(&querystr, Z_IVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(&querystr, buf, snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val))); @@ -6563,7 +6563,7 @@ PHP_FUNCTION(pg_insert) zval *pgsql_link, *values; char *table; int table_len; - ulong option = PGSQL_DML_EXEC, return_sql; + php_uint_t option = PGSQL_DML_EXEC, return_sql; PGconn *pg_link; PGresult *pg_result; ExecStatusType status; @@ -6571,7 +6571,7 @@ PHP_FUNCTION(pg_insert) zend_string *sql = NULL; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i", &pgsql_link, &table, &table_len, &values, &option) == FAILURE) { return; } @@ -6645,7 +6645,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, { char *tmp; char buf[256]; - ulong num_idx; + php_uint_t num_idx; zend_string *fld; zval *val; @@ -6671,18 +6671,18 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, case IS_STRING: if (opt & PGSQL_DML_ESCAPE) { size_t new_len; - tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); - new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); + tmp = (char *)safe_emalloc(Z_STRSIZE_P(val), 2, 1); + new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRSIZE_P(val), NULL); smart_str_appendc(querystr, '\''); smart_str_appendl(querystr, tmp, new_len); smart_str_appendc(querystr, '\''); efree(tmp); } else { - smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); + smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRSIZE_P(val)); } break; - case IS_LONG: - smart_str_append_long(querystr, Z_LVAL_P(val)); + case IS_INT: + smart_str_append_int(querystr, Z_IVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)), sizeof(buf)-1)); @@ -6706,7 +6706,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, /* {{{ php_pgsql_update */ -PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, ulong opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, php_uint_t opt, zend_string **sql TSRMLS_DC) { zval var_converted, ids_converted; smart_str querystr = {0}; @@ -6779,12 +6779,12 @@ PHP_FUNCTION(pg_update) zval *pgsql_link, *values, *ids; char *table; int table_len; - ulong option = PGSQL_DML_EXEC; + php_uint_t option = PGSQL_DML_EXEC; PGconn *pg_link; zend_string *sql = NULL; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|l", + if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|i", &pgsql_link, &table, &table_len, &values, &ids, &option) == FAILURE) { return; } @@ -6810,7 +6810,7 @@ PHP_FUNCTION(pg_update) /* {{{ php_pgsql_delete */ -PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, ulong opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, php_uint_t opt, zend_string **sql TSRMLS_DC) { zval ids_converted; smart_str querystr = {0}; @@ -6869,12 +6869,12 @@ PHP_FUNCTION(pg_delete) zval *pgsql_link, *ids; char *table; int table_len; - ulong option = PGSQL_DML_EXEC; + php_uint_t option = PGSQL_DML_EXEC; PGconn *pg_link; zend_string *sql; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i", &pgsql_link, &table, &table_len, &ids, &option) == FAILURE) { return; } @@ -6936,7 +6936,7 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS /* {{{ php_pgsql_select */ -PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, ulong opt, zend_string **sql TSRMLS_DC) +PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, php_uint_t opt, zend_string **sql TSRMLS_DC) { zval ids_converted; smart_str querystr = {0}; @@ -6999,12 +6999,12 @@ PHP_FUNCTION(pg_select) zval *pgsql_link, *ids; char *table; int table_len; - ulong option = PGSQL_DML_EXEC; + php_uint_t option = PGSQL_DML_EXEC; PGconn *pg_link; zend_string *sql = NULL; int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l", + if (zend_parse_parameters(argc TSRMLS_CC, "rsa|i", &pgsql_link, &table, &table_len, &ids, &option) == FAILURE) { return; } diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index cfbe67fd9d..d090a08797 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -211,11 +211,11 @@ PHP_FUNCTION(pg_select); /* exported functions */ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, zend_bool extended TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, ulong opt, zend_string **sql TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, ulong opt , zend_string **sql TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, ulong opt, zend_string **sql TSRMLS_DC); -PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, ulong opt, zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, php_uint_t opt TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, php_uint_t opt, zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, php_uint_t opt , zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, php_uint_t opt, zend_string **sql TSRMLS_DC); +PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, php_uint_t opt, zend_string **sql TSRMLS_DC); PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC); /* internal functions */ @@ -309,10 +309,10 @@ static php_stream_ops php_stream_pgsql_fd_ops = { }; ZEND_BEGIN_MODULE_GLOBALS(pgsql) - long num_links,num_persistent; - long max_links,max_persistent; - long allow_persistent; - long auto_reset_persistent; + php_int_t num_links,num_persistent; + php_int_t max_links,max_persistent; + php_int_t allow_persistent; + php_int_t auto_reset_persistent; int le_lofp,le_string; int ignore_notices,log_notices; HashTable notices; /* notice message for each connection */ diff --git a/ext/pgsql/tests/config.inc b/ext/pgsql/tests/config.inc index 367f1ef9ba..be652b2507 100644 --- a/ext/pgsql/tests/config.inc +++ b/ext/pgsql/tests/config.inc @@ -4,7 +4,7 @@ // "test" database must be existed. i.e. "createdb test" before testing // PostgreSQL uses login name as username, user must have access to "test" database. -$conn_str = "host=localhost dbname=test port=5432"; // connection string +$conn_str = "user=test password=test host=localhost dbname=test port=5432"; // connection string $table_name = "php_pgsql_test"; // test table that will be created $table_name_92 = "php_pgsql_test_92"; // test table that will be created $num_test_record = 1000; // Number of records to create diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index d24a4c76da..53e6175ecb 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -58,7 +58,7 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{ /** * Used for seeking on a phar directory handle */ -static int phar_dir_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) /* {{{ */ +static int phar_dir_seek(php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC) /* {{{ */ { HashTable *data = (HashTable *)stream->abstract; @@ -95,7 +95,7 @@ static size_t phar_dir_read(php_stream *stream, char *buf, size_t count TSRMLS_D size_t to_read; HashTable *data = (HashTable *)stream->abstract; zend_string *str_key; - ulong unused; + php_uint_t unused; if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(data, &str_key, &unused, 0, &data->nInternalPointer)) { return 0; @@ -184,7 +184,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC) char *entry, *found, *save; zend_string *str_key; uint keylen; - ulong unused; + php_uint_t unused; ALLOC_HASHTABLE(data); zend_hash_init(data, 64, NULL, NULL, 0); @@ -306,7 +306,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, php_stream *ret; char *internal_file, *error; zend_string *str_key; - ulong unused; + php_uint_t unused; phar_archive_data *phar; phar_entry_info *entry = NULL; uint host_len; @@ -550,7 +550,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options php_url *resource = NULL; uint host_len; zend_string *str_key; - ulong unused; + php_uint_t unused; uint path_len; /* pre-readonly check, we need to know if this is a data phar */ diff --git a/ext/phar/dirstream.h b/ext/phar/dirstream.h index fd12ea1698..27d236aca4 100644 --- a/ext/phar/dirstream.h +++ b/ext/phar/dirstream.h @@ -31,7 +31,7 @@ static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count T static size_t phar_dir_read( php_stream *stream, char *buf, size_t count TSRMLS_DC); static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC); static int phar_dir_flush(php_stream *stream TSRMLS_DC); -static int phar_dir_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC); +static int phar_dir_seek( php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC); #else php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); #endif diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index 392f7d73ab..b548516fc7 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -98,8 +98,8 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */ zend_string *contents; zend_bool use_include_path = 0; php_stream *stream; - long offset = -1; - long maxlen = PHP_STREAM_COPY_ALL; + php_int_t offset = -1; + php_int_t maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; if (!PHAR_G(intercepted)) { @@ -112,7 +112,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */ } /* Parse arguments */ - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ii", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { goto skip_phar; } @@ -195,7 +195,7 @@ phar_it: } if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", offset); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %pd in the stream", offset); php_stream_close(stream); RETURN_FALSE; } @@ -307,7 +307,7 @@ notfound: } size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_INT(size); } skip_phar: @@ -433,7 +433,7 @@ skip_phar: /* {{{ php_stat */ -static void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value TSRMLS_DC) +static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TSRMLS_DC) { zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev, stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks; @@ -477,32 +477,32 @@ static void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value T switch (type) { case FS_PERMS: - RETURN_LONG((long)stat_sb->st_mode); + RETURN_INT((php_int_t)stat_sb->st_mode); case FS_INODE: - RETURN_LONG((long)stat_sb->st_ino); + RETURN_INT((php_int_t)stat_sb->st_ino); case FS_SIZE: - RETURN_LONG((long)stat_sb->st_size); + RETURN_INT((php_int_t)stat_sb->st_size); case FS_OWNER: - RETURN_LONG((long)stat_sb->st_uid); + RETURN_INT((php_int_t)stat_sb->st_uid); case FS_GROUP: - RETURN_LONG((long)stat_sb->st_gid); + RETURN_INT((php_int_t)stat_sb->st_gid); case FS_ATIME: #ifdef NETWARE - RETURN_LONG((long)stat_sb->st_atime.tv_sec); + RETURN_INT((php_int_t)stat_sb->st_atime.tv_sec); #else - RETURN_LONG((long)stat_sb->st_atime); + RETURN_INT((php_int_t)stat_sb->st_atime); #endif case FS_MTIME: #ifdef NETWARE - RETURN_LONG((long)stat_sb->st_mtime.tv_sec); + RETURN_INT((php_int_t)stat_sb->st_mtime.tv_sec); #else - RETURN_LONG((long)stat_sb->st_mtime); + RETURN_INT((php_int_t)stat_sb->st_mtime); #endif case FS_CTIME: #ifdef NETWARE - RETURN_LONG((long)stat_sb->st_ctime.tv_sec); + RETURN_INT((php_int_t)stat_sb->st_ctime.tv_sec); #else - RETURN_LONG((long)stat_sb->st_ctime); + RETURN_INT((php_int_t)stat_sb->st_ctime); #endif case FS_TYPE: if (S_ISLNK(stat_sb->st_mode)) { @@ -533,36 +533,36 @@ static void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value T case FS_STAT: array_init(return_value); - ZVAL_LONG(&stat_dev, stat_sb->st_dev); - ZVAL_LONG(&stat_ino, stat_sb->st_ino); - ZVAL_LONG(&stat_mode, stat_sb->st_mode); - ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); - ZVAL_LONG(&stat_uid, stat_sb->st_uid); - ZVAL_LONG(&stat_gid, stat_sb->st_gid); + ZVAL_INT(&stat_dev, stat_sb->st_dev); + ZVAL_INT(&stat_ino, stat_sb->st_ino); + ZVAL_INT(&stat_mode, stat_sb->st_mode); + ZVAL_INT(&stat_nlink, stat_sb->st_nlink); + ZVAL_INT(&stat_uid, stat_sb->st_uid); + ZVAL_INT(&stat_gid, stat_sb->st_gid); #ifdef HAVE_ST_RDEV - ZVAL_LONG(&stat_rdev, stat_sb->st_rdev); + ZVAL_INT(&stat_rdev, stat_sb->st_rdev); #else - ZVAL_LONG(&stat_rdev, -1); + ZVAL_INT(&stat_rdev, -1); #endif - ZVAL_LONG(&stat_size, stat_sb->st_size); + ZVAL_INT(&stat_size, stat_sb->st_size); #ifdef NETWARE - ZVAL_LONG(&stat_atime, (stat_sb->st_atime).tv_sec); - ZVAL_LONG(&stat_mtime, (stat_sb->st_mtime).tv_sec); - ZVAL_LONG(&stat_ctime, (stat_sb->st_ctime).tv_sec); + ZVAL_INT(&stat_atime, (stat_sb->st_atime).tv_sec); + ZVAL_INT(&stat_mtime, (stat_sb->st_mtime).tv_sec); + ZVAL_INT(&stat_ctime, (stat_sb->st_ctime).tv_sec); #else - ZVAL_LONG(&stat_atime, stat_sb->st_atime); - ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); - ZVAL_LONG(&stat_ctime, stat_sb->st_ctime); + ZVAL_INT(&stat_atime, stat_sb->st_atime); + ZVAL_INT(&stat_mtime, stat_sb->st_mtime); + ZVAL_INT(&stat_ctime, stat_sb->st_ctime); #endif #ifdef HAVE_ST_BLKSIZE - ZVAL_LONG(&stat_blksize, stat_sb->st_blksize); + ZVAL_INT(&stat_blksize, stat_sb->st_blksize); #else - ZVAL_LONG(&stat_blksize,-1); + ZVAL_INT(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_LONG(&stat_blocks, stat_sb->st_blocks); + ZVAL_INT(&stat_blocks, stat_sb->st_blocks); #else - ZVAL_LONG(&stat_blocks,-1); + ZVAL_INT(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -611,7 +611,7 @@ static void phar_file_stat(const char *filename, php_stat_len filename_length, i if (!IS_ABSOLUTE_PATH(filename, filename_length) && !strstr(filename, "://")) { char *arch, *entry, *fname; int arch_len, entry_len, fname_len; - struct stat sb = {0}; + php_stat_t sb = {0}; phar_entry_info *data = NULL; phar_archive_data *phar; diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 62b08cc642..c0df89fc5c 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -662,14 +662,14 @@ int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRM * This is used by phar_open_from_filename to process the manifest, but can be called * directly. */ -static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ +static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, php_int_t halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ { char b32[4], *buffer, *endbuffer, *savebuf; phar_archive_data *mydata = NULL; phar_entry_info entry; php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags; php_uint16 manifest_ver; - long offset; + php_int_t offset; int sig_len, register_alias = 0, temp_alias = 0; char *signature = NULL; @@ -771,7 +771,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char /* be ignored on reading because it is being generated anyways. */ if (manifest_flags & PHAR_HDR_SIGNATURE) { char sig_buf[8], *sig_ptr = sig_buf; - off_t read_len; + php_off_t read_len; size_t end_of_phar; if (-1 == php_stream_seek(fp, -8, SEEK_END) @@ -792,7 +792,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char case PHAR_SIG_OPENSSL: { php_uint32 signature_len; char *sig; - off_t whence; + php_off_t whence; /* we store the signature followed by the signature length */ if (-1 == php_stream_seek(fp, -12, SEEK_CUR) @@ -1535,7 +1535,7 @@ int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_l static inline char *phar_strnstr(const char *buf, int buf_len, const char *search, int search_len) /* {{{ */ { const char *c; - int so_far = 0; + ptrdiff_t so_far = 0; if (buf_len < search_len) { return NULL; @@ -1575,9 +1575,9 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a char *pos, test = '\0'; const int window_size = 1024; char buffer[1024 + sizeof(token)]; /* a 1024 byte window + the size of the halt_compiler token (moving window) */ - const long readsize = sizeof(buffer) - sizeof(token); - const long tokenlen = sizeof(token) - 1; - long halt_offset; + const php_int_t readsize = sizeof(buffer) - sizeof(token); + const php_int_t tokenlen = sizeof(token) - 1; + php_int_t halt_offset; size_t got; php_uint32 compression = PHAR_FILE_COMPRESSED_NONE; @@ -1618,7 +1618,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_long(&filterparams, "window", MAX_WBITS + 32); + add_assoc_int(&filterparams, "window", MAX_WBITS + 32); /* entire file is gzip-compressed, uncompress to temporary file */ if (!(temp = php_stream_fopen_tmpfile())) { @@ -1630,7 +1630,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a if (!filter) { err = 1; - add_assoc_long(&filterparams, "window", MAX_WBITS); + add_assoc_int(&filterparams, "window", MAX_WBITS); filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC); zval_dtor(&filterparams); @@ -1960,7 +1960,7 @@ woohoo: } } else { zend_string *str_key; - ulong unused; + php_uint_t unused; for (zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map)); HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &str_key, &unused, 0, &PHAR_GLOBALS->phar_fname_map.nInternalPointer); @@ -2534,7 +2534,7 @@ char *phar_create_default_stub(const char *index_php, const char *web_index, siz * user_stub contains either a string, or a resource pointer, if len is a negative length. * user_stub and len should be both 0 if the default or existing stub should be used */ -int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, char **error TSRMLS_DC) /* {{{ */ +int phar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int convert, char **error TSRMLS_DC) /* {{{ */ { char halt_stub[] = "__HALT_COMPILER();"; char *newstub, *tmp; @@ -2542,8 +2542,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, int halt_offset, restore_alias_len, global_flags = 0, closeoldfile; char *pos, has_dirs = 0; char manifest[18], entry_buffer[24]; - off_t manifest_ftell; - long offset; + php_off_t manifest_ftell; + php_int_t offset; size_t wrote; php_uint32 manifest_len, mytime, loc, new_manifest_count; php_uint32 newcrc32; @@ -3230,7 +3230,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, long len, int convert, zval filterparams; array_init(&filterparams); - add_assoc_long(&filterparams, "window", MAX_WBITS+16); + add_assoc_int(&filterparams, "window", MAX_WBITS+16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); zval_dtor(&filterparams); diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index b7dc155a96..ff750d07cd 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -249,11 +249,11 @@ typedef struct _phar_entry_info { char *filename; enum phar_fp_type fp_type; /* offset within original phar file of the file contents */ - long offset_abs; + php_int_t offset_abs; /* offset within fp of the file contents */ - long offset; + php_int_t offset; /* offset within original phar file of the file header (for zip-based/tar-based) */ - long header_offset; + php_int_t header_offset; php_stream *fp; php_stream *cfp; int fp_refcount; @@ -334,7 +334,7 @@ struct _phar_archive_data { typedef struct _phar_entry_fp_info { enum phar_fp_type fp_type; /* offset within fp of the file contents */ - long offset; + php_int_t offset; } phar_entry_fp_info; struct _phar_entry_fp { @@ -415,7 +415,7 @@ static inline void phar_set_pharufp(phar_archive_data *phar, php_stream *fp TSRM PHAR_GLOBALS->cached_fp[phar->phar_pos].ufp = fp; } -static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, off_t offset TSRMLS_DC) +static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, php_off_t offset TSRMLS_DC) { phar_entry_fp_info *data; @@ -437,7 +437,7 @@ static inline enum phar_fp_type phar_get_fp_type(phar_entry_info *entry TSRMLS_D return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].manifest[entry->manifest_pos].fp_type; } -static inline off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC) +static inline php_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC) { if (!entry->is_persistent) { return entry->offset; @@ -466,9 +466,9 @@ typedef struct _phar_entry_data { phar_archive_data *phar; php_stream *fp; /* stream position proxy, allows multiple open streams referring to the same fp */ - off_t position; + php_off_t position; /* for copies of the phar fp, defines where 0 is */ - off_t zero; + php_off_t zero; unsigned int for_write:1; unsigned int is_zip:1; unsigned int is_tar:1; @@ -564,7 +564,7 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC); phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC); int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRMLS_DC); void destroy_phar_manifest_entry(zval *zv); -int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position, int follow_links TSRMLS_DC); +int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_t position, int follow_links TSRMLS_DC); php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC); int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error TSRMLS_DC); int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TSRMLS_DC); @@ -578,12 +578,12 @@ int phar_copy_on_write(phar_archive_data **pphar TSRMLS_DC); int phar_is_tar(char *buf, char *fname); int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC); int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); -int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defaultstub, char **error TSRMLS_DC); +int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC); /* zip functions in zip.c */ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, char **error TSRMLS_DC); int phar_open_or_create_zip(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error TSRMLS_DC); -int phar_zip_flush(phar_archive_data *archive, char *user_stub, long len, int defaultstub, char **error TSRMLS_DC); +int phar_zip_flush(phar_archive_data *archive, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC); #ifdef PHAR_MAIN static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, int is_data, char **error TSRMLS_DC); @@ -600,7 +600,7 @@ phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int pa phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC); phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC); int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC); -int phar_flush(phar_archive_data *archive, char *user_stub, long len, int convert, char **error TSRMLS_DC); +int phar_flush(phar_archive_data *archive, char *user_stub, php_int_t len, int convert, char **error TSRMLS_DC); int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC); int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index e9acfe435b..9319645fac 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -75,7 +75,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char /* PATH_INFO and PATH_TRANSLATED should always be munged */ if (NULL != (stuff = zend_hash_str_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRLEN_P(stuff); + code = Z_STRSIZE_P(stuff); if (code > entry_len && !memcmp(path_info, entry, entry_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + entry_len, request_uri_len); @@ -99,7 +99,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) { if (NULL != (stuff = zend_hash_str_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRLEN_P(stuff); + code = Z_STRSIZE_P(stuff); if (code > basename_len && !memcmp(path_info, basename, basename_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); ZVAL_STRINGL(stuff, path_info + basename_len, code - basename_len); @@ -111,7 +111,7 @@ static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) { if (NULL != (stuff = zend_hash_str_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF")-1))) { path_info = Z_STRVAL_P(stuff); - code = Z_STRLEN_P(stuff); + code = Z_STRSIZE_P(stuff); if (code > basename_len && !memcmp(path_info, basename, basename_len)) { ZVAL_STR(&temp, Z_STR_P(stuff)); @@ -155,7 +155,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char zend_op_array *new_op_array; zval result; php_stream *fp; - off_t position; + php_off_t position; switch (code) { case PHAR_MIME_PHPS: @@ -211,7 +211,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char if (got > 0) { PHPWRITE(buf, got); position += got; - if (position == (off_t) info->uncompressed_filesize) { + if (position == (php_off_t) info->uncompressed_filesize) { break; } } @@ -601,11 +601,11 @@ PHP_METHOD(Phar, webPhar) if (NULL != (z_path_info = zend_hash_str_find(_server, "PATH_INFO", sizeof("PATH_INFO")-1)) && IS_STRING == Z_TYPE_P(z_path_info)) { - entry_len = Z_STRLEN_P(z_path_info); + entry_len = Z_STRSIZE_P(z_path_info); entry = estrndup(Z_STRVAL_P(z_path_info), entry_len); - path_info = emalloc(Z_STRLEN_P(z_script_name) + entry_len + 1); - memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); - memcpy(path_info + Z_STRLEN_P(z_script_name), entry, entry_len + 1); + path_info = emalloc(Z_STRSIZE_P(z_script_name) + entry_len + 1); + memcpy(path_info, Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name)); + memcpy(path_info + Z_STRSIZE_P(z_script_name), entry, entry_len + 1); free_pathinfo = 1; } else { entry_len = 0; @@ -613,7 +613,7 @@ PHP_METHOD(Phar, webPhar) path_info = Z_STRVAL_P(z_script_name); } - pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRLEN_P(z_script_name)); + pt = estrndup(Z_STRVAL_P(z_script_name), Z_STRSIZE_P(z_script_name)); } else { char *testit; @@ -702,8 +702,8 @@ PHP_METHOD(Phar, webPhar) switch (Z_TYPE(retval)) { case IS_STRING: efree(entry); - entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); - entry_len = Z_STRLEN_P(fci.retval); + entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRSIZE_P(fci.retval)); + entry_len = Z_STRSIZE_P(fci.retval); break; case IS_TRUE: case IS_FALSE: @@ -809,10 +809,10 @@ PHP_METHOD(Phar, webPhar) if (NULL != (val = zend_hash_str_find(Z_ARRVAL_P(mimeoverride), ext, strlen(ext)))) { switch (Z_TYPE_P(val)) { - case IS_LONG: - if (Z_LVAL_P(val) == PHAR_MIME_PHP || Z_LVAL_P(val) == PHAR_MIME_PHPS) { + case IS_INT: + if (Z_IVAL_P(val) == PHAR_MIME_PHP || Z_IVAL_P(val) == PHAR_MIME_PHPS) { mime_type = ""; - code = Z_LVAL_P(val); + code = Z_IVAL_P(val); } else { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Unknown mime type specifier used, only Phar::PHP, Phar::PHPS and a mime type string are allowed"); #ifdef PHP_WIN32 @@ -876,11 +876,11 @@ PHP_METHOD(Phar, mungServer) return; } - if (Z_STRLEN_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { + if (Z_STRSIZE_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_PHP_SELF; } - if (Z_STRLEN_P(data) == sizeof("REQUEST_URI")-1) { + if (Z_STRSIZE_P(data) == sizeof("REQUEST_URI")-1) { if (!strncmp(Z_STRVAL_P(data), "REQUEST_URI", sizeof("REQUEST_URI")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_REQUEST_URI; } @@ -889,7 +889,7 @@ PHP_METHOD(Phar, mungServer) } } - if (Z_STRLEN_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { + if (Z_STRSIZE_P(data) == sizeof("SCRIPT_FILENAME")-1 && !strncmp(Z_STRVAL_P(data), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1)) { PHAR_GLOBALS->phar_SERVER_mung_list |= PHAR_MUNG_SCRIPT_FILENAME; } } ZEND_HASH_FOREACH_END(); @@ -947,9 +947,9 @@ PHP_METHOD(Phar, mapPhar) { char *alias = NULL, *error; int alias_len = 0; - long dataoffset = 0; + php_int_t dataoffset = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!i", &alias, &alias_len, &dataoffset) == FAILURE) { return; } @@ -999,9 +999,9 @@ PHP_METHOD(Phar, apiVersion) * Returns whether phar extension supports compression using zlib/bzip2 */ PHP_METHOD(Phar, canCompress) { - long method = 0; + php_int_t method = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &method) == FAILURE) { return; } @@ -1109,8 +1109,8 @@ PHP_METHOD(Phar, __construct) #else char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname; int fname_len, alias_len = 0, arch_len, entry_len, is_data; - long flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS; - long format = 0; + php_int_t flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS; + php_int_t format = 0; phar_archive_object *phar_obj; phar_archive_data *phar_data; zval *zobj = getThis(), arg1, arg2; @@ -1120,11 +1120,11 @@ PHP_METHOD(Phar, __construct) is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC); if (is_data) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|is!i", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) { return; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|is!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) { return; } } @@ -1214,7 +1214,7 @@ PHP_METHOD(Phar, __construct) } ZVAL_STRINGL(&arg1, fname, fname_len); - ZVAL_LONG(&arg2, flags); + ZVAL_INT(&arg2, flags); zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj), &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2); @@ -1435,7 +1435,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRLEN(key); + str_key_len = Z_STRSIZE(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1504,7 +1504,7 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ } fname = Z_STRVAL_P(value); - fname_len = Z_STRLEN_P(value); + fname_len = Z_STRSIZE_P(value); phar_spl_fileinfo: if (base_len) { @@ -1563,7 +1563,7 @@ phar_spl_fileinfo: return ZEND_HASH_APPLY_STOP; } - str_key_len = Z_STRLEN(key); + str_key_len = Z_STRSIZE(key); str_key = estrndup(Z_STRVAL(key), str_key_len); save = str_key; @@ -1737,7 +1737,7 @@ PHP_METHOD(Phar, buildFromDirectory) } ZVAL_STRINGL(&arg, dir, dir_len); - ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); + ZVAL_INT(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS); zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator, &spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2); @@ -1900,14 +1900,14 @@ PHP_METHOD(Phar, buildFromIterator) PHP_METHOD(Phar, count) { /* mode can be ignored, maximum depth is 1 */ - long mode; + php_int_t mode; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) { RETURN_FALSE; } - RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest)); + RETURN_INT(zend_hash_num_elements(&phar_obj->archive->manifest)); } /* }}} */ @@ -1917,10 +1917,10 @@ PHP_METHOD(Phar, count) */ PHP_METHOD(Phar, isFileFormat) { - long type; + php_int_t type; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &type) == FAILURE) { RETURN_FALSE; } @@ -1940,7 +1940,7 @@ PHP_METHOD(Phar, isFileFormat) static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */ { char *error; - off_t offset; + php_off_t offset; phar_entry_info *link; if (FAILURE == phar_open_entry_fp(entry, &error, 1 TSRMLS_CC)) { @@ -2300,10 +2300,10 @@ PHP_METHOD(Phar, convertToExecutable) php_uint32 flags; zend_object *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday, so there) */ - long format = 9021976, method = 9021976; + php_int_t format = 9021976, method = 9021976; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &format, &method, &ext, &ext_len) == FAILURE) { return; } @@ -2403,10 +2403,10 @@ PHP_METHOD(Phar, convertToData) php_uint32 flags; zend_object *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday so there) */ - long format = 9021976, method = 9021976; + php_int_t format = 9021976, method = 9021976; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", &format, &method, &ext, &ext_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &format, &method, &ext, &ext_len) == FAILURE) { return; } @@ -2506,11 +2506,11 @@ PHP_METHOD(Phar, isCompressed) } if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) { - RETURN_LONG(PHAR_ENT_COMPRESSED_GZ); + RETURN_INT(PHAR_ENT_COMPRESSED_GZ); } if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_BZ2) { - RETURN_LONG(PHAR_ENT_COMPRESSED_BZ2); + RETURN_INT(PHAR_ENT_COMPRESSED_BZ2); } RETURN_FALSE; @@ -2812,7 +2812,7 @@ PHP_METHOD(Phar, setStub) zval *zstub; char *stub, *error; int stub_len; - long len = -1; + php_int_t len = -1; php_stream *stream; PHAR_ARCHIVE_OBJECT(); @@ -2833,7 +2833,7 @@ PHP_METHOD(Phar, setStub) return; } - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zstub, &len) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zstub, &len) == SUCCESS) { if ((php_stream_from_zval_no_verify(stream, zstub)) != NULL) { if (len > 0) { len = -len; @@ -2962,7 +2962,7 @@ PHP_METHOD(Phar, setDefaultStub) */ PHP_METHOD(Phar, setSignatureAlgorithm) { - long algo; + php_int_t algo; char *error, *key = NULL; int key_len = 0; @@ -2974,7 +2974,7 @@ PHP_METHOD(Phar, setSignatureAlgorithm) return; } - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &algo, &key, &key_len) != SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "i|s", &algo, &key, &key_len) != SUCCESS) { return; } @@ -3133,14 +3133,14 @@ static int pharobj_cancompress(HashTable *manifest TSRMLS_DC) /* {{{ */ */ PHP_METHOD(Phar, compress) { - long method; + php_int_t method; char *ext = NULL; int ext_len = 0; php_uint32 flags; zend_object *ret; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &method, &ext, &ext_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|s", &method, &ext, &ext_len) == FAILURE) { return; } @@ -3246,10 +3246,10 @@ PHP_METHOD(Phar, compressFiles) { char *error; php_uint32 flags; - long method; + php_int_t method; PHAR_ARCHIVE_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) { return; } @@ -4242,7 +4242,7 @@ PHP_METHOD(Phar, extractTo) goto all_files; case IS_STRING: filename = Z_STRVAL_P(zval_files); - filename_len = Z_STRLEN_P(zval_files); + filename_len = Z_STRSIZE_P(zval_files); break; case IS_ARRAY: nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files)); @@ -4419,7 +4419,7 @@ PHP_METHOD(PharFileInfo, getCompressedSize) return; } - RETURN_LONG(entry_obj->entry->compressed_filesize); + RETURN_INT(entry_obj->entry->compressed_filesize); } /* }}} */ @@ -4429,10 +4429,10 @@ PHP_METHOD(PharFileInfo, getCompressedSize) PHP_METHOD(PharFileInfo, isCompressed) { /* a number that is not Phar::GZ or Phar::BZ2 */ - long method = 9021976; + php_int_t method = 9021976; PHAR_ENTRY_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &method) == FAILURE) { return; } @@ -4468,7 +4468,7 @@ PHP_METHOD(PharFileInfo, getCRC32) } if (entry_obj->entry->is_crc_checked) { - RETURN_LONG(entry_obj->entry->crc32); + RETURN_INT(entry_obj->entry->crc32); } else { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \ "Phar entry was not CRC checked"); \ @@ -4502,7 +4502,7 @@ PHP_METHOD(PharFileInfo, getPharFlags) return; } - RETURN_LONG(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK)); + RETURN_INT(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK)); } /* }}} */ @@ -4512,7 +4512,7 @@ PHP_METHOD(PharFileInfo, getPharFlags) PHP_METHOD(PharFileInfo, chmod) { char *error; - long perms; + php_int_t perms; PHAR_ENTRY_OBJECT(); if (entry_obj->entry->is_temp_dir) { @@ -4526,7 +4526,7 @@ PHP_METHOD(PharFileInfo, chmod) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perms) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &perms) == FAILURE) { return; } @@ -4774,11 +4774,11 @@ PHP_METHOD(PharFileInfo, getContent) */ PHP_METHOD(PharFileInfo, compress) { - long method; + php_int_t method; char *error; PHAR_ENTRY_OBJECT(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) { return; } @@ -5266,8 +5266,8 @@ zend_function_entry phar_exception_methods[] = { }; /* }}} */ -#define REGISTER_PHAR_CLASS_CONST_LONG(class_name, const_name, value) \ - zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_PHAR_CLASS_CONST_INT(class_name, const_name, value) \ + zend_declare_class_constant_int(class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); #define phar_exception_get_default() zend_exception_get_default(TSRMLS_C) @@ -5301,20 +5301,20 @@ void phar_object_init(TSRMLS_D) /* {{{ */ phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS; #endif - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "TAR", PHAR_FORMAT_TAR) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHP", PHAR_MIME_PHP) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "MD5", PHAR_SIG_MD5) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "GZ", PHAR_ENT_COMPRESSED_GZ) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "NONE", PHAR_ENT_COMPRESSED_NONE) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHAR", PHAR_FORMAT_PHAR) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "TAR", PHAR_FORMAT_TAR) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "ZIP", PHAR_FORMAT_ZIP) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "COMPRESSED", PHAR_ENT_COMPRESSION_MASK) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHP", PHAR_MIME_PHP) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "MD5", PHAR_SIG_MD5) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) + REGISTER_PHAR_CLASS_CONST_INT(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) } /* }}} */ diff --git a/ext/phar/stream.c b/ext/phar/stream.c index 5aa6aa43ea..a500758420 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -213,11 +213,11 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha if (idata->internal_file->uncompressed_filesize == 0 && idata->internal_file->compressed_filesize == 0 && (pzoption = zend_hash_str_find(pharcontext, "compress", sizeof("compress")-1)) != NULL - && Z_TYPE_P(pzoption) == IS_LONG - && (Z_LVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 + && Z_TYPE_P(pzoption) == IS_INT + && (Z_IVAL_P(pzoption) & ~PHAR_ENT_COMPRESSION_MASK) == 0 ) { idata->internal_file->flags &= ~PHAR_ENT_COMPRESSION_MASK; - idata->internal_file->flags |= Z_LVAL_P(pzoption); + idata->internal_file->flags |= Z_IVAL_P(pzoption); } if ((pzoption = zend_hash_str_find(pharcontext, "metadata", sizeof("metadata")-1)) != NULL) { if (Z_TYPE(idata->internal_file->metadata) != IS_UNDEF) { @@ -377,7 +377,7 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML got = php_stream_read(data->fp, buf, MIN(count, entry->uncompressed_filesize - data->position)); data->position = php_stream_tell(data->fp) - data->zero; - stream->eof = (data->position == (off_t) entry->uncompressed_filesize); + stream->eof = (data->position == (php_off_t) entry->uncompressed_filesize); return got; } @@ -386,12 +386,12 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML /** * Used for fseek($fp) on a phar file handle */ -static int phar_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) /* {{{ */ +static int phar_stream_seek(php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC) /* {{{ */ { phar_entry_data *data = (phar_entry_data *)stream->abstract; phar_entry_info *entry; int res; - off_t temp; + php_off_t temp; if (data->internal_file->link) { entry = phar_get_link_source(data->internal_file TSRMLS_CC); @@ -412,7 +412,7 @@ static int phar_stream_seek(php_stream *stream, off_t offset, int whence, off_t default: temp = 0; } - if (temp > data->zero + (off_t) entry->uncompressed_filesize) { + if (temp > data->zero + (php_off_t) entry->uncompressed_filesize) { *newoffset = -1; return -1; } @@ -440,7 +440,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun return -1; } data->position = php_stream_tell(data->fp); - if (data->position > (off_t)data->internal_file->uncompressed_filesize) { + if (data->position > (php_off_t)data->internal_file->uncompressed_filesize) { data->internal_file->uncompressed_filesize = data->position; } data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize; diff --git a/ext/phar/stream.h b/ext/phar/stream.h index 2b78696560..20cf68d9d7 100644 --- a/ext/phar/stream.h +++ b/ext/phar/stream.h @@ -34,7 +34,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun static size_t phar_stream_read( php_stream *stream, char *buf, size_t count TSRMLS_DC); static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC); static int phar_stream_flush(php_stream *stream TSRMLS_DC); -static int phar_stream_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC); +static int phar_stream_seek( php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC); static int phar_stream_stat( php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); END_EXTERN_C() diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 6d210cbf5d..fd571eae48 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -256,7 +256,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, phar_tar_number(hdr->size, sizeof(hdr->size)); if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) { - off_t curloc; + php_off_t curloc; if (size > 511) { if (error) { @@ -921,7 +921,7 @@ static int phar_tar_setupmetadata(zval *zv, void *argument TSRMLS_DC) /* {{{ */ } /* }}} */ -int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ +int phar_tar_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ { phar_entry_info entry = {0}; static const char newstub[] = "<?php // tar-based phar archive stub file\n__HALT_COMPILER();"; @@ -1300,7 +1300,7 @@ nostub: #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_long(&filterparams, "window", MAX_WBITS + 16); + add_assoc_int(&filterparams, "window", MAX_WBITS + 16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp) TSRMLS_CC); zval_dtor(&filterparams); diff --git a/ext/phar/util.c b/ext/phar/util.c index 4bac776511..c2a398d787 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -38,7 +38,7 @@ #include <openssl/ssl.h> #include <openssl/pkcs12.h> #else -static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); +static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); #endif /* for links to relative location, prepend cwd of the entry */ @@ -117,10 +117,10 @@ php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC) /* } /* }}} */ -int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t position, int follow_links TSRMLS_DC) /* {{{ */ +int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_t position, int follow_links TSRMLS_DC) /* {{{ */ { php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC); - off_t temp, eoffset; + php_off_t temp, eoffset; if (!fp) { return -1; @@ -154,7 +154,7 @@ int phar_seek_efp(phar_entry_info *entry, off_t offset, int whence, off_t positi temp = 0; } - if (temp > eoffset + (off_t) entry->uncompressed_filesize) { + if (temp > eoffset + (php_off_t) entry->uncompressed_filesize) { return -1; } @@ -693,7 +693,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS php_stream_filter *filter; phar_archive_data *phar = entry->phar; char *filtername; - off_t loc; + php_off_t loc; php_stream *ufp; phar_entry_data dummy; @@ -786,7 +786,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS php_stream_flush(ufp); php_stream_filter_remove(filter, 1 TSRMLS_CC); - if (php_stream_tell(ufp) - loc != (off_t) entry->uncompressed_filesize) { + if (php_stream_tell(ufp) - loc != (php_off_t) entry->uncompressed_filesize) { spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename); return FAILURE; } @@ -1388,7 +1388,7 @@ static int phar_hex_str(const char *digest, size_t digest_len, char **signature /* }}} */ #ifndef PHAR_HAVE_OPENSSL -static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */ +static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */ { zend_fcall_info fci; zend_fcall_info_cache fcc; @@ -1406,7 +1406,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, ZVAL_EMPTY_STRING(&zp[0]); } - if (end != Z_STRLEN(zp[0])) { + if (end != Z_STRSIZE(zp[0])) { zval_dtor(&zp[0]); zval_dtor(&zp[1]); zval_dtor(&zp[2]); @@ -1457,15 +1457,15 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, switch (Z_TYPE(retval)) { default: - case IS_LONG: + case IS_INT: zval_dtor(&zp[1]); - if (1 == Z_LVAL(retval)) { + if (1 == Z_IVAL(retval)) { return SUCCESS; } return FAILURE; case IS_TRUE: - *signature = estrndup(Z_STRVAL(zp[1]), Z_STRLEN(zp[1])); - *signature_len = Z_STRLEN(zp[1]); + *signature = estrndup(Z_STRVAL(zp[1]), Z_STRSIZE(zp[1])); + *signature_len = Z_STRSIZE(zp[1]); zval_dtor(&zp[1]); return SUCCESS; case IS_FALSE: @@ -1479,7 +1479,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, off_t end, int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC) /* {{{ */ { int read_size, len; - off_t read_len; + php_off_t read_len; unsigned char buf[1024]; php_stream_rewind(fp); @@ -1576,7 +1576,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while (read_size && (len = php_stream_read(fp, (char*)buf, read_size)) > 0) { EVP_VerifyUpdate (&md_ctx, buf, len); - read_len -= (off_t)len; + read_len -= (php_off_t)len; if (read_len < read_size) { read_size = (int)read_len; @@ -1616,7 +1616,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_SHA512Update(&context, buf, len); - read_len -= (off_t)len; + read_len -= (php_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } @@ -1649,7 +1649,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_SHA256Update(&context, buf, len); - read_len -= (off_t)len; + read_len -= (php_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } @@ -1690,7 +1690,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_SHA1Update(&context, buf, len); - read_len -= (off_t)len; + read_len -= (php_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } @@ -1723,7 +1723,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_MD5Update(&context, buf, len); - read_len -= (off_t)len; + read_len -= (php_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 10becce09f..2eb48f45a4 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -167,7 +167,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, { phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; - long size; + php_int_t size; php_uint16 i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; @@ -338,7 +338,7 @@ foundit: /* add each central directory item to the manifest */ for (i = 0; i < PHAR_GET_16(locator.count); ++i) { phar_zip_central_dir_file zipentry; - off_t beforeus = php_stream_tell(fp); + php_off_t beforeus = php_stream_tell(fp); if (sizeof(zipentry) != php_stream_read(fp, (char *) &zipentry, sizeof(zipentry))) { PHAR_ZIP_FAIL("unable to read central directory entry, truncated"); @@ -393,7 +393,7 @@ foundit: if (entry.filename_len == sizeof(".phar/signature.bin")-1 && !strncmp(entry.filename, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) { size_t read; php_stream *sigfile; - off_t now; + php_off_t now; char *sig; now = php_stream_tell(fp); @@ -448,7 +448,7 @@ foundit: phar_add_virtual_dirs(mydata, entry.filename, entry.filename_len TSRMLS_CC); if (PHAR_GET_16(zipentry.extra_len)) { - off_t loc = php_stream_tell(fp); + php_off_t loc = php_stream_tell(fp); if (FAILURE == phar_zip_process_extra(fp, &entry, PHAR_GET_16(zipentry.extra_len) TSRMLS_CC)) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("Unable to process extra field header for file in central directory"); @@ -537,7 +537,7 @@ foundit: if (!actual_alias && entry.filename_len == sizeof(".phar/alias.txt")-1 && !strncmp(entry.filename, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) { php_stream_filter *filter; - off_t saveloc; + php_off_t saveloc; /* verify local file header */ phar_zip_file_header local; @@ -790,7 +790,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D phar_zip_central_dir_file central; struct _phar_zip_pass *p; php_uint32 newcrc32; - off_t offset; + php_off_t offset; int not_really_modified = 0; p = (struct _phar_zip_pass*) arg; @@ -1108,7 +1108,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas char *signature, sigbuf[8]; phar_entry_info entry = {0}; php_stream *newfile; - off_t tell, st; + php_off_t tell, st; newfile = php_stream_fopen_tmpfile(); if (newfile == NULL) { @@ -1177,7 +1177,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas } /* }}} */ -int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ +int phar_zip_flush(phar_archive_data *phar, char *user_stub, php_int_t len, int defaultstub, char **error TSRMLS_DC) /* {{{ */ { char *pos; smart_str main_metadata_str = {0}; diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 301507f655..d4047cb692 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -325,24 +325,24 @@ static PHP_GINIT_FUNCTION(posix) /* {{{ */ */ static PHP_MINIT_FUNCTION(posix) { - REGISTER_LONG_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_R_OK", R_OK, CONST_CS | CONST_PERSISTENT); #ifdef S_IFREG - REGISTER_LONG_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFREG", S_IFREG, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFCHR - REGISTER_LONG_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFCHR", S_IFCHR, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFBLK - REGISTER_LONG_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFBLK", S_IFBLK, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFIFO - REGISTER_LONG_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFIFO", S_IFIFO, CONST_CS | CONST_PERSISTENT); #endif #ifdef S_IFSOCK - REGISTER_LONG_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("POSIX_S_IFSOCK", S_IFSOCK, CONST_CS | CONST_PERSISTENT); #endif return SUCCESS; @@ -375,13 +375,13 @@ ZEND_GET_MODULE(posix) #define PHP_POSIX_NO_ARGS if (zend_parse_parameters_none() == FAILURE) return; -#define PHP_POSIX_RETURN_LONG_FUNC(func_name) \ +#define PHP_POSIX_RETURN_INT_FUNC(func_name) \ PHP_POSIX_NO_ARGS \ - RETURN_LONG(func_name()); + RETURN_INT(func_name()); #define PHP_POSIX_SINGLE_ARG_FUNC(func_name) \ - long val; \ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) RETURN_FALSE; \ + php_int_t val; \ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) RETURN_FALSE; \ if (func_name(val) < 0) { \ POSIX_G(last_error) = errno; \ RETURN_FALSE; \ @@ -393,9 +393,9 @@ ZEND_GET_MODULE(posix) PHP_FUNCTION(posix_kill) { - long pid, sig; + php_int_t pid, sig; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &sig) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &pid, &sig) == FAILURE) { RETURN_FALSE; } @@ -412,7 +412,7 @@ PHP_FUNCTION(posix_kill) Get the current process id (POSIX.1, 4.1.1) */ PHP_FUNCTION(posix_getpid) { - PHP_POSIX_RETURN_LONG_FUNC(getpid); + PHP_POSIX_RETURN_INT_FUNC(getpid); } /* }}} */ @@ -420,7 +420,7 @@ PHP_FUNCTION(posix_getpid) Get the parent process id (POSIX.1, 4.1.1) */ PHP_FUNCTION(posix_getppid) { - PHP_POSIX_RETURN_LONG_FUNC(getppid); + PHP_POSIX_RETURN_INT_FUNC(getppid); } /* }}} */ @@ -428,7 +428,7 @@ PHP_FUNCTION(posix_getppid) Get the current user id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getuid) { - PHP_POSIX_RETURN_LONG_FUNC(getuid); + PHP_POSIX_RETURN_INT_FUNC(getuid); } /* }}} */ @@ -436,7 +436,7 @@ PHP_FUNCTION(posix_getuid) Get the current group id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getgid) { - PHP_POSIX_RETURN_LONG_FUNC(getgid); + PHP_POSIX_RETURN_INT_FUNC(getgid); } /* }}} */ @@ -444,7 +444,7 @@ PHP_FUNCTION(posix_getgid) Get the current effective user id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_geteuid) { - PHP_POSIX_RETURN_LONG_FUNC(geteuid); + PHP_POSIX_RETURN_INT_FUNC(geteuid); } /* }}} */ @@ -452,7 +452,7 @@ PHP_FUNCTION(posix_geteuid) Get the current effective group id (POSIX.1, 4.2.1) */ PHP_FUNCTION(posix_getegid) { - PHP_POSIX_RETURN_LONG_FUNC(getegid); + PHP_POSIX_RETURN_INT_FUNC(getegid); } /* }}} */ @@ -511,7 +511,7 @@ PHP_FUNCTION(posix_getgroups) array_init(return_value); for (i=0; i<result; i++) { - add_next_index_long(return_value, gidlist[i]); + add_next_index_int(return_value, gidlist[i]); } } #endif @@ -540,7 +540,7 @@ PHP_FUNCTION(posix_getlogin) Get current process group id (POSIX.1, 4.3.1) */ PHP_FUNCTION(posix_getpgrp) { - PHP_POSIX_RETURN_LONG_FUNC(getpgrp); + PHP_POSIX_RETURN_INT_FUNC(getpgrp); } /* }}} */ @@ -549,7 +549,7 @@ PHP_FUNCTION(posix_getpgrp) #ifdef HAVE_SETSID PHP_FUNCTION(posix_setsid) { - PHP_POSIX_RETURN_LONG_FUNC(setsid); + PHP_POSIX_RETURN_INT_FUNC(setsid); } #endif /* }}} */ @@ -558,9 +558,9 @@ PHP_FUNCTION(posix_setsid) Set process group id for job control (POSIX.1, 4.3.3) */ PHP_FUNCTION(posix_setpgid) { - long pid, pgid; + php_int_t pid, pgid; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &pid, &pgid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &pid, &pgid) == FAILURE) { RETURN_FALSE; } @@ -578,8 +578,8 @@ PHP_FUNCTION(posix_setpgid) #ifdef HAVE_GETPGID PHP_FUNCTION(posix_getpgid) { - long val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) { + php_int_t val; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) { RETURN_FALSE; } @@ -587,7 +587,7 @@ PHP_FUNCTION(posix_getpgid) POSIX_G(last_error) = errno; RETURN_FALSE; } - RETURN_LONG(val); + RETURN_INT(val); } #endif /* }}} */ @@ -597,8 +597,8 @@ PHP_FUNCTION(posix_getpgid) #ifdef HAVE_GETSID PHP_FUNCTION(posix_getsid) { - long val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &val) == FAILURE) { + php_int_t val; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &val) == FAILURE) { RETURN_FALSE; } @@ -606,7 +606,7 @@ PHP_FUNCTION(posix_getsid) POSIX_G(last_error) = errno; RETURN_FALSE; } - RETURN_LONG(val); + RETURN_INT(val); } #endif /* }}} */ @@ -658,11 +658,11 @@ PHP_FUNCTION(posix_times) array_init(return_value); - add_assoc_long(return_value, "ticks", ticks); /* clock ticks */ - add_assoc_long(return_value, "utime", t.tms_utime); /* user time */ - add_assoc_long(return_value, "stime", t.tms_stime); /* system time */ - add_assoc_long(return_value, "cutime", t.tms_cutime); /* user time of children */ - add_assoc_long(return_value, "cstime", t.tms_cstime); /* system time of children */ + add_assoc_int(return_value, "ticks", ticks); /* clock ticks */ + add_assoc_int(return_value, "utime", t.tms_utime); /* user time */ + add_assoc_int(return_value, "stime", t.tms_stime); /* system time */ + add_assoc_int(return_value, "cutime", t.tms_cutime); /* user time of children */ + add_assoc_int(return_value, "cstime", t.tms_cstime); /* system time of children */ } /* }}} */ @@ -724,7 +724,7 @@ PHP_FUNCTION(posix_ttyname) char *p; int fd; #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) - long buflen; + php_int_t buflen; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) { @@ -738,8 +738,8 @@ PHP_FUNCTION(posix_ttyname) } break; default: - convert_to_long_ex(z_fd); - fd = Z_LVAL_P(z_fd); + convert_to_int_ex(z_fd); + fd = Z_IVAL_P(z_fd); } #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) buflen = sysconf(_SC_TTY_NAME_MAX); @@ -783,8 +783,8 @@ PHP_FUNCTION(posix_isatty) } break; default: - convert_to_long_ex(z_fd); - fd = Z_LVAL_P(z_fd); + convert_to_int_ex(z_fd); + fd = Z_IVAL_P(z_fd); } if (isatty(fd)) { @@ -836,10 +836,10 @@ PHP_FUNCTION(posix_mkfifo) { char *path; int path_len; - long mode; + php_int_t mode; int result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &path, &path_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi", &path, &path_len, &mode) == FAILURE) { RETURN_FALSE; } @@ -865,14 +865,14 @@ PHP_FUNCTION(posix_mknod) { char *path; int path_len; - long mode; - long major = 0, minor = 0; + php_int_t mode; + php_int_t major = 0, minor = 0; int result; dev_t php_dev; php_dev = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|ll", &path, &path_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi|ii", &path, &path_len, &mode, &major, &minor) == FAILURE) { RETURN_FALSE; } @@ -931,7 +931,7 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ add_next_index_string(&array_members, g->gr_mem[count]); } zend_hash_str_update(Z_ARRVAL_P(array_group), "members", sizeof("members")-1, &array_members); - add_assoc_long(array_group, "gid", g->gr_gid); + add_assoc_int(array_group, "gid", g->gr_gid); return 1; } /* }}} */ @@ -947,11 +947,11 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ Determine accessibility of a file (POSIX.1 5.6.3) */ PHP_FUNCTION(posix_access) { - long mode = 0; + php_int_t mode = 0; int filename_len, ret; char *filename, *path; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &mode) == FAILURE) { RETURN_FALSE; } @@ -1039,7 +1039,7 @@ PHP_FUNCTION(posix_getgrnam) Group database access (POSIX.1, 9.2.1) */ PHP_FUNCTION(posix_getgrgid) { - long gid; + php_int_t gid; #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) int ret; struct group _g; @@ -1049,7 +1049,7 @@ PHP_FUNCTION(posix_getgrgid) #endif struct group *g; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &gid) == FAILURE) { RETURN_FALSE; } #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) @@ -1096,8 +1096,8 @@ int php_posix_passwd_to_array(struct passwd *pw, zval *return_value) /* {{{ */ add_assoc_string(return_value, "name", pw->pw_name); add_assoc_string(return_value, "passwd", pw->pw_passwd); - add_assoc_long (return_value, "uid", pw->pw_uid); - add_assoc_long (return_value, "gid", pw->pw_gid); + add_assoc_int (return_value, "uid", pw->pw_uid); + add_assoc_int (return_value, "gid", pw->pw_gid); add_assoc_string(return_value, "gecos", pw->pw_gecos); add_assoc_string(return_value, "dir", pw->pw_dir); add_assoc_string(return_value, "shell", pw->pw_shell); @@ -1158,7 +1158,7 @@ PHP_FUNCTION(posix_getpwnam) User database access (POSIX.1, 9.2.2) */ PHP_FUNCTION(posix_getpwuid) { - long uid; + php_int_t uid; #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) struct passwd _pw; struct passwd *retpwptr = NULL; @@ -1168,7 +1168,7 @@ PHP_FUNCTION(posix_getpwuid) #endif struct passwd *pw; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &uid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &uid) == FAILURE) { RETURN_FALSE; } #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) @@ -1229,13 +1229,13 @@ static int posix_addlimit(int limit, char *name, zval *return_value TSRMLS_DC) { if (rl.rlim_cur == RLIM_INFINITY) { add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { - add_assoc_long(return_value, soft, rl.rlim_cur); + add_assoc_int(return_value, soft, rl.rlim_cur); } if (rl.rlim_max == RLIM_INFINITY) { add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1); } else { - add_assoc_long(return_value, hard, rl.rlim_max); + add_assoc_int(return_value, hard, rl.rlim_max); } return SUCCESS; @@ -1328,7 +1328,7 @@ PHP_FUNCTION(posix_get_last_error) { PHP_POSIX_NO_ARGS; - RETURN_LONG(POSIX_G(last_error)); + RETURN_INT(POSIX_G(last_error)); } /* }}} */ @@ -1336,9 +1336,9 @@ PHP_FUNCTION(posix_get_last_error) Retrieve the system error message associated with the given errno. */ PHP_FUNCTION(posix_strerror) { - long error; + php_int_t error; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &error) == FAILURE) { RETURN_FALSE; } @@ -1353,11 +1353,11 @@ PHP_FUNCTION(posix_strerror) Calculate the group access list for the user specified in name. */ PHP_FUNCTION(posix_initgroups) { - long basegid; + php_int_t basegid; char *name; int name_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &name, &name_len, &basegid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &name, &name_len, &basegid) == FAILURE) { RETURN_FALSE; } diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index f95ecc8b58..359f02fb15 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -249,10 +249,10 @@ static void php_pspell_close_config(zend_resource *rsrc TSRMLS_DC) */ static PHP_MINIT_FUNCTION(pspell) { - REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number); le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number); return SUCCESS; @@ -265,7 +265,7 @@ static PHP_FUNCTION(pspell_new) { char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL; int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0; - long mode = 0L, speed = 0L; + php_int_t mode = Z_I(0), speed = Z_I(0); int argc = ZEND_NUM_ARGS(); zval *ind; @@ -281,7 +281,7 @@ static PHP_FUNCTION(pspell_new) PspellManager *manager; PspellConfig *config; - if (zend_parse_parameters(argc TSRMLS_CC, "s|sssl", &language, &language_len, &spelling, &spelling_len, + if (zend_parse_parameters(argc TSRMLS_CC, "s|sssi", &language, &language_len, &spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) { return; } @@ -352,7 +352,7 @@ static PHP_FUNCTION(pspell_new) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -362,7 +362,7 @@ static PHP_FUNCTION(pspell_new_personal) { char *personal, *language, *spelling = NULL, *jargon = NULL, *encoding = NULL; int personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0; - long mode = 0L, speed = 0L; + php_int_t mode = Z_I(0), speed = Z_I(0); int argc = ZEND_NUM_ARGS(); zval *ind; @@ -378,7 +378,7 @@ static PHP_FUNCTION(pspell_new_personal) PspellManager *manager; PspellConfig *config; - if (zend_parse_parameters(argc TSRMLS_CC, "ps|sssl", &personal, &personal_len, &language, &language_len, + if (zend_parse_parameters(argc TSRMLS_CC, "ps|sssi", &personal, &personal_len, &language, &language_len, &spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) { return; } @@ -457,7 +457,7 @@ static PHP_FUNCTION(pspell_new_personal) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -465,13 +465,13 @@ static PHP_FUNCTION(pspell_new_personal) Load a dictionary based on the given config */ static PHP_FUNCTION(pspell_new_config) { - long conf; + php_int_t conf; zval *ind; PspellCanHaveError *ret; PspellManager *manager; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &conf) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &conf) == FAILURE) { return; } @@ -487,7 +487,7 @@ static PHP_FUNCTION(pspell_new_config) manager = to_pspell_manager(ret); ind = zend_list_insert(manager, le_pspell TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -496,11 +496,11 @@ static PHP_FUNCTION(pspell_new_config) static PHP_FUNCTION(pspell_check) { int word_len; - long scin; + php_int_t scin; char *word; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { return; } @@ -518,14 +518,14 @@ static PHP_FUNCTION(pspell_check) Returns array of suggestions */ static PHP_FUNCTION(pspell_suggest) { - long scin; + php_int_t scin; char *word; int word_len; PspellManager *manager; const PspellWordList *wl; const char *sug; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { return; } @@ -552,11 +552,11 @@ static PHP_FUNCTION(pspell_suggest) static PHP_FUNCTION(pspell_store_replacement) { int miss_len, corr_len; - long scin; + php_int_t scin; char *miss, *corr; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) { return; } @@ -577,11 +577,11 @@ static PHP_FUNCTION(pspell_store_replacement) static PHP_FUNCTION(pspell_add_to_personal) { int word_len; - long scin; + php_int_t scin; char *word; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { return; } @@ -607,11 +607,11 @@ static PHP_FUNCTION(pspell_add_to_personal) static PHP_FUNCTION(pspell_add_to_session) { int word_len; - long scin; + php_int_t scin; char *word; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, &word, &word_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &scin, &word, &word_len) == FAILURE) { return; } @@ -636,10 +636,10 @@ static PHP_FUNCTION(pspell_add_to_session) Clears the current session */ static PHP_FUNCTION(pspell_clear_session) { - long scin; + php_int_t scin; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &scin) == FAILURE) { return; } @@ -659,10 +659,10 @@ static PHP_FUNCTION(pspell_clear_session) Saves the current (personal) wordlist */ static PHP_FUNCTION(pspell_save_wordlist) { - long scin; + php_int_t scin; PspellManager *manager; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &scin) == FAILURE) { return; } @@ -744,7 +744,7 @@ static PHP_FUNCTION(pspell_config_create) pspell_config_replace(config, "save-repl", "false"); ind = zend_list_insert(config, le_pspell_config TSRMLS_CC); - RETURN_LONG(Z_RES_HANDLE_P(ind)); + RETURN_INT(Z_RES_HANDLE_P(ind)); } /* }}} */ @@ -752,11 +752,11 @@ static PHP_FUNCTION(pspell_config_create) Consider run-together words as valid components */ static PHP_FUNCTION(pspell_config_runtogether) { - long conf; + php_int_t conf; zend_bool runtogether; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &runtogether) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &conf, &runtogether) == FAILURE) { return; } @@ -772,10 +772,10 @@ static PHP_FUNCTION(pspell_config_runtogether) Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */ static PHP_FUNCTION(pspell_config_mode) { - long conf, mode; + php_int_t conf, mode; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &conf, &mode) == FAILURE) { return; } @@ -798,11 +798,11 @@ static PHP_FUNCTION(pspell_config_mode) Ignore words <= n chars */ static PHP_FUNCTION(pspell_config_ignore) { - char ignore_str[MAX_LENGTH_OF_LONG + 1]; - long conf, ignore = 0L; + char ignore_str[MAX_LENGTH_OF_ZEND_INT + 1]; + php_int_t conf, ignore = 0L; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, &ignore) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &conf, &ignore) == FAILURE) { return; } @@ -817,12 +817,12 @@ static PHP_FUNCTION(pspell_config_ignore) static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option) { - long conf; + php_int_t conf; char *value; int value_len; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &conf, &value, &value_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ip", &conf, &value, &value_len) == FAILURE) { return; } @@ -865,12 +865,12 @@ static PHP_FUNCTION(pspell_config_data_dir) Use a personal dictionary with replacement pairs for this config */ static PHP_FUNCTION(pspell_config_repl) { - long conf; + php_int_t conf; char *repl; int repl_len; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &conf, &repl, &repl_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ip", &conf, &repl, &repl_len) == FAILURE) { return; } @@ -892,11 +892,11 @@ static PHP_FUNCTION(pspell_config_repl) Save replacement pairs when personal list is saved for this config */ static PHP_FUNCTION(pspell_config_save_repl) { - long conf; + php_int_t conf; zend_bool save; PspellConfig *config; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, &save) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &conf, &save) == FAILURE) { return; } diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 22b727b6a4..ef82d5f8a3 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -250,21 +250,21 @@ PHP_FUNCTION(readline_info) if (!what) { array_init(return_value); add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer)); - add_assoc_long(return_value,"point",rl_point); - add_assoc_long(return_value,"end",rl_end); + add_assoc_int(return_value,"point",rl_point); + add_assoc_int(return_value,"end",rl_end); #ifdef HAVE_LIBREADLINE - add_assoc_long(return_value,"mark",rl_mark); - add_assoc_long(return_value,"done",rl_done); - add_assoc_long(return_value,"pending_input",rl_pending_input); + add_assoc_int(return_value,"mark",rl_mark); + add_assoc_int(return_value,"done",rl_done); + add_assoc_int(return_value,"pending_input",rl_pending_input); add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt)); add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name)); #endif #if HAVE_ERASE_EMPTY_LINE - add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line); + add_assoc_int(return_value,"erase_empty_line",rl_erase_empty_line); #endif add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version)); add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name)); - add_assoc_long(return_value,"attempted_completion_over",rl_attempted_completion_over); + add_assoc_int(return_value,"attempted_completion_over",rl_attempted_completion_over); } else { if (!strcasecmp(what,"line_buffer")) { oldstr = rl_line_buffer; @@ -275,26 +275,26 @@ PHP_FUNCTION(readline_info) } RETVAL_STRING(SAFE_STRING(oldstr)); } else if (!strcasecmp(what, "point")) { - RETVAL_LONG(rl_point); + RETVAL_INT(rl_point); } else if (!strcasecmp(what, "end")) { - RETVAL_LONG(rl_end); + RETVAL_INT(rl_end); #ifdef HAVE_LIBREADLINE } else if (!strcasecmp(what, "mark")) { - RETVAL_LONG(rl_mark); + RETVAL_INT(rl_mark); } else if (!strcasecmp(what, "done")) { oldval = rl_done; if (value) { - convert_to_long_ex(value); - rl_done = Z_LVAL_P(value); + convert_to_int_ex(value); + rl_done = Z_IVAL_P(value); } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); } else if (!strcasecmp(what, "pending_input")) { oldval = rl_pending_input; if (value) { convert_to_string_ex(value); rl_pending_input = Z_STRVAL_P(value)[0]; } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); } else if (!strcasecmp(what, "prompt")) { RETVAL_STRING(SAFE_STRING(rl_prompt)); } else if (!strcasecmp(what, "terminal_name")) { @@ -304,10 +304,10 @@ PHP_FUNCTION(readline_info) } else if (!strcasecmp(what, "erase_empty_line")) { oldval = rl_erase_empty_line; if (value) { - convert_to_long_ex(value); - rl_erase_empty_line = Z_LVAL_PP(value); + convert_to_int_ex(value); + rl_erase_empty_line = Z_IVAL_PP(value); } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); #endif } else if (!strcasecmp(what,"library_version")) { RETVAL_STRING((char *)SAFE_STRING(rl_library_version)); @@ -322,10 +322,10 @@ PHP_FUNCTION(readline_info) } else if (!strcasecmp(what, "attempted_completion_over")) { oldval = rl_attempted_completion_over; if (value) { - convert_to_long_ex(value); - rl_attempted_completion_over = Z_LVAL_P(value); + convert_to_int_ex(value); + rl_attempted_completion_over = Z_IVAL_P(value); } - RETVAL_LONG(oldval); + RETVAL_INT(oldval); } } } @@ -473,7 +473,7 @@ static void _readline_string_zval(zval *ret, const char *str) static void _readline_long_zval(zval *ret, long l) { - ZVAL_LONG(ret, l); + ZVAL_INT(ret, l); } static char **_readline_completion_cb(const char *text, int start, int end) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e4ad9416f0..8d3e0494f6 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -110,8 +110,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) target = intern->ptr; \ /* Class constants */ -#define REGISTER_REFLECTION_CLASS_CONST_LONG(class_name, const_name, value) \ - zend_declare_class_constant_long(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_REFLECTION_CLASS_CONST_INT(class_name, const_name, value) \ + zend_declare_class_constant_int(reflection_ ## class_name ## _ptr, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); /* {{{ Smart string functions */ typedef struct _string { @@ -435,7 +435,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in HashPosition pos; zval *value; zend_string *key; - ulong num_index; + php_uint_t num_index; zend_hash_internal_pointer_reset_ex(&ce->constants_table, &pos); @@ -565,7 +565,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in while ((prop = zend_hash_get_current_data_ptr_ex(properties, &pos)) != NULL) { zend_string *prop_name; - ulong index; + php_uint_t index; if (zend_hash_get_current_key_ex(properties, &prop_name, &index, 0, &pos) == HASH_KEY_IS_STRING) { if (prop_name->len && prop_name->val[0]) { /* skip all private and protected properties */ @@ -602,7 +602,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in && ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) { zend_string *key; - ulong num_index; + php_uint_t num_index; uint len = mptr->common.function_name->len; /* Do not display old-style inherited constructors */ @@ -729,8 +729,8 @@ static void _parameter_string(string *str, zend_function *fptr, struct _zend_arg string_write(str, "NULL", sizeof("NULL")-1); } else if (Z_TYPE(zv) == IS_STRING) { string_write(str, "'", sizeof("'")-1); - string_write(str, Z_STRVAL(zv), MIN(Z_STRLEN(zv), 15)); - if (Z_STRLEN(zv) > 15) { + string_write(str, Z_STRVAL(zv), MIN(Z_STRSIZE(zv), 15)); + if (Z_STRSIZE(zv) > 15) { string_write(str, "...", sizeof("...")-1); } string_write(str, "'", sizeof("'")-1); @@ -774,7 +774,7 @@ static void _function_parameter_string(string *str, zend_function *fptr, char* i static void _function_closure_string(string *str, zend_function *fptr, char* indent TSRMLS_DC) { zend_uint i, count; - ulong num_index; + php_uint_t num_index; zend_string *key; HashTable *static_variables; HashPosition pos; @@ -1532,9 +1532,9 @@ ZEND_METHOD(reflection, export) Returns an array of modifier names */ ZEND_METHOD(reflection, getModifierNames) { - long modifiers; + php_int_t modifiers; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &modifiers) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &modifiers) == FAILURE) { return; } @@ -1808,7 +1808,7 @@ ZEND_METHOD(reflection_function, getStartLine) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_LONG(fptr->op_array.line_start); + RETURN_INT(fptr->op_array.line_start); } RETURN_FALSE; } @@ -1826,7 +1826,7 @@ ZEND_METHOD(reflection_function, getEndLine) } GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { - RETURN_LONG(fptr->op_array.line_end); + RETURN_INT(fptr->op_array.line_end); } RETURN_FALSE; } @@ -2009,7 +2009,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters) METHOD_NOTSTATIC(reflection_function_abstract_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_LONG(fptr->common.num_args); + RETURN_INT(fptr->common.num_args); } /* }}} */ @@ -2023,7 +2023,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters) METHOD_NOTSTATIC(reflection_function_abstract_ptr); GET_REFLECTION_OBJECT_PTR(fptr); - RETURN_LONG(fptr->common.required_num_args); + RETURN_INT(fptr->common.required_num_args); } /* }}} */ @@ -2140,7 +2140,7 @@ ZEND_METHOD(reflection_parameter, __construct) unsigned int lcname_len; char *lcname; - lcname_len = Z_STRLEN_P(reference); + lcname_len = Z_STRSIZE_P(reference); lcname = zend_str_tolower_dup(Z_STRVAL_P(reference), lcname_len); if ((fptr = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len)) == NULL) { efree(lcname); @@ -2178,7 +2178,7 @@ ZEND_METHOD(reflection_parameter, __construct) } convert_to_string_ex(method); - lcname_len = Z_STRLEN_P(method); + lcname_len = Z_STRSIZE_P(method); lcname = zend_str_tolower_dup(Z_STRVAL_P(method), lcname_len); if (ce == zend_ce_closure && Z_TYPE_P(classref) == IS_OBJECT && (lcname_len == sizeof(ZEND_INVOKE_FUNC_NAME)-1) @@ -2219,8 +2219,8 @@ ZEND_METHOD(reflection_parameter, __construct) /* Now, search for the parameter */ arg_info = fptr->common.arg_info; - if (Z_TYPE_P(parameter) == IS_LONG) { - position= Z_LVAL_P(parameter); + if (Z_TYPE_P(parameter) == IS_INT) { + position= Z_IVAL_P(parameter); if (position < 0 || (zend_uint)position >= fptr->common.num_args) { if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) { if (fptr->type != ZEND_OVERLOADED_FUNCTION) { @@ -2503,7 +2503,7 @@ ZEND_METHOD(reflection_parameter, getPosition) } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_LONG(param->offset); + RETVAL_INT(param->offset); } /* }}} */ @@ -3103,7 +3103,7 @@ ZEND_METHOD(reflection_function, inNamespace) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_TRUE; @@ -3126,7 +3126,7 @@ ZEND_METHOD(reflection_function, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name)); @@ -3149,10 +3149,10 @@ ZEND_METHOD(reflection_function, getShortName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { - RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1)); + RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1)); } RETURN_ZVAL(name, 1, 0); } @@ -3203,7 +3203,7 @@ ZEND_METHOD(reflection_method, getModifiers) } GET_REFLECTION_OBJECT_PTR(mptr); - RETURN_LONG(mptr->common.fn_flags); + RETURN_INT(mptr->common.fn_flags); } /* }}} */ @@ -3343,7 +3343,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value zend_property_info *prop_info; zval *prop, prop_copy; zend_string *key; - ulong num_index; + php_uint_t num_index; ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) { if (((prop_info->flags & ZEND_ACC_SHADOW) && @@ -3566,7 +3566,7 @@ ZEND_METHOD(reflection_class, getStartLine) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_FUNCTION) { - RETURN_LONG(ce->info.user.line_start); + RETURN_INT(ce->info.user.line_start); } RETURN_FALSE; } @@ -3584,7 +3584,7 @@ ZEND_METHOD(reflection_class, getEndLine) } GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS) { - RETURN_LONG(ce->info.user.line_end); + RETURN_INT(ce->info.user.line_end); } RETURN_FALSE; } @@ -3744,12 +3744,12 @@ ZEND_METHOD(reflection_class, getMethods) { reflection_object *intern; zend_class_entry *ce; - long filter = 0; + php_int_t filter = 0; int argc = ZEND_NUM_ARGS(); METHOD_NOTSTATIC(reflection_class_ptr); if (argc) { - if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "|i", &filter) == FAILURE) { return; } } else { @@ -3934,12 +3934,12 @@ ZEND_METHOD(reflection_class, getProperties) { reflection_object *intern; zend_class_entry *ce; - long filter = 0; + php_int_t filter = 0; int argc = ZEND_NUM_ARGS(); METHOD_NOTSTATIC(reflection_class_ptr); if (argc) { - if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "|i", &filter) == FAILURE) { return; } } else { @@ -4137,7 +4137,7 @@ ZEND_METHOD(reflection_class, getModifiers) } GET_REFLECTION_OBJECT_PTR(ce); - RETURN_LONG(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED); + RETURN_INT(ce->ce_flags & ~ZEND_ACC_CONSTANTS_UPDATED); } /* }}} */ @@ -4648,7 +4648,7 @@ ZEND_METHOD(reflection_class, inNamespace) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_TRUE; @@ -4671,7 +4671,7 @@ ZEND_METHOD(reflection_class, getNamespaceName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { RETURN_STRINGL(Z_STRVAL_P(name), backslash - Z_STRVAL_P(name)); @@ -4694,10 +4694,10 @@ ZEND_METHOD(reflection_class, getShortName) RETURN_FALSE; } if (Z_TYPE_P(name) == IS_STRING - && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRLEN_P(name))) + && (backslash = zend_memrchr(Z_STRVAL_P(name), '\\', Z_STRSIZE_P(name))) && backslash > Z_STRVAL_P(name)) { - RETURN_STRINGL(backslash + 1, Z_STRLEN_P(name) - (backslash - Z_STRVAL_P(name) + 1)); + RETURN_STRINGL(backslash + 1, Z_STRSIZE_P(name) - (backslash - Z_STRVAL_P(name) + 1)); } RETURN_ZVAL(name, 1, 0); } @@ -4917,7 +4917,7 @@ ZEND_METHOD(reflection_property, getModifiers) } GET_REFLECTION_OBJECT_PTR(ref); - RETURN_LONG(ref->prop.flags); + RETURN_INT(ref->prop.flags); } /* }}} */ @@ -6048,8 +6048,8 @@ static void _reflection_write_property(zval *object, zval *member, zval *value, { if ((Z_TYPE_P(member) == IS_STRING) && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member)) - && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) - || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) + && ((Z_STRSIZE_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name"))) + || (Z_STRSIZE_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class"))))) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Cannot set read-only property %s::$%s", Z_OBJCE_P(object)->name->val, Z_STRVAL_P(member)); @@ -6092,7 +6092,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ reflection_function_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr TSRMLS_CC); zend_declare_property_string(reflection_function_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED); + REGISTER_REFLECTION_CLASS_CONST_INT(function, "IS_DEPRECATED", ZEND_ACC_DEPRECATED); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionParameter", reflection_parameter_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6106,12 +6106,12 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_declare_property_string(reflection_method_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_method_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_STATIC", ZEND_ACC_STATIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PUBLIC", ZEND_ACC_PUBLIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PROTECTED", ZEND_ACC_PROTECTED); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_PRIVATE", ZEND_ACC_PRIVATE); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT); - REGISTER_REFLECTION_CLASS_CONST_LONG(method, "IS_FINAL", ZEND_ACC_FINAL); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_STATIC", ZEND_ACC_STATIC); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PUBLIC", ZEND_ACC_PUBLIC); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PROTECTED", ZEND_ACC_PROTECTED); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_PRIVATE", ZEND_ACC_PRIVATE); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_ABSTRACT", ZEND_ACC_ABSTRACT); + REGISTER_REFLECTION_CLASS_CONST_INT(method, "IS_FINAL", ZEND_ACC_FINAL); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionClass", reflection_class_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6119,9 +6119,9 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_class_implements(reflection_class_ptr TSRMLS_CC, 1, reflector_ptr); zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); + REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); + REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + REGISTER_REFLECTION_CLASS_CONST_INT(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions); _reflection_entry.create_object = reflection_objects_new; @@ -6134,10 +6134,10 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_declare_property_string(reflection_property_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(reflection_property_ptr, "class", sizeof("class")-1, "", ZEND_ACC_PUBLIC TSRMLS_CC); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_STATIC", ZEND_ACC_STATIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PUBLIC", ZEND_ACC_PUBLIC); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PROTECTED", ZEND_ACC_PROTECTED); - REGISTER_REFLECTION_CLASS_CONST_LONG(property, "IS_PRIVATE", ZEND_ACC_PRIVATE); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_STATIC", ZEND_ACC_STATIC); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PUBLIC", ZEND_ACC_PUBLIC); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PROTECTED", ZEND_ACC_PROTECTED); + REGISTER_REFLECTION_CLASS_CONST_INT(property, "IS_PRIVATE", ZEND_ACC_PRIVATE); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionExtension", reflection_extension_functions); _reflection_entry.create_object = reflection_objects_new; diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 3366985279..6ea33a71aa 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -187,7 +187,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) DIR *dir; char dentry[sizeof(struct dirent) + MAXPATHLEN]; struct dirent *entry = (struct dirent *) &dentry; - struct stat sbuf; + php_stat_t sbuf; char buf[MAXPATHLEN]; time_t now; int nrdels = 0; @@ -238,7 +238,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) static int ps_files_key_exists(ps_files *data, const char *key TSRMLS_DC) { char buf[MAXPATHLEN]; - struct stat sbuf; + php_stat_t sbuf; if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) { return FAILURE; @@ -283,7 +283,7 @@ PS_OPEN_FUNC(files) if (argc > 1) { errno = 0; - dirdepth = (size_t) strtol(argv[0], NULL, 10); + dirdepth = (size_t) ZEND_STRTOI(argv[0], NULL, 10); if (errno == ERANGE) { php_error(E_WARNING, "The first parameter in session.save_path is invalid"); return FAILURE; @@ -292,7 +292,7 @@ PS_OPEN_FUNC(files) if (argc > 2) { errno = 0; - filemode = strtol(argv[1], NULL, 8); + filemode = ZEND_STRTOI(argv[1], NULL, 8); if (errno == ERANGE || filemode < 0 || filemode > 07777) { php_error(E_WARNING, "The second parameter in session.save_path is invalid"); return FAILURE; @@ -335,7 +335,7 @@ PS_CLOSE_FUNC(files) PS_READ_FUNC(files) { - long n; + php_int_t n; struct stat sbuf; PS_FILES_DATA; @@ -398,7 +398,7 @@ PS_READ_FUNC(files) PS_WRITE_FUNC(files) { - long n; + php_int_t n; PS_FILES_DATA; ps_files_open(data, key->val TSRMLS_CC); diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 9e09dff83b..40bb88813b 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -26,9 +26,9 @@ ps_module ps_mod_user = { PS_MOD_SID(user) }; -#define SESS_ZVAL_LONG(val, a) \ +#define SESS_ZVAL_INT(val, a) \ { \ - ZVAL_LONG(a, val); \ + ZVAL_INT(a, val); \ } #define SESS_ZVAL_STRING(vl, a) \ @@ -73,10 +73,10 @@ static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRML ret = SUCCESS; \ } else if (Z_TYPE(retval) == IS_FALSE) { \ ret = FAILURE; \ - } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == -1)) { \ + } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == -1)) { \ /* BC for clever users - Deprecate me */ \ ret = FAILURE; \ - } else if ((Z_TYPE(retval) == IS_LONG) && (Z_LVAL(retval) == 0)) { \ + } else if ((Z_TYPE(retval) == IS_INT) && (Z_IVAL(retval) == 0)) { \ /* BC for clever users - Deprecate me */ \ ret = SUCCESS; \ } else { \ @@ -189,7 +189,7 @@ PS_GC_FUNC(user) zval args[1]; STDVARS; - SESS_ZVAL_LONG(maxlifetime, &args[0]); + SESS_ZVAL_INT(maxlifetime, &args[0]); ps_call_handler(&PSF(gc), 1, args, &retval TSRMLS_CC); diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 78b90f49fa..326f6f21f1 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -125,12 +125,12 @@ PHP_METHOD(SessionHandler, destroy) Wraps the old gc handler */ PHP_METHOD(SessionHandler, gc) { - long maxlifetime; + php_int_t maxlifetime; int nrdels; PS_SANITY_CHECK_IS_OPEN; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &maxlifetime) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &maxlifetime) == FAILURE) { return; } diff --git a/ext/session/php_session.h b/ext/session/php_session.h index 403d9e0086..0e2eca9188 100644 --- a/ext/session/php_session.h +++ b/ext/session/php_session.h @@ -104,8 +104,8 @@ typedef struct _php_session_rfc1867_progress { zval sid; smart_str key; - long update_step; - long next_update; + php_int_t update_step; + php_int_t next_update; double next_update_time; zend_bool cancel_upload; zend_bool apply_trans_sid; @@ -125,8 +125,8 @@ typedef struct _php_ps_globals { char *extern_referer_chk; char *entropy_file; char *cache_limiter; - long entropy_length; - long cookie_lifetime; + php_int_t entropy_length; + php_int_t cookie_lifetime; char *cookie_path; char *cookie_domain; zend_bool cookie_secure; @@ -135,11 +135,11 @@ typedef struct _php_ps_globals { ps_module *default_mod; void *mod_data; php_session_status session_status; - long gc_probability; - long gc_divisor; - long gc_maxlifetime; + php_int_t gc_probability; + php_int_t gc_divisor; + php_int_t gc_maxlifetime; int module_number; - long cache_expire; + php_int_t cache_expire; union { zval names[7]; struct { @@ -162,11 +162,11 @@ typedef struct _php_ps_globals { zend_bool use_trans_sid; /* contains the INI value of whether to use trans-sid */ zend_bool apply_trans_sid; /* whether or not to enable trans-sid for the current request */ - long hash_func; + php_int_t hash_func; #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) php_hash_ops *hash_ops; #endif - long hash_bits_per_character; + php_int_t hash_bits_per_character; int send_cookie; int define_sid; zend_bool invalid_session_id; /* allows the driver to report about an invalid session id and request id regeneration */ @@ -176,7 +176,7 @@ typedef struct _php_ps_globals { zend_bool rfc1867_cleanup; /* session.upload_progress.cleanup */ char *rfc1867_prefix; /* session.upload_progress.prefix */ char *rfc1867_name; /* session.upload_progress.name */ - long rfc1867_freq; /* session.upload_progress.freq */ + php_int_t rfc1867_freq; /* session.upload_progress.freq */ double rfc1867_min_freq; /* session.upload_progress.min_freq */ zend_bool use_strict_mode; /* whether or not PHP accepts unknown session ids */ @@ -254,7 +254,7 @@ PHPAPI void php_session_reset_id(TSRMLS_D); #define PS_ENCODE_VARS \ zend_string *key; \ - ulong num_key; \ + php_uint_t num_key; \ zval *struc; #define PS_ENCODE_LOOP(code) do { \ diff --git a/ext/session/session.c b/ext/session/session.c index 1a678b8ddb..8811a08caf 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -305,7 +305,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ } /* maximum 15+19+19+10 bytes */ - spprintf(&buf, 0, "%.15s%ld%ld%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (long int)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10); + spprintf(&buf, 0, "%.15s%ld%ld%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (php_int_t)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10); switch (PS(hash_func)) { case PS_HASH_FUNC_MD5: @@ -705,14 +705,14 @@ static PHP_INI_MH(OnUpdateName) /* {{{ */ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */ { - long val; + php_int_t val; char *endptr = NULL; #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) PS(hash_ops) = NULL; #endif - val = strtol(new_value, &endptr, 10); + val = ZEND_STRTOI(new_value, &endptr, 10); if (endptr && (*endptr == '\0')) { /* Numeric value */ PS(hash_func) = val ? 1 : 0; @@ -1148,7 +1148,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */ static inline void last_modified(TSRMLS_D) /* {{{ */ { const char *path; - struct stat sb; + php_stat_t sb; char buf[MAX_STR + 1]; path = SG(request_info).path_translated; @@ -1344,7 +1344,7 @@ static void php_session_send_cookie(TSRMLS_D) /* {{{ */ STR_RELEASE(date_fmt); smart_str_appends(&ncookie, COOKIE_MAX_AGE); - smart_str_append_long(&ncookie, PS(cookie_lifetime)); + smart_str_append_int(&ncookie, PS(cookie_lifetime)); } } @@ -1413,7 +1413,7 @@ static void ppid2sid(zval *ppid TSRMLS_DC) { PS(send_cookie) = 1; } else { convert_to_string(ppid); - PS(id) = STR_INIT(Z_STRVAL_P(ppid), Z_STRLEN_P(ppid), 0); + PS(id) = STR_INIT(Z_STRVAL_P(ppid), Z_STRSIZE_P(ppid), 0); PS(send_cookie) = 0; } } @@ -1560,7 +1560,7 @@ PHPAPI void php_session_start(TSRMLS_D) /* {{{ */ !Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER]) && (data = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_REFERER", sizeof("HTTP_REFERER") - 1)) && Z_TYPE_P(data) == IS_STRING && - Z_STRLEN_P(data) != 0 && + Z_STRSIZE_P(data) != 0 && strstr(Z_STRVAL_P(data), PS(extern_referer_chk)) == NULL ) { STR_RELEASE(PS(id)); @@ -1656,7 +1656,7 @@ static PHP_FUNCTION(session_set_cookie_params) convert_to_string_ex(lifetime); ini_name = STR_INIT("session.cookie_lifetime", sizeof("session.cookie_lifetime") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRLEN_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); + zend_alter_ini_entry(ini_name, Z_STRVAL_P(lifetime), Z_STRSIZE_P(lifetime), PHP_INI_USER, PHP_INI_STAGE_RUNTIME); STR_RELEASE(ini_name); if (path) { @@ -1693,7 +1693,7 @@ static PHP_FUNCTION(session_get_cookie_params) array_init(return_value); - add_assoc_long(return_value, "lifetime", PS(cookie_lifetime)); + add_assoc_int(return_value, "lifetime", PS(cookie_lifetime)); add_assoc_string(return_value, "path", PS(cookie_path)); add_assoc_string(return_value, "domain", PS(cookie_domain)); add_assoc_bool(return_value, "secure", PS(cookie_secure)); @@ -1779,7 +1779,7 @@ static PHP_FUNCTION(session_set_save_handler) zend_string *func_name; HashPosition pos; zend_function *default_mptr, *current_mptr; - ulong func_index; + php_uint_t func_index; php_shutdown_function_entry shutdown_function_entry; zend_bool register_shutdown = 1; @@ -2028,12 +2028,12 @@ static PHP_FUNCTION(session_cache_expire) return; } - RETVAL_LONG(PS(cache_expire)); + RETVAL_INT(PS(cache_expire)); if (expires) { convert_to_string_ex(expires); ini_name = STR_INIT("session.cache_expire", sizeof("session.cache_expire") - 1, 0); - zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRLEN_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); + zend_alter_ini_entry(ini_name, Z_STRVAL_P(expires), Z_STRSIZE_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME); STR_RELEASE(ini_name); } } @@ -2157,7 +2157,7 @@ static PHP_FUNCTION(session_status) return; } - RETURN_LONG(PS(session_status)); + RETURN_INT(PS(session_status)); } /* }}} */ @@ -2460,9 +2460,9 @@ static PHP_MINIT_FUNCTION(session) /* {{{ */ zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_iface_entry); zend_class_implements(php_session_class_entry TSRMLS_CC, 1, php_session_id_iface_entry); - REGISTER_LONG_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_SESSION_DISABLED", php_session_disabled, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_SESSION_NONE", php_session_none, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_SESSION_ACTIVE", php_session_active, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -2603,7 +2603,7 @@ static zend_bool php_check_cancel_upload(php_session_rfc1867_progress *progress static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, int force_update TSRMLS_DC) /* {{{ */ { if (!force_update) { - if (Z_LVAL_P(progress->post_bytes_processed) < progress->next_update) { + if (Z_IVAL_P(progress->post_bytes_processed) < progress->next_update) { return; } #ifdef HAVE_GETTIMEOFDAY @@ -2618,7 +2618,7 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i progress->next_update_time = dtv + PS(rfc1867_min_freq); } #endif - progress->next_update = Z_LVAL_P(progress->post_bytes_processed) + progress->update_step; + progress->next_update = Z_IVAL_P(progress->post_bytes_processed) + progress->update_step; } php_session_initialize(TSRMLS_C); @@ -2720,16 +2720,16 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo array_init(&progress->data); array_init(&progress->files); - add_assoc_long_ex(&progress->data, "start_time", sizeof("start_time") - 1, (long)sapi_get_request_time(TSRMLS_C)); - add_assoc_long_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length); - add_assoc_long_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed); + add_assoc_int_ex(&progress->data, "start_time", sizeof("start_time") - 1, (php_int_t)sapi_get_request_time(TSRMLS_C)); + add_assoc_int_ex(&progress->data, "content_length", sizeof("content_length") - 1, progress->content_length); + add_assoc_int_ex(&progress->data, "bytes_processed", sizeof("bytes_processed") - 1, data->post_bytes_processed); add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 0); add_assoc_zval_ex(&progress->data, "files", sizeof("files") - 1, &progress->files); progress->post_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->data), "bytes_processed", sizeof("bytes_processed") - 1); php_rinit_session(0 TSRMLS_CC); - PS(id) = STR_INIT(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid), 0); + PS(id) = STR_INIT(Z_STRVAL(progress->sid), Z_STRSIZE(progress->sid), 0); PS(apply_trans_sid) = progress->apply_trans_sid; PS(send_cookie) = 0; } @@ -2740,17 +2740,17 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo add_assoc_string_ex(&progress->current_file, "field_name", sizeof("field_name") - 1, data->name); add_assoc_string_ex(&progress->current_file, "name", sizeof("name") - 1, *data->filename); add_assoc_null_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1); - add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, 0); + add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, 0); add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 0); - add_assoc_long_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (long)time(NULL)); - add_assoc_long_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0); + add_assoc_int_ex(&progress->current_file, "start_time", sizeof("start_time") - 1, (php_int_t)time(NULL)); + add_assoc_int_ex(&progress->current_file, "bytes_processed", sizeof("bytes_processed") - 1, 0); add_next_index_zval(&progress->files, &progress->current_file); progress->current_file_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->current_file), "bytes_processed", sizeof("bytes_processed") - 1); - Z_LVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } break; @@ -2761,8 +2761,8 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo break; } - Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; - Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; + Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } @@ -2778,10 +2778,10 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo add_assoc_string_ex(&progress->current_file, "tmp_name", sizeof("tmp_name") - 1, data->temp_filename); } - add_assoc_long_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); + add_assoc_int_ex(&progress->current_file, "error", sizeof("error") - 1, data->cancel_upload); add_assoc_bool_ex(&progress->current_file, "done", sizeof("done") - 1, 1); - Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } @@ -2794,7 +2794,7 @@ static int php_session_rfc1867_callback(unsigned int event, void *event_data, vo php_session_rfc1867_cleanup(progress TSRMLS_CC); } else { add_assoc_bool_ex(&progress->data, "done", sizeof("done") - 1, 1); - Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; + Z_IVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 1 TSRMLS_CC); } php_rshutdown_session_globals(TSRMLS_C); diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h index 2779fe14be..e0e0448709 100644 --- a/ext/shmop/php_shmop.h +++ b/ext/shmop/php_shmop.h @@ -45,7 +45,7 @@ struct php_shmop int shmflg; int shmatflg; char *addr; - int size; + php_int_t size; }; typedef struct { diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index c6569aa4c8..3a66d7343c 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -146,13 +146,13 @@ PHP_MINFO_FUNCTION(shmop) gets and attaches a shared memory segment */ PHP_FUNCTION(shmop_open) { - long key, mode, size; + php_int_t key, mode, size; struct php_shmop *shmop; struct shmid_ds shm; char *flags; int flags_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "isii", &key, &flags, &flags_len, &mode, &size) == FAILURE) { return; } @@ -216,7 +216,7 @@ PHP_FUNCTION(shmop_open) shmop->size = shm.shm_segsz; ZEND_REGISTER_RESOURCE(return_value, shmop, shm_type); - RETURN_LONG(Z_RES_HANDLE_P(return_value)); + RETURN_INT(Z_RES_HANDLE_P(return_value)); err: efree(shmop); RETURN_FALSE; @@ -227,13 +227,13 @@ err: reads from a shm segment */ PHP_FUNCTION(shmop_read) { - long shmid, start, count; + php_int_t shmid, start, count; struct php_shmop *shmop; char *startaddr; int bytes; zend_string *return_string; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start, &count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &shmid, &start, &count) == FAILURE) { return; } @@ -262,10 +262,10 @@ PHP_FUNCTION(shmop_read) closes a shared memory segment */ PHP_FUNCTION(shmop_close) { - long shmid; + php_int_t shmid; zval *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) { return; } @@ -280,16 +280,16 @@ PHP_FUNCTION(shmop_close) returns the shm size */ PHP_FUNCTION(shmop_size) { - long shmid; + php_int_t shmid; struct php_shmop *shmop; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) { return; } ZEND_FETCH_RESOURCE(shmop, struct php_shmop *, NULL, shmid, "shmop", shm_type); - RETURN_LONG(shmop->size); + RETURN_INT(shmop->size); } /* }}} */ @@ -299,11 +299,10 @@ PHP_FUNCTION(shmop_write) { struct php_shmop *shmop; int writesize; - long shmid, offset; - char *data; - int data_len; + php_int_t shmid, offset; + zend_string *data; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &shmid, &data, &data_len, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iSi", &shmid, &data, &offset) == FAILURE) { return; } @@ -319,10 +318,10 @@ PHP_FUNCTION(shmop_write) RETURN_FALSE; } - writesize = (data_len < shmop->size - offset) ? data_len : shmop->size - offset; - memcpy(shmop->addr + offset, data, writesize); + writesize = (data->len < shmop->size - offset) ? data->len : shmop->size - offset; + memcpy(shmop->addr + offset, data->val, writesize); - RETURN_LONG(writesize); + RETURN_INT(writesize); } /* }}} */ @@ -330,10 +329,10 @@ PHP_FUNCTION(shmop_write) mark segment for deletion */ PHP_FUNCTION(shmop_delete) { - long shmid; + php_int_t shmid; struct php_shmop *shmop; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) { return; } diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 014bf2f4f6..78d8da5694 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -138,9 +138,9 @@ static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name, } /* }}} */ -static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, long offset, xmlNodePtr node, long *cnt) /* {{{ */ +static xmlNodePtr sxe_get_element_by_offset(php_sxe_object *sxe, php_int_t offset, xmlNodePtr node, php_int_t *cnt) /* {{{ */ { - long nodendx = 0; + php_int_t nodendx = 0; if (sxe->iter.type == SXE_ITER_NONE) { if (offset == 0) { @@ -255,7 +255,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z sxe = Z_SXEOBJ_P(object); - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -299,11 +299,11 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (node) { if (attribs) { - if (Z_TYPE_P(member) != IS_LONG || sxe->iter.type == SXE_ITER_ATTRLIST) { - if (Z_TYPE_P(member) == IS_LONG) { - while (attr && nodendx <= Z_LVAL_P(member)) { + if (Z_TYPE_P(member) != IS_INT || sxe->iter.type == SXE_ITER_ATTRLIST) { + if (Z_TYPE_P(member) == IS_INT) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { _node_as_zval(sxe, (xmlNodePtr) attr, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); break; } @@ -327,27 +327,27 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (!sxe->node) { php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, node, NULL TSRMLS_CC); } - if (!member || Z_TYPE_P(member) == IS_LONG) { - long cnt = 0; + if (!member || Z_TYPE_P(member) == IS_INT) { + php_int_t cnt = 0; xmlNodePtr mynode = node; if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } if (sxe->iter.type == SXE_ITER_NONE) { - if (member && Z_LVAL_P(member) > 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only 0 such elements exist", mynode->name, Z_LVAL_P(member)); + if (member && Z_IVAL_P(member) > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_IVAL_P(member)); } } else if (member) { - node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); + node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt); } else { node = NULL; } if (node) { _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); } else if (type == BP_VAR_W || type == BP_VAR_RW) { - if (member && cnt < Z_LVAL_P(member)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_LVAL_P(member), cnt); + if (member && cnt < Z_IVAL_P(member)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_IVAL_P(member), cnt); } node = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, NULL); _node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix TSRMLS_CC); @@ -410,7 +410,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC) return; } switch (Z_TYPE_P(value)) { - case IS_LONG: + case IS_INT: case IS_FALSE: case IS_TRUE: case IS_DOUBLE: @@ -456,13 +456,13 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool int nodendx = 0; int test = 0; int new_value = 0; - long cnt = 0; + php_int_t cnt = 0; int retval = SUCCESS; zval tmp_zv, trim_zv, zval_copy; sxe = Z_SXEOBJ_P(object); - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -479,12 +479,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool trim_zv = *member; zval_copy_ctor(&trim_zv); convert_to_string(&trim_zv); - php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC); + php_trim(Z_STRVAL(trim_zv), Z_STRSIZE(trim_zv), NULL, 0, &tmp_zv, 3 TSRMLS_CC); zval_dtor(&trim_zv); member = &tmp_zv; } - if (!Z_STRLEN_P(member)) { + if (!Z_STRSIZE_P(member)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element"); if (member == &tmp_zv) { zval_dtor(&tmp_zv); @@ -525,7 +525,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (value) { switch (Z_TYPE_P(value)) { - case IS_LONG: + case IS_INT: case IS_FALSE: case IS_TRUE: case IS_DOUBLE: @@ -559,10 +559,10 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { - while (attr && nodendx <= Z_LVAL_P(member)) { + if (Z_TYPE_P(member) == IS_INT) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { is_attr = 1; ++counter; break; @@ -585,7 +585,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool } if (elements) { - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { if (node->type == XML_ATTRIBUTE_NODE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot create duplicate attribute"); return FAILURE; @@ -594,12 +594,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (sxe->iter.type == SXE_ITER_NONE) { newnode = node; ++counter; - if (member && Z_LVAL_P(member) > 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only 0 such elements exist", mynode->name, Z_LVAL_P(member)); + if (member && Z_IVAL_P(member) > 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_IVAL_P(member)); retval = FAILURE; } } else if (member) { - newnode = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt); + newnode = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, &cnt); if (newnode) { ++counter; } @@ -636,21 +636,21 @@ next_iter: retval = FAILURE; } else if (elements) { if (!node) { - if (!member || Z_TYPE_P(member) == IS_LONG) { + if (!member || Z_TYPE_P(member) == IS_INT) { newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } else { newnode = xmlNewTextChild(mynode, mynode->ns, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } - } else if (!member || Z_TYPE_P(member) == IS_LONG) { - if (member && cnt < Z_LVAL_P(member)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %ld when only %ld such elements exist", mynode->name, Z_LVAL_P(member), cnt); + } else if (!member || Z_TYPE_P(member) == IS_INT) { + if (member && cnt < Z_IVAL_P(member)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_IVAL_P(member), cnt); retval = FAILURE; } newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL); } } else if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %ld when only %d attributes exist", Z_LVAL_P(member), nodendx); + if (Z_TYPE_P(member) == IS_INT) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot change attribute number %pd when only %d attributes exist", Z_IVAL_P(member), nodendx); retval = FAILURE; } else { newnode = (xmlNodePtr)xmlNewProp(node, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL); @@ -735,7 +735,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend int test = 0; zval tmp_zv; - if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) { + if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) { tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; @@ -746,7 +746,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend GET_NODE(sxe, node); - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -770,12 +770,12 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { int nodendx = 0; - while (attr && nodendx <= Z_LVAL_P(member)) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { exists = 1; break; } @@ -801,11 +801,11 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend } if (elements) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); + node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL); } else { node = node->children; @@ -865,7 +865,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zval tmp_zv; int test = 0; - if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) { + if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_INT) { tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; @@ -876,7 +876,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, GET_NODE(sxe, node); - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type != SXE_ITER_ATTRLIST) { attribs = 0; elements = 1; @@ -900,12 +900,12 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, if (node) { if (attribs) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { int nodendx = 0; - while (attr && nodendx <= Z_LVAL_P(member)) { + while (attr && nodendx <= Z_IVAL_P(member)) { if ((!test || !xmlStrcmp(attr->name, sxe->iter.name)) && match_ns(sxe, (xmlNodePtr) attr, sxe->iter.nsprefix, sxe->iter.isprefix)) { - if (nodendx == Z_LVAL_P(member)) { + if (nodendx == Z_IVAL_P(member)) { xmlUnlinkNode((xmlNodePtr) attr); php_libxml_node_free_resource((xmlNodePtr) attr TSRMLS_CC); break; @@ -928,11 +928,11 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, } if (elements) { - if (Z_TYPE_P(member) == IS_LONG) { + if (Z_TYPE_P(member) == IS_INT) { if (sxe->iter.type == SXE_ITER_CHILD) { node = php_sxe_get_first_node(sxe, node TSRMLS_CC); } - node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, NULL); + node = sxe_get_element_by_offset(sxe, Z_IVAL_P(member), node, NULL); if (node) { xmlUnlinkNode(node); php_libxml_node_free_resource(node TSRMLS_CC); @@ -1770,8 +1770,8 @@ static int cast_object(zval *object, int type, char *contents TSRMLS_DC) case _IS_BOOL: convert_to_boolean(object); break; - case IS_LONG: - convert_to_long(object); + case IS_INT: + convert_to_int(object); break; case IS_DOUBLE: convert_to_double(object); @@ -1864,7 +1864,7 @@ SXE_METHOD(__toString) } /* }}} */ -static int php_sxe_count_elements_helper(php_sxe_object *sxe, long *count TSRMLS_DC) /* {{{ */ +static int php_sxe_count_elements_helper(php_sxe_object *sxe, php_int_t *count TSRMLS_DC) /* {{{ */ { xmlNodePtr node; zval data; @@ -1891,7 +1891,7 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, long *count TSRMLS } /* }}} */ -static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +static int sxe_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { php_sxe_object *intern; intern = Z_SXEOBJ_P(object); @@ -1903,8 +1903,8 @@ static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ zval_ptr_dtor(&intern->tmp); } ZVAL_ZVAL(&intern->tmp, &rv, 0, 0); - convert_to_long(&intern->tmp); - *count = (long)Z_LVAL(intern->tmp); + convert_to_int(&intern->tmp); + *count = (php_int_t)Z_IVAL(intern->tmp); return SUCCESS; } return FAILURE; @@ -1917,7 +1917,7 @@ static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ Get number of child elements */ SXE_METHOD(count) { - long count = 0; + php_int_t count = 0; php_sxe_object *sxe = Z_SXEOBJ_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -1926,7 +1926,7 @@ SXE_METHOD(count) php_sxe_count_elements_helper(sxe, &count TSRMLS_CC); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -2118,11 +2118,11 @@ PHP_FUNCTION(simplexml_load_file) xmlDocPtr docp; char *ns = NULL; int ns_len = 0; - long options = 0; + php_int_t options = 0; zend_class_entry *ce= sxe_class_entry; zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|C!isb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { return; } @@ -2155,11 +2155,11 @@ PHP_FUNCTION(simplexml_load_string) xmlDocPtr docp; char *ns = NULL; int ns_len = 0; - long options = 0; + php_int_t options = 0; zend_class_entry *ce= sxe_class_entry; zend_bool isprefix = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!isb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) { return; } @@ -2190,12 +2190,12 @@ SXE_METHOD(__construct) char *data, *ns = NULL; int data_len, ns_len = 0; xmlDocPtr docp; - long options = 0; + php_int_t options = 0; zend_bool is_url = 0, isprefix = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ibsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h index d0ba6f04ab..bd0b272777 100644 --- a/ext/skeleton/php_skeleton.h +++ b/ext/skeleton/php_skeleton.h @@ -25,7 +25,7 @@ extern zend_module_entry extname_module_entry; and END macros here: ZEND_BEGIN_MODULE_GLOBALS(extname) - long global_value; + php_int_t global_value; char *global_string; ZEND_END_MODULE_GLOBALS(extname) */ diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h index 50bd272204..a3293e370f 100644 --- a/ext/snmp/php_snmp.h +++ b/ext/snmp/php_snmp.h @@ -132,8 +132,8 @@ ZEND_END_MODULE_GLOBALS(snmp) #define SNMP_G(v) (snmp_globals.v) #endif -#define REGISTER_SNMP_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(php_snmp_ce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_SNMP_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(php_snmp_ce, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); #else diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 3afa0af9f1..2d6afc43d4 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -376,8 +376,8 @@ struct objid_query { int count; int offset; int step; - long non_repeaters; - long max_repetitions; + php_int_t non_repeaters; + php_int_t max_repetitions; int valueretrieval; int array_output; int oid_increasing_check; @@ -680,7 +680,7 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval TSRMLS_D if (valueretrieval & SNMP_VALUE_OBJECT) { object_init(snmpval); - add_property_long(snmpval, "type", vars->type); + add_property_int(snmpval, "type", vars->type); add_property_zval(snmpval, "value", &val); } else { ZVAL_COPY(snmpval, &val); @@ -1014,8 +1014,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu objid_query->vars[objid_query->count].oid = Z_STRVAL_P(oid); if (st & SNMP_CMD_SET) { if (Z_TYPE_P(type) == IS_STRING && Z_TYPE_P(value) == IS_STRING) { - if (Z_STRLEN_P(type) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRLEN_P(type)); + if (Z_STRSIZE_P(type) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bogus type '%s', should be single char, got %u", Z_STRVAL_P(type), Z_STRSIZE_P(type)); efree(objid_query->vars); return FALSE; } @@ -1054,8 +1054,8 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu } else if (Z_TYPE_P(type) == IS_ARRAY) { if ((tmp_type = zend_hash_get_current_data_ex(Z_ARRVAL_P(type), &pos_type)) != NULL) { convert_to_string_ex(tmp_type); - if (Z_STRLEN_P(tmp_type) != 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRLEN_P(tmp_type)); + if (Z_STRSIZE_P(tmp_type) != 1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s': bogus type '%s', should be single char, got %u", Z_STRVAL_P(tmp_oid), Z_STRVAL_P(tmp_type), Z_STRSIZE_P(tmp_type)); efree(objid_query->vars); return FALSE; } @@ -1429,8 +1429,8 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) char *a1, *a2, *a3, *a4, *a5, *a6, *a7; int a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len; zend_bool use_orignames = 0, suffix_keys = 0; - long timeout = SNMP_DEFAULT_TIMEOUT; - long retries = SNMP_DEFAULT_RETRIES; + php_int_t timeout = SNMP_DEFAULT_TIMEOUT; + php_int_t retries = SNMP_DEFAULT_RETRIES; int argc = ZEND_NUM_ARGS(); struct objid_query objid_query; php_snmp_session *session; @@ -1446,7 +1446,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) if (session_less_mode) { if (version == SNMP_VERSION_3) { if (st & SNMP_CMD_SET) { - if (zend_parse_parameters(argc TSRMLS_CC, "ssssssszzz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, + if (zend_parse_parameters(argc TSRMLS_CC, "ssssssszzz|ii", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, &a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &type, &value, &timeout, &retries) == FAILURE) { RETURN_FALSE; } @@ -1455,14 +1455,14 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) * SNMP_CMD_GETNEXT * SNMP_CMD_WALK */ - if (zend_parse_parameters(argc TSRMLS_CC, "sssssssz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, + if (zend_parse_parameters(argc TSRMLS_CC, "sssssssz|ii", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, &a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &timeout, &retries) == FAILURE) { RETURN_FALSE; } } } else { if (st & SNMP_CMD_SET) { - if (zend_parse_parameters(argc TSRMLS_CC, "sszzz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "sszzz|ii", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) { RETURN_FALSE; } } else { @@ -1470,7 +1470,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) * SNMP_CMD_GETNEXT * SNMP_CMD_WALK */ - if (zend_parse_parameters(argc TSRMLS_CC, "ssz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ssz|ii", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) { RETURN_FALSE; } } @@ -1481,7 +1481,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version) RETURN_FALSE; } } else if (st & SNMP_CMD_WALK) { - if (zend_parse_parameters(argc TSRMLS_CC, "z|bll", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "z|bii", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) { RETURN_FALSE; } if (suffix_keys) { @@ -1619,9 +1619,9 @@ PHP_FUNCTION(snmp_get_quick_print) Return all objects including their respective object id withing the specified one */ PHP_FUNCTION(snmp_set_quick_print) { - long a1; + php_int_t a1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) { RETURN_FALSE; } @@ -1634,9 +1634,9 @@ PHP_FUNCTION(snmp_set_quick_print) Return all values that are enums with their enum value instead of the raw integer */ PHP_FUNCTION(snmp_set_enum_print) { - long a1; + php_int_t a1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) { RETURN_FALSE; } @@ -1649,9 +1649,9 @@ PHP_FUNCTION(snmp_set_enum_print) Set the OID output format. */ PHP_FUNCTION(snmp_set_oid_output_format) { - long a1; + php_int_t a1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &a1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &a1) == FAILURE) { RETURN_FALSE; } @@ -1757,9 +1757,9 @@ PHP_FUNCTION(snmp3_set) Specify the method how the SNMP values will be returned */ PHP_FUNCTION(snmp_set_valueretrieval) { - long method; + php_int_t method; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &method) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &method) == FAILURE) { RETURN_FALSE; } @@ -1767,7 +1767,7 @@ PHP_FUNCTION(snmp_set_valueretrieval) SNMP_G(valueretrieval) = method; RETURN_TRUE; } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%ld'", method); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%pd'", method); RETURN_FALSE; } } @@ -1781,7 +1781,7 @@ PHP_FUNCTION(snmp_get_valueretrieval) RETURN_FALSE; } - RETURN_LONG(SNMP_G(valueretrieval)); + RETURN_INT(SNMP_G(valueretrieval)); } /* }}} */ @@ -1813,16 +1813,16 @@ PHP_METHOD(snmp, __construct) zval *object = getThis(); char *a1, *a2; int a1_len, a2_len; - long timeout = SNMP_DEFAULT_TIMEOUT; - long retries = SNMP_DEFAULT_RETRIES; - long version = SNMP_DEFAULT_VERSION; + php_int_t timeout = SNMP_DEFAULT_TIMEOUT; + php_int_t retries = SNMP_DEFAULT_RETRIES; + php_int_t version = SNMP_DEFAULT_VERSION; int argc = ZEND_NUM_ARGS(); zend_error_handling error_handling; snmp_object = Z_SNMP_P(object); zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(argc TSRMLS_CC, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "iss|ii", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1942,7 +1942,7 @@ PHP_METHOD(snmp, getErrno) snmp_object = Z_SNMP_P(object); - RETVAL_LONG(snmp_object->snmp_errno); + RETVAL_INT(snmp_object->snmp_errno); return; } /* }}} */ @@ -2097,7 +2097,7 @@ static HashTable *php_snmp_get_properties(zval *object TSRMLS_DC) HashTable *props; zval rv; zend_string *key; - ulong num_key; + php_uint_t num_key; obj = Z_SNMP_P(object); props = zend_std_get_properties(object TSRMLS_CC); @@ -2127,13 +2127,13 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_ ZVAL_STRINGL(&val, snmp_object->session->peername, strlen(snmp_object->session->peername)); add_assoc_zval(retval, "hostname", &val); - ZVAL_LONG(&val, snmp_object->session->remote_port); + ZVAL_INT(&val, snmp_object->session->remote_port); add_assoc_zval(retval, "port", &val); - ZVAL_LONG(&val, snmp_object->session->timeout); + ZVAL_INT(&val, snmp_object->session->timeout); add_assoc_zval(retval, "timeout", &val); - ZVAL_LONG(&val, snmp_object->session->retries); + ZVAL_INT(&val, snmp_object->session->retries); add_assoc_zval(retval, "retries", &val); return SUCCESS; @@ -2144,7 +2144,7 @@ static int php_snmp_read_info(php_snmp_object *snmp_object, zval *retval TSRMLS_ static int php_snmp_read_max_oids(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) { if (snmp_object->max_oids > 0) { - ZVAL_LONG(retval, snmp_object->max_oids); + ZVAL_INT(retval, snmp_object->max_oids); } else { ZVAL_NULL(retval); } @@ -2163,16 +2163,16 @@ PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(oid_increasing_check) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(quick_print) PHP_SNMP_BOOL_PROPERTY_READER_FUNCTION(enum_print) -#define PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(name) \ +#define PHP_SNMP_INT_PROPERTY_READER_FUNCTION(name) \ static int php_snmp_read_##name(php_snmp_object *snmp_object, zval *retval TSRMLS_DC) \ { \ - ZVAL_LONG(retval, snmp_object->name); \ + ZVAL_INT(retval, snmp_object->name); \ return SUCCESS; \ } -PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(valueretrieval) -PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(oid_output_format) -PHP_SNMP_LONG_PROPERTY_READER_FUNCTION(exceptions_enabled) +PHP_SNMP_INT_PROPERTY_READER_FUNCTION(valueretrieval) +PHP_SNMP_INT_PROPERTY_READER_FUNCTION(oid_output_format) +PHP_SNMP_INT_PROPERTY_READER_FUNCTION(exceptions_enabled) /* {{{ */ static int php_snmp_write_info(php_snmp_object *snmp_object, zval *newval TSRMLS_DC) @@ -2193,17 +2193,17 @@ static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval TS return ret; } - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ztmp = *newval; zval_copy_ctor(&ztmp); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - if (Z_LVAL_P(newval) > 0) { - snmp_object->max_oids = Z_LVAL_P(newval); + if (Z_IVAL_P(newval) > 0) { + snmp_object->max_oids = Z_IVAL_P(newval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %ld", Z_LVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_IVAL_P(newval)); } if (newval == &ztmp) { @@ -2220,17 +2220,17 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ztmp = *newval; zval_copy_ctor(&ztmp); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - if (Z_LVAL_P(newval) >= 0 && Z_LVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) { - snmp_object->valueretrieval = Z_LVAL_P(newval); + if (Z_IVAL_P(newval) >= 0 && Z_IVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) { + snmp_object->valueretrieval = Z_IVAL_P(newval); } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%ld'", Z_LVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP value retrieval method '%pd'", Z_IVAL_P(newval)); ret = FAILURE; } @@ -2264,23 +2264,23 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval * { zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ZVAL_COPY(&ztmp, newval); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - switch(Z_LVAL_P(newval)) { + switch(Z_IVAL_P(newval)) { case NETSNMP_OID_OUTPUT_SUFFIX: case NETSNMP_OID_OUTPUT_MODULE: case NETSNMP_OID_OUTPUT_FULL: case NETSNMP_OID_OUTPUT_NUMERIC: case NETSNMP_OID_OUTPUT_UCD: case NETSNMP_OID_OUTPUT_NONE: - snmp_object->oid_output_format = Z_LVAL_P(newval); + snmp_object->oid_output_format = Z_IVAL_P(newval); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%ld'", Z_LVAL_P(newval)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown SNMP output print format '%pd'", Z_IVAL_P(newval)); ret = FAILURE; break; } @@ -2297,13 +2297,13 @@ static int php_snmp_write_exceptions_enabled(php_snmp_object *snmp_object, zval { zval ztmp; int ret = SUCCESS; - if (Z_TYPE_P(newval) != IS_LONG) { + if (Z_TYPE_P(newval) != IS_INT) { ZVAL_COPY(&ztmp, newval); - convert_to_long(&ztmp); + convert_to_int(&ztmp); newval = &ztmp; } - snmp_object->exceptions_enabled = Z_LVAL_P(newval); + snmp_object->exceptions_enabled = Z_IVAL_P(newval); if (newval == &ztmp) { zval_ptr_dtor(newval); @@ -2391,43 +2391,43 @@ PHP_MINIT_FUNCTION(snmp) zend_hash_init(&php_snmp_properties, 0, NULL, free_php_snmp_properties, 1); PHP_SNMP_ADD_PROPERTIES(&php_snmp_properties, php_snmp_property_entries); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT); - - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_1", SNMP_VERSION_1); - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2c", SNMP_VERSION_2c); - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2C", SNMP_VERSION_2c); - REGISTER_SNMP_CLASS_CONST_LONG("VERSION_3", SNMP_VERSION_3); - - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ANY", PHP_SNMP_ERRNO_ANY); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR); - REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT); + + REGISTER_SNMP_CLASS_CONST_INT("VERSION_1", SNMP_VERSION_1); + REGISTER_SNMP_CLASS_CONST_INT("VERSION_2c", SNMP_VERSION_2c); + REGISTER_SNMP_CLASS_CONST_INT("VERSION_2C", SNMP_VERSION_2c); + REGISTER_SNMP_CLASS_CONST_INT("VERSION_3", SNMP_VERSION_3); + + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ANY", PHP_SNMP_ERRNO_ANY); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR); + REGISTER_SNMP_CLASS_CONST_INT("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES); /* Register SNMPException class */ INIT_CLASS_ENTRY(cex, "SNMPException", NULL); diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 8aeab65a1b..97b619d359 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -145,7 +145,7 @@ encode defaultEncoding[] = { {{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null}, {{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string}, - {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, + {{IS_INT, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long}, {{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double}, {{IS_FALSE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool}, {{IS_TRUE, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool}, @@ -290,7 +290,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { if (Z_TYPE_P(data) == IS_OBJECT) { data = (zval*)Z_OBJ_P(data); } - if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (ulong)data)) != NULL) { + if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (php_uint_t)data)) != NULL) { xmlAttrPtr attr = node_ptr->properties; char *id; smart_str prefix = {0}; @@ -317,7 +317,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); - smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref)); + smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref)); smart_str_0(&prefix); id = prefix.s->val; xmlSetProp(node_ptr, BAD_CAST("id"), BAD_CAST(id+1)); @@ -334,7 +334,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { } else { SOAP_GLOBAL(cur_uniq_ref)++; smart_str_appendl(&prefix, "#ref", 4); - smart_str_append_long(&prefix, SOAP_GLOBAL(cur_uniq_ref)); + smart_str_append_int(&prefix, SOAP_GLOBAL(cur_uniq_ref)); smart_str_0(&prefix); id = prefix.s->val; set_ns_prop(node_ptr, SOAP_1_2_ENC_NAMESPACE, "id", id+1); @@ -344,7 +344,7 @@ static zend_bool soap_check_zval_ref(zval *data, xmlNodePtr node TSRMLS_DC) { smart_str_free(&prefix); return 1; } else { - zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (ulong)data, node); + zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (php_uint_t)data, node); } } return 0; @@ -355,7 +355,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC) zval *data_ptr; if (SOAP_GLOBAL(ref_map)) { - if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (ulong)node)) != NULL) { + if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (php_uint_t)node)) != NULL) { if (!Z_REFCOUNTED_P(data) || !Z_REFCOUNTED_P(data_ptr) || Z_COUNTED_P(data) != Z_COUNTED_P(data_ptr)) { @@ -371,7 +371,7 @@ static zend_bool soap_check_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC) static void soap_add_xml_ref(zval *data, xmlNodePtr node TSRMLS_DC) { if (SOAP_GLOBAL(ref_map)) { - zend_hash_index_update(SOAP_GLOBAL(ref_map), (ulong)node, data); + zend_hash_index_update(SOAP_GLOBAL(ref_map), (php_uint_t)node, data); } } @@ -397,23 +397,23 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_P(zns), Z_STRVAL_P(zstype)); } else { zns = NULL; - enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRLEN_P(zstype)); + enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype)); } if (enc == NULL && SOAP_GLOBAL(typemap)) { smart_str nscat = {0}; if (zns != NULL) { - smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRLEN_P(zns)); + smart_str_appendl(&nscat, Z_STRVAL_P(zns), Z_STRSIZE_P(zns)); smart_str_appendc(&nscat, ':'); } - smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRLEN_P(zstype)); + smart_str_appendl(&nscat, Z_STRVAL_P(zstype), Z_STRSIZE_P(zstype)); smart_str_0(&nscat); enc = zend_hash_find_ptr(SOAP_GLOBAL(typemap), nscat.s); smart_str_free(&nscat); } } if (enc == NULL) { - enc = get_conversion(Z_LVAL_P(ztype)); + enc = get_conversion(Z_IVAL_P(ztype)); } if (enc == NULL) { enc = encode; @@ -449,7 +449,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml ZEND_HASH_FOREACH_STR_KEY_VAL(SOAP_GLOBAL(class_map), type_name, tmp) { if (Z_TYPE_P(tmp) == IS_STRING && - ce->name->len == Z_STRLEN_P(tmp) && + ce->name->len == Z_STRSIZE_P(tmp) && zend_binary_strncasecmp(ce->name->val, ce->name->len, Z_STRVAL_P(tmp), ce->name->len, ce->name->len) == 0 && type_name) { @@ -600,7 +600,7 @@ xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr par soap_error0(E_ERROR, "Encoding: Error calling to_xml callback"); } if (Z_TYPE(return_value) == IS_STRING) { - xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRLEN(return_value)); + xmlDocPtr doc = soap_xmlParseMemory(Z_STRVAL(return_value), Z_STRSIZE(return_value)); if (doc && doc->children) { ret = xmlDocCopyNode(doc->children, parent->doc, 1); } @@ -831,15 +831,15 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) == IS_STRING) { - str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)); - new_len = Z_STRLEN_P(data); + str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data)); + new_len = Z_STRSIZE_P(data); } else { zval tmp = *data; zval_copy_ctor(&tmp); convert_to_string(&tmp); - str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); - new_len = Z_STRLEN(tmp); + str = estrndup(Z_STRVAL(tmp), Z_STRSIZE(tmp)); + new_len = Z_STRSIZE(tmp); zval_dtor(&tmp); } @@ -918,7 +918,7 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo FIND_ZVAL_NULL(data, ret, style); if (Z_TYPE_P(data) == IS_STRING) { - str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRLEN_P(data)); + str = php_base64_encode((unsigned char*)Z_STRVAL_P(data), Z_STRSIZE_P(data)); text = xmlNewTextLen(BAD_CAST(str->val), str->len); xmlAddChild(ret, text); STR_RELEASE(str); @@ -927,7 +927,7 @@ static xmlNodePtr to_xml_base64(encodeTypePtr type, zval *data, int style, xmlNo ZVAL_DUP(&tmp, data); convert_to_string(&tmp); - str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRLEN(tmp)); + str = php_base64_encode((unsigned char*)Z_STRVAL(tmp), Z_STRSIZE(tmp)); text = xmlNewTextLen(BAD_CAST(str->val), str->len); xmlAddChild(ret, text); STR_RELEASE(str); @@ -958,15 +958,15 @@ static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNo convert_to_string(&tmp); data = &tmp; } - str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1); + str = (unsigned char *) safe_emalloc(Z_STRSIZE_P(data) * 2, sizeof(char), 1); - for (i = j = 0; i < Z_STRLEN_P(data); i++) { + for (i = j = 0; i < Z_STRSIZE_P(data); i++) { str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4]; str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15]; } str[j] = '\0'; - text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char)); + text = xmlNewTextLen(str, Z_STRSIZE_P(data) * 2 * sizeof(char)); xmlAddChild(ret, text); efree(str); if (data == &tmp) { @@ -986,12 +986,12 @@ static zval *to_zval_double(zval *ret, encodeTypePtr type, xmlNodePtr data TSRML if (data && data->children) { if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) { - long lval; + php_int_t lval; double dval; whiteSpace_collapse(data->children->content); switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) { - case IS_LONG: + case IS_INT: ZVAL_DOUBLE(ret, lval); break; case IS_DOUBLE: @@ -1024,15 +1024,15 @@ static zval *to_zval_long(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_ if (data && data->children) { if (data->children->type == XML_TEXT_NODE && data->children->next == NULL) { - long lval; + php_int_t lval; double dval; whiteSpace_collapse(data->children->content); errno = 0; switch (is_numeric_string((char*)data->children->content, strlen((char*)data->children->content), &lval, &dval, 0)) { - case IS_LONG: - ZVAL_LONG(ret, lval); + case IS_INT: + ZVAL_INT(ret, lval); break; case IS_DOUBLE: ZVAL_DOUBLE(ret, dval); @@ -1066,11 +1066,11 @@ static xmlNodePtr to_xml_long(encodeTypePtr type, zval *data, int style, xmlNode zval tmp = *data; zval_copy_ctor(&tmp); - if (Z_TYPE(tmp) != IS_LONG) { - convert_to_long(&tmp); + if (Z_TYPE(tmp) != IS_INT) { + convert_to_int(&tmp); } convert_to_string(&tmp); - xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp)); + xmlNodeSetContentLen(ret, BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp)); zval_dtor(&tmp); } @@ -2347,10 +2347,10 @@ iterator_done: } } - smart_str_append_long(&array_size, dims[0]); + smart_str_append_int(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_long(&array_size, dims[i]); + smart_str_append_int(&array_size, dims[i]); } efree(value); @@ -2375,15 +2375,15 @@ iterator_done: dims = get_position_12(dimension, ext->val); if (dims[0] == 0) {dims[0] = i;} - smart_str_append_long(&array_size, dims[0]); + smart_str_append_int(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_long(&array_size, dims[i]); + smart_str_append_int(&array_size, dims[i]); } } else { dims = emalloc(sizeof(int)); *dims = 0; - smart_str_append_long(&array_size, i); + smart_str_append_int(&array_size, i); } } else if (sdl_type && sdl_type->attributes && @@ -2395,10 +2395,10 @@ iterator_done: dims = get_position_12(dimension, ext->val); if (dims[0] == 0) {dims[0] = i;} - smart_str_append_long(&array_size, dims[0]); + smart_str_append_int(&array_size, dims[0]); for (i=1; i<dimension; i++) { smart_str_appendc(&array_size, ','); - smart_str_append_long(&array_size, dims[i]); + smart_str_append_int(&array_size, dims[i]); } if (sdl_type && sdl_type->elements && @@ -2422,14 +2422,14 @@ iterator_done: enc = elementType->encode; get_type_str(xmlParam, elementType->encode->details.ns, elementType->encode->details.type_str, &array_type); - smart_str_append_long(&array_size, i); + smart_str_append_int(&array_size, i); dims = safe_emalloc(sizeof(int), dimension, 0); dims[0] = i; } else { enc = get_array_type(xmlParam, data, &array_type TSRMLS_CC); - smart_str_append_long(&array_size, i); + smart_str_append_int(&array_size, i); dims = safe_emalloc(sizeof(int), dimension, 0); dims[0] = i; } @@ -2689,7 +2689,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP { zval *temp_data; zend_string *key_val; - ulong int_val; + php_uint_t int_val; xmlNodePtr xmlParam; xmlNodePtr xparam, item; xmlNodePtr key; @@ -2712,7 +2712,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP xmlNodeSetContent(key, BAD_CAST(key_val->val)); } else { smart_str tmp = {0}; - smart_str_append_long(&tmp, int_val); + smart_str_append_int(&tmp, int_val); smart_str_0(&tmp); if (style == SOAP_ENCODED) { @@ -2765,8 +2765,8 @@ static zval *to_zval_map(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_D if (Z_TYPE(key) == IS_STRING) { zend_symtable_update(Z_ARRVAL_P(ret), Z_STR(key), &value); - } else if (Z_TYPE(key) == IS_LONG) { - zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL(key), &value); + } else if (Z_TYPE(key) == IS_INT) { + zend_hash_index_update(Z_ARRVAL_P(ret), Z_IVAL(key), &value); } else { soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowd as keys"); } @@ -2863,7 +2863,7 @@ static zval *guess_zval_convert(zval *ret, encodeTypePtr type, xmlNodePtr data T xmlNsPtr nsptr; object_init_ex(&soapvar, soap_var_class_entry); - add_property_long(&soapvar, "enc_type", enc->details.type); + add_property_int(&soapvar, "enc_type", enc->details.type); Z_DELREF_P(ret); add_property_zval(&soapvar, "enc_value", ret); parse_namespace(type_name, &cptype, &ns); @@ -2896,12 +2896,12 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma xmlAddChild(parent, xmlParam); FIND_ZVAL_NULL(data, xmlParam, style); - if (Z_TYPE_P(data) == IS_LONG) { - timestamp = Z_LVAL_P(data); + if (Z_TYPE_P(data) == IS_INT) { + timestamp = Z_IVAL_P(data); ta = php_localtime_r(×tamp, &tmbuf); /*ta = php_gmtime_r(×tamp, &tmbuf);*/ if (!ta) { - soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_LVAL_P(data)); + soap_error1(E_ERROR, "Encoding: Invalid timestamp %ld", Z_IVAL_P(data)); } buf = (char *) emalloc(buf_len); @@ -2935,7 +2935,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma xmlNodeSetContent(xmlParam, BAD_CAST(buf)); efree(buf); } else if (Z_TYPE_P(data) == IS_STRING) { - xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data)); + xmlNodeSetContentLen(xmlParam, BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data)); } if (style == SOAP_ENCODED) { @@ -3043,7 +3043,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP convert_to_string(&tmp); data = &tmp; } - str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data)); + str = estrndup(Z_STRVAL_P(data), Z_STRSIZE_P(data)); whiteSpace_collapse(BAD_CAST(str)); start = str; while (start != NULL && *start != '\0') { @@ -3144,13 +3144,13 @@ static xmlNodePtr to_xml_any(encodeTypePtr type, zval *data, int style, xmlNodeP return ret; } if (Z_TYPE_P(data) == IS_STRING) { - ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRLEN_P(data)); + ret = xmlNewTextLen(BAD_CAST(Z_STRVAL_P(data)), Z_STRSIZE_P(data)); } else { zval tmp = *data; zval_copy_ctor(&tmp); convert_to_string(&tmp); - ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRLEN(tmp)); + ret = xmlNewTextLen(BAD_CAST(Z_STRVAL(tmp)), Z_STRSIZE(tmp)); zval_dtor(&tmp); } @@ -3251,20 +3251,20 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo if (type) { if (type->restrictions && Z_TYPE_P(data) == IS_STRING) { if (type->restrictions->enumeration) { - if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) { + if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRSIZE_P(data)+1)) { soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data)); } } if (type->restrictions->minLength && - Z_STRLEN_P(data) < type->restrictions->minLength->value) { + Z_STRSIZE_P(data) < type->restrictions->minLength->value) { soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'"); } if (type->restrictions->maxLength && - Z_STRLEN_P(data) > type->restrictions->maxLength->value) { + Z_STRSIZE_P(data) > type->restrictions->maxLength->value) { soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'"); } if (type->restrictions->length && - Z_STRLEN_P(data) != type->restrictions->length->value) { + Z_STRSIZE_P(data) != type->restrictions->length->value) { soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); } } @@ -3426,7 +3426,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns) while (1) { smart_str_appendl(&prefix, "ns", 2); - smart_str_append_long(&prefix, num); + smart_str_append_int(&prefix, num); smart_str_0(&prefix); if (xmlSearchNs(node->doc, node, BAD_CAST(prefix.s->val)) == NULL) { break; @@ -3498,7 +3498,7 @@ encodePtr get_conversion(int encode) static int is_map(zval *array) { - ulong index; + php_uint_t index; zend_string *key; int i = 0; @@ -3536,7 +3536,7 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type TS if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL) { soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property"); } - cur_type = Z_LVAL_P(ztype); + cur_type = Z_IVAL_P(ztype); if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL) { cur_stype = Z_STRVAL_P(ztype); diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index bb2a6c7a53..0935ce36ad 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -40,10 +40,10 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); @@ -67,10 +67,10 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC) zend_string* buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); @@ -95,7 +95,7 @@ void http_context_headers(php_stream_context* context, if (context && (tmp = php_stream_context_get_option(context, "http", "header")) != NULL && - Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp)) { + Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp)) { char *s = Z_STRVAL_P(tmp); char *p; int name_len; @@ -161,7 +161,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph char *host; char *name; char *protocol; - long namelen; + php_int_t namelen; int port; int old_error_reporting; struct timeval tv; @@ -170,17 +170,17 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL && Z_TYPE_P(proxy_host) == IS_STRING && (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL && - Z_TYPE_P(proxy_port) == IS_LONG) { + Z_TYPE_P(proxy_port) == IS_INT) { host = Z_STRVAL_P(proxy_host); - port = Z_LVAL_P(proxy_port); + port = Z_IVAL_P(proxy_port); *use_proxy = 1; } else { host = phpurl->host; port = phpurl->port; } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) { - tv.tv_sec = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) > 0) { + tv.tv_sec = Z_IVAL_P(tmp); tv.tv_usec = 0; timeout = &tv; } @@ -191,9 +191,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph /* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */ if (use_ssl && !*use_proxy) { if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { + Z_TYPE_P(tmp) == IS_INT) { /* uses constants declared in soap.c to determine ssl uri protocol */ - switch (Z_LVAL_P(tmp)) { + switch (Z_IVAL_P(tmp)) { case SOAP_SSL_METHOD_TLS: protocol = "tls"; break; @@ -274,8 +274,8 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph proper encrypyion method based on constants defined in soap.c */ int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - switch (Z_LVAL_P(tmp)) { + Z_TYPE_P(tmp) == IS_INT) { + switch (Z_IVAL_P(tmp)) { case SOAP_SSL_METHOD_TLS: crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; break; @@ -347,7 +347,7 @@ int make_http_soap_request(zval *this_ptr, int http_1_1; int http_status; int content_type_xml = 0; - long redirect_max = 20; + php_int_t redirect_max = 20; char *content_encoding; char *http_msg = NULL; zend_bool old_allow_url_fopen; @@ -363,13 +363,13 @@ int make_http_soap_request(zval *this_ptr, request = buf; request_size = buf_size; /* Compress request */ - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { - int level = Z_LVAL_P(tmp) & 0x0f; - int kind = Z_LVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE; + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) { + int level = Z_IVAL_P(tmp) & 0x0f; + int kind = Z_IVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE; if (level > 9) {level = 9;} - if ((Z_LVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { + if ((Z_IVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n"); } if (level > 0) { @@ -379,7 +379,7 @@ int make_http_soap_request(zval *this_ptr, int n; ZVAL_STRINGL(¶ms[0], buf, buf_size); - ZVAL_LONG(¶ms[1], level); + ZVAL_INT(¶ms[1], level); if (kind == SOAP_COMPRESSION_DEFLATE) { n = 2; ZVAL_STRING(&func, "gzcompress"); @@ -388,7 +388,7 @@ int make_http_soap_request(zval *this_ptr, n = 3; ZVAL_STRING(&func, "gzencode"); smart_str_append_const(&soap_headers_z,"Content-Encoding: gzip\r\n"); - ZVAL_LONG(¶ms[2], 0x1f); + ZVAL_INT(¶ms[2], 0x1f); } if (call_user_function(CG(function_table), (zval*)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS && Z_TYPE(retval) == IS_STRING) { @@ -396,7 +396,7 @@ int make_http_soap_request(zval *this_ptr, zval_ptr_dtor(&func); // TODO: free retval ??? request = Z_STRVAL(retval); - request_size = Z_STRLEN(retval); + request_size = Z_STRSIZE(retval); } else { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); @@ -409,8 +409,8 @@ int make_http_soap_request(zval *this_ptr, if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1)) != NULL) { php_stream_from_zval_no_verify(stream,tmp); - if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { - use_proxy = Z_LVAL_P(tmp); + if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_INT) { + use_proxy = Z_IVAL_P(tmp); } } else { stream = NULL; @@ -427,9 +427,9 @@ int make_http_soap_request(zval *this_ptr, if (context && (tmp = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) { - if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &redirect_max, NULL, 1)) { - if (Z_TYPE_P(tmp) == IS_LONG) - redirect_max = Z_LVAL_P(tmp); + if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), &redirect_max, NULL, 1)) { + if (Z_TYPE_P(tmp) == IS_INT) + redirect_max = Z_IVAL_P(tmp); } } @@ -504,7 +504,7 @@ try_again: if (stream) { php_stream_auto_cleanup(stream); add_property_resource(this_ptr, "httpsocket", stream->res); - add_property_long(this_ptr, "_use_proxy", use_proxy); + add_property_int(this_ptr, "_use_proxy", use_proxy); } else { php_url_free(phpurl); if (request != buf) {efree(request);} @@ -566,7 +566,7 @@ try_again: } if (!http_1_1 || ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL && - Z_LVAL_P(tmp) == 0)) { + Z_IVAL_P(tmp) == 0)) { smart_str_append_const(&soap_headers, "\r\n" "Connection: close\r\n"); } else { @@ -575,17 +575,17 @@ try_again: } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - if (Z_STRLEN_P(tmp) > 0) { + if (Z_STRSIZE_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (context && (tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - if (Z_STRLEN_P(tmp) > 0) { + if (Z_STRSIZE_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (FG(user_agent)) { @@ -615,7 +615,7 @@ try_again: } } smart_str_append_const(&soap_headers,"Content-Length: "); - smart_str_append_long(&soap_headers, request_size); + smart_str_append_int(&soap_headers, request_size); smart_str_append_const(&soap_headers, "\r\n"); /* HTTP Authentication */ @@ -637,38 +637,38 @@ try_again: make_digest(cnonce, hash); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - Z_LVAL_P(tmp)++; - snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT) { + Z_IVAL_P(tmp)++; + snprintf(nc, sizeof(nc), "%08ld", Z_IVAL_P(tmp)); } else { - add_assoc_long(digest, "nc", 1); + add_assoc_int(digest, "nc", 1); strcpy(nc, "00000001"); } PHP_MD5Init(&md5ctx); - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRLEN_P(login)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRSIZE_P(login)); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRLEN_P(password)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRSIZE_P(password)); } PHP_MD5Final(hash, &md5ctx); make_digest(HA1, hash); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING && - Z_STRLEN_P(tmp) == sizeof("md5-sess")-1 && + Z_STRSIZE_P(tmp) == sizeof("md5-sess")-1 && stricmp(Z_STRVAL_P(tmp), "md5-sess") == 0) { PHP_MD5Init(&md5ctx); PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32); PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8); @@ -692,7 +692,7 @@ try_again: /* if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING && - Z_STRLEN_PP(tmp) == sizeof("auth-int")-1 && + Z_STRSIZE_PP(tmp) == sizeof("auth-int")-1 && stricmp(Z_STRVAL_PP(tmp), "auth-int") == 0) { PHP_MD5Update(&md5ctx, ":", 1); PHP_MD5Update(&md5ctx, HEntity, HASHHEXLEN); @@ -706,7 +706,7 @@ try_again: PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } PHP_MD5Update(&md5ctx, (unsigned char*)":", 1); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL && @@ -724,16 +724,16 @@ try_again: make_digest(response, hash); smart_str_append_const(&soap_headers, "Authorization: Digest username=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRSIZE_P(login)); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", realm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", nonce=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } smart_str_append_const(&soap_headers, "\", uri=\""); if (phpurl->path) { @@ -763,12 +763,12 @@ try_again: if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", opaque=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", algorithm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } smart_str_append_const(&soap_headers, "\"\r\n"); } @@ -776,11 +776,11 @@ try_again: zend_string *buf; smart_str auth = {0}; - smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRSIZE_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { - smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); + smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRSIZE_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len); @@ -819,13 +819,13 @@ try_again: Z_TYPE_P(value) == IS_STRING) { zval *tmp; if (((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 1)) == NULL || - strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) && + strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRSIZE_P(tmp)) == 0) && ((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 2)) == NULL || in_domain(phpurl->host,Z_STRVAL_P(tmp))) && (use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) { smart_str_appendl(&soap_headers, key->val, key->len); smart_str_appendc(&soap_headers, '='); - smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRLEN_P(value)); + smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRSIZE_P(value)); smart_str_appendc(&soap_headers, ';'); } } @@ -841,7 +841,7 @@ try_again: smart_str_append_const(&soap_headers, "\r\n"); smart_str_0(&soap_headers); if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len); } smart_str_appendl(&soap_headers, request, request_size); @@ -886,7 +886,7 @@ try_again: } if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size); } @@ -1283,9 +1283,9 @@ try_again: if (http_status >= 400) { int error = 0; - if (Z_STRLEN_P(return_value) == 0) { + if (Z_STRSIZE_P(return_value) == 0) { error = 1; - } else if (Z_STRLEN_P(return_value) > 0) { + } else if (Z_STRSIZE_P(return_value) > 0) { if (!content_type_xml) { char *s = Z_STRVAL_P(return_value); diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c index 5ba3bd3de5..9145390ca3 100644 --- a/ext/soap/php_schema.c +++ b/ext/soap/php_schema.c @@ -460,7 +460,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? newType->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -558,7 +558,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? newType->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -1931,7 +1931,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl smart_str anonymous = {0}; smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1); - smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types)); + smart_str_append_int(&anonymous, zend_hash_num_elements(sdl->types)); smart_str_0(&anonymous); // TODO: avoid reallocation ??? dummy_type->name = estrndup(anonymous.s->val, anonymous.s->len); @@ -2169,7 +2169,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT zend_hash_move_forward(tmp->attributes); } else { - ulong index; + php_uint_t index; schema_attributegroup_fixup(ctx, tmp_attr, ht); zend_hash_get_current_key(tmp->attributes, NULL, &index, 0); @@ -2268,7 +2268,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type) } if (type->attributes) { zend_string *str_key; - ulong index; + php_uint_t index; ZEND_HASH_FOREACH_KEY_PTR(type->attributes, index, str_key, attr) { if (str_key) { diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 8de779a5f7..6daa8dbafe 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -292,9 +292,9 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC) zval new_header; rest += 2; - ZVAL_STR(&new_header, STR_ALLOC(Z_STRLEN_P(header) - (rest - s), 0)); + ZVAL_STR(&new_header, STR_ALLOC(Z_STRSIZE_P(header) - (rest - s), 0)); memcpy(Z_STRVAL(new_header), Z_STRVAL_P(header), s - Z_STRVAL_P(header)); - memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRLEN_P(header) - (rest - Z_STRVAL_P(header)) + 1); + memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRSIZE_P(header) - (rest - Z_STRVAL_P(header)) + 1); ZVAL_COPY(&ctx->old_header, header); php_stream_context_set_option(ctx->context, "http", "header", &new_header); zval_dtor(&new_header); @@ -1805,7 +1805,7 @@ static void sdl_serialize_encoder_ref(encodePtr enc, HashTable *tmp_encoders, sm if (enc) { zval *encoder_num; if ((encoder_num = zend_hash_str_find(tmp_encoders, (char*)&enc, sizeof(enc))) != 0) { - WSDL_CACHE_PUT_INT(Z_LVAL_P(encoder_num), out); + WSDL_CACHE_PUT_INT(Z_IVAL_P(encoder_num), out); } else { WSDL_CACHE_PUT_INT(0, out); } @@ -1818,7 +1818,7 @@ static void sdl_serialize_type_ref(sdlTypePtr type, HashTable *tmp_types, smart_ if (type) { zval *type_num; if ((type_num = zend_hash_str_find(tmp_types, (char*)&type, sizeof(type))) != NULL) { - WSDL_CACHE_PUT_INT(Z_LVAL_P(type_num), out); + WSDL_CACHE_PUT_INT(Z_IVAL_P(type_num), out); } else { WSDL_CACHE_PUT_INT(0, out); } @@ -1974,7 +1974,7 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab ZEND_HASH_FOREACH_STR_KEY_PTR(type->elements, key, tmp) { sdl_serialize_key(key, out); sdl_serialize_type(tmp, tmp_encoders, tmp_types, out); - ZVAL_LONG(&zv, i); + ZVAL_INT(&zv, i); zend_hash_str_add(tmp_elements, (char*)&tmp, sizeof(tmp), &zv); i--; } ZEND_HASH_FOREACH_END(); @@ -2140,7 +2140,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->groups, tmp) { - ZVAL_LONG(&zv, type_num); + ZVAL_INT(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2157,7 +2157,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->types, tmp) { - ZVAL_LONG(&zv, type_num); + ZVAL_INT(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2174,7 +2174,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->elements, tmp) { - ZVAL_LONG(&zv, type_num); + ZVAL_INT(&zv, type_num); zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv); ++type_num; } ZEND_HASH_FOREACH_END(); @@ -2191,7 +2191,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s zval zv; ZEND_HASH_FOREACH_PTR(sdl->encoders, tmp) { - ZVAL_LONG(&zv, encoder_num); + ZVAL_INT(&zv, encoder_num); zend_hash_str_add(&tmp_encoders, (char*)&tmp, sizeof(tmp), &zv); ++encoder_num; } ZEND_HASH_FOREACH_END(); @@ -2200,7 +2200,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s while (enc->details.type != END_KNOWN_TYPES) { zval zv; - ZVAL_LONG(&zv, encoder_num); + ZVAL_INT(&zv, encoder_num); zend_hash_str_add(&tmp_encoders, (char*)&enc, sizeof(encodePtr), &zv); enc++; ++encoder_num; @@ -2272,7 +2272,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s WSDL_CACHE_PUT_1(0,out); } - ZVAL_LONG(&zv, binding_num); + ZVAL_INT(&zv, binding_num); zend_hash_str_add(&tmp_bindings, (char*)&tmp, sizeof(tmp), &zv); binding_num++; } ZEND_HASH_FOREACH_END(); @@ -2296,8 +2296,8 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s if (tmp->binding) { binding_num = zend_hash_str_find(&tmp_bindings,(char*)&tmp->binding, sizeof(tmp->binding)); if (binding_num) { - WSDL_CACHE_PUT_INT(Z_LVAL_P(binding_num), out); - if (Z_LVAL_P(binding_num) >= 0) { + WSDL_CACHE_PUT_INT(Z_IVAL_P(binding_num), out); + if (Z_IVAL_P(binding_num) >= 0) { if (tmp->binding->bindingType == BINDING_SOAP && tmp->bindingAttributes != NULL) { sdlSoapBindingFunctionPtr binding = (sdlSoapBindingFunctionPtr)tmp->bindingAttributes; WSDL_CACHE_PUT_1(binding->style, out); @@ -2338,7 +2338,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s WSDL_CACHE_PUT_INT(0, out); } - ZVAL_LONG(&zv, function_num); + ZVAL_INT(&zv, function_num); zend_hash_str_add(&tmp_functions, (char*)&tmp, sizeof(tmp), &zv); function_num++; } ZEND_HASH_FOREACH_END(); @@ -2358,7 +2358,7 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->requests, key, tmp) { function_num = zend_hash_str_find(&tmp_functions, (char*)&tmp, sizeof(tmp)); - WSDL_CACHE_PUT_INT(Z_LVAL_P(function_num), out); + WSDL_CACHE_PUT_INT(Z_IVAL_P(function_num), out); sdl_serialize_key(key, out); } ZEND_HASH_FOREACH_END(); } @@ -3151,7 +3151,7 @@ static void delete_psdl(zval *zv) free(Z_PTR_P(zv)); } -sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) +sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC) { char fn[MAXPATHLEN]; sdlPtr sdl = NULL; @@ -3230,7 +3230,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL && - Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) { + Z_TYPE_P(tmp) == IS_STRING && Z_STRSIZE_P(tmp) > 0) { smart_str_appends(&headers, "User-Agent: "); smart_str_appends(&headers, Z_STRVAL_P(tmp)); smart_str_appends(&headers, "\r\n"); @@ -3239,7 +3239,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC) if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL && Z_TYPE_P(proxy_host) == IS_STRING && (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL && - Z_TYPE_P(proxy_port) == IS_LONG) { + Z_TYPE_P(proxy_port) == IS_INT) { zval str_port, str_proxy; smart_str proxy = {0}; ZVAL_DUP(&str_port, proxy_port); diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h index 2856ed1c47..56877b5b85 100644 --- a/ext/soap/php_sdl.h +++ b/ext/soap/php_sdl.h @@ -254,7 +254,7 @@ struct _sdlAttribute { }; -sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC); +sdlPtr get_sdl(zval *this_ptr, char *uri, php_int_t cache_wsdl TSRMLS_DC); encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const xmlChar *type); encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type); diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h index d721af6234..d311214a20 100644 --- a/ext/soap/php_soap.h +++ b/ext/soap/php_soap.h @@ -171,8 +171,8 @@ ZEND_BEGIN_MODULE_GLOBALS(soap) char cache_mode; char cache_enabled; char* cache_dir; - long cache_ttl; - long cache_limit; + php_int_t cache_ttl; + php_int_t cache_limit; HashTable *mem_cache; xmlCharEncodingHandlerPtr encoding; HashTable *class_map; diff --git a/ext/soap/soap.c b/ext/soap/soap.c index a1d2ca4f48..5af02c3ad4 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -687,103 +687,103 @@ PHP_MINIT_FUNCTION(soap) le_service = zend_register_list_destructors_ex(delete_service_res, NULL, "SOAP service", module_number); le_typemap = zend_register_list_destructors_ex(delete_hashtable_res, NULL, "SOAP table", module_number); - REGISTER_LONG_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_1_1", SOAP_1_1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_1_2", SOAP_1_2, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_SESSION", SOAP_PERSISTENCE_SESSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_PERSISTENCE_REQUEST", SOAP_PERSISTENCE_REQUEST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_FUNCTIONS_ALL", SOAP_FUNCTIONS_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_ENCODED", SOAP_ENCODED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_LITERAL", SOAP_LITERAL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_RPC", SOAP_RPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_DOCUMENT", SOAP_DOCUMENT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_ACTOR_NEXT", SOAP_ACTOR_NEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_ACTOR_NONE", SOAP_ACTOR_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_ACTOR_UNLIMATERECEIVER", SOAP_ACTOR_UNLIMATERECEIVER, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_COMPRESSION_ACCEPT", SOAP_COMPRESSION_ACCEPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_COMPRESSION_GZIP", SOAP_COMPRESSION_GZIP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_COMPRESSION_DEFLATE", SOAP_COMPRESSION_DEFLATE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_BASIC", SOAP_AUTHENTICATION_BASIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_AUTHENTICATION_DIGEST", SOAP_AUTHENTICATION_DIGEST, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("UNKNOWN_TYPE", UNKNOWN_TYPE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XSD_STRING", XSD_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_BOOLEAN", XSD_BOOLEAN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DECIMAL", XSD_DECIMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_FLOAT", XSD_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DOUBLE", XSD_DOUBLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DURATION", XSD_DURATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DATETIME", XSD_DATETIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_TIME", XSD_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_DATE", XSD_DATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GYEARMONTH", XSD_GYEARMONTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GYEAR", XSD_GYEAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GMONTHDAY", XSD_GMONTHDAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GDAY", XSD_GDAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_GMONTH", XSD_GMONTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_HEXBINARY", XSD_HEXBINARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_BASE64BINARY", XSD_BASE64BINARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ANYURI", XSD_ANYURI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_QNAME", XSD_QNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NOTATION", XSD_NOTATION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NORMALIZEDSTRING", XSD_NORMALIZEDSTRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_TOKEN", XSD_TOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_LANGUAGE", XSD_LANGUAGE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NMTOKEN", XSD_NMTOKEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NAME", XSD_NAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NCNAME", XSD_NCNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ID", XSD_ID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_IDREF", XSD_IDREF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_IDREFS", XSD_IDREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ENTITY", XSD_ENTITY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ENTITIES", XSD_ENTITIES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_INTEGER", XSD_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NONPOSITIVEINTEGER", XSD_NONPOSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NEGATIVEINTEGER", XSD_NEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_LONG", XSD_LONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_INT", XSD_INT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_SHORT", XSD_SHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_BYTE", XSD_BYTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NONNEGATIVEINTEGER", XSD_NONNEGATIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDLONG", XSD_UNSIGNEDLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDINT", XSD_UNSIGNEDINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDSHORT", XSD_UNSIGNEDSHORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_UNSIGNEDBYTE", XSD_UNSIGNEDBYTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_POSITIVEINTEGER", XSD_POSITIVEINTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_NMTOKENS", XSD_NMTOKENS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ANYTYPE", XSD_ANYTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSD_ANYXML", XSD_ANYXML, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("APACHE_MAP", APACHE_MAP, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SOAP_ENC_OBJECT", SOAP_ENC_OBJECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_ENC_ARRAY", SOAP_ENC_ARRAY, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XSD_1999_TIMEINSTANT", XSD_1999_TIMEINSTANT, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_USE_XSI_ARRAY_TYPE", SOAP_USE_XSI_ARRAY_TYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT); /* New SOAP SSL Method Constants */ - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_TLS", SOAP_SSL_METHOD_TLS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv2", SOAP_SSL_METHOD_SSLv2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv3", SOAP_SSL_METHOD_SSLv3, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOAP_SSL_METHOD_SSLv23", SOAP_SSL_METHOD_SSLv23, CONST_CS | CONST_PERSISTENT); old_error_handler = zend_error_cb; zend_error_cb = soap_error_handler; @@ -855,13 +855,13 @@ PHP_METHOD(SoapHeader, SoapHeader) } add_property_bool(this_ptr, "mustUnderstand", must_understand); if (actor == NULL) { - } else if (Z_TYPE_P(actor) == IS_LONG && - (Z_LVAL_P(actor) == SOAP_ACTOR_NEXT || - Z_LVAL_P(actor) == SOAP_ACTOR_NONE || - Z_LVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { - add_property_long(this_ptr, "actor", Z_LVAL_P(actor)); - } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) { - add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor)); + } else if (Z_TYPE_P(actor) == IS_INT && + (Z_IVAL_P(actor) == SOAP_ACTOR_NEXT || + Z_IVAL_P(actor) == SOAP_ACTOR_NONE || + Z_IVAL_P(actor) == SOAP_ACTOR_UNLIMATERECEIVER)) { + add_property_int(this_ptr, "actor", Z_IVAL_P(actor)); + } else if (Z_TYPE_P(actor) == IS_STRING && Z_STRSIZE_P(actor) > 0) { + add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRSIZE_P(actor)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor"); } @@ -886,7 +886,7 @@ PHP_METHOD(SoapFault, SoapFault) if (Z_TYPE_P(code) == IS_NULL) { } else if (Z_TYPE_P(code) == IS_STRING) { fault_code = Z_STRVAL_P(code); - fault_code_len = Z_STRLEN_P(code); + fault_code_len = Z_STRSIZE_P(code); } else if (Z_TYPE_P(code) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(code)) == 2) { zval *t_ns, *t_code; @@ -897,7 +897,7 @@ PHP_METHOD(SoapFault, SoapFault) if (Z_TYPE_P(t_ns) == IS_STRING && Z_TYPE_P(t_code) == IS_STRING) { fault_code_ns = Z_STRVAL_P(t_ns); fault_code = Z_STRVAL_P(t_code); - fault_code_len = Z_STRLEN_P(t_code); + fault_code_len = Z_STRSIZE_P(t_code); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code"); return; @@ -957,8 +957,8 @@ PHP_METHOD(SoapFault, __toString) zval_ptr_dtor(&fci.function_name); str = strpprintf(0, "SoapFault exception: [%s] %s in %s:%ld\nStack trace:\n%s", - Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line), - Z_STRLEN(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); + Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_IVAL_P(line), + Z_STRSIZE(trace) ? Z_STRVAL(trace) : "#0 {main}\n"); zval_ptr_dtor(&trace); @@ -980,10 +980,10 @@ PHP_METHOD(SoapVar, SoapVar) this_ptr = getThis(); if (Z_TYPE_P(type) == IS_NULL) { - add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE); + add_property_int(this_ptr, "enc_type", UNKNOWN_TYPE); } else { - if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) { - add_property_long(this_ptr, "enc_type", Z_LVAL_P(type)); + if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_IVAL_P(type))) { + add_property_int(this_ptr, "enc_type", Z_IVAL_P(type)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type ID"); return; @@ -1121,7 +1121,7 @@ PHP_METHOD(SoapServer, SoapServer) zval *wsdl = NULL, *options = NULL; zend_resource *res; int version = SOAP_1_1; - long cache_wsdl; + php_int_t cache_wsdl; HashTable *typemap_ht = NULL; SOAP_SERVER_BEGIN_CODE(); @@ -1145,9 +1145,9 @@ PHP_METHOD(SoapServer, SoapServer) zval *tmp; if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) { - if (Z_TYPE_P(tmp) == IS_LONG && - (Z_LVAL_P(tmp) == SOAP_1_1 || Z_LVAL_P(tmp) == SOAP_1_2)) { - version = Z_LVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_INT && + (Z_IVAL_P(tmp) == SOAP_1_1 || Z_IVAL_P(tmp) == SOAP_1_2)) { + version = Z_IVAL_P(tmp); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'soap_version' option must be SOAP_1_1 or SOAP_1_2"); } @@ -1155,14 +1155,14 @@ PHP_METHOD(SoapServer, SoapServer) if ((tmp = zend_hash_str_find(ht, "uri", sizeof("uri")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + service->uri = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode"); } if ((tmp = zend_hash_str_find(ht, "actor", sizeof("actor")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + service->actor = estrndup(Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL && @@ -1190,13 +1190,13 @@ PHP_METHOD(SoapServer, SoapServer) } if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - service->features = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + service->features = Z_IVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - cache_wsdl = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + cache_wsdl = Z_IVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "send_errors", sizeof("send_errors")-1)) != NULL) { @@ -1204,8 +1204,8 @@ PHP_METHOD(SoapServer, SoapServer) service->send_errors = 0; } else if (Z_TYPE_P(tmp) == IS_TRUE) { service->send_errors = 1; - } else if (Z_TYPE_P(tmp) == IS_LONG) { - service->send_errors = Z_LVAL_P(tmp); + } else if (Z_TYPE_P(tmp) == IS_INT) { + service->send_errors = Z_IVAL_P(tmp); } } @@ -1248,19 +1248,19 @@ PHP_METHOD(SoapServer, SoapServer) PHP_METHOD(SoapServer, setPersistence) { soapServicePtr service; - long value; + php_int_t value; SOAP_SERVER_BEGIN_CODE(); FETCH_THIS_SERVICE(service); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) != FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) != FAILURE) { if (service->type == SOAP_CLASS) { if (value == SOAP_PERSISTENCE_SESSION || value == SOAP_PERSISTENCE_REQUEST) { service->soap_class.persistance = value; } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set persistence with bogus value (%ld)", value); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set persistence with bogus value (%pd)", value); return; } } else { @@ -1421,8 +1421,8 @@ PHP_METHOD(SoapServer, addFunction) return; } - key = STR_ALLOC(Z_STRLEN_P(tmp_function), 0); - zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRLEN_P(tmp_function)); + key = STR_ALLOC(Z_STRSIZE_P(tmp_function), 0); + zend_str_tolower_copy(key->val, Z_STRVAL_P(tmp_function), Z_STRSIZE_P(tmp_function)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(tmp_function)); @@ -1439,8 +1439,8 @@ PHP_METHOD(SoapServer, addFunction) zend_string *key; zend_function *f; - key = STR_ALLOC(Z_STRLEN_P(function_name), 0); - zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)); + key = STR_ALLOC(Z_STRSIZE_P(function_name), 0); + zend_str_tolower_copy(key->val, Z_STRVAL_P(function_name), Z_STRSIZE_P(function_name)); if ((f = zend_hash_find_ptr(EG(function_table), key)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existent function '%s'", Z_STRVAL_P(function_name)); @@ -1455,8 +1455,8 @@ PHP_METHOD(SoapServer, addFunction) ZVAL_STR(&function_copy, STR_COPY(f->common.function_name)); zend_hash_update(service->soap_functions.ft, key, &function_copy); STR_RELEASE(key); - } else if (Z_TYPE_P(function_name) == IS_LONG) { - if (Z_LVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { + } else if (Z_TYPE_P(function_name) == IS_INT) { + if (Z_IVAL_P(function_name) == SOAP_FUNCTIONS_ALL) { if (service->soap_functions.ft != NULL) { zend_hash_destroy(service->soap_functions.ft); efree(service->soap_functions.ft); @@ -1573,7 +1573,7 @@ PHP_METHOD(SoapServer, handle) zval filter_params; array_init_size(&filter_params, 1); - add_assoc_long_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ + add_assoc_int_ex(&filter_params, "window", sizeof("window")-1, 0x2f); /* ANY WBITS */ zf = php_stream_filter_create("zlib.inflate", &filter_params, 0 TSRMLS_CC); zval_dtor(&filter_params); @@ -1786,8 +1786,8 @@ PHP_METHOD(SoapServer, handle) } } #endif - fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name)); - if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name)) || + fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRSIZE(h->function_name)); + if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(h->function_name)), Z_STRSIZE(h->function_name)) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1839,8 +1839,8 @@ PHP_METHOD(SoapServer, handle) } } - fn_name = estrndup(Z_STRVAL(function_name),Z_STRLEN(function_name)); - if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRLEN(function_name)), Z_STRLEN(function_name)) || + fn_name = estrndup(Z_STRVAL(function_name),Z_STRSIZE(function_name)); + if (zend_hash_str_exists(function_table, php_strtolower(fn_name, Z_STRSIZE(function_name)), Z_STRSIZE(function_name)) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && zend_hash_str_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (service->type == SOAP_CLASS || service->type == SOAP_OBJECT) { @@ -1897,9 +1897,9 @@ PHP_METHOD(SoapServer, handle) if (function && function->responseName) { response_name = estrdup(function->responseName); } else { - response_name = emalloc(Z_STRLEN(function_name) + sizeof("Response")); - memcpy(response_name,Z_STRVAL(function_name),Z_STRLEN(function_name)); - memcpy(response_name+Z_STRLEN(function_name),"Response",sizeof("Response")); + response_name = emalloc(Z_STRSIZE(function_name) + sizeof("Response")); + memcpy(response_name,Z_STRVAL(function_name),Z_STRSIZE(function_name)); + memcpy(response_name+Z_STRSIZE(function_name),"Response",sizeof("Response")); } doc_return = serialize_response_call(function, response_name, service->uri, &retval, soap_headers, soap_version TSRMLS_CC); efree(response_name); @@ -1947,7 +1947,7 @@ PHP_METHOD(SoapServer, handle) xmlFreeDoc(doc_return); - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); @@ -2096,7 +2096,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade if (use_http_error_status) { sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1); } - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + if (zend_ini_int("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); @@ -2265,7 +2265,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const } /* Get output buffer and send as fault detials */ - if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0) { + if (php_output_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_IVAL(outbuflen) != 0) { php_output_get_contents(&outbuf TSRMLS_CC); } php_output_discard(TSRMLS_C); @@ -2330,7 +2330,7 @@ PHP_METHOD(SoapClient, SoapClient) zval *wsdl, *options = NULL; int soap_version = SOAP_1_1; php_stream_context *context = NULL; - long cache_wsdl; + php_int_t cache_wsdl; sdlPtr sdl = NULL; HashTable *typemap_ht = NULL; zval *this_ptr = getThis(); @@ -2361,15 +2361,15 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "style", sizeof("style")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && - (Z_LVAL_P(tmp) == SOAP_RPC || Z_LVAL_P(tmp) == SOAP_DOCUMENT)) { - add_property_long(this_ptr, "style", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT && + (Z_IVAL_P(tmp) == SOAP_RPC || Z_IVAL_P(tmp) == SOAP_DOCUMENT)) { + add_property_int(this_ptr, "style", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "use", sizeof("use")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && - (Z_LVAL_P(tmp) == SOAP_LITERAL || Z_LVAL_P(tmp) == SOAP_ENCODED)) { - add_property_long(this_ptr, "use", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT && + (Z_IVAL_P(tmp) == SOAP_LITERAL || Z_IVAL_P(tmp) == SOAP_ENCODED)) { + add_property_int(this_ptr, "use", Z_IVAL_P(tmp)); } } @@ -2387,9 +2387,9 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "soap_version", sizeof("soap_version")-1)) != NULL) { - if (Z_TYPE_P(tmp) == IS_LONG || - (Z_LVAL_P(tmp) == SOAP_1_1 && Z_LVAL_P(tmp) == SOAP_1_2)) { - soap_version = Z_LVAL_P(tmp); + if (Z_TYPE_P(tmp) == IS_INT || + (Z_IVAL_P(tmp) == SOAP_1_1 && Z_IVAL_P(tmp) == SOAP_1_2)) { + soap_version = Z_IVAL_P(tmp); } } if ((tmp = zend_hash_str_find(ht, "login", sizeof("login")-1)) != NULL && @@ -2400,8 +2400,8 @@ PHP_METHOD(SoapClient, SoapClient) add_property_str(this_ptr, "_password", STR_COPY(Z_STR_P(tmp))); } if ((tmp = zend_hash_str_find(ht, "authentication", sizeof("authentication")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && - Z_LVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) { + Z_TYPE_P(tmp) == IS_INT && + Z_IVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) { add_property_null(this_ptr, "_digest"); } } @@ -2409,11 +2409,11 @@ PHP_METHOD(SoapClient, SoapClient) Z_TYPE_P(tmp) == IS_STRING) { add_property_str(this_ptr, "_proxy_host", STR_COPY(Z_STR_P(tmp))); if ((tmp = zend_hash_str_find(ht, "proxy_port", sizeof("proxy_port")-1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { - ZVAL_LONG(&tmp2, zval_get_long(tmp)); + if (Z_TYPE_P(tmp) != IS_INT) { + ZVAL_INT(&tmp2, zval_get_int(tmp)); tmp = &tmp2; } - add_property_long(this_ptr, "_proxy_port", Z_LVAL_P(tmp)); + add_property_int(this_ptr, "_proxy_port", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "proxy_login", sizeof("proxy_login")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -2437,24 +2437,24 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "trace", sizeof("trace")-1)) != NULL && (Z_TYPE_P(tmp) == IS_TRUE || - (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 1))) { - add_property_long(this_ptr, "trace", 1); + (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 1))) { + add_property_int(this_ptr, "trace", 1); } if ((tmp = zend_hash_str_find(ht, "exceptions", sizeof("exceptions")-1)) != NULL && (Z_TYPE_P(tmp) == IS_FALSE || - (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) { + (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) { add_property_bool(this_ptr, "_exceptions", 0); } if ((tmp = zend_hash_str_find(ht, "compression", sizeof("compression")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG && + Z_TYPE_P(tmp) == IS_INT && zend_hash_str_exists(EG(function_table), "gzinflate", sizeof("gzinflate")-1) && zend_hash_str_exists(EG(function_table), "gzdeflate", sizeof("gzdeflate")-1) && zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1) && zend_hash_str_exists(EG(function_table), "gzcompress", sizeof("gzcompress")-1) && zend_hash_str_exists(EG(function_table), "gzencode", sizeof("gzencode")-1)) { - add_property_long(this_ptr, "compression", Z_LVAL_P(tmp)); + add_property_int(this_ptr, "compression", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "encoding", sizeof("encoding")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -2486,17 +2486,17 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - add_property_long(this_ptr, "_features", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT) { + add_property_int(this_ptr, "_features", Z_IVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "connection_timeout", sizeof("connection_timeout")-1)) != NULL) { - if (Z_TYPE_P(tmp) != IS_LONG) { - ZVAL_LONG(&tmp2, zval_get_long(tmp)); + if (Z_TYPE_P(tmp) != IS_INT) { + ZVAL_INT(&tmp2, zval_get_int(tmp)); tmp = &tmp2; } - if (Z_LVAL_P(tmp) > 0) { - add_property_long(this_ptr, "_connection_timeout", Z_LVAL_P(tmp)); + if (Z_IVAL_P(tmp) > 0) { + add_property_int(this_ptr, "_connection_timeout", Z_IVAL_P(tmp)); } } @@ -2505,8 +2505,8 @@ PHP_METHOD(SoapClient, SoapClient) } if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - cache_wsdl = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + cache_wsdl = Z_IVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "user_agent", sizeof("user_agent")-1)) != NULL && @@ -2516,19 +2516,19 @@ PHP_METHOD(SoapClient, SoapClient) if ((tmp = zend_hash_str_find(ht, "keep_alive", sizeof("keep_alive")-1)) != NULL && (Z_TYPE_P(tmp) == IS_FALSE || - (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) { - add_property_long(this_ptr, "_keep_alive", 0); + (Z_TYPE_P(tmp) == IS_INT && Z_IVAL_P(tmp) == 0))) { + add_property_int(this_ptr, "_keep_alive", 0); } if ((tmp = zend_hash_str_find(ht, "ssl_method", sizeof("ssl_method")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - add_property_long(this_ptr, "_ssl_method", Z_LVAL_P(tmp)); + Z_TYPE_P(tmp) == IS_INT) { + add_property_int(this_ptr, "_ssl_method", Z_IVAL_P(tmp)); } } else if (Z_TYPE_P(wsdl) == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode"); } - add_property_long(this_ptr, "_soap_version", soap_version); + add_property_int(this_ptr, "_soap_version", soap_version); if (Z_TYPE_P(wsdl) != IS_NULL) { int old_soap_version; @@ -2577,7 +2577,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_stringl(this_ptr, "__last_request", buf, buf_size); } @@ -2593,8 +2593,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } else { ZVAL_STRING(¶ms[2], action); } - ZVAL_LONG(¶ms[3], version); - ZVAL_LONG(¶ms[4], one_way); + ZVAL_INT(¶ms[3], version); + ZVAL_INT(¶ms[4], one_way); if (call_user_function(NULL, this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) { add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC); @@ -2605,7 +2605,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act } ret = FALSE; } else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL && - Z_LVAL_P(trace) > 0) { + Z_IVAL_P(trace) > 0) { add_property_str(this_ptr, "__last_response", STR_COPY(Z_STR_P(response))); } zval_ptr_dtor(&func); @@ -2651,12 +2651,12 @@ static void do_soap_call(zval* this_ptr, SOAP_CLIENT_BEGIN_CODE(); if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL - && Z_LVAL_P(trace) > 0) { + && Z_IVAL_P(trace) > 0) { zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1); } if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL - && Z_LVAL_P(tmp) == SOAP_1_2) { + && Z_IVAL_P(tmp) == SOAP_1_2) { soap_version = SOAP_1_2; } else { soap_version = SOAP_1_1; @@ -2699,8 +2699,8 @@ static void do_soap_call(zval* this_ptr, SOAP_GLOBAL(typemap) = typemap; old_features = SOAP_GLOBAL(features); if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features")-1)) != NULL && - Z_TYPE_P(tmp) == IS_LONG) { - SOAP_GLOBAL(features) = Z_LVAL_P(tmp); + Z_TYPE_P(tmp) == IS_INT) { + SOAP_GLOBAL(features) = Z_IVAL_P(tmp); } else { SOAP_GLOBAL(features) = 0; } @@ -2734,7 +2734,7 @@ static void do_soap_call(zval* this_ptr, if (ret && Z_TYPE(response) == IS_STRING) { encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers TSRMLS_CC); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), fn, NULL, return_value, output_headers TSRMLS_CC); encode_finish(); } @@ -2779,7 +2779,7 @@ static void do_soap_call(zval* this_ptr, if (ret && Z_TYPE(response) == IS_STRING) { encode_reset_ns(); - ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, function, return_value, output_headers TSRMLS_CC); + ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRSIZE(response), NULL, function, return_value, output_headers TSRMLS_CC); encode_finish(); } @@ -3082,11 +3082,11 @@ PHP_METHOD(SoapClient, __doRequest) { char *buf, *location, *action; int buf_size, location_size, action_size; - long version; - long one_way = 0; + php_int_t version; + php_int_t one_way = 0; zval *this_ptr = getThis(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssi|i", &buf, &buf_size, &location, &location_size, &action, &action_size, @@ -3643,7 +3643,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c smart_str_appends(&key, (char*)hdr_func->ns->href); smart_str_appendc(&key, ':'); } - smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRLEN(h->function_name)); + smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRSIZE(h->function_name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(fnb->input.headers, key.s)) != NULL) { h->hdr = hdr; @@ -3711,17 +3711,17 @@ static void set_soap_header_attributes(xmlNodePtr h, HashTable *ht, int version) } else { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(Z_STRVAL_P(tmp))); } - } else if (Z_TYPE_P(tmp) == IS_LONG) { + } else if (Z_TYPE_P(tmp) == IS_INT) { if (version == SOAP_1_1) { - if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) { + if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) { xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), BAD_CAST(SOAP_1_1_ACTOR_NEXT)); } } else { - if (Z_LVAL_P(tmp) == SOAP_ACTOR_NEXT) { + if (Z_IVAL_P(tmp) == SOAP_ACTOR_NEXT) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NEXT)); - } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_NONE) { + } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_NONE) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_NONE)); - } else if (Z_LVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { + } else if (Z_IVAL_P(tmp) == SOAP_ACTOR_UNLIMATERECEIVER) { xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER)); } } @@ -3801,7 +3801,7 @@ static int serialize_response_call2(xmlNodePtr body, sdlFunctionPtr function, ch int i = 0; zend_string *param_name; //??? - ulong param_index = i; + php_uint_t param_index = i; ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(ret), param_index, param_name, data) { parameter = get_param(function, param_name->val, param_index, TRUE); @@ -3885,13 +3885,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -3978,7 +3978,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function if (version == SOAP_1_1) { if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) { xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode")); - zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC); + zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC); xmlAddChild(param, node); if (fault_ns) { xmlNsPtr nsptr = encode_add_ns(node, fault_ns); @@ -4002,7 +4002,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function } else { if ((tmp = zend_hash_str_find(prop, "faultcode", sizeof("faultcode")-1)) != NULL) { xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL); - zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), 0, 0, NULL TSRMLS_CC); + zend_string *str = php_escape_html_entities((unsigned char*)Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp), 0, 0, NULL TSRMLS_CC); node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL); if (fault_ns) { xmlNsPtr nsptr = encode_add_ns(node, fault_ns); @@ -4101,13 +4101,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function ht = Z_OBJPROP(h->retval); if ((tmp = zend_hash_str_find(ht, "namespace", sizeof("namespace")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } if ((tmp = zend_hash_str_find(ht, "name", sizeof("name")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -4239,7 +4239,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } } else { if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL) { - style = Z_LVAL_P(zstyle); + style = Z_IVAL_P(zstyle); } else { style = SOAP_RPC; } @@ -4261,7 +4261,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function } if ((zuse = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use")-1)) != NULL && - Z_LVAL_P(zuse) == SOAP_LITERAL) { + Z_IVAL_P(zuse) == SOAP_LITERAL) { use = SOAP_LITERAL; } else { use = SOAP_ENCODED; @@ -4330,9 +4330,9 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function smart_str key = {0}; sdlSoapBindingFunctionHeaderPtr hdr; - smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRSIZE_P(ns)); smart_str_appendc(&key, ':'); - smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRLEN_P(name)); + smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRSIZE_P(name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(hdrs, key.s)) != NULL) { hdr_use = hdr->use; diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index 66d1938f07..7f616232b8 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -303,45 +303,45 @@ static void to_zval_read_aggregation(const char *structure, } /* CONVERSIONS for integers */ -static long from_zval_integer_common(const zval *arr_value, ser_context *ctx) +static php_int_t from_zval_integer_common(const zval *arr_value, ser_context *ctx) { - long ret = 0; + php_int_t ret = 0; zval lzval; ZVAL_NULL(&lzval); - if (Z_TYPE_P(arr_value) != IS_LONG) { + if (Z_TYPE_P(arr_value) != IS_INT) { ZVAL_COPY(&lzval, arr_value); arr_value = &lzval; } switch (Z_TYPE_P(arr_value)) { - case IS_LONG: + case IS_INT: long_case: - ret = Z_LVAL_P(arr_value); + ret = Z_IVAL_P(arr_value); break; /* if not long we're operating on lzval */ case IS_DOUBLE: double_case: - convert_to_long(&lzval); + convert_to_int(&lzval); goto long_case; case IS_OBJECT: case IS_STRING: { - long lval; + php_int_t lval; double dval; convert_to_string(&lzval); - switch (is_numeric_string(Z_STRVAL(lzval), Z_STRLEN(lzval), &lval, &dval, 0)) { + switch (is_numeric_string(Z_STRVAL(lzval), Z_STRSIZE(lzval), &lval, &dval, 0)) { case IS_DOUBLE: zval_dtor(&lzval); ZVAL_DOUBLE(&lzval, dval); goto double_case; - case IS_LONG: + case IS_INT: zval_dtor(&lzval); - ZVAL_LONG(&lzval, lval); + ZVAL_INT(&lzval, lval); goto long_case; } @@ -363,7 +363,7 @@ double_case: } void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) { - long lval; + php_int_t lval; int ival; lval = from_zval_integer_common(arr_value, ctx); @@ -382,7 +382,7 @@ void from_zval_write_int(const zval *arr_value, char *field, ser_context *ctx) } static void from_zval_write_uint32(const zval *arr_value, char *field, ser_context *ctx) { - long lval; + php_int_t lval; uint32_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -401,7 +401,7 @@ static void from_zval_write_uint32(const zval *arr_value, char *field, ser_conte } static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_context *ctx) { - long lval; + php_int_t lval; uint16_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -420,7 +420,7 @@ static void from_zval_write_net_uint16(const zval *arr_value, char *field, ser_c } static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_context *ctx) { - long lval; + php_int_t lval; sa_family_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -439,7 +439,7 @@ static void from_zval_write_sa_family(const zval *arr_value, char *field, ser_co } static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_context *ctx) { - long lval; + php_int_t lval; pid_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -458,7 +458,7 @@ static void from_zval_write_pid_t(const zval *arr_value, char *field, ser_contex } static void from_zval_write_uid_t(const zval *arr_value, char *field, ser_context *ctx) { - long lval; + php_int_t lval; uid_t ival; lval = from_zval_integer_common(arr_value, ctx); @@ -490,49 +490,49 @@ void to_zval_read_int(const char *data, zval *zv, res_context *ctx) int ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx) { unsigned ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx) { uint16_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ntohs(ival)); + ZVAL_INT(zv, (long)ntohs(ival)); } static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx) { uint32_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx) { sa_family_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx) { pid_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } static void to_zval_read_uid_t(const char *data, zval *zv, res_context *ctx) { uid_t ival; memcpy(&ival, data, sizeof(ival)); - ZVAL_LONG(zv, (long)ival); + ZVAL_INT(zv, (long)ival); } /* CONVERSIONS for sockaddr */ @@ -576,7 +576,7 @@ static void to_zval_read_sin_addr(const char *data, zval *zv, res_context *ctx) return; } - Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv)); + Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv)); } static const field_descriptor descriptors_sockaddr_in[] = { {"family", sizeof("family"), 0, offsetof(struct sockaddr_in, sin_family), from_zval_write_sa_family, to_zval_read_sa_family}, @@ -635,7 +635,7 @@ static void to_zval_read_sin6_addr(const char *data, zval *zv, res_context *ctx) return; } - Z_STRLEN_P(zv) = strlen(Z_STRVAL_P(zv)); + Z_STRSIZE_P(zv) = strlen(Z_STRVAL_P(zv)); } static const field_descriptor descriptors_sockaddr_in6[] = { {"family", sizeof("family"), 0, offsetof(struct sockaddr_in6, sin6_family), from_zval_write_sa_family, to_zval_read_sa_family}, @@ -669,18 +669,18 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_ /* code in this file relies on the path being nul terminated, even though * this is not required, at least on linux for abstract paths. It also * assumes that the path is not empty */ - if (Z_STRLEN_P(path) == 0) { + if (Z_STRSIZE_P(path) == 0) { do_from_zval_err(ctx, "%s", "the path is cannot be empty"); return; } - if (Z_STRLEN_P(path) >= sizeof(saddr->sun_path)) { + if (Z_STRSIZE_P(path) >= sizeof(saddr->sun_path)) { do_from_zval_err(ctx, "the path is too long, the maximum permitted " "length is %ld", sizeof(saddr->sun_path) - 1); return; } - memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRLEN_P(path)); - saddr->sun_path[Z_STRLEN_P(path)] = '\0'; + memcpy(&saddr->sun_path, Z_STRVAL_P(path), Z_STRSIZE_P(path)); + saddr->sun_path[Z_STRSIZE_P(path)] = '\0'; zval_dtor(&lzval); } @@ -984,8 +984,8 @@ static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context } if (CMSG_LEN(entry->size) > cmsg->cmsg_len) { do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " - "expected a length of at least %ld, but got %ld", - (long)CMSG_LEN(entry->size), (long)cmsg->cmsg_len); + "expected a length of at least %pd, but got %pd", + (php_int_t)CMSG_LEN(entry->size), (php_int_t)cmsg->cmsg_len); return; } @@ -1072,7 +1072,7 @@ static void to_zval_read_name(const char *sockaddr_p, zval *zv, res_context *ctx } static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, ser_context *ctx) { - long lval; + php_int_t lval; struct msghdr *msghdr = (struct msghdr *)msghdr_c; lval = from_zval_integer_common(elem, ctx); @@ -1081,8 +1081,8 @@ static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, } if (lval < 0 || lval > MAX_USER_BUFF_SIZE) { - do_from_zval_err(ctx, "the buffer size must be between 1 and %ld; " - "given %ld", (long)MAX_USER_BUFF_SIZE, lval); + do_from_zval_err(ctx, "the buffer size must be between 1 and %pd; " + "given %pd", (php_int_t)MAX_USER_BUFF_SIZE, lval); return; } @@ -1101,7 +1101,7 @@ static void from_zval_write_iov_array_aux(zval *elem, unsigned i, void **args, s } convert_to_string_ex(elem); - len = Z_STRLEN_P(elem); + len = Z_STRSIZE_P(elem); msg->msg_iov[i - 1].iov_base = accounted_emalloc(len, ctx); msg->msg_iov[i - 1].iov_len = len; memcpy(msg->msg_iov[i - 1].iov_base, Z_STRVAL_P(elem), len); @@ -1257,12 +1257,12 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context ZVAL_NULL(&lzval); - if (Z_TYPE_P(zv) == IS_LONG) { - if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ + if (Z_TYPE_P(zv) == IS_INT) { + if (Z_IVAL_P(zv) < 0 || Z_IVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ do_from_zval_err(ctx, "the interface index cannot be negative or " - "larger than %u; given %ld", UINT_MAX, Z_LVAL_P(zv)); + "larger than %u; given %ld", UINT_MAX, Z_IVAL_P(zv)); } else { - ret = (unsigned)Z_LVAL_P(zv); + ret = (unsigned)Z_IVAL_P(zv); } } else { if (Z_TYPE_P(zv) != IS_STRING) { @@ -1431,7 +1431,7 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) if (*cmsg_len < data_offset) { do_to_zval_err(ctx, "length of cmsg is smaller than its data member " - "offset (%ld vs %ld)", (long)*cmsg_len, (long)data_offset); + "offset (%pd vs %pd)", (php_int_t)*cmsg_len, (php_int_t)data_offset); return; } num_elems = (*cmsg_len - data_offset) / sizeof(int); diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 2bc86b1dba..0fc3dbb2cf 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -89,14 +89,14 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out TSRMLS_DC) { int ret; - if (Z_TYPE_P(val) == IS_LONG) { - if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) { + if (Z_TYPE_P(val) == IS_INT) { + if (Z_IVAL_P(val) < 0 || Z_IVAL_P(val) > UINT_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "the interface index cannot be negative or larger than %u;" - " given %ld", UINT_MAX, Z_LVAL_P(val)); + " given %ld", UINT_MAX, Z_IVAL_P(val)); ret = FAILURE; } else { - *out = Z_LVAL_P(val); + *out = Z_IVAL_P(val); ret = SUCCESS; } } else { @@ -288,13 +288,13 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock, goto ipv4_loop_ttl; case IP_MULTICAST_TTL: - convert_to_long_ex(arg4); - if (Z_LVAL_P(arg4) < 0L || Z_LVAL_P(arg4) > 255L) { + convert_to_int_ex(arg4); + if (Z_IVAL_P(arg4) < 0L || Z_IVAL_P(arg4) > 255L) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a value between 0 and 255"); return FAILURE; } - ipv4_mcast_ttl_lback = (unsigned char) Z_LVAL_P(arg4); + ipv4_mcast_ttl_lback = (unsigned char) Z_IVAL_P(arg4); ipv4_loop_ttl: opt_ptr = &ipv4_mcast_ttl_lback; optlen = sizeof(ipv4_mcast_ttl_lback); @@ -353,13 +353,13 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock, ov = (int) Z_TYPE_P(arg4) == IS_TRUE; goto ipv6_loop_hops; case IPV6_MULTICAST_HOPS: - convert_to_long_ex(arg4); - if (Z_LVAL_P(arg4) < -1L || Z_LVAL_P(arg4) > 255L) { + convert_to_int_ex(arg4); + if (Z_IVAL_P(arg4) < -1L || Z_IVAL_P(arg4) > 255L) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a value between -1 and 255"); return FAILURE; } - ov = (int) Z_LVAL_P(arg4); + ov = (int) Z_IVAL_P(arg4); ipv6_loop_hops: opt_ptr = &ov; optlen = sizeof(ov); diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 72c7286eb5..07740cdfe5 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -167,7 +167,7 @@ PHP_FUNCTION(socket_sendmsg) { zval *zsocket, *zmsg; - long flags = 0; + php_int_t flags = 0; php_socket *php_sock; struct msghdr *msghdr; zend_llist *allocations; @@ -175,7 +175,7 @@ PHP_FUNCTION(socket_sendmsg) ssize_t res; /* zmsg should be passed by ref */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|l", &zsocket, &zmsg, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra|i", &zsocket, &zmsg, &flags) == FAILURE) { return; } @@ -198,7 +198,7 @@ PHP_FUNCTION(socket_sendmsg) zend_llist_destroy(allocations); efree(allocations); - RETURN_LONG((long)res); + RETURN_INT((long)res); } else { PHP_SOCKET_ERROR(php_sock, "error in sendmsg", errno); RETURN_FALSE; @@ -209,7 +209,7 @@ PHP_FUNCTION(socket_recvmsg) { zval *zsocket, *zmsg; - long flags = 0; + php_int_t flags = 0; php_socket *php_sock; ssize_t res; struct msghdr *msghdr; @@ -217,7 +217,7 @@ PHP_FUNCTION(socket_recvmsg) struct err_s err = {0}; //ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra/|l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra/|i", &zsocket, &zmsg, &flags) == FAILURE) { return; } @@ -268,17 +268,17 @@ PHP_FUNCTION(socket_recvmsg) RETURN_FALSE; } - RETURN_LONG((long)res); + RETURN_INT((php_int_t)res); } PHP_FUNCTION(socket_cmsg_space) { - long level, + php_int_t level, type, n = 0; ancillary_reg_entry *entry; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|l", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii|i", &level, &type, &n) == FAILURE) { return; } @@ -295,20 +295,20 @@ PHP_FUNCTION(socket_cmsg_space) entry = get_ancillary_reg_entry(level, type); if (entry == NULL) { - php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The pair level %ld/type %ld is " + php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The pair level %pd/type %pd is " "not supported by PHP", level, type); return; } - if (entry->var_el_size > 0 && n > (LONG_MAX - (long)entry->size - - (long)CMSG_SPACE(0) - 15L) / entry->var_el_size) { + if (entry->var_el_size > 0 && n > (PHP_INT_MAX - (php_int_t)entry->size - + (php_int_t)CMSG_SPACE(0) - 15L) / entry->var_el_size) { /* the -15 is to account for any padding CMSG_SPACE may add after the data */ php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The value for the " - "third argument (%ld) is too large", n); + "third argument (%pd) is too large", n); return; } - RETURN_LONG((long)CMSG_SPACE(entry->size + n * entry->var_el_size)); + RETURN_INT((long)CMSG_SPACE(entry->size + n * entry->var_el_size)); } #if HAVE_IPV6 @@ -409,35 +409,35 @@ void php_socket_sendrecvmsg_init(INIT_FUNC_ARGS) { /* IPv6 ancillary data */ #if defined(IPV6_RECVPKTINFO) && HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_CS | CONST_PERSISTENT); #endif #if defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_CS | CONST_PERSISTENT); #endif /* would require some effort: - REGISTER_LONG_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVRTHDR", IPV6_RECVRTHDR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS, CONST_CS | CONST_PERSISTENT); */ #if defined(IPV6_RECVTCLASS) && HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_CS | CONST_PERSISTENT); #endif /* - REGISTER_LONG_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_RTHDR", IPV6_RTHDR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_HOPOPTS", IPV6_HOPOPTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_DSTOPTS", IPV6_DSTOPTS, CONST_CS | CONST_PERSISTENT); */ #ifdef SCM_RIGHTS - REGISTER_LONG_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCM_RIGHTS", SCM_RIGHTS, CONST_CS | CONST_PERSISTENT); #endif #ifdef SO_PASSCRED - REGISTER_LONG_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCM_CREDENTIALS", SCM_CREDENTIALS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_PASSCRED", SO_PASSCRED, CONST_CS | CONST_PERSISTENT); #endif #ifdef ZTS diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c index 1c1a90d58f..f563941396 100644 --- a/ext/sockets/sockaddr_conv.c +++ b/ext/sockets/sockaddr_conv.c @@ -61,11 +61,11 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_ } if (scope++) { - long lval = 0; + php_int_t lval = 0; double dval = 0; unsigned scope_id = 0; - if (IS_LONG == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { + if (IS_INT == is_numeric_string(scope, strlen(scope), &lval, &dval, 0)) { if (lval > 0 && lval <= UINT_MAX) { scope_id = lval; } diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index dd7f27260f..5ea62bbd10 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -611,100 +611,100 @@ static PHP_MINIT_FUNCTION(sockets) { le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number); - REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("AF_INET6", AF_INET6, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_CTRUNC", MSG_CTRUNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_TRUNC", MSG_TRUNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT); #ifdef MSG_EOR - REGISTER_LONG_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_EOR", MSG_EOR, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_EOF - REGISTER_LONG_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_EOF", MSG_EOF, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_CONFIRM - REGISTER_LONG_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_CONFIRM", MSG_CONFIRM, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_ERRQUEUE - REGISTER_LONG_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_ERRQUEUE", MSG_ERRQUEUE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_NOSIGNAL - REGISTER_LONG_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_NOSIGNAL", MSG_NOSIGNAL, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_DONTWAIT - REGISTER_LONG_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_DONTWAIT", MSG_DONTWAIT, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_MORE - REGISTER_LONG_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_MORE", MSG_MORE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_WAITFORONE - REGISTER_LONG_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_WAITFORONE",MSG_WAITFORONE, CONST_CS | CONST_PERSISTENT); #endif #ifdef MSG_CMSG_CLOEXEC - REGISTER_LONG_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MSG_CMSG_CLOEXEC",MSG_CMSG_CLOEXEC,CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); #ifdef SO_REUSEPORT - REGISTER_LONG_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); +#endif + REGISTER_INT_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT); #ifdef SO_FAMILY - REGISTER_LONG_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_FAMILY", SO_FAMILY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); #ifdef SO_BINDTODEVICE - REGISTER_LONG_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SO_BINDTODEVICE", SO_BINDTODEVICE, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); #ifdef TCP_NODELAY - REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("TCP_NODELAY", TCP_NODELAY, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_JOIN_GROUP", PHP_MCAST_JOIN_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_LEAVE_GROUP", PHP_MCAST_LEAVE_GROUP, CONST_CS | CONST_PERSISTENT); #ifdef HAS_MCAST_EXT - REGISTER_LONG_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_BLOCK_SOURCE", PHP_MCAST_BLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_UNBLOCK_SOURCE", PHP_MCAST_UNBLOCK_SOURCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_JOIN_SOURCE_GROUP", PHP_MCAST_JOIN_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("MCAST_LEAVE_SOURCE_GROUP", PHP_MCAST_LEAVE_SOURCE_GROUP, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IP_MULTICAST_IF", IP_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IP_MULTICAST_TTL", IP_MULTICAST_TTL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IP_MULTICAST_LOOP", IP_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_MULTICAST_IF", IPV6_MULTICAST_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP, CONST_CS | CONST_PERSISTENT); #endif #ifndef WIN32 @@ -713,16 +713,16 @@ static PHP_MINIT_FUNCTION(sockets) # include "win32_socket_constants.h" #endif - REGISTER_LONG_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPPROTO_IP", IPPROTO_IP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPPROTO_IPV6", IPPROTO_IPV6, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOL_TCP", IPPROTO_TCP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOL_UDP", IPPROTO_UDP, CONST_CS | CONST_PERSISTENT); #if HAVE_IPV6 - REGISTER_LONG_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS, CONST_CS | CONST_PERSISTENT); #endif php_socket_sendrecvmsg_init(INIT_FUNC_ARGS_PASSTHRU); @@ -793,7 +793,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) / php_socket *php_sock; zval new_hash; int num = 0; - ulong num_key; + php_uint_t num_key; zend_string *key; if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0; @@ -836,9 +836,9 @@ PHP_FUNCTION(socket_select) fd_set rfds, wfds, efds; PHP_SOCKET max_fd = 0; int retval, sets = 0; - long usec = 0; + php_int_t usec = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) { return; } @@ -861,19 +861,19 @@ PHP_FUNCTION(socket_select) if (sec != NULL) { zval tmp; - if (Z_TYPE_P(sec) != IS_LONG) { + if (Z_TYPE_P(sec) != IS_INT) { tmp = *sec; zval_copy_ctor(&tmp); - convert_to_long(&tmp); + convert_to_int(&tmp); sec = &tmp; } /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_LVAL_P(sec); + tv.tv_sec = Z_IVAL_P(sec); tv.tv_usec = usec; } @@ -896,7 +896,7 @@ PHP_FUNCTION(socket_select) if (w_array != NULL) php_sock_array_from_fd_set(w_array, &wfds TSRMLS_CC); if (e_array != NULL) php_sock_array_from_fd_set(e_array, &efds TSRMLS_CC); - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -905,9 +905,9 @@ PHP_FUNCTION(socket_select) PHP_FUNCTION(socket_create_listen) { php_socket *php_sock; - long port, backlog = 128; + php_int_t port, backlog = 128; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &port, &backlog) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &port, &backlog) == FAILURE) { return; } @@ -1027,9 +1027,9 @@ PHP_FUNCTION(socket_listen) { zval *arg1; php_socket *php_sock; - long backlog = 0; + php_int_t backlog = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &backlog) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &backlog) == FAILURE) { return; } @@ -1076,10 +1076,10 @@ PHP_FUNCTION(socket_write) zval *arg1; php_socket *php_sock; int retval, str_len; - long length = 0; + php_int_t length = 0; char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &str, &str_len, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &str, &str_len, &length) == FAILURE) { return; } @@ -1100,7 +1100,7 @@ PHP_FUNCTION(socket_write) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1112,9 +1112,9 @@ PHP_FUNCTION(socket_read) php_socket *php_sock; zend_string *tmpbuf; int retval; - long length, type = PHP_BINARY_READ; + php_int_t length, type = PHP_BINARY_READ; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &length, &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|i", &arg1, &length, &type) == FAILURE) { return; } @@ -1206,7 +1206,7 @@ PHP_FUNCTION(socket_getsockname) if (port != NULL) { zval_dtor(port); - ZVAL_LONG(port, htons(sin6->sin6_port)); + ZVAL_INT(port, htons(sin6->sin6_port)); } RETURN_TRUE; break; @@ -1223,7 +1223,7 @@ PHP_FUNCTION(socket_getsockname) if (port != NULL) { zval_dtor(port); - ZVAL_LONG(port, htons(sin->sin_port)); + ZVAL_INT(port, htons(sin->sin_port)); } RETURN_TRUE; break; @@ -1283,7 +1283,7 @@ PHP_FUNCTION(socket_getpeername) if (arg3 != NULL) { zval_dtor(arg3); - ZVAL_LONG(arg3, htons(sin6->sin6_port)); + ZVAL_INT(arg3, htons(sin6->sin6_port)); } RETURN_TRUE; @@ -1301,7 +1301,7 @@ PHP_FUNCTION(socket_getpeername) if (arg3 != NULL) { zval_dtor(arg3); - ZVAL_LONG(arg3, htons(sin->sin_port)); + ZVAL_INT(arg3, htons(sin->sin_port)); } RETURN_TRUE; @@ -1326,10 +1326,10 @@ PHP_FUNCTION(socket_getpeername) Creates an endpoint for communication in the domain specified by domain, of type specified by type */ PHP_FUNCTION(socket_create) { - long arg1, arg2, arg3; + php_int_t arg1, arg2, arg3; php_socket *php_sock = php_create_socket(); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &arg1, &arg2, &arg3) == FAILURE) { efree(php_sock); return; } @@ -1339,12 +1339,12 @@ PHP_FUNCTION(socket_create) && arg1 != AF_INET6 #endif && arg1 != AF_INET) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket domain [%ld] specified for argument 1, assuming AF_INET", arg1); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket domain [%pd] specified for argument 1, assuming AF_INET", arg1); arg1 = AF_INET; } if (arg2 > 10) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket type [%ld] specified for argument 2, assuming SOCK_STREAM", arg2); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket type [%pd] specified for argument 2, assuming SOCK_STREAM", arg2); arg2 = SOCK_STREAM; } @@ -1373,10 +1373,10 @@ PHP_FUNCTION(socket_connect) php_socket *php_sock; char *addr; int retval, addr_len; - long port = 0; + php_int_t port = 0; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rs|i", &arg1, &addr, &addr_len, &port) == FAILURE) { return; } @@ -1457,9 +1457,9 @@ PHP_FUNCTION(socket_connect) Returns a string describing an error */ PHP_FUNCTION(socket_strerror) { - long arg1; + php_int_t arg1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &arg1) == FAILURE) { return; } @@ -1477,10 +1477,10 @@ PHP_FUNCTION(socket_bind) php_socket *php_sock; char *addr; int addr_len; - long port = 0; - long retval = 0; + php_int_t port = 0; + php_int_t retval = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &addr, &addr_len, &port) == FAILURE) { return; } @@ -1558,9 +1558,9 @@ PHP_FUNCTION(socket_recv) zend_string *recv_buf; php_socket *php_sock; int retval; - long len, flags; + php_int_t len, flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/ll", &php_sock_res, &buf, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/ii", &php_sock_res, &buf, &len, &flags) == FAILURE) { return; } @@ -1592,7 +1592,7 @@ PHP_FUNCTION(socket_recv) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1603,10 +1603,10 @@ PHP_FUNCTION(socket_send) zval *arg1; php_socket *php_sock; int buf_len, retval; - long len, flags; + php_int_t len, flags; char *buf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsll", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsii", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) { return; } @@ -1619,7 +1619,7 @@ PHP_FUNCTION(socket_send) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1637,11 +1637,11 @@ PHP_FUNCTION(socket_recvfrom) #endif socklen_t slen; int retval; - long arg3, arg4; + php_int_t arg3, arg4; char *address; zend_string *recv_buf; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/llz/|z/", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/iiz/|z/", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { return; } @@ -1703,7 +1703,7 @@ PHP_FUNCTION(socket_recvfrom) ZVAL_STR(arg2, recv_buf); ZVAL_STRING(arg5, address ? address : "0.0.0.0"); - ZVAL_LONG(arg6, ntohs(sin.sin_port)); + ZVAL_INT(arg6, ntohs(sin.sin_port)); break; #if HAVE_IPV6 case AF_INET6: @@ -1735,7 +1735,7 @@ PHP_FUNCTION(socket_recvfrom) ZVAL_STR(arg2, recv_buf); ZVAL_STRING(arg5, addr6[0] ? addr6 : "::"); - ZVAL_LONG(arg6, ntohs(sin6.sin6_port)); + ZVAL_INT(arg6, ntohs(sin6.sin6_port)); break; #endif default: @@ -1743,7 +1743,7 @@ PHP_FUNCTION(socket_recvfrom) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1759,11 +1759,11 @@ PHP_FUNCTION(socket_sendto) struct sockaddr_in6 sin6; #endif int retval, buf_len, addr_len; - long len, flags, port = 0; + php_int_t len, flags, port = 0; char *buf, *addr; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rslls|l", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "rsiis|i", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) { return; } @@ -1820,7 +1820,7 @@ PHP_FUNCTION(socket_sendto) RETURN_FALSE; } - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -1837,9 +1837,9 @@ PHP_FUNCTION(socket_get_option) socklen_t optlen; php_socket *php_sock; int other_val; - long level, optname; + php_int_t level, optname; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &arg1, &level, &optname) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rii", &arg1, &level, &optname) == FAILURE) { return; } @@ -1856,7 +1856,7 @@ PHP_FUNCTION(socket_get_option) RETURN_FALSE; } if (php_add4_to_if_index(&if_addr, php_sock, &if_index TSRMLS_CC) == SUCCESS) { - RETURN_LONG((long) if_index); + RETURN_INT((long) if_index); } else { RETURN_FALSE; } @@ -1885,8 +1885,8 @@ PHP_FUNCTION(socket_get_option) } array_init(return_value); - add_assoc_long(return_value, "l_onoff", linger_val.l_onoff); - add_assoc_long(return_value, "l_linger", linger_val.l_linger); + add_assoc_int(return_value, "l_onoff", linger_val.l_onoff); + add_assoc_int(return_value, "l_linger", linger_val.l_linger); break; case SO_RCVTIMEO: @@ -1912,8 +1912,8 @@ PHP_FUNCTION(socket_get_option) array_init(return_value); - add_assoc_long(return_value, "sec", tv.tv_sec); - add_assoc_long(return_value, "usec", tv.tv_usec); + add_assoc_int(return_value, "sec", tv.tv_sec); + add_assoc_int(return_value, "usec", tv.tv_usec); break; default: @@ -1926,7 +1926,7 @@ PHP_FUNCTION(socket_get_option) if (optlen == 1) other_val = *((unsigned char *)&other_val); - RETURN_LONG(other_val); + RETURN_INT(other_val); break; } } @@ -1945,14 +1945,14 @@ PHP_FUNCTION(socket_set_option) #else struct timeval tv; #endif - long level, optname; + php_int_t level, optname; void *opt_ptr; HashTable *opt_ht; zval *l_onoff, *l_linger; zval *sec, *usec; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllz", &arg1, &level, &optname, &arg4) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riiz", &arg1, &level, &optname, &arg4) == FAILURE) { return; } @@ -2000,11 +2000,11 @@ PHP_FUNCTION(socket_set_option) RETURN_FALSE; } - convert_to_long_ex(l_onoff); - convert_to_long_ex(l_linger); + convert_to_int_ex(l_onoff); + convert_to_int_ex(l_linger); - lv.l_onoff = (unsigned short)Z_LVAL_P(l_onoff); - lv.l_linger = (unsigned short)Z_LVAL_P(l_linger); + lv.l_onoff = (unsigned short)Z_IVAL_P(l_onoff); + lv.l_linger = (unsigned short)Z_IVAL_P(l_linger); optlen = sizeof(lv); opt_ptr = &lv; @@ -2028,15 +2028,15 @@ PHP_FUNCTION(socket_set_option) RETURN_FALSE; } - convert_to_long_ex(sec); - convert_to_long_ex(usec); + convert_to_int_ex(sec); + convert_to_int_ex(usec); #ifndef PHP_WIN32 - tv.tv_sec = Z_LVAL_P(sec); - tv.tv_usec = Z_LVAL_P(usec); + tv.tv_sec = Z_IVAL_P(sec); + tv.tv_usec = Z_IVAL_P(usec); optlen = sizeof(tv); opt_ptr = &tv; #else - timeout = Z_LVAL_P(sec) * 1000 + Z_LVAL_P(usec) / 1000; + timeout = Z_IVAL_P(sec) * 1000 + Z_IVAL_P(usec) / 1000; optlen = sizeof(int); opt_ptr = &timeout; #endif @@ -2046,7 +2046,7 @@ PHP_FUNCTION(socket_set_option) case SO_BINDTODEVICE: { if (Z_TYPE_P(arg4) == IS_STRING) { opt_ptr = Z_STRVAL_P(arg4); - optlen = Z_STRLEN_P(arg4); + optlen = Z_STRSIZE_P(arg4); } else { opt_ptr = ""; optlen = 0; @@ -2057,8 +2057,8 @@ PHP_FUNCTION(socket_set_option) default: default_case: - convert_to_long_ex(arg4); - ov = Z_LVAL_P(arg4); + convert_to_int_ex(arg4); + ov = Z_IVAL_P(arg4); optlen = sizeof(ov); opt_ptr = &ov; @@ -2083,9 +2083,9 @@ PHP_FUNCTION(socket_create_pair) zval retval[2], *fds_array_zval; php_socket *php_sock[2]; PHP_SOCKET fds_array[2]; - long domain, type, protocol; + php_int_t domain, type, protocol; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllz/", &domain, &type, &protocol, &fds_array_zval) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiiz/", &domain, &type, &protocol, &fds_array_zval) == FAILURE) { return; } @@ -2097,12 +2097,12 @@ PHP_FUNCTION(socket_create_pair) && domain != AF_INET6 #endif && domain != AF_UNIX) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket domain [%ld] specified for argument 1, assuming AF_INET", domain); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket domain [%pd] specified for argument 1, assuming AF_INET", domain); domain = AF_INET; } if (type > 10) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket type [%ld] specified for argument 2, assuming SOCK_STREAM", type); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid socket type [%pd] specified for argument 2, assuming SOCK_STREAM", type); type = SOCK_STREAM; } @@ -2143,10 +2143,10 @@ PHP_FUNCTION(socket_create_pair) PHP_FUNCTION(socket_shutdown) { zval *arg1; - long how_shutdown = 2; + php_int_t how_shutdown = 2; php_socket *php_sock; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &how_shutdown) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &how_shutdown) == FAILURE) { return; } @@ -2175,9 +2175,9 @@ PHP_FUNCTION(socket_last_error) if (arg1) { ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, le_socket_name, le_socket); - RETVAL_LONG(php_sock->error); + RETVAL_INT(php_sock->error); } else { - RETVAL_LONG(SOCKETS_G(last_error)); + RETVAL_INT(SOCKETS_G(last_error)); } } /* }}} */ diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h index 485b2534d2..645b018cbf 100644 --- a/ext/sockets/unix_socket_constants.h +++ b/ext/sockets/unix_socket_constants.h @@ -22,405 +22,405 @@ #ifdef EPERM /* Operation not permitted */ - REGISTER_LONG_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPERM", EPERM, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOENT /* No such file or directory */ - REGISTER_LONG_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOENT", ENOENT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINTR /* Interrupted system call */ - REGISTER_LONG_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EINTR", EINTR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EIO /* I/O error */ - REGISTER_LONG_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EIO", EIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENXIO /* No such device or address */ - REGISTER_LONG_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENXIO", ENXIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef E2BIG /* Arg list too long */ - REGISTER_LONG_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_E2BIG", E2BIG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADF /* Bad file number */ - REGISTER_LONG_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADF", EBADF, CONST_CS | CONST_PERSISTENT); #endif #ifdef EAGAIN /* Try again */ - REGISTER_LONG_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EAGAIN", EAGAIN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMEM /* Out of memory */ - REGISTER_LONG_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOMEM", ENOMEM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EACCES /* Permission denied */ - REGISTER_LONG_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EACCES", EACCES, CONST_CS | CONST_PERSISTENT); #endif #ifdef EFAULT /* Bad address */ - REGISTER_LONG_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EFAULT", EFAULT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTBLK /* Block device required */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTBLK", ENOTBLK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBUSY /* Device or resource busy */ - REGISTER_LONG_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBUSY", EBUSY, CONST_CS | CONST_PERSISTENT); #endif #ifdef EEXIST /* File exists */ - REGISTER_LONG_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EEXIST", EEXIST, CONST_CS | CONST_PERSISTENT); #endif #ifdef EXDEV /* Cross-device link */ - REGISTER_LONG_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EXDEV", EXDEV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENODEV /* No such device */ - REGISTER_LONG_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENODEV", ENODEV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTDIR /* Not a directory */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTDIR", ENOTDIR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISDIR /* Is a directory */ - REGISTER_LONG_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EISDIR", EISDIR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINVAL /* Invalid argument */ - REGISTER_LONG_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EINVAL", EINVAL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENFILE /* File table overflow */ - REGISTER_LONG_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENFILE", ENFILE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMFILE /* Too many open files */ - REGISTER_LONG_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMFILE", EMFILE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTTY /* Not a typewriter */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTTY", ENOTTY, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSPC /* No space left on device */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSPC", ENOSPC, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESPIPE /* Illegal seek */ - REGISTER_LONG_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESPIPE", ESPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EROFS /* Read-only file system */ - REGISTER_LONG_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EROFS", EROFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMLINK /* Too many links */ - REGISTER_LONG_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMLINK", EMLINK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPIPE /* Broken pipe */ - REGISTER_LONG_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPIPE", EPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENAMETOOLONG /* File name too long */ - REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", ENAMETOOLONG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOLCK /* No record locks available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOLCK", ENOLCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSYS /* Function not implemented */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSYS", ENOSYS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTEMPTY /* Directory not empty */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", ENOTEMPTY, CONST_CS | CONST_PERSISTENT); #endif #ifdef ELOOP /* Too many symbolic links encountered */ - REGISTER_LONG_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ELOOP", ELOOP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EWOULDBLOCK /* Operation would block */ - REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", EWOULDBLOCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMSG /* No message of desired type */ - REGISTER_LONG_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOMSG", ENOMSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EIDRM /* Identifier removed */ - REGISTER_LONG_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EIDRM", EIDRM, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECHRNG /* Channel number out of range */ - REGISTER_LONG_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECHRNG", ECHRNG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL2NSYNC /* Level 2 not synchronized */ - REGISTER_LONG_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL2NSYNC", EL2NSYNC, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL3HLT /* Level 3 halted */ - REGISTER_LONG_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL3HLT", EL3HLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL3RST /* Level 3 reset */ - REGISTER_LONG_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL3RST", EL3RST, CONST_CS | CONST_PERSISTENT); #endif #ifdef ELNRNG /* Link number out of range */ - REGISTER_LONG_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ELNRNG", ELNRNG, CONST_CS | CONST_PERSISTENT); #endif #ifdef EUNATCH /* Protocol driver not attached */ - REGISTER_LONG_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EUNATCH", EUNATCH, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOCSI /* No CSI structure available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOCSI", ENOCSI, CONST_CS | CONST_PERSISTENT); #endif #ifdef EL2HLT /* Level 2 halted */ - REGISTER_LONG_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EL2HLT", EL2HLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADE /* Invalid exchange */ - REGISTER_LONG_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADE", EBADE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADR /* Invalid request descriptor */ - REGISTER_LONG_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADR", EBADR, CONST_CS | CONST_PERSISTENT); #endif #ifdef EXFULL /* Exchange full */ - REGISTER_LONG_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EXFULL", EXFULL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOANO /* No anode */ - REGISTER_LONG_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOANO", ENOANO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADRQC /* Invalid request code */ - REGISTER_LONG_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADRQC", EBADRQC, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADSLT /* Invalid slot */ - REGISTER_LONG_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADSLT", EBADSLT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSTR /* Device not a stream */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSTR", ENOSTR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENODATA /* No data available */ - REGISTER_LONG_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENODATA", ENODATA, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETIME /* Timer expired */ - REGISTER_LONG_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ETIME", ETIME, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOSR /* Out of streams resources */ - REGISTER_LONG_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOSR", ENOSR, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENONET /* Machine is not on the network */ - REGISTER_LONG_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENONET", ENONET, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMOTE /* Object is remote */ - REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EREMOTE", EREMOTE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOLINK /* Link has been severed */ - REGISTER_LONG_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOLINK", ENOLINK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADV /* Advertise error */ - REGISTER_LONG_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EADV", EADV, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESRMNT /* Srmount error */ - REGISTER_LONG_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESRMNT", ESRMNT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECOMM /* Communication error on send */ - REGISTER_LONG_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECOMM", ECOMM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTO /* Protocol error */ - REGISTER_LONG_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPROTO", EPROTO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMULTIHOP /* Multihop attempted */ - REGISTER_LONG_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMULTIHOP", EMULTIHOP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADMSG /* Not a data message */ - REGISTER_LONG_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADMSG", EBADMSG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTUNIQ /* Name not unique on network */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTUNIQ", ENOTUNIQ, CONST_CS | CONST_PERSISTENT); #endif #ifdef EBADFD /* File descriptor in bad state */ - REGISTER_LONG_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EBADFD", EBADFD, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMCHG /* Remote address changed */ - REGISTER_LONG_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EREMCHG", EREMCHG, CONST_CS | CONST_PERSISTENT); #endif #ifdef ERESTART /* Interrupted system call should be restarted */ - REGISTER_LONG_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ERESTART", ERESTART, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESTRPIPE /* Streams pipe error */ - REGISTER_LONG_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESTRPIPE", ESTRPIPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EUSERS /* Too many users */ - REGISTER_LONG_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EUSERS", EUSERS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTSOCK /* Socket operation on non-socket */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", ENOTSOCK, CONST_CS | CONST_PERSISTENT); #endif #ifdef EDESTADDRREQ /* Destination address required */ - REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", EDESTADDRREQ, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMSGSIZE /* Message too long */ - REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", EMSGSIZE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTOTYPE /* Protocol wrong type for socket */ - REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", EPROTOTYPE, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOPROTOOPT /* Protocol not available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", ENOPROTOOPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPROTONOSUPPORT /* Protocol not supported */ - REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", EPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESOCKTNOSUPPORT /* Socket type not supported */ - REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EOPNOTSUPP /* Operation not supported on transport endpoint */ - REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", EOPNOTSUPP, CONST_CS | CONST_PERSISTENT); #endif #ifdef EPFNOSUPPORT /* Protocol family not supported */ - REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", EPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EAFNOSUPPORT /* Address family not supported by protocol */ - REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", EAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADDRINUSE /* Address already in use */ - REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", EADDRINUSE, CONST_CS | CONST_PERSISTENT); #endif #ifdef EADDRNOTAVAIL /* Cannot assign requested address */ - REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", EADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETDOWN /* Network is down */ - REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", ENETDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETUNREACH /* Network is unreachable */ - REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", ENETUNREACH, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENETRESET /* Network dropped connection because of reset */ - REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENETRESET", ENETRESET, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNABORTED /* Software caused connection abort */ - REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", ECONNABORTED, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNRESET /* Connection reset by peer */ - REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", ECONNRESET, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOBUFS /* No buffer space available */ - REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", ENOBUFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISCONN /* Transport endpoint is already connected */ - REGISTER_LONG_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EISCONN", EISCONN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOTCONN /* Transport endpoint is not connected */ - REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", ENOTCONN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ESHUTDOWN /* Cannot send after transport endpoint shutdown */ - REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", ESHUTDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETOOMANYREFS /* Too many references: cannot splice */ - REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", ETOOMANYREFS, CONST_CS | CONST_PERSISTENT); #endif #ifdef ETIMEDOUT /* Connection timed out */ - REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", ETIMEDOUT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ECONNREFUSED /* Connection refused */ - REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", ECONNREFUSED, CONST_CS | CONST_PERSISTENT); #endif #ifdef EHOSTDOWN /* Host is down */ - REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", EHOSTDOWN, CONST_CS | CONST_PERSISTENT); #endif #ifdef EHOSTUNREACH /* No route to host */ - REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", EHOSTUNREACH, CONST_CS | CONST_PERSISTENT); #endif #ifdef EALREADY /* Operation already in progress */ - REGISTER_LONG_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EALREADY", EALREADY, CONST_CS | CONST_PERSISTENT); #endif #ifdef EINPROGRESS /* Operation now in progress */ - REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", EINPROGRESS, CONST_CS | CONST_PERSISTENT); #endif #ifdef EISNAM /* Is a named type file */ - REGISTER_LONG_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EISNAM", EISNAM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EREMOTEIO /* Remote I/O error */ - REGISTER_LONG_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EREMOTEIO", EREMOTEIO, CONST_CS | CONST_PERSISTENT); #endif #ifdef EDQUOT /* Quota exceeded */ - REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EDQUOT", EDQUOT, CONST_CS | CONST_PERSISTENT); #endif #ifdef ENOMEDIUM /* No medium found */ - REGISTER_LONG_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_ENOMEDIUM", ENOMEDIUM, CONST_CS | CONST_PERSISTENT); #endif #ifdef EMEDIUMTYPE /* Wrong medium type */ - REGISTER_LONG_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SOCKET_EMEDIUMTYPE", EMEDIUMTYPE, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h index 848e14fb51..2d633efdb7 100644 --- a/ext/sockets/win32_socket_constants.h +++ b/ext/sockets/win32_socket_constants.h @@ -20,55 +20,55 @@ /* This file is to be included by sockets.c */ -REGISTER_LONG_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT); -REGISTER_LONG_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EINTR", WSAEINTR, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EBADF", WSAEBADF, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EACCES", WSAEACCES, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EFAULT", WSAEFAULT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EINVAL", WSAEINVAL, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EMFILE", WSAEMFILE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EWOULDBLOCK", WSAEWOULDBLOCK, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EINPROGRESS", WSAEINPROGRESS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EALREADY", WSAEALREADY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOTSOCK", WSAENOTSOCK, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EDESTADDRREQ", WSAEDESTADDRREQ, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EMSGSIZE", WSAEMSGSIZE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPROTOTYPE", WSAEPROTOTYPE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOPROTOOPT", WSAENOPROTOOPT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPROTONOSUPPORT", WSAEPROTONOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EOPNOTSUPP", WSAEOPNOTSUPP, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPFNOSUPPORT", WSAEPFNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EAFNOSUPPORT", WSAEAFNOSUPPORT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EADDRINUSE", WSAEADDRINUSE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EADDRNOTAVAIL", WSAEADDRNOTAVAIL, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENETDOWN", WSAENETDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENETUNREACH", WSAENETUNREACH, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENETRESET", WSAENETRESET, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ECONNABORTED", WSAECONNABORTED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ECONNRESET", WSAECONNRESET, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOBUFS", WSAENOBUFS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EISCONN", WSAEISCONN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOTCONN", WSAENOTCONN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ESHUTDOWN", WSAESHUTDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ETOOMANYREFS", WSAETOOMANYREFS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ETIMEDOUT", WSAETIMEDOUT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ECONNREFUSED", WSAECONNREFUSED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ELOOP", WSAELOOP, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENAMETOOLONG", WSAENAMETOOLONG, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EHOSTDOWN", WSAEHOSTDOWN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EHOSTUNREACH", WSAEHOSTUNREACH, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ENOTEMPTY", WSAENOTEMPTY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EPROCLIM", WSAEPROCLIM, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EUSERS", WSAEUSERS, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EDQUOT", WSAEDQUOT, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_ESTALE", WSAESTALE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EREMOTE", WSAEREMOTE, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_EDISCON", WSAEDISCON, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_SYSNOTREADY", WSASYSNOTREADY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_VERNOTSUPPORTED", WSAVERNOTSUPPORTED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NOTINITIALISED", WSANOTINITIALISED, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_HOST_NOT_FOUND", WSAHOST_NOT_FOUND, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_TRY_AGAIN", WSATRY_AGAIN, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NO_RECOVERY", WSANO_RECOVERY, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NO_DATA", WSANO_DATA, CONST_CS | CONST_PERSISTENT); +REGISTER_INT_CONSTANT("SOCKET_NO_ADDRESS", WSANO_ADDRESS, CONST_CS | CONST_PERSISTENT); diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 5636a5f989..5ca26d3f19 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -417,8 +417,8 @@ PHP_FUNCTION(spl_autoload_call) if (SPL_G(autoload_functions)) { int l_autoload_running = SPL_G(autoload_running); SPL_G(autoload_running) = 1; - lc_name = STR_ALLOC(Z_STRLEN_P(class_name), 0); - zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRLEN_P(class_name)); + lc_name = STR_ALLOC(Z_STRSIZE_P(class_name), 0); + zend_str_tolower_copy(lc_name->val, Z_STRVAL_P(class_name), Z_STRSIZE_P(class_name)); ZEND_HASH_FOREACH_STR_KEY_PTR(SPL_G(autoload_functions), func_name, alfi) { zend_call_method(Z_ISUNDEF(alfi->obj)? NULL : &alfi->obj, alfi->ce, &alfi->func_ptr, func_name->val, func_name->len, retval, 1, class_name, NULL TSRMLS_CC); zend_exception_save(TSRMLS_C); diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 720a704e92..23ee137064 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -66,7 +66,7 @@ typedef struct _spl_array_object { zval array; zval retval; HashPosition pos; - ulong pos_h; + php_uint_t pos_h; int ar_flags; int is_self; zend_function *fptr_offset_get; @@ -300,7 +300,7 @@ static zend_object *spl_array_object_clone(zval *zobject TSRMLS_DC) static zval *spl_array_get_dimension_ptr(int check_inherited, zval *object, zval *offset, int type TSRMLS_DC) /* {{{ */ { zval *retval; - long index; + php_int_t index; zend_string *offset_key; spl_array_object *intern = Z_SPLARRAY_P(object); HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -360,11 +360,11 @@ fetch_dim_string: } return retval; case IS_RESOURCE: - zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle); + zend_error(E_STRICT, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle); index = Z_RES_P(offset)->handle; goto num_index; case IS_DOUBLE: - index = (long)Z_DVAL_P(offset); + index = (php_int_t)Z_DVAL_P(offset); goto num_index; case IS_FALSE: index = 0; @@ -372,19 +372,19 @@ fetch_dim_string: case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: if ((retval = zend_hash_index_find(ht, index)) == NULL) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined offset: %ld", index); + zend_error(E_NOTICE, "Undefined offset: %pd", index); case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE, "Undefined offset: %ld", index); + zend_error(E_NOTICE, "Undefined offset: %pd", index); case BP_VAR_W: { zval value; ZVAL_UNDEF(&value); @@ -450,7 +450,7 @@ static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = Z_SPLARRAY_P(object); - long index; + php_int_t index; HashTable *ht; if (check_inherited && intern->fptr_offset_set) { @@ -493,7 +493,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval zend_symtable_update_ind(ht, Z_STR_P(offset), value); return; case IS_DOUBLE: - index = (long)Z_DVAL_P(offset); + index = (php_int_t)Z_DVAL_P(offset); goto num_index; case IS_RESOURCE: index = Z_RES_HANDLE_P(offset); @@ -504,8 +504,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->u.v.nApplyCount > 0) { @@ -535,7 +535,7 @@ static void spl_array_write_dimension(zval *object, zval *offset, zval *value TS static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; HashTable *ht; spl_array_object *intern = Z_SPLARRAY_P(object); @@ -585,7 +585,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval } break; case IS_DOUBLE: - index = (long)Z_DVAL_P(offset); + index = (php_int_t)Z_DVAL_P(offset); goto num_index; case IS_RESOURCE: index = Z_RES_HANDLE_P(offset); @@ -596,8 +596,8 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->u.v.nApplyCount > 0) { @@ -605,7 +605,7 @@ num_index: return; } if (zend_hash_index_del(ht, index) == FAILURE) { - zend_error(E_NOTICE,"Undefined offset: %ld", index); + zend_error(E_NOTICE,"Undefined offset: %pd", index); } break; default: @@ -623,7 +623,7 @@ static void spl_array_unset_dimension(zval *object, zval *offset TSRMLS_DC) /* { static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { spl_array_object *intern = Z_SPLARRAY_P(object); - long index; + php_int_t index; zval rv, *value = NULL, *tmp; if (check_inherited && intern->fptr_offset_has) { @@ -664,7 +664,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o break; case IS_DOUBLE: - index = (long)Z_DVAL_P(offset); + index = (php_int_t)Z_DVAL_P(offset); goto num_index; case IS_RESOURCE: index = Z_RES_HANDLE_P(offset); @@ -675,8 +675,8 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o case IS_TRUE: index = 1; goto num_index; - case IS_LONG: - index = Z_LVAL_P(offset); + case IS_INT: + index = Z_IVAL_P(offset); num_index: if ((tmp = zend_hash_index_find(ht, index)) != NULL) { if (check_empty == 2) { @@ -957,7 +957,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ ht2 = spl_array_get_hash_table(intern2, 0 TSRMLS_CC); zend_compare_symbol_tables(&temp_zv, ht1, ht2 TSRMLS_CC); - result = (int)Z_LVAL(temp_zv); + result = (int)Z_IVAL(temp_zv); /* if we just compared std.properties, don't do it again */ if (result == 0 && !(ht1 == intern1->std.properties && ht2 == intern2->std.properties)) { @@ -969,7 +969,7 @@ static int spl_array_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */ static int spl_array_skip_protected(spl_array_object *intern, HashTable *aht TSRMLS_DC) /* {{{ */ { zend_string *string_key; - ulong num_key; + php_uint_t num_key; zval *data; if (Z_TYPE(intern->array) == IS_OBJECT) { @@ -1141,7 +1141,7 @@ static void spl_array_it_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */ /* }}} */ /* {{{ spl_array_set_array */ -static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, long ar_flags, int just_array TSRMLS_DC) { +static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, php_int_t ar_flags, int just_array TSRMLS_DC) { if (Z_TYPE_P(array) == IS_ARRAY) { SEPARATE_ZVAL_IF_NOT_REF(array); @@ -1223,7 +1223,7 @@ SPL_METHOD(Array, __construct) zval *object = getThis(); spl_array_object *intern; zval *array; - long ar_flags = 0; + php_int_t ar_flags = 0; zend_class_entry *ce_get_iterator = spl_ce_Iterator; zend_error_handling error_handling; @@ -1235,7 +1235,7 @@ SPL_METHOD(Array, __construct) intern = Z_SPLARRAY_P(object); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|iC", &array, &ar_flags, &ce_get_iterator) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1302,7 +1302,7 @@ SPL_METHOD(Array, getFlags) return; } - RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK); + RETURN_INT(intern->ar_flags & ~SPL_ARRAY_INT_MASK); } /* }}} */ @@ -1312,9 +1312,9 @@ SPL_METHOD(Array, setFlags) { zval *object = getThis(); spl_array_object *intern = Z_SPLARRAY_P(object); - long ar_flags = 0; + php_int_t ar_flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ar_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ar_flags) == FAILURE) { return; } @@ -1381,13 +1381,13 @@ SPL_METHOD(Array, rewind) Seek to position. */ SPL_METHOD(Array, seek) { - long opos, position; + php_int_t opos, position; zval *object = getThis(); spl_array_object *intern = Z_SPLARRAY_P(object); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); int result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &position) == FAILURE) { return; } @@ -1408,10 +1408,10 @@ SPL_METHOD(Array, seek) return; /* ok */ } } - zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %pd is out of range", opos); } /* }}} */ -int static spl_array_object_count_elements_helper(spl_array_object *intern, long *count TSRMLS_DC) /* {{{ */ +int static spl_array_object_count_elements_helper(spl_array_object *intern, php_int_t *count TSRMLS_DC) /* {{{ */ { HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); HashPosition pos; @@ -1439,7 +1439,7 @@ int static spl_array_object_count_elements_helper(spl_array_object *intern, long } } /* }}} */ -int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +int spl_array_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_array_object *intern = Z_SPLARRAY_P(object); @@ -1449,8 +1449,8 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ if (Z_TYPE(rv) != IS_UNDEF) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long)Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (php_int_t)Z_IVAL(intern->retval); return SUCCESS; } *count = 0; @@ -1464,7 +1464,7 @@ int spl_array_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ Return the number of elements in the Iterator. */ SPL_METHOD(Array, count) { - long count; + php_int_t count; spl_array_object *intern = Z_SPLARRAY_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -1473,7 +1473,7 @@ SPL_METHOD(Array, count) spl_array_object_count_elements_helper(intern, &count TSRMLS_CC); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */ @@ -1706,7 +1706,7 @@ SPL_METHOD(Array, getChildren) } } - ZVAL_LONG(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags); + ZVAL_INT(&flags, SPL_ARRAY_USE_OTHER | intern->ar_flags); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, entry, &flags TSRMLS_CC); } /* }}} */ @@ -1733,7 +1733,7 @@ SPL_METHOD(Array, serialize) PHP_VAR_SERIALIZE_INIT(var_hash); - ZVAL_LONG(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK)); + ZVAL_INT(&flags, (intern->ar_flags & SPL_ARRAY_CLONE_MASK)); /* storage */ smart_str_appendl(&buf, "x:", 2); @@ -1781,7 +1781,7 @@ SPL_METHOD(Array, unserialize) php_unserialize_data_t var_hash; zval members, zflags; HashTable *aht; - long flags; + php_int_t flags; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; @@ -1806,12 +1806,12 @@ SPL_METHOD(Array, unserialize) } ++p; - if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_LONG) { + if (!php_var_unserialize(&zflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE(zflags) != IS_INT) { goto outexcept; } --p; /* for ';' */ - flags = Z_LVAL(zflags); + flags = Z_IVAL(zflags); /* flags needs to be verified and we also need to verify whether the next * thing we get is ';'. After that we require an 'm' or somethign else * where 'm' stands for members and anything else should be an array. If @@ -1861,7 +1861,7 @@ SPL_METHOD(Array, unserialize) outexcept: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len); return; } /* }}} */ @@ -2018,13 +2018,13 @@ PHP_MINIT_FUNCTION(spl_array) REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); - REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); + REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); + REGISTER_SPL_CLASS_CONST_INT(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); - REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); + REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST); + REGISTER_SPL_CLASS_CONST_INT(ArrayIterator, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY); + REGISTER_SPL_CLASS_CONST_INT(RecursiveArrayIterator, "CHILD_ARRAYS_ONLY", SPL_ARRAY_CHILD_ARRAYS_ONLY); return SUCCESS; } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index f9fe83e26d..de8cff4ab0 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -671,19 +671,19 @@ zend_function *spl_filesystem_object_get_method_check(zend_object **object, zend #define DIT_CTOR_FLAGS 0x00000001 #define DIT_CTOR_GLOB 0x00000002 -void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, long ctor_flags) /* {{{ */ +void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, php_int_t ctor_flags) /* {{{ */ { spl_filesystem_object *intern; char *path; int parsed, len; - long flags; + php_int_t flags; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_FLAGS)) { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; - parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &len, &flags); + parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &len, &flags); } else { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &path, &len); @@ -767,7 +767,7 @@ SPL_METHOD(DirectoryIterator, key) } if (intern->u.dir.dirp) { - RETURN_LONG(intern->u.dir.index); + RETURN_INT(intern->u.dir.index); } else { RETURN_FALSE; } @@ -813,9 +813,9 @@ SPL_METHOD(DirectoryIterator, seek) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); zval retval; - long pos; + php_int_t pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) { return; } @@ -1445,7 +1445,7 @@ SPL_METHOD(FilesystemIterator, getFlags) return; } - RETURN_LONG(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); + RETURN_INT(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK)); } /* }}} */ /* {{{ proto void FilesystemIterator::setFlags(long $flags) @@ -1453,9 +1453,9 @@ SPL_METHOD(FilesystemIterator, getFlags) SPL_METHOD(FilesystemIterator, setFlags) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - long flags; + php_int_t flags; - 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; } @@ -1506,7 +1506,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren) if (SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) { RETURN_STRINGL(intern->file_name, intern->file_name_len); } else { - ZVAL_LONG(&zflags, intern->flags); + ZVAL_INT(&zflags, intern->flags); ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &zpath, &zflags TSRMLS_CC); zval_ptr_dtor(&zpath); @@ -1597,7 +1597,7 @@ SPL_METHOD(GlobIterator, count) } if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { - RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); + RETURN_INT(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); } else { /* should not happen */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "GlobIterator lost glob state"); @@ -1686,7 +1686,7 @@ static void spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zval * { spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter TSRMLS_CC); - ZVAL_LONG(key, object->u.dir.index); + ZVAL_INT(key, object->u.dir.index); } /* }}} */ @@ -2025,7 +2025,7 @@ static int spl_filesystem_file_read(spl_filesystem_object *intern, int silent TS { char *buf; size_t line_len = 0; - long line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0; + php_int_t line_add = (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) ? 1 : 0; spl_filesystem_file_free_line(intern TSRMLS_CC); @@ -2177,8 +2177,8 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje } spl_filesystem_file_free_line(intern TSRMLS_CC); if (Z_TYPE(retval) == IS_STRING) { - intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRLEN(retval)); - intern->u.file.current_line_len = Z_STRLEN(retval); + intern->u.file.current_line = estrndup(Z_STRVAL(retval), Z_STRSIZE(retval)); + intern->u.file.current_line_len = Z_STRSIZE(retval); } else { ZVAL_ZVAL(&intern->u.file.current_zval, &retval, 1, 0); } @@ -2199,7 +2199,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML } else if (!Z_ISUNDEF(intern->u.file.current_zval)) { switch(Z_TYPE(intern->u.file.current_zval)) { case IS_STRING: - return Z_STRLEN(intern->u.file.current_zval) == 0; + return Z_STRSIZE(intern->u.file.current_zval) == 0; case IS_ARRAY: if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) && zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 1) { @@ -2210,7 +2210,7 @@ static int spl_filesystem_file_is_empty_line(spl_filesystem_object *intern TSRML idx++; } first = &Z_ARRVAL(intern->u.file.current_zval)->arData[idx].val; - return Z_TYPE_P(first) == IS_STRING && Z_STRLEN_P(first) == 0; + return Z_TYPE_P(first) == IS_STRING && Z_STRSIZE_P(first) == 0; } return zend_hash_num_elements(Z_ARRVAL(intern->u.file.current_zval)) == 0; case IS_NULL: @@ -2319,14 +2319,14 @@ SPL_METHOD(SplFileObject, __construct) Construct a new temp file object */ SPL_METHOD(SplTempFileObject, __construct) { - long max_memory = PHP_STREAM_MAX_MEM; + php_int_t max_memory = PHP_STREAM_MAX_MEM; char tmp_fname[48]; spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_memory) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_memory) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -2463,7 +2463,7 @@ SPL_METHOD(SplFileObject, key) if (!intern->current_line) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); } */ - RETURN_LONG(intern->u.file.current_line_num); + RETURN_INT(intern->u.file.current_line_num); } /* }}} */ /* {{{ proto void SplFileObject::next() @@ -2489,7 +2489,7 @@ SPL_METHOD(SplFileObject, setFlags) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) { return; } } /* }}} */ @@ -2504,18 +2504,18 @@ SPL_METHOD(SplFileObject, getFlags) return; } - RETURN_LONG(intern->flags & SPL_FILE_OBJECT_MASK); + RETURN_INT(intern->flags & SPL_FILE_OBJECT_MASK); } /* }}} */ /* {{{ proto void SplFileObject::setMaxLineLen(int max_len) Set maximum line length */ SPL_METHOD(SplFileObject, setMaxLineLen) { - long max_len; + php_int_t max_len; spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &max_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &max_len) == FAILURE) { return; } @@ -2537,7 +2537,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen) return; } - RETURN_LONG((long)intern->u.file.max_line_len); + RETURN_INT((php_int_t)intern->u.file.max_line_len); } /* }}} */ /* {{{ proto bool SplFileObject::hasChildren() @@ -2649,7 +2649,7 @@ SPL_METHOD(SplFileObject, fputcsv) break; } ret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC); - RETURN_LONG(ret); + RETURN_INT(ret); } } /* }}} */ @@ -2740,7 +2740,7 @@ SPL_METHOD(SplFileObject, fflush) SPL_METHOD(SplFileObject, ftell) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - long ret; + php_int_t ret; if(!intern->u.file.stream) { zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Object not initialized"); @@ -2752,7 +2752,7 @@ SPL_METHOD(SplFileObject, ftell) if (ret == -1) { RETURN_FALSE; } else { - RETURN_LONG(ret); + RETURN_INT(ret); } } /* }}} */ @@ -2761,9 +2761,9 @@ SPL_METHOD(SplFileObject, ftell) SPL_METHOD(SplFileObject, fseek) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - long pos, whence = SEEK_SET; + php_int_t pos, whence = SEEK_SET; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &pos, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &pos, &whence) == FAILURE) { return; } @@ -2773,7 +2773,7 @@ SPL_METHOD(SplFileObject, fseek) } spl_filesystem_file_free_line(intern TSRMLS_CC); - RETURN_LONG(php_stream_seek(intern->u.file.stream, pos, whence)); + RETURN_INT(php_stream_seek(intern->u.file.stream, pos, whence)); } /* }}} */ /* {{{ proto int SplFileObject::fgetc() @@ -2819,9 +2819,9 @@ SPL_METHOD(SplFileObject, fgetss) } if (intern->u.file.max_line_len > 0) { - ZVAL_LONG(&arg2, intern->u.file.max_line_len); + ZVAL_INT(&arg2, intern->u.file.max_line_len); } else { - ZVAL_LONG(&arg2, 1024); + ZVAL_INT(&arg2, 1024); } spl_filesystem_file_free_line(intern TSRMLS_CC); @@ -2841,7 +2841,7 @@ SPL_METHOD(SplFileObject, fpassthru) return; } - RETURN_LONG(php_stream_passthru(intern->u.file.stream)); + RETURN_INT(php_stream_passthru(intern->u.file.stream)); } /* }}} */ /* {{{ proto bool SplFileObject::fscanf(string format [, string ...]) @@ -2869,9 +2869,9 @@ SPL_METHOD(SplFileObject, fwrite) spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *str; int str_len; - long length = 0; + php_int_t length = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &length) == FAILURE) { return; } @@ -2884,18 +2884,18 @@ SPL_METHOD(SplFileObject, fwrite) str_len = MAX(0, MIN(length, str_len)); } if (!str_len) { - RETURN_LONG(0); + RETURN_INT(0); } - RETURN_LONG(php_stream_write(intern->u.file.stream, str, str_len)); + RETURN_INT(php_stream_write(intern->u.file.stream, str, str_len)); } /* }}} */ SPL_METHOD(SplFileObject, fread) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - long length = 0; + php_int_t length = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &length) == FAILURE) { return; } @@ -2910,10 +2910,10 @@ SPL_METHOD(SplFileObject, fread) } ZVAL_STR(return_value, STR_ALLOC(length, 0)); - Z_STRLEN_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length); + Z_STRSIZE_P(return_value) = php_stream_read(intern->u.file.stream, Z_STRVAL_P(return_value), length); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; } /* {{{ proto bool SplFileObject::fstat() @@ -2926,9 +2926,9 @@ FileFunction(fstat) SPL_METHOD(SplFileObject, ftruncate) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - long size; + php_int_t size; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) { return; } @@ -2950,9 +2950,9 @@ SPL_METHOD(SplFileObject, ftruncate) SPL_METHOD(SplFileObject, seek) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); - long line_pos; + php_int_t line_pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &line_pos) == FAILURE) { return; } if(!intern->u.file.stream) { @@ -2961,7 +2961,7 @@ SPL_METHOD(SplFileObject, seek) } if (line_pos < 0) { - zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %ld", intern->file_name, line_pos); + zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Can't seek file %s to negative line %pd", intern->file_name, line_pos); RETURN_FALSE; } @@ -3110,18 +3110,18 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_SUB_CLASS_EX(FilesystemIterator, DirectoryIterator, spl_filesystem_object_new, spl_FilesystemIterator_functions); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); - REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_MODE_MASK", SPL_FILE_DIR_CURRENT_MODE_MASK); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_PATHNAME", SPL_FILE_DIR_CURRENT_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_FILEINFO", SPL_FILE_DIR_CURRENT_AS_FILEINFO); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "CURRENT_AS_SELF", SPL_FILE_DIR_CURRENT_AS_SELF); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_MODE_MASK", SPL_FILE_DIR_KEY_MODE_MASK); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_PATHNAME", SPL_FILE_DIR_KEY_AS_PATHNAME); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS); + REGISTER_SPL_CLASS_CONST_INT(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS); spl_ce_FilesystemIterator->get_iterator = spl_filesystem_tree_get_iterator; @@ -3140,10 +3140,10 @@ PHP_MINIT_FUNCTION(spl_directory) REGISTER_SPL_IMPLEMENTS(SplFileObject, RecursiveIterator); REGISTER_SPL_IMPLEMENTS(SplFileObject, SeekableIterator); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); - REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_AHEAD", SPL_FILE_OBJECT_READ_AHEAD); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "SKIP_EMPTY", SPL_FILE_OBJECT_SKIP_EMPTY); + REGISTER_SPL_CLASS_CONST_INT(SplFileObject, "READ_CSV", SPL_FILE_OBJECT_READ_CSV); REGISTER_SPL_SUB_CLASS_EX(SplTempFileObject, SplFileObject, spl_filesystem_object_new_check, spl_SplTempFileObject_functions); return SUCCESS; diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h index 3276d51463..a958e30874 100644 --- a/ext/spl/spl_directory.h +++ b/ext/spl/spl_directory.h @@ -68,7 +68,7 @@ struct _spl_filesystem_object { char *file_name; int file_name_len; SPL_FS_OBJ_TYPE type; - long flags; + php_int_t flags; zend_class_entry *file_class; zend_class_entry *info_class; union { @@ -93,7 +93,7 @@ struct _spl_filesystem_object { char *current_line; size_t current_line_len; size_t max_line_len; - long current_line_num; + php_int_t current_line_num; zval zresource; zend_function *func_getCurr; char delimiter; diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 09d874645d..c2eb5c0486 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -143,9 +143,9 @@ static spl_ptr_llist *spl_ptr_llist_init(spl_ptr_llist_ctor_func ctor, spl_ptr_l } /* }}} */ -static long spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ +static php_int_t spl_ptr_llist_count(spl_ptr_llist *llist) /* {{{ */ { - return (long)llist->count; + return (php_int_t)llist->count; } /* }}} */ @@ -167,7 +167,7 @@ static void spl_ptr_llist_destroy(spl_ptr_llist *llist TSRMLS_DC) /* {{{ */ } /* }}} */ -static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, long offset, int backward) /* {{{ */ +static spl_ptr_llist_element *spl_ptr_llist_offset(spl_ptr_llist *llist, php_int_t offset, int backward) /* {{{ */ { spl_ptr_llist_element *current; @@ -474,7 +474,7 @@ static zend_object *spl_dllist_object_clone(zval *zobject TSRMLS_DC) /* {{{ */ } /* }}} */ -static int spl_dllist_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +static int spl_dllist_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_dllist_object *intern = Z_SPLDLLIST_P(object); @@ -484,8 +484,8 @@ static int spl_dllist_object_count_elements(zval *object, long *count TSRMLS_DC) if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long) Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (php_int_t) Z_IVAL(intern->retval); return SUCCESS; } *count = 0; @@ -520,7 +520,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1 TSRMLS_CC); - ZVAL_LONG(&tmp, intern->flags); + ZVAL_INT(&tmp, intern->flags); zend_hash_add(intern->debug_info, pnstr, &tmp); STR_RELEASE(pnstr); @@ -673,7 +673,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom) Return the number of elements in the datastructure. */ SPL_METHOD(SplDoublyLinkedList, count) { - long count; + php_int_t count; spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -681,7 +681,7 @@ SPL_METHOD(SplDoublyLinkedList, count) } count = spl_ptr_llist_count(intern->llist); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -689,7 +689,7 @@ SPL_METHOD(SplDoublyLinkedList, count) Return true if the SplDoublyLinkedList is empty. */ SPL_METHOD(SplDoublyLinkedList, isEmpty) { - long count; + php_int_t count; if (zend_parse_parameters_none() == FAILURE) { return; @@ -704,10 +704,10 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty) Set the mode of iteration */ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) { - long value; + php_int_t value; spl_dllist_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) { return; } @@ -721,7 +721,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode) intern->flags = value & SPL_DLLIST_IT_MASK; - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -737,7 +737,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode) intern = Z_SPLDLLIST_P(getThis()); - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -747,14 +747,14 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists) { zval *zindex; spl_dllist_object *intern; - long index; + php_int_t index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zindex) == FAILURE) { return; } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); RETURN_BOOL(index >= 0 && index < intern->llist->count); } /* }}} */ @@ -764,7 +764,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists) SPL_METHOD(SplDoublyLinkedList, offsetGet) { zval *zindex; - long index; + php_int_t index; spl_dllist_object *intern; spl_ptr_llist_element *element; @@ -773,7 +773,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet) } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); @@ -808,10 +808,10 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet) spl_ptr_llist_push(intern->llist, value TSRMLS_CC); } else { /* $obj[$foo] = ... */ - long index; + php_int_t index; spl_ptr_llist_element *element; - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); if (index < 0 || index >= intern->llist->count) { zval_ptr_dtor(value); @@ -849,7 +849,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet) SPL_METHOD(SplDoublyLinkedList, offsetUnset) { zval *zindex; - long index; + php_int_t index; spl_dllist_object *intern; spl_ptr_llist_element *element; spl_ptr_llist *llist; @@ -859,7 +859,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset) } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); llist = intern->llist; if (index < 0 || index >= intern->llist->count) { @@ -1006,7 +1006,7 @@ static void spl_dllist_it_get_current_key(zend_object_iterator *iter, zval *key { spl_dllist_it *iterator = (spl_dllist_it *)iter; - ZVAL_LONG(key, iterator->traverse_position); + ZVAL_INT(key, iterator->traverse_position); } /* }}} */ @@ -1031,7 +1031,7 @@ SPL_METHOD(SplDoublyLinkedList, key) return; } - RETURN_LONG(intern->traverse_position); + RETURN_INT(intern->traverse_position); } /* }}} */ @@ -1127,7 +1127,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize) PHP_VAR_SERIALIZE_INIT(var_hash); /* flags */ - ZVAL_LONG(&flags, intern->flags); + ZVAL_INT(&flags, intern->flags); php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC); zval_ptr_dtor(&flags); @@ -1181,12 +1181,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) goto error; } - if (Z_TYPE(flags) != IS_LONG) { + if (Z_TYPE(flags) != IS_INT) { zval_ptr_dtor(&flags); goto error; } - intern->flags = Z_LVAL(flags); + intern->flags = Z_IVAL(flags); zval_ptr_dtor(&flags); /* elements */ @@ -1209,7 +1209,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize) error: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %pd of %d bytes", (php_int_t)((char*)p - buf), buf_len); return; } /* }}} */ @@ -1221,14 +1221,14 @@ SPL_METHOD(SplDoublyLinkedList, add) zval *zindex, *value; spl_dllist_object *intern; spl_ptr_llist_element *element; - long index; + php_int_t index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &zindex, &value) == FAILURE) { return; } intern = Z_SPLDLLIST_P(getThis()); - index = spl_offset_convert_to_long(zindex TSRMLS_CC); + index = spl_offset_convert_to_int(zindex TSRMLS_CC); if (index < 0 || index > intern->llist->count) { zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC); @@ -1385,10 +1385,10 @@ PHP_MINIT_FUNCTION(spl_dllist) /* {{{ */ spl_handler_SplDoublyLinkedList.dtor_obj = zend_objects_destroy_object; spl_handler_SplDoublyLinkedList.free_obj = spl_dllist_object_free_storage; - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO); - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_FIFO", 0); - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); - REGISTER_SPL_CLASS_CONST_LONG(SplDoublyLinkedList, "IT_MODE_KEEP", 0); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_LIFO", SPL_DLLIST_IT_LIFO); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_FIFO", 0); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_DELETE",SPL_DLLIST_IT_DELETE); + REGISTER_SPL_CLASS_CONST_INT(SplDoublyLinkedList, "IT_MODE_KEEP", 0); REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Iterator); REGISTER_SPL_IMPLEMENTS(SplDoublyLinkedList, Countable); diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 0cfcb8ee18..1cae08e652 100644 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -40,9 +40,9 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC) } /* }}} */ -PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ +PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC) /* {{{ */ { - ulong idx; + php_uint_t idx; switch (Z_TYPE_P(offset)) { case IS_STRING: @@ -51,9 +51,9 @@ PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ } break; case IS_DOUBLE: - return (long)Z_DVAL_P(offset); - case IS_LONG: - return Z_LVAL_P(offset); + return (php_int_t)Z_DVAL_P(offset); + case IS_INT: + return Z_IVAL_P(offset); case IS_FALSE: return 0; case IS_TRUE: diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h index 8c72ca9691..f5a58e835e 100644 --- a/ext/spl/spl_engine.h +++ b/ext/spl/spl_engine.h @@ -27,7 +27,7 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC); -PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC); +PHPAPI php_int_t spl_offset_convert_to_int(zval *offset TSRMLS_DC); /* {{{ spl_instantiate_arg_ex1 */ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1 TSRMLS_DC) diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 62aaffbc3c..990805bd4a 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -43,7 +43,7 @@ ZEND_GET_MODULE(spl_fixedarray) #endif typedef struct _spl_fixedarray { /* {{{ */ - long size; + php_int_t size; zval *elements; } spl_fixedarray; /* }}} */ @@ -81,7 +81,7 @@ static inline spl_fixedarray_object *spl_fixed_array_from_obj(zend_object *obj) #define Z_SPLFIXEDARRAY_P(zv) spl_fixed_array_from_obj(Z_OBJ_P((zv))) -static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_init(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ { if (size > 0) { array->size = 0; /* reset size in case ecalloc() fails */ @@ -94,7 +94,7 @@ static void spl_fixedarray_init(spl_fixedarray *array, long size TSRMLS_DC) /* { } /* }}} */ -static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* {{{ */ +static void spl_fixedarray_resize(spl_fixedarray *array, php_int_t size TSRMLS_DC) /* {{{ */ { if (size == array->size) { /* nothing to do */ @@ -109,7 +109,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* /* clearing the array */ if (size == 0) { - long i; + php_int_t i; for (i = 0; i < array->size; i++) { zval_ptr_dtor(&(array->elements[i])); @@ -123,7 +123,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, long size TSRMLS_DC) /* array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0); memset(array->elements + array->size, '\0', sizeof(zval) * (size - array->size)); } else { /* size < array->size */ - long i; + php_int_t i; for (i = size; i < array->size; i++) { zval_ptr_dtor(&(array->elements[i])); @@ -194,7 +194,7 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj TSRMLS_DC) /* { static void spl_fixedarray_object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern = spl_fixed_array_from_obj(object); - long i; + php_int_t i; if (intern->array) { for (i = 0; i < intern->array->size; i++) { @@ -328,7 +328,7 @@ static zend_object *spl_fixedarray_object_clone(zval *zobject TSRMLS_DC) /* {{{ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; /* we have to return NULL on error here to avoid memleak because of * ZE duplicating uninitialized_zval_ptr */ @@ -337,10 +337,10 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o return NULL; } - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -384,7 +384,7 @@ static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, in static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object *intern, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; if (!offset) { /* '$array[] = value' syntax is not supported */ @@ -392,10 +392,10 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o return; } - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -438,12 +438,12 @@ static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zv static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_object *intern, zval *offset TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -476,13 +476,13 @@ static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset TSR static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_object *intern, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { - long index; + php_int_t index; int retval; - if (Z_TYPE_P(offset) != IS_LONG) { - index = spl_offset_convert_to_long(offset TSRMLS_CC); + if (Z_TYPE_P(offset) != IS_INT) { + index = spl_offset_convert_to_int(offset TSRMLS_CC); } else { - index = Z_LVAL_P(offset); + index = Z_IVAL_P(offset); } if (index < 0 || intern->array == NULL || index >= intern->array->size) { @@ -528,7 +528,7 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c } /* }}} */ -static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +static int spl_fixedarray_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_fixedarray_object *intern; @@ -539,8 +539,8 @@ static int spl_fixedarray_object_count_elements(zval *object, long *count TSRMLS if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long) Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (php_int_t) Z_IVAL(intern->retval); return SUCCESS; } } else if (intern->array) { @@ -559,9 +559,9 @@ SPL_METHOD(SplFixedArray, __construct) { zval *object = getThis(); spl_fixedarray_object *intern; - long size = 0; + php_int_t size = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &size) == FAILURE) { return; } @@ -629,9 +629,9 @@ SPL_METHOD(SplFixedArray, count) intern = Z_SPLFIXEDARRAY_P(object); if (intern->array) { - RETURN_LONG(intern->array->size); + RETURN_INT(intern->array->size); } - RETURN_LONG(0); + RETURN_INT(0); } /* }}} */ @@ -684,11 +684,11 @@ SPL_METHOD(SplFixedArray, fromArray) if (num > 0 && save_indexes) { zval *element; zend_string *str_index; - ulong num_index, max_index = 0; - long tmp; + php_uint_t num_index, max_index = 0; + php_int_t tmp; ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) { - if (str_index != NULL || (long)num_index < 0) { + if (str_index != NULL || (php_int_t)num_index < 0) { efree(array); zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "array must contain only positive integer keys"); return; @@ -714,7 +714,7 @@ SPL_METHOD(SplFixedArray, fromArray) } else if (num > 0 && !save_indexes) { zval *element; - long i = 0; + php_int_t i = 0; spl_fixedarray_init(array, num TSRMLS_CC); @@ -747,9 +747,9 @@ SPL_METHOD(SplFixedArray, getSize) intern = Z_SPLFIXEDARRAY_P(object); if (intern->array) { - RETURN_LONG(intern->array->size); + RETURN_INT(intern->array->size); } - RETURN_LONG(0); + RETURN_INT(0); } /* }}} */ @@ -759,9 +759,9 @@ SPL_METHOD(SplFixedArray, setSize) { zval *object = getThis(); spl_fixedarray_object *intern; - long size; + php_int_t size; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &size) == FAILURE) { return; } @@ -895,7 +895,7 @@ static zval *spl_fixedarray_it_get_current_data(zend_object_iterator *iter TSRML } else { zval *data; - ZVAL_LONG(&zindex, object->current); + ZVAL_INT(&zindex, object->current); data = spl_fixedarray_object_read_dimension_helper(object, &zindex TSRMLS_CC); zval_ptr_dtor(&zindex); @@ -915,7 +915,7 @@ static void spl_fixedarray_it_get_current_key(zend_object_iterator *iter, zval * if (object->flags & SPL_FIXEDARRAY_OVERLOADED_KEY) { zend_user_it_get_current_key(iter, key TSRMLS_CC); } else { - ZVAL_LONG(key, object->current); + ZVAL_INT(key, object->current); } } /* }}} */ @@ -943,7 +943,7 @@ SPL_METHOD(SplFixedArray, key) return; } - RETURN_LONG(intern->current); + RETURN_INT(intern->current); } /* }}} */ @@ -1000,7 +1000,7 @@ SPL_METHOD(SplFixedArray, current) return; } - ZVAL_LONG(&zindex, intern->current); + ZVAL_INT(&zindex, intern->current); value = spl_fixedarray_object_read_dimension_helper(intern, &zindex TSRMLS_CC); diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h index 1d116ff783..f3d8f26a07 100644 --- a/ext/spl/spl_functions.h +++ b/ext/spl/spl_functions.h @@ -46,8 +46,8 @@ typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type TSRMLS #define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \ spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags TSRMLS_CC); -#define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \ - zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_SPL_CLASS_CONST_INT(class_name, const_name, value) \ + zend_declare_class_constant_int(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (php_int_t)value TSRMLS_CC); void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list TSRMLS_DC); diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 90d78db6ee..916ed919f8 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -105,7 +105,7 @@ static void spl_ptr_heap_zval_ctor(zval *elem TSRMLS_DC) { /* {{{ */ } /* }}} */ -static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, long *result TSRMLS_DC) { /* {{{ */ +static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, php_int_t *result TSRMLS_DC) { /* {{{ */ zval zresult; zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b); @@ -114,8 +114,8 @@ static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object return FAILURE; } - convert_to_long(&zresult); - *result = Z_LVAL(zresult); + convert_to_int(&zresult); + *result = Z_IVAL(zresult); zval_ptr_dtor(&zresult); @@ -155,7 +155,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { if (object) { spl_heap_object *heap_object = Z_SPLHEAP_P(object); if (heap_object->fptr_cmp) { - long lval = 0; + php_int_t lval = 0; if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; @@ -165,7 +165,7 @@ static int spl_ptr_heap_zval_max_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { } compare_function(&result, a, b TSRMLS_CC); - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -179,7 +179,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { if (object) { spl_heap_object *heap_object = Z_SPLHEAP_P(object); if (heap_object->fptr_cmp) { - long lval = 0; + php_int_t lval = 0; if (spl_ptr_heap_cmp_cb_helper(object, heap_object, a, b, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; @@ -189,7 +189,7 @@ static int spl_ptr_heap_zval_min_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { } compare_function(&result, b, a TSRMLS_CC); - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -210,7 +210,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { / if (object) { spl_heap_object *heap_object = Z_SPLHEAP_P(object); if (heap_object->fptr_cmp) { - long lval = 0; + php_int_t lval = 0; if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, a_priority_p, b_priority_p, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; @@ -220,7 +220,7 @@ static int spl_ptr_pqueue_zval_cmp(zval *a, zval *b, zval *object TSRMLS_DC) { / } compare_function(&result, a_priority_p, b_priority_p TSRMLS_CC); - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -483,7 +483,7 @@ static zend_object *spl_heap_object_clone(zval *zobject TSRMLS_DC) /* {{{ */ } /* }}} */ -static int spl_heap_object_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ +static int spl_heap_object_count_elements(zval *object, php_int_t *count TSRMLS_DC) /* {{{ */ { spl_heap_object *intern = Z_SPLHEAP_P(object); @@ -493,8 +493,8 @@ static int spl_heap_object_count_elements(zval *object, long *count TSRMLS_DC) / if (!Z_ISUNDEF(rv)) { zval_ptr_dtor(&intern->retval); ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (long) Z_LVAL(intern->retval); + convert_to_int(&intern->retval); + *count = (php_int_t) Z_IVAL(intern->retval); return SUCCESS; } *count = 0; @@ -529,7 +529,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref); pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1 TSRMLS_CC); - ZVAL_LONG(&tmp, intern->flags); + ZVAL_INT(&tmp, intern->flags); zend_hash_update(intern->debug_info, pnstr, &tmp); STR_RELEASE(pnstr); @@ -572,7 +572,7 @@ static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp TSRML Return the number of elements in the heap. */ SPL_METHOD(SplHeap, count) { - long count; + php_int_t count; spl_heap_object *intern = Z_SPLHEAP_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { @@ -580,7 +580,7 @@ SPL_METHOD(SplHeap, count) } count = spl_ptr_heap_count(intern->heap); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -765,10 +765,10 @@ SPL_METHOD(SplPriorityQueue, top) Set the flags of extraction*/ SPL_METHOD(SplPriorityQueue, setExtractFlags) { - long value; + php_int_t value; spl_heap_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &value) == FAILURE) { return; } @@ -776,7 +776,7 @@ SPL_METHOD(SplPriorityQueue, setExtractFlags) intern->flags = value & SPL_PQUEUE_EXTR_MASK; - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -808,7 +808,7 @@ SPL_METHOD(SplPriorityQueue, compare) return; } - RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); + RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -851,7 +851,7 @@ SPL_METHOD(SplMinHeap, compare) return; } - RETURN_LONG(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC)); + RETURN_INT(spl_ptr_heap_zval_min_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -865,7 +865,7 @@ SPL_METHOD(SplMaxHeap, compare) return; } - RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); + RETURN_INT(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } /* }}} */ @@ -934,7 +934,7 @@ static void spl_heap_it_get_current_key(zend_object_iterator *iter, zval *key TS { spl_heap_object *object = Z_SPLHEAP_P(&iter->data); - ZVAL_LONG(key, object->heap->count - 1); + ZVAL_INT(key, object->heap->count - 1); } /* }}} */ @@ -966,7 +966,7 @@ SPL_METHOD(SplHeap, key) return; } - RETURN_LONG(intern->heap->count - 1); + RETURN_INT(intern->heap->count - 1); } /* }}} */ @@ -1226,9 +1226,9 @@ PHP_MINIT_FUNCTION(spl_heap) /* {{{ */ spl_ce_SplPriorityQueue->get_iterator = spl_pqueue_get_iterator; - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); - REGISTER_SPL_CLASS_CONST_LONG(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); + REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_BOTH", SPL_PQUEUE_EXTR_BOTH); + REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_PRIORITY", SPL_PQUEUE_EXTR_PRIORITY); + REGISTER_SPL_CLASS_CONST_INT(SplPriorityQueue, "EXTR_DATA", SPL_PQUEUE_EXTR_DATA); return SUCCESS; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index e503f9b581..87cdb70007 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -228,7 +228,7 @@ static void spl_recursive_it_get_current_key(zend_object_iterator *iter, zval *k if (sub_iter->funcs->get_current_key) { sub_iter->funcs->get_current_key(sub_iter, key TSRMLS_CC); } else { - ZVAL_LONG(key, iter->index); + ZVAL_INT(key, iter->index); } } @@ -473,7 +473,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla spl_recursive_it_object *intern; zval *iterator; zend_class_entry *ce_iterator; - long mode, flags; + php_int_t mode, flags; int inc_refcount = 1; zend_error_handling error_handling; @@ -486,7 +486,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla mode = RIT_SELF_FIRST; flags = RTIT_BYPASS_KEY; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|izi", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) { zval *aggregate = iterator; zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator); @@ -496,7 +496,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla if (user_caching_it_flags) { ZVAL_ZVAL(&caching_it_flags, user_caching_it_flags, 1, 0); } else { - ZVAL_LONG(&caching_it_flags, CIT_CATCH_GET_CHILD); + ZVAL_INT(&caching_it_flags, CIT_CATCH_GET_CHILD); } spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &caching_it, iterator, &caching_it_flags TSRMLS_CC); zval_ptr_dtor(&caching_it_flags); @@ -515,7 +515,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla mode = RIT_LEAVES_ONLY; flags = 0; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ll", &iterator, &mode, &flags) == SUCCESS) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "o|ii", &iterator, &mode, &flags) == SUCCESS) { if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) { zval *aggregate = iterator; zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), &Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator", iterator); @@ -695,7 +695,7 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth) return; } - RETURN_LONG(object->level); + RETURN_INT(object->level); } /* }}} */ /* {{{ proto RecursiveIterator RecursiveIteratorIterator::getSubIterator([int level]) @@ -703,9 +703,9 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth) SPL_METHOD(RecursiveIteratorIterator, getSubIterator) { spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis()); - long level = object->level; + php_int_t level = object->level; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &level) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &level) == FAILURE) { return; } if (level < 0 || level > object->level) { @@ -846,9 +846,9 @@ SPL_METHOD(RecursiveIteratorIterator, nextElement) SPL_METHOD(RecursiveIteratorIterator, setMaxDepth) { spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis()); - long max_depth = -1; + php_int_t max_depth = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &max_depth) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &max_depth) == FAILURE) { return; } if (max_depth < -1) { @@ -871,7 +871,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth) if (object->max_depth == -1) { RETURN_FALSE; } else { - RETURN_LONG(object->max_depth); + RETURN_INT(object->max_depth); } } /* }}} */ @@ -879,7 +879,7 @@ static union _zend_function *spl_recursive_it_get_method(zend_object **zobject, { union _zend_function *function_handler; spl_recursive_it_object *object = spl_recursive_it_from_obj(*zobject); - long level = object->level; + php_int_t level = object->level; zval *zobj; if (!object->iterators) { @@ -1088,12 +1088,12 @@ SPL_METHOD(RecursiveTreeIterator, __construct) Sets prefix parts as used in getPrefix() */ SPL_METHOD(RecursiveTreeIterator, setPrefixPart) { - long part; + php_int_t part; char* prefix; int prefix_len; spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &part, &prefix, &prefix_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &part, &prefix, &prefix_len) == FAILURE) { return; } @@ -1222,15 +1222,15 @@ SPL_METHOD(RecursiveTreeIterator, current) } spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str = STR_ALLOC(Z_STRLEN(prefix) + Z_STRLEN(entry) + Z_STRLEN(postfix), 0); + str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(entry) + Z_STRSIZE(postfix), 0); ptr = str->val; - memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); - ptr += Z_STRLEN(prefix); - memcpy(ptr, Z_STRVAL(entry), Z_STRLEN(entry)); - ptr += Z_STRLEN(entry); - memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); - ptr += Z_STRLEN(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); + ptr += Z_STRSIZE(prefix); + memcpy(ptr, Z_STRVAL(entry), Z_STRSIZE(entry)); + ptr += Z_STRSIZE(entry); + memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); + ptr += Z_STRSIZE(postfix); *ptr = 0; zval_ptr_dtor(&prefix); @@ -1278,15 +1278,15 @@ SPL_METHOD(RecursiveTreeIterator, key) spl_recursive_tree_iterator_get_prefix(object, &prefix TSRMLS_CC); spl_recursive_tree_iterator_get_postfix(object, &postfix TSRMLS_CC); - str = STR_ALLOC(Z_STRLEN(prefix) + Z_STRLEN(key) + Z_STRLEN(postfix), 0); + str = STR_ALLOC(Z_STRSIZE(prefix) + Z_STRSIZE(key) + Z_STRSIZE(postfix), 0); ptr = str->val; - memcpy(ptr, Z_STRVAL(prefix), Z_STRLEN(prefix)); - ptr += Z_STRLEN(prefix); - memcpy(ptr, Z_STRVAL(key), Z_STRLEN(key)); - ptr += Z_STRLEN(key); - memcpy(ptr, Z_STRVAL(postfix), Z_STRLEN(postfix)); - ptr += Z_STRLEN(postfix); + memcpy(ptr, Z_STRVAL(prefix), Z_STRSIZE(prefix)); + ptr += Z_STRSIZE(prefix); + memcpy(ptr, Z_STRVAL(key), Z_STRSIZE(key)); + ptr += Z_STRSIZE(key); + memcpy(ptr, Z_STRVAL(postfix), Z_STRSIZE(postfix)); + ptr += Z_STRSIZE(postfix); *ptr = 0; zval_ptr_dtor(&prefix); @@ -1387,7 +1387,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) } p = EG(argument_stack).top_element-2; - arg_count = (ulong) *p; + arg_count = (php_uint_t) *p; func_params = safe_emalloc(sizeof(zval **), arg_count, 0); @@ -1457,7 +1457,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_LimitIterator: { intern->u.limit.offset = 0; /* start at beginning */ intern->u.limit.count = -1; /* get all */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ii", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1475,8 +1475,8 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z } case DIT_CachingIterator: case DIT_RecursiveCachingIterator: { - long flags = CIT_CALL_TOSTRING; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &zobject, ce_inner, &flags) == FAILURE) { + php_int_t flags = CIT_CALL_TOSTRING; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|i", &zobject, ce_inner, &flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1539,17 +1539,17 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z case DIT_RegexIterator: case DIT_RecursiveRegexIterator: { zend_string *regex; - long mode = REGIT_MODE_MATCH; + php_int_t mode = REGIT_MODE_MATCH; intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5; intern->u.regex.flags = 0; intern->u.regex.preg_flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|lll", &zobject, ce_inner, ®ex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS|iii", &zobject, ce_inner, ®ex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } if (mode < 0 || mode >= REGIT_MODE_MAX) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %pd", mode); zend_restore_error_handling(&error_handling TSRMLS_CC); return NULL; } @@ -1709,7 +1709,7 @@ static inline int spl_dual_it_fetch(spl_dual_it_object *intern, int check_more T ZVAL_UNDEF(&intern->current.key); } } else { - ZVAL_LONG(&intern->current.key, intern->current.pos); + ZVAL_INT(&intern->current.key, intern->current.pos); } return EG(exception) ? FAILURE : SUCCESS; } @@ -2049,10 +2049,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 = Z_STRSIZE(subject_copy); } else { subject = Z_STRVAL_P(subject_ptr); - subject_len = Z_STRLEN_P(subject_ptr); + subject_len = Z_STRSIZE_P(subject_ptr); } use_copy = 0; @@ -2151,7 +2151,7 @@ SPL_METHOD(RegexIterator, getMode) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->u.regex.mode); + RETURN_INT(intern->u.regex.mode); } /* }}} */ /* {{{ proto bool RegexIterator::setMode(int new_mode) @@ -2159,14 +2159,14 @@ SPL_METHOD(RegexIterator, getMode) SPL_METHOD(RegexIterator, setMode) { spl_dual_it_object *intern; - long mode; + php_int_t mode; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &mode) == FAILURE) { return; } if (mode < 0 || mode >= REGIT_MODE_MAX) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %ld", mode); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Illegal mode %pd", mode); return;/* NULL */ } @@ -2187,7 +2187,7 @@ SPL_METHOD(RegexIterator, getFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->u.regex.flags); + RETURN_INT(intern->u.regex.flags); } /* }}} */ /* {{{ proto bool RegexIterator::setFlags(int new_flags) @@ -2195,9 +2195,9 @@ SPL_METHOD(RegexIterator, getFlags) SPL_METHOD(RegexIterator, setFlags) { spl_dual_it_object *intern; - long flags; + php_int_t flags; - 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; } @@ -2219,7 +2219,7 @@ SPL_METHOD(RegexIterator, getPregFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); if (intern->u.regex.use_flags) { - RETURN_LONG(intern->u.regex.preg_flags); + RETURN_INT(intern->u.regex.preg_flags); } else { return; } @@ -2230,9 +2230,9 @@ SPL_METHOD(RegexIterator, getPregFlags) SPL_METHOD(RegexIterator, setPregFlags) { spl_dual_it_object *intern; - long preg_flags; + php_int_t preg_flags; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preg_flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &preg_flags) == FAILURE) { return; } @@ -2472,21 +2472,21 @@ static inline int spl_limit_it_valid(spl_dual_it_object *intern TSRMLS_DC) } } -static inline void spl_limit_it_seek(spl_dual_it_object *intern, long pos TSRMLS_DC) +static inline void spl_limit_it_seek(spl_dual_it_object *intern, php_int_t pos TSRMLS_DC) { zval zpos; spl_dual_it_free(intern TSRMLS_CC); if (pos < intern->u.limit.offset) { - zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is below the offset %ld", pos, intern->u.limit.offset); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %pd which is below the offset %pd", pos, intern->u.limit.offset); return; } if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) { - zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %ld which is behind offset %ld plus count %ld", pos, intern->u.limit.offset, intern->u.limit.count); + zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Cannot seek to %pd which is behind offset %pd plus count %pd", pos, intern->u.limit.offset, intern->u.limit.count); return; } if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator TSRMLS_CC)) { - ZVAL_LONG(&zpos, pos); + ZVAL_INT(&zpos, pos); spl_dual_it_free(intern TSRMLS_CC); zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos); zval_ptr_dtor(&zpos); @@ -2560,15 +2560,15 @@ SPL_METHOD(LimitIterator, next) SPL_METHOD(LimitIterator, seek) { spl_dual_it_object *intern; - long pos; + php_int_t pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pos) == FAILURE) { return; } SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); spl_limit_it_seek(intern, pos TSRMLS_CC); - RETURN_LONG(intern->current.pos); + RETURN_INT(intern->current.pos); } /* }}} */ /* {{{ proto int LimitIterator::getPosition() @@ -2577,7 +2577,7 @@ SPL_METHOD(LimitIterator, getPosition) { spl_dual_it_object *intern; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->current.pos); + RETURN_INT(intern->current.pos); } /* }}} */ ZEND_BEGIN_ARG_INFO(arginfo_seekable_it_seek, 0) @@ -2660,7 +2660,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern TSRMLS_DC) return; } } else { - ZVAL_LONG(&zflags, intern->u.caching.flags & CIT_PUBLIC); + ZVAL_INT(&zflags, intern->u.caching.flags & CIT_PUBLIC); spl_instantiate_arg_ex2(spl_ce_RecursiveCachingIterator, &intern->u.caching.zchildren, &zchildren, &zflags TSRMLS_CC); zval_ptr_dtor(&zchildren); } @@ -2929,7 +2929,7 @@ SPL_METHOD(CachingIterator, getFlags) SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - RETURN_LONG(intern->u.caching.flags); + RETURN_INT(intern->u.caching.flags); } /* }}} */ @@ -2938,11 +2938,11 @@ SPL_METHOD(CachingIterator, getFlags) SPL_METHOD(CachingIterator, setFlags) { spl_dual_it_object *intern; - long flags; + php_int_t flags; SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis()); - 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; } @@ -2983,7 +2983,7 @@ SPL_METHOD(CachingIterator, count) return; } - RETURN_LONG(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); + RETURN_INT(zend_hash_num_elements(HASH_OF(&intern->u.caching.zcache))); } /* }}} */ @@ -3574,7 +3574,7 @@ PHP_FUNCTION(iterator_to_array) static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */ { - (*(long*)puser)++; + (*(php_int_t*)puser)++; return ZEND_HASH_APPLY_KEEP; } /* }}} */ @@ -3584,14 +3584,14 @@ static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser TSRM PHP_FUNCTION(iterator_count) { zval *obj; - long count = 0; + php_int_t count = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &obj, zend_ce_traversable) == FAILURE) { RETURN_FALSE; } if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count TSRMLS_CC) == SUCCESS) { - RETURN_LONG(count); + RETURN_INT(count); } } /* }}} */ @@ -3599,7 +3599,7 @@ PHP_FUNCTION(iterator_count) typedef struct { zval *obj; zval *args; - long count; + php_int_t count; zend_fcall_info fci; zend_fcall_info_cache fcc; } spl_iterator_apply_info; @@ -3636,7 +3636,7 @@ PHP_FUNCTION(iterator_apply) apply_info.count = 0; zend_fcall_info_args(&apply_info.fci, apply_info.args TSRMLS_CC); if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info TSRMLS_CC) == SUCCESS) { - RETVAL_LONG(apply_info.count); + RETVAL_INT(apply_info.count); } else { RETVAL_FALSE; } @@ -3682,10 +3682,10 @@ PHP_MINIT_FUNCTION(spl_iterators) spl_ce_RecursiveIteratorIterator->get_iterator = spl_recursive_it_get_iterator; spl_ce_RecursiveIteratorIterator->iterator_funcs.funcs = &spl_recursive_it_iterator_funcs; - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "LEAVES_ONLY", RIT_LEAVES_ONLY); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "SELF_FIRST", RIT_SELF_FIRST); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CHILD_FIRST", RIT_CHILD_FIRST); + REGISTER_SPL_CLASS_CONST_INT(RecursiveIteratorIterator, "CATCH_GET_CHILD", RIT_CATCH_GET_CHILD); REGISTER_SPL_INTERFACE(OuterIterator); REGISTER_SPL_ITERATOR(OuterIterator); @@ -3718,12 +3718,12 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_IMPLEMENTS(CachingIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(CachingIterator, Countable); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); - REGISTER_SPL_CLASS_CONST_LONG(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CALL_TOSTRING", CIT_CALL_TOSTRING); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "CATCH_GET_CHILD", CIT_CATCH_GET_CHILD); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_KEY", CIT_TOSTRING_USE_KEY); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_CURRENT", CIT_TOSTRING_USE_CURRENT); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "TOSTRING_USE_INNER", CIT_TOSTRING_USE_INNER); + REGISTER_SPL_CLASS_CONST_INT(CachingIterator, "FULL_CACHE", CIT_FULL_CACHE); REGISTER_SPL_SUB_CLASS_EX(RecursiveCachingIterator, CachingIterator, spl_dual_it_new, spl_funcs_RecursiveCachingIterator); REGISTER_SPL_IMPLEMENTS(RecursiveCachingIterator, RecursiveIterator); @@ -3737,13 +3737,13 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_SUB_CLASS_EX(InfiniteIterator, IteratorIterator, spl_dual_it_new, spl_funcs_InfiniteIterator); #if HAVE_PCRE || HAVE_BUNDLED_PCRE REGISTER_SPL_SUB_CLASS_EX(RegexIterator, FilterIterator, spl_dual_it_new, spl_funcs_RegexIterator); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "USE_KEY", REGIT_USE_KEY); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "MATCH", REGIT_MODE_MATCH); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); - REGISTER_SPL_CLASS_CONST_LONG(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "USE_KEY", REGIT_USE_KEY); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "INVERT_MATCH",REGIT_INVERTED); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "MATCH", REGIT_MODE_MATCH); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "GET_MATCH", REGIT_MODE_GET_MATCH); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "ALL_MATCHES", REGIT_MODE_ALL_MATCHES); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "SPLIT", REGIT_MODE_SPLIT); + REGISTER_SPL_CLASS_CONST_INT(RegexIterator, "REPLACE", REGIT_MODE_REPLACE); REGISTER_SPL_PROPERTY(RegexIterator, "replacement", 0); REGISTER_SPL_SUB_CLASS_EX(RecursiveRegexIterator, RegexIterator, spl_dual_it_new, spl_funcs_RecursiveRegexIterator); REGISTER_SPL_IMPLEMENTS(RecursiveRegexIterator, RecursiveIterator); @@ -3756,14 +3756,14 @@ PHP_MINIT_FUNCTION(spl_iterators) REGISTER_SPL_ITERATOR(EmptyIterator); REGISTER_SPL_SUB_CLASS_EX(RecursiveTreeIterator, RecursiveIteratorIterator, spl_RecursiveTreeIterator_new, spl_funcs_RecursiveTreeIterator); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_LEFT", 0); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_MID_LAST", 2); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_END_LAST", 4); - REGISTER_SPL_CLASS_CONST_LONG(RecursiveTreeIterator, "PREFIX_RIGHT", 5); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_CURRENT", RTIT_BYPASS_CURRENT); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "BYPASS_KEY", RTIT_BYPASS_KEY); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_LEFT", 0); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_HAS_NEXT", 1); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_MID_LAST", 2); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_HAS_NEXT", 3); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_END_LAST", 4); + REGISTER_SPL_CLASS_CONST_INT(RecursiveTreeIterator, "PREFIX_RIGHT", 5); return SUCCESS; } diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h index f51fc3a990..851436350b 100644 --- a/ext/spl/spl_iterators.h +++ b/ext/spl/spl_iterators.h @@ -139,11 +139,11 @@ typedef struct _spl_dual_it_object { dual_it_type dit_type; union { struct { - long offset; - long count; + php_int_t offset; + php_int_t count; } limit; struct { - long flags; /* CIT_* */ + php_int_t flags; /* CIT_* */ zval zstr; zval zchildren; zval zcache; @@ -155,9 +155,9 @@ typedef struct _spl_dual_it_object { #if HAVE_PCRE || HAVE_BUNDLED_PCRE struct { int use_flags; - long flags; + php_int_t flags; regex_mode mode; - long preg_flags; + php_int_t preg_flags; pcre_cache_entry *pce; zend_string *regex; } regex; diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 1eeaf95724..18a2b9699e 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -81,9 +81,9 @@ PHPAPI zend_object_handlers spl_handler_SplObjectStorage; typedef struct _spl_SplObjectStorage { /* {{{ */ HashTable storage; - long index; + php_int_t index; HashPosition pos; - long flags; + php_int_t flags; zend_function *fptr_get_hash; HashTable *debug_info; zend_object std; @@ -398,7 +398,7 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2 TSRMLS_DC) /* {{{ return 1; } - return Z_LVAL(result); + return Z_IVAL(result); } /* }}} */ @@ -523,7 +523,7 @@ SPL_METHOD(SplObjectStorage, addAll) spl_object_storage_addall(intern, getThis(), other TSRMLS_CC); - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto bool SplObjectStorage::removeAll(SplObjectStorage $os) @@ -551,7 +551,7 @@ SPL_METHOD(SplObjectStorage, removeAll) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto bool SplObjectStorage::removeAllExcept(SplObjectStorage $os) @@ -578,7 +578,7 @@ SPL_METHOD(SplObjectStorage, removeAllExcept) zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos); intern->index = 0; - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ @@ -600,25 +600,25 @@ SPL_METHOD(SplObjectStorage, contains) SPL_METHOD(SplObjectStorage, count) { spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); - long mode = COUNT_NORMAL; + php_int_t mode = COUNT_NORMAL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) { return; } if (mode == COUNT_RECURSIVE) { - long ret = zend_hash_num_elements(&intern->storage); + php_int_t ret = zend_hash_num_elements(&intern->storage); zval *element; ZEND_HASH_FOREACH_VAL(&intern->storage, element) { ret += php_count_recursive(element, mode TSRMLS_CC); } ZEND_HASH_FOREACH_END(); - RETURN_LONG(ret); + RETURN_INT(ret); return; } - RETURN_LONG(zend_hash_num_elements(&intern->storage)); + RETURN_INT(zend_hash_num_elements(&intern->storage)); } /* }}} */ /* {{{ proto void SplObjectStorage::rewind() @@ -658,7 +658,7 @@ SPL_METHOD(SplObjectStorage, key) return; } - RETURN_LONG(intern->index); + RETURN_INT(intern->index); } /* }}} */ /* {{{ proto mixed SplObjectStorage::current() @@ -748,7 +748,7 @@ SPL_METHOD(SplObjectStorage, serialize) /* storage */ smart_str_appendl(&buf, "x:", 2); - ZVAL_LONG(&flags, zend_hash_num_elements(&intern->storage)); + ZVAL_INT(&flags, zend_hash_num_elements(&intern->storage)); php_var_serialize(&buf, &flags, &var_hash TSRMLS_CC); zval_ptr_dtor(&flags); @@ -797,7 +797,7 @@ SPL_METHOD(SplObjectStorage, unserialize) php_unserialize_data_t var_hash; zval entry, pmembers, pcount, inf; spl_SplObjectStorageElement *element; - long count; + php_int_t count; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { return; @@ -819,13 +819,13 @@ SPL_METHOD(SplObjectStorage, unserialize) if (!php_var_unserialize(&pcount, &p, s + buf_len, &var_hash TSRMLS_CC)) { goto outexcept; } - if (Z_TYPE(pcount) != IS_LONG) { + if (Z_TYPE(pcount) != IS_INT) { zval_ptr_dtor(&pcount); goto outexcept; } --p; /* for ';' */ - count = Z_LVAL(pcount); + count = Z_IVAL(pcount); while (count-- > 0) { spl_SplObjectStorageElement *pelement; @@ -906,7 +906,7 @@ SPL_METHOD(SplObjectStorage, unserialize) outexcept: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Error at offset %ld of %d bytes", (php_int_t)((char*)p - buf), buf_len); return; } /* }}} */ @@ -983,12 +983,12 @@ typedef enum { SPL_METHOD(MultipleIterator, __construct) { spl_SplObjectStorage *intern; - long flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC; + php_int_t flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flags) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1008,7 +1008,7 @@ SPL_METHOD(MultipleIterator, getFlags) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(intern->flags); + RETURN_INT(intern->flags); } /* }}} */ @@ -1019,7 +1019,7 @@ SPL_METHOD(MultipleIterator, setFlags) spl_SplObjectStorage *intern; intern = Z_SPLOBJSTORAGE_P(getThis()); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &intern->flags) == FAILURE) { return; } } @@ -1042,7 +1042,7 @@ SPL_METHOD(MultipleIterator, attachIterator) spl_SplObjectStorageElement *element; zval compare_result; - if (Z_TYPE_P(info) != IS_LONG && Z_TYPE_P(info) != IS_STRING) { + if (Z_TYPE_P(info) != IS_INT && Z_TYPE_P(info) != IS_STRING) { zend_throw_exception(spl_ce_InvalidArgumentException, "Info must be NULL, integer or string", 0 TSRMLS_CC); return; } @@ -1115,7 +1115,7 @@ SPL_METHOD(MultipleIterator, valid) spl_SplObjectStorage *intern; spl_SplObjectStorageElement *element; zval *it, retval; - long expect, valid; + php_int_t expect, valid; intern = Z_SPLOBJSTORAGE_P(getThis()); @@ -1200,8 +1200,8 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_ if (intern->flags & MIT_KEYS_ASSOC) { switch (Z_TYPE(element->inf)) { - case IS_LONG: - add_index_zval(return_value, Z_LVAL(element->inf), &retval); + case IS_INT: + add_index_zval(return_value, Z_IVAL(element->inf), &retval); break; case IS_STRING: zend_hash_update(Z_ARRVAL_P(return_value), Z_STR(element->inf), &retval); @@ -1309,10 +1309,10 @@ PHP_MINIT_FUNCTION(spl_observer) REGISTER_SPL_STD_CLASS_EX(MultipleIterator, spl_SplObjectStorage_new, spl_funcs_MultipleIterator); REGISTER_SPL_ITERATOR(MultipleIterator); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC); - REGISTER_SPL_CLASS_CONST_LONG(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ANY", MIT_NEED_ANY); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_NEED_ALL", MIT_NEED_ALL); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_NUMERIC", MIT_KEYS_NUMERIC); + REGISTER_SPL_CLASS_CONST_INT(MultipleIterator, "MIT_KEYS_ASSOC", MIT_KEYS_ASSOC); return SUCCESS; } diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h index e988ac20d0..a75b340e2c 100644 --- a/ext/sqlite3/php_sqlite3_structs.h +++ b/ext/sqlite3/php_sqlite3_structs.h @@ -38,9 +38,9 @@ /* Structure for SQLite Statement Parameter. */ struct php_sqlite3_bound_param { - long param_number; + php_int_t param_number; zend_string *name; - long type; + php_int_t type; zval parameter; }; @@ -91,7 +91,7 @@ static inline php_sqlite3_db_object *php_sqlite3_db_from_obj(zend_object *obj) { /* Structure for SQLite Database object. */ typedef struct _php_sqlite3_agg_context { zval zval_context; - long row_count; + php_int_t row_count; } php_sqlite3_agg_context; typedef struct _php_sqlite3_stmt_object php_sqlite3_stmt; diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 20fa139062..6643506c1a 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -103,13 +103,13 @@ PHP_METHOD(sqlite3, open) zval *object = getThis(); char *filename, *encryption_key, *fullpath; int filename_len, encryption_key_len = 0; - long flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; + php_int_t flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; zend_error_handling error_handling; db_obj = Z_SQLITE3_DB_P(object); zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|is", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -218,17 +218,17 @@ PHP_METHOD(sqlite3, exec) { php_sqlite3_db_object *db_obj; zval *object = getThis(); - char *sql, *errtext = NULL; - int sql_len; + zend_string *sql; + char *errtext = NULL; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &sql)) { return; } - if (sqlite3_exec(db_obj->db, sql, NULL, NULL, &errtext) != SQLITE_OK) { + if (sqlite3_exec(db_obj->db, sql->val, NULL, NULL, &errtext) != SQLITE_OK) { php_sqlite3_error(db_obj, "%s", errtext); sqlite3_free(errtext); RETURN_FALSE; @@ -249,7 +249,7 @@ PHP_METHOD(sqlite3, version) array_init(return_value); add_assoc_string(return_value, "versionString", (char*)sqlite3_libversion()); - add_assoc_long(return_value, "versionNumber", sqlite3_libversion_number()); + add_assoc_int(return_value, "versionNumber", sqlite3_libversion_number()); return; } @@ -269,7 +269,7 @@ PHP_METHOD(sqlite3, lastInsertRowID) return; } - RETURN_LONG(sqlite3_last_insert_rowid(db_obj->db)); + RETURN_INT(sqlite3_last_insert_rowid(db_obj->db)); } /* }}} */ @@ -287,7 +287,7 @@ PHP_METHOD(sqlite3, lastErrorCode) return; } - RETURN_LONG(sqlite3_errcode(db_obj->db)); + RETURN_INT(sqlite3_errcode(db_obj->db)); } /* }}} */ @@ -315,13 +315,13 @@ PHP_METHOD(sqlite3, busyTimeout) { php_sqlite3_db_object *db_obj; zval *object = getThis(); - long ms; + php_int_t ms; int return_code; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ms)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &ms)) { return; } @@ -424,7 +424,7 @@ PHP_METHOD(sqlite3, changes) return; } - RETURN_LONG(sqlite3_changes(db_obj->db)); + RETURN_INT(sqlite3_changes(db_obj->db)); } /* }}} */ @@ -432,15 +432,15 @@ PHP_METHOD(sqlite3, changes) Returns a string that has been properly escaped. */ PHP_METHOD(sqlite3, escapeString) { - char *sql, *ret; - int sql_len; + zend_string *sql; + char *ret; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &sql)) { return; } - if (sql_len) { - ret = sqlite3_mprintf("%q", sql); + if (sql->len) { + ret = sqlite3_mprintf("%q", sql->val); if (ret) { RETVAL_STRING(ret); sqlite3_free(ret); @@ -458,19 +458,19 @@ PHP_METHOD(sqlite3, prepare) php_sqlite3_db_object *db_obj; php_sqlite3_stmt *stmt_obj; zval *object = getThis(); - char *sql; - int sql_len, errcode; + zend_string *sql; + int errcode; php_sqlite3_free_list *free_item; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &sql)) { return; } - if (!sql_len) { + if (!sql->len) { RETURN_FALSE; } @@ -479,7 +479,7 @@ PHP_METHOD(sqlite3, prepare) stmt_obj->db_obj = db_obj; ZVAL_COPY(&stmt_obj->db_obj_zval, object); - errcode = sqlite3_prepare_v2(db_obj->db, sql, sql_len, &(stmt_obj->stmt), NULL); + errcode = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &(stmt_obj->stmt), NULL); if (errcode != SQLITE_OK) { php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); zval_dtor(return_value); @@ -505,23 +505,24 @@ PHP_METHOD(sqlite3, query) php_sqlite3_stmt *stmt_obj; zval *object = getThis(); zval stmt; - char *sql, *errtext = NULL; - int sql_len, return_code; + zend_string *sql; + char *errtext = NULL; + int return_code; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &sql)) { return; } - if (!sql_len) { + if (!sql->len) { RETURN_FALSE; } /* If there was no return value then just execute the query */ if (!USED_RET()) { - if (sqlite3_exec(db_obj->db, sql, NULL, NULL, &errtext) != SQLITE_OK) { + if (sqlite3_exec(db_obj->db, sql->val, NULL, NULL, &errtext) != SQLITE_OK) { php_sqlite3_error(db_obj, "%s", errtext); sqlite3_free(errtext); } @@ -533,7 +534,7 @@ PHP_METHOD(sqlite3, query) stmt_obj->db_obj = db_obj; ZVAL_COPY(&stmt_obj->db_obj_zval, object); - return_code = sqlite3_prepare_v2(db_obj->db, sql, sql_len, &(stmt_obj->stmt), NULL); + return_code = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &(stmt_obj->stmt), NULL); if (return_code != SQLITE_OK) { php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_obj->db)); zval_ptr_dtor(&stmt); @@ -579,7 +580,7 @@ static void sqlite_value_to_zval(sqlite3_stmt *stmt, int column, zval *data) /* if ((sqlite3_column_int64(stmt, column)) >= INT_MAX || sqlite3_column_int64(stmt, column) <= INT_MIN) { ZVAL_STRINGL(data, (char *)sqlite3_column_text(stmt, column), sqlite3_column_bytes(stmt, column)); } else { - ZVAL_LONG(data, sqlite3_column_int64(stmt, column)); + ZVAL_INT(data, sqlite3_column_int64(stmt, column)); } break; @@ -608,32 +609,33 @@ PHP_METHOD(sqlite3, querySingle) { php_sqlite3_db_object *db_obj; zval *object = getThis(); - char *sql, *errtext = NULL; - int sql_len, return_code; + zend_string *sql; + char *errtext = NULL; + int return_code; zend_bool entire_row = 0; sqlite3_stmt *stmt; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &sql, &sql_len, &entire_row)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &sql, &entire_row)) { return; } - if (!sql_len) { + if (!sql->len) { RETURN_FALSE; } /* If there was no return value then just execute the query */ if (!USED_RET()) { - if (sqlite3_exec(db_obj->db, sql, NULL, NULL, &errtext) != SQLITE_OK) { + if (sqlite3_exec(db_obj->db, sql->val, NULL, NULL, &errtext) != SQLITE_OK) { php_sqlite3_error(db_obj, "%s", errtext); sqlite3_free(errtext); } return; } - return_code = sqlite3_prepare_v2(db_obj->db, sql, sql_len, &stmt, NULL); + return_code = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &stmt, NULL); if (return_code != SQLITE_OK) { php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", return_code, sqlite3_errmsg(db_obj->db)); RETURN_FALSE; @@ -711,16 +713,16 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s ZVAL_NULL(&agg_context->zval_context); } ZVAL_COPY_VALUE(&zargs[0], &agg_context->zval_context); - ZVAL_LONG(&zargs[1], agg_context->row_count); + ZVAL_INT(&zargs[1], agg_context->row_count); } for (i = 0; i < argc; i++) { switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: -#if LONG_MAX > 2147483647 - ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); +#if PHP_INT_MAX > 2147483647 + ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); #else - ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); + ZVAL_INT(&zargs[i + is_agg], sqlite3_value_int(argv[i])); #endif break; @@ -762,11 +764,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s * or if we are finalizing an aggregate */ if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { - case IS_LONG: -#if LONG_MAX > 2147483647 - sqlite3_result_int64(context, Z_LVAL(retval)); + case IS_INT: +#if PHP_INT_MAX > 2147483647 + sqlite3_result_int64(context, Z_IVAL(retval)); #else - sqlite3_result_int(context, Z_LVAL(retval)); + sqlite3_result_int(context, Z_IVAL(retval)); #endif break; @@ -780,7 +782,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s default: convert_to_string_ex(&retval); - sqlite3_result_text(context, Z_STRVAL(retval), Z_STRLEN(retval), SQLITE_TRANSIENT); + sqlite3_result_text(context, Z_STRVAL(retval), Z_STRSIZE(retval), SQLITE_TRANSIENT); break; } } else { @@ -871,13 +873,13 @@ static int php_sqlite3_callback_compare(void *coll, int a_len, const void *a, in zval_ptr_dtor(&zargs[1]); efree(zargs); - //retval ought to contain a ZVAL_LONG by now + //retval ought to contain a ZVAL_INT by now // (the result of a comparison, i.e. most likely -1, 0, or 1) //I suppose we could accept any scalar return type, though. - if (Z_TYPE(retval) != IS_LONG){ + if (Z_TYPE(retval) != IS_INT){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the compare callback (invalid return type). Collation behaviour is undefined."); }else{ - ret = Z_LVAL(retval); + ret = Z_IVAL(retval); } zval_ptr_dtor(&retval); @@ -897,12 +899,12 @@ PHP_METHOD(sqlite3, createFunction) int sql_func_len; zval *callback_func; zend_string *callback_name; - long sql_func_num_args = -1; + php_int_t sql_func_num_args = -1; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|i", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args) == FAILURE) { return; } @@ -947,12 +949,12 @@ PHP_METHOD(sqlite3, createAggregate) zend_string *callback_name; int sql_func_len; zval *step_callback, *fini_callback; - long sql_func_num_args = -1; + php_int_t sql_func_num_args = -1; db_obj = Z_SQLITE3_DB_P(object); SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|i", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) { return; } @@ -1091,7 +1093,7 @@ static int php_sqlite3_stream_flush(php_stream *stream TSRMLS_DC) } /* {{{ */ -static int php_sqlite3_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_sqlite3_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { php_stream_sqlite3_data *sqlite3_stream = (php_stream_sqlite3_data *) stream->abstract; @@ -1185,7 +1187,7 @@ PHP_METHOD(sqlite3, openBlob) zval *object = getThis(); char *table, *column, *dbname = "main"; int table_len, column_len, dbname_len; - long rowid, flags = 0; + php_int_t rowid, flags = 0; sqlite3_blob *blob = NULL; php_stream_sqlite3_data *sqlite3_stream; php_stream *stream; @@ -1194,7 +1196,7 @@ PHP_METHOD(sqlite3, openBlob) SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|s", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssi|s", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len) == FAILURE) { return; } @@ -1252,7 +1254,7 @@ PHP_METHOD(sqlite3stmt, paramCount) SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); - RETURN_LONG(sqlite3_bind_parameter_count(stmt_obj->stmt)); + RETURN_INT(sqlite3_bind_parameter_count(stmt_obj->stmt)); } /* }}} */ @@ -1402,7 +1404,7 @@ PHP_METHOD(sqlite3stmt, bindParam) param.param_number = -1; param.type = SQLITE3_TEXT; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "iz|i", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|l", ¶m.name, ¶meter, ¶m.type) == FAILURE) { return; } @@ -1436,8 +1438,8 @@ PHP_METHOD(sqlite3stmt, bindValue) param.param_number = -1; param.type = SQLITE3_TEXT; - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", ¶m.name, ¶meter, ¶m.type) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "iz/|i", ¶m.param_number, ¶meter, ¶m.type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|i", ¶m.name, ¶meter, ¶m.type) == FAILURE) { return; } } @@ -1493,11 +1495,11 @@ PHP_METHOD(sqlite3stmt, execute) switch (param->type) { case SQLITE_INTEGER: - convert_to_long(parameter); -#if LONG_MAX > 2147483647 - sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); + convert_to_int(parameter); +#if PHP_INT_MAX > 2147483647 + sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter)); #else - sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); + sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_IVAL_P(parameter)); #endif break; @@ -1532,7 +1534,7 @@ PHP_METHOD(sqlite3stmt, execute) case SQLITE3_TEXT: convert_to_string(parameter); - sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRLEN_P(parameter), SQLITE_STATIC); + sqlite3_bind_text(stmt_obj->stmt, param->param_number, Z_STRVAL_P(parameter), Z_STRSIZE_P(parameter), SQLITE_STATIC); break; case SQLITE_NULL: @@ -1540,7 +1542,7 @@ PHP_METHOD(sqlite3stmt, execute) break; default: - php_sqlite3_error(stmt_obj->db_obj, "Unknown parameter type: %ld for parameter %ld", param->type, param->param_number); + php_sqlite3_error(stmt_obj->db_obj, "Unknown parameter type: %pd for parameter %pd", param->type, param->param_number); RETURN_FALSE; } } ZEND_HASH_FOREACH_END(); @@ -1584,15 +1586,15 @@ PHP_METHOD(sqlite3stmt, __construct) php_sqlite3_db_object *db_obj; zval *object = getThis(); zval *db_zval; - char *sql; - int sql_len, errcode; + zend_string *sql; + int errcode; zend_error_handling error_handling; php_sqlite3_free_list *free_item; stmt_obj = Z_SQLITE3_STMT_P(object); zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &db_zval, php_sqlite3_sc_entry, &sql, &sql_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OS", &db_zval, php_sqlite3_sc_entry, &sql) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -1603,14 +1605,14 @@ PHP_METHOD(sqlite3stmt, __construct) zend_restore_error_handling(&error_handling TSRMLS_CC); - if (!sql_len) { + if (!sql->len) { RETURN_FALSE; } stmt_obj->db_obj = db_obj; ZVAL_COPY(&stmt_obj->db_obj_zval, db_zval); - errcode = sqlite3_prepare_v2(db_obj->db, sql, sql_len, &(stmt_obj->stmt), NULL); + errcode = sqlite3_prepare_v2(db_obj->db, sql->val, sql->len, &(stmt_obj->stmt), NULL); if (errcode != SQLITE_OK) { php_sqlite3_error(db_obj, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->db)); zval_dtor(return_value); @@ -1641,7 +1643,7 @@ PHP_METHOD(sqlite3result, numColumns) return; } - RETURN_LONG(sqlite3_column_count(result_obj->stmt_obj->stmt)); + RETURN_INT(sqlite3_column_count(result_obj->stmt_obj->stmt)); } /* }}} */ @@ -1651,13 +1653,13 @@ PHP_METHOD(sqlite3result, columnName) { php_sqlite3_result *result_obj; zval *object = getThis(); - long column = 0; + php_int_t column = 0; char *column_name; result_obj = Z_SQLITE3_RESULT_P(object); SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &column) == FAILURE) { return; } column_name = (char*) sqlite3_column_name(result_obj->stmt_obj->stmt, column); @@ -1676,12 +1678,12 @@ PHP_METHOD(sqlite3result, columnType) { php_sqlite3_result *result_obj; zval *object = getThis(); - long column = 0; + php_int_t column = 0; result_obj = Z_SQLITE3_RESULT_P(object); SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &column) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &column) == FAILURE) { return; } @@ -1689,7 +1691,7 @@ PHP_METHOD(sqlite3result, columnType) RETURN_FALSE; } - RETURN_LONG(sqlite3_column_type(result_obj->stmt_obj->stmt, column)); + RETURN_INT(sqlite3_column_type(result_obj->stmt_obj->stmt, column)); } /* }}} */ @@ -1700,12 +1702,12 @@ PHP_METHOD(sqlite3result, fetchArray) php_sqlite3_result *result_obj; zval *object = getThis(); int i, ret; - long mode = PHP_SQLITE3_BOTH; + php_int_t mode = PHP_SQLITE3_BOTH; result_obj = Z_SQLITE3_RESULT_P(object); SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result) - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &mode) == FAILURE) { return; } @@ -2223,19 +2225,19 @@ PHP_MINIT_FUNCTION(sqlite3) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_ASSOC", PHP_SQLITE3_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_NUM", PHP_SQLITE3_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_BOTH", PHP_SQLITE3_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_INTEGER", SQLITE_INTEGER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_FLOAT", SQLITE_FLOAT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_TEXT", SQLITE3_TEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_BLOB", SQLITE_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_NULL", SQLITE_NULL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_OPEN_READONLY", SQLITE_OPEN_READONLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } diff --git a/ext/standard/array.c b/ext/standard/array.c index 39526c25b7..22a26941ed 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -99,33 +99,33 @@ PHP_MINIT_FUNCTION(array) /* {{{ */ { ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL); - REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_PREFIX_IF_EXISTS", EXTR_PREFIX_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_IF_EXISTS", EXTR_IF_EXISTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("EXTR_REFS", EXTR_REFS, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SORT_ASC", PHP_SORT_ASC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_DESC", PHP_SORT_DESC, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("SORT_REGULAR", PHP_SORT_REGULAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_NUMERIC", PHP_SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_STRING", PHP_SORT_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_LOCALE_STRING", PHP_SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_NATURAL", PHP_SORT_NATURAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SORT_FLAG_CASE", PHP_SORT_FLAG_CASE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("COUNT_NORMAL", COUNT_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("COUNT_RECURSIVE", COUNT_RECURSIVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_BOTH", ARRAY_FILTER_USE_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ARRAY_FILTER_USE_KEY", ARRAY_FILTER_USE_KEY, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -141,7 +141,7 @@ PHP_MSHUTDOWN_FUNCTION(array) /* {{{ */ } /* }}} */ -static void php_set_compare_func(int sort_type TSRMLS_DC) /* {{{ */ +static void php_set_compare_func(php_int_t sort_type TSRMLS_DC) /* {{{ */ { switch (sort_type & ~PHP_SORT_FLAG_CASE) { case PHP_SORT_NUMERIC: @@ -182,13 +182,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ s = (Bucket *) b; if (f->key == NULL) { - ZVAL_LONG(&first, f->h); + ZVAL_INT(&first, f->h); } else { ZVAL_STR(&first, f->key); } if (s->key == 0) { - ZVAL_LONG(&second, s->h); + ZVAL_INT(&second, s->h); } else { ZVAL_STR(&second, s->key); } @@ -197,13 +197,13 @@ static int php_array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ return 0; } - if (EXPECTED(Z_TYPE(result) == IS_LONG)) { - return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); + if (EXPECTED(Z_TYPE(result) == IS_INT)) { + return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); } else if (Z_TYPE(result) == IS_DOUBLE) { return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } - return ZEND_NORMALIZE_BOOL(zval_get_long(&result)); + return ZEND_NORMALIZE_BOOL(zval_get_int(&result)); } /* }}} */ @@ -218,9 +218,9 @@ static int php_array_reverse_key_compare(const void *a, const void *b TSRMLS_DC) PHP_FUNCTION(krsort) { zval *array; - long sort_type = PHP_SORT_REGULAR; + php_int_t sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -238,9 +238,9 @@ PHP_FUNCTION(krsort) PHP_FUNCTION(ksort) { zval *array; - long sort_type = PHP_SORT_REGULAR; + php_int_t sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -253,9 +253,9 @@ PHP_FUNCTION(ksort) } /* }}} */ -PHPAPI int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */ +PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC) /* {{{ */ { - long cnt = 0; + php_int_t cnt = 0; zval *element; if (Z_TYPE_P(array) == IS_ARRAY) { @@ -288,25 +288,25 @@ PHPAPI int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */ PHP_FUNCTION(count) { zval *array; - long mode = COUNT_NORMAL; - long cnt; + php_int_t mode = COUNT_NORMAL; + php_int_t cnt; zval *element; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &array, &mode) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(array) Z_PARAM_OPTIONAL - Z_PARAM_LONG(mode) + Z_PARAM_INT(mode) ZEND_PARSE_PARAMETERS_END(); #endif switch (Z_TYPE_P(array)) { case IS_NULL: - RETURN_LONG(0); + RETURN_INT(0); break; case IS_ARRAY: cnt = zend_hash_num_elements(Z_ARRVAL_P(array)); @@ -316,7 +316,7 @@ PHP_FUNCTION(count) cnt += php_count_recursive(element, COUNT_RECURSIVE TSRMLS_CC); } ZEND_HASH_FOREACH_END(); } - RETURN_LONG(cnt); + RETURN_INT(cnt); break; case IS_OBJECT: { #ifdef HAVE_SPL @@ -324,8 +324,8 @@ PHP_FUNCTION(count) #endif /* first, we check if the handler is defined */ if (Z_OBJ_HT_P(array)->count_elements) { - RETVAL_LONG(1); - if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value) TSRMLS_CC)) { + RETVAL_INT(1); + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_IVAL_P(return_value) TSRMLS_CC)) { return; } } @@ -334,7 +334,7 @@ PHP_FUNCTION(count) if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { zend_call_method_with_0_params(array, NULL, NULL, "count", &retval); if (Z_TYPE(retval) != IS_UNDEF) { - RETVAL_LONG(zval_get_long(&retval)); + RETVAL_INT(zval_get_int(&retval)); zval_ptr_dtor(&retval); } return; @@ -342,7 +342,7 @@ PHP_FUNCTION(count) #endif } default: - RETURN_LONG(1); + RETURN_INT(1); break; } } @@ -378,13 +378,13 @@ static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ return 0; } - if (EXPECTED(Z_TYPE(result) == IS_LONG)) { - return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); + if (EXPECTED(Z_TYPE(result) == IS_INT)) { + return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); } else if (Z_TYPE(result) == IS_DOUBLE) { return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } - return ZEND_NORMALIZE_BOOL(zval_get_long(&result)); + return ZEND_NORMALIZE_BOOL(zval_get_int(&result)); } /* }}} */ @@ -464,9 +464,9 @@ PHP_FUNCTION(natcasesort) PHP_FUNCTION(asort) { zval *array; - long sort_type = PHP_SORT_REGULAR; + php_int_t sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -484,9 +484,9 @@ PHP_FUNCTION(asort) PHP_FUNCTION(arsort) { zval *array; - long sort_type = PHP_SORT_REGULAR; + php_int_t sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -504,9 +504,9 @@ PHP_FUNCTION(arsort) PHP_FUNCTION(sort) { zval *array; - long sort_type = PHP_SORT_REGULAR; + php_int_t sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -524,9 +524,9 @@ PHP_FUNCTION(sort) PHP_FUNCTION(rsort) { zval *array; - long sort_type = PHP_SORT_REGULAR; + php_int_t sort_type = PHP_SORT_REGULAR; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|i", &array, &sort_type) == FAILURE) { RETURN_FALSE; } @@ -557,7 +557,7 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{ BG(user_compare_fci).retval = &retval; BG(user_compare_fci).no_separation = 0; if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - long ret = zval_get_long(&retval); + php_int_t ret = zval_get_int(&retval); zval_ptr_dtor(&retval); zval_ptr_dtor(&args[1]); zval_ptr_dtor(&args[0]); @@ -695,7 +695,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* Bucket *s; zval args[2]; zval retval; - long result; + php_int_t result; ZVAL_NULL(&args[0]); ZVAL_NULL(&args[1]); @@ -704,12 +704,12 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* s = (Bucket *) b; if (f->key == NULL) { - ZVAL_LONG(&args[0], f->h); + ZVAL_INT(&args[0], f->h); } else { ZVAL_STR(&args[0], STR_COPY(f->key)); } if (s->key == NULL) { - ZVAL_LONG(&args[1], s->h); + ZVAL_INT(&args[1], s->h); } else { ZVAL_STR(&args[1], STR_COPY(s->key)); } @@ -719,7 +719,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /* BG(user_compare_fci).retval = &retval; BG(user_compare_fci).no_separation = 0; if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - result = zval_get_long(&retval); + result = zval_get_int(&retval); zval_ptr_dtor(&retval); } else { result = 0; @@ -1230,7 +1230,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ *array, /* array to check in */ *entry, /* pointer to array entry */ res; /* comparison result */ - ulong num_idx; + php_uint_t num_idx; zend_string *str_idx; zend_bool strict = 0; /* strict comparison or not */ @@ -1258,7 +1258,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ if (str_idx) { RETVAL_STR(STR_COPY(str_idx)); } else { - RETVAL_LONG(num_idx); + RETVAL_INT(num_idx); } return; } @@ -1273,7 +1273,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ if (str_idx) { RETVAL_STR(STR_COPY(str_idx)); } else { - RETVAL_LONG(num_idx); + RETVAL_INT(num_idx); } return; } @@ -1339,14 +1339,14 @@ static int php_valid_var_name(char *var_name, int var_name_len) /* {{{ */ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int var_name_len, zend_bool add_underscore TSRMLS_DC) /* {{{ */ { - ZVAL_NEW_STR(result, STR_ALLOC(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + ZVAL_NEW_STR(result, STR_ALLOC(Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + Z_STRVAL_P(result)[Z_STRSIZE_P(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + Z_STRSIZE_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1357,15 +1357,15 @@ PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, int va PHP_FUNCTION(extract) { zval *var_array, *prefix = NULL; - long extract_type = EXTR_OVERWRITE; + php_int_t extract_type = EXTR_OVERWRITE; zval *entry; zend_string *var_name; - ulong num_key; + php_uint_t num_key; int var_exists, count = 0; int extract_refs = 0; zend_array *symbol_table; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|lz/", &var_array, &extract_type, &prefix) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/|iz/", &var_array, &extract_type, &prefix) == FAILURE) { return; } @@ -1384,7 +1384,7 @@ PHP_FUNCTION(extract) if (prefix) { convert_to_string(prefix); - if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { + if (Z_STRSIZE_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRSIZE_P(prefix))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "prefix is not a valid identifier"); return; } @@ -1403,9 +1403,9 @@ PHP_FUNCTION(extract) } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) { zval num; - ZVAL_LONG(&num, num_key); + ZVAL_INT(&num, num_key); convert_to_string(&num); - php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRLEN(num), 1 TSRMLS_CC); + php_prefix_varname(&final_name, prefix, Z_STRVAL(num), Z_STRSIZE(num), 1 TSRMLS_CC); zval_dtor(&num); } else { continue; @@ -1462,7 +1462,7 @@ PHP_FUNCTION(extract) break; } - if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRLEN(final_name))) { + if (Z_TYPE(final_name) != IS_NULL && php_valid_var_name(Z_STRVAL(final_name), Z_STRSIZE(final_name))) { if (extract_refs) { zval *orig_var; @@ -1487,7 +1487,7 @@ PHP_FUNCTION(extract) zval_dtor(&final_name); } ZEND_HASH_FOREACH_END(); - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -1554,9 +1554,9 @@ PHP_FUNCTION(compact) PHP_FUNCTION(array_fill) { zval *val; - long start_key, num; + php_int_t start_key, num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz", &start_key, &num, &val) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iiz", &start_key, &num, &val) == FAILURE) { return; } @@ -1603,9 +1603,9 @@ PHP_FUNCTION(array_fill_keys) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(keys), entry) { ZVAL_DEREF(entry); - if (Z_TYPE_P(entry) == IS_LONG) { + if (Z_TYPE_P(entry) == IS_INT) { zval_add_ref(val); - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), val); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), val); } else { zend_string *key = zval_get_string(entry); @@ -1632,7 +1632,7 @@ PHP_FUNCTION(range) if (zstep) { if (Z_TYPE_P(zstep) == IS_DOUBLE || - (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0) == IS_DOUBLE) + (Z_TYPE_P(zstep) == IS_STRING && is_numeric_string(Z_STRVAL_P(zstep), Z_STRSIZE_P(zstep), NULL, NULL, 0) == IS_DOUBLE) ) { is_step_double = 1; } @@ -1649,17 +1649,17 @@ PHP_FUNCTION(range) array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRSIZE_P(zlow) >= 1 && Z_STRSIZE_P(zhigh) >= 1) { int type1, type2; unsigned char low, high; - long lstep = (long) step; + php_int_t lstep = (php_int_t) step; - type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRLEN_P(zlow), NULL, NULL, 0); - type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRLEN_P(zhigh), NULL, NULL, 0); + type1 = is_numeric_string(Z_STRVAL_P(zlow), Z_STRSIZE_P(zlow), NULL, NULL, 0); + type2 = is_numeric_string(Z_STRVAL_P(zhigh), Z_STRSIZE_P(zhigh), NULL, NULL, 0); if (type1 == IS_DOUBLE || type2 == IS_DOUBLE || is_step_double) { goto double_str; - } else if (type1 == IS_LONG || type2 == IS_LONG) { + } else if (type1 == IS_INT || type2 == IS_INT) { goto long_str; } @@ -1709,7 +1709,7 @@ PHP_FUNCTION(range) } else if (Z_TYPE_P(zlow) == IS_DOUBLE || Z_TYPE_P(zhigh) == IS_DOUBLE || is_step_double) { double low, high, value; - long i; + php_int_t i; double_str: low = zval_get_double(zlow); high = zval_get_double(zhigh); @@ -1742,20 +1742,20 @@ double_str: } } else { double low, high; - long lstep; + php_int_t lstep; long_str: low = zval_get_double(zlow); high = zval_get_double(zhigh); - lstep = (long) step; + lstep = (php_int_t) step; - Z_TYPE_INFO(tmp) = IS_LONG; + Z_TYPE_INFO(tmp) = IS_INT; if (low > high) { /* Negative steps */ if (low - high < lstep || lstep <= 0) { err = 1; goto err; } for (; low >= high; low -= lstep) { - Z_LVAL(tmp) = (long)low; + Z_IVAL(tmp) = (php_int_t)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } else if (high > low) { /* Positive steps */ @@ -1764,11 +1764,11 @@ long_str: goto err; } for (; low <= high; low += lstep) { - Z_LVAL(tmp) = (long)low; + Z_IVAL(tmp) = (php_int_t)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } else { - Z_LVAL(tmp) = (long)low; + Z_IVAL(tmp) = (php_int_t)low; zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp); } } @@ -1985,7 +1985,7 @@ PHP_FUNCTION(array_push) } /* Clean up and return the number of values in the stack */ - RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); + RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack))); } /* }}} */ @@ -1995,7 +1995,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zval *stack, /* Input stack */ *val; /* Value to be popped */ zend_string *key = NULL; - ulong index; + php_uint_t index; #ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/", &stack) == FAILURE) { @@ -2129,7 +2129,7 @@ PHP_FUNCTION(array_unshift) zend_hash_destroy(&old_hash); /* Clean up and return the number of elements in the stack */ - RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack))); + RETVAL_INT(zend_hash_num_elements(Z_ARRVAL_P(stack))); } /* }}} */ @@ -2145,13 +2145,13 @@ PHP_FUNCTION(array_splice) HashTable old_hash; uint idx; Bucket *p; /* Bucket used for traversing hash */ - long i, + php_int_t i, offset, length = 0, repl_num = 0; /* Number of replacement elements */ int num_in; /* Number of elements in the input array */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/l|lz/", &array, &offset, &length, &repl_array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/i|iz/", &array, &offset, &length, &repl_array) == FAILURE) { return; } @@ -2190,7 +2190,7 @@ PHP_FUNCTION(array_splice) /* ..and the length */ if (length < 0) { size = num_in - offset + length; - } else if (((unsigned long) offset + (unsigned long) length) > (unsigned) num_in) { + } else if (((php_uint_t) offset + (php_uint_t) length) > (unsigned) num_in) { size = num_in - offset; } @@ -2222,22 +2222,22 @@ PHP_FUNCTION(array_slice) zval *input, /* Input array */ *z_length = NULL, /* How many elements to get */ *entry; /* An array entry */ - long offset, /* Offset to get elements from */ + php_int_t offset, /* Offset to get elements from */ length = 0; zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */ int num_in, /* Number of elements in the input array */ pos; /* Current position in the array */ zend_string *string_key; - ulong num_key; + php_uint_t num_key; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "al|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ai|zb", &input, &offset, &z_length, &preserve_keys) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(2, 4) Z_PARAM_ARRAY(input) - Z_PARAM_LONG(offset) + Z_PARAM_INT(offset) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(z_length) Z_PARAM_BOOL(preserve_keys) @@ -2251,7 +2251,7 @@ PHP_FUNCTION(array_slice) if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) { length = num_in; } else { - length = zval_get_long(z_length); + length = zval_get_int(z_length); } /* Clamp the offset.. */ @@ -2265,7 +2265,7 @@ PHP_FUNCTION(array_slice) /* ..and the length */ if (length < 0) { length = num_in - offset + length; - } else if (((unsigned long) offset + (unsigned long) length) > (unsigned) num_in) { + } else if (((php_uint_t) offset + (php_uint_t) length) > (unsigned) num_in) { length = num_in - offset; } @@ -2404,7 +2404,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC { zval *src_entry, *dest_entry, *src_zval, *dest_zval; zend_string *string_key; - ulong num_key; + php_uint_t num_key; int ret; ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) { @@ -2564,7 +2564,7 @@ PHP_FUNCTION(array_keys) new_val; /* New value */ int add_key; /* Flag to indicate whether a key should be added */ zend_bool strict = 0; /* do strict comparison */ - ulong num_idx; + php_uint_t num_idx; zend_string *str_idx; int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; @@ -2604,7 +2604,7 @@ PHP_FUNCTION(array_keys) if (str_idx) { ZVAL_STR(&new_val, STR_COPY(str_idx)); } else { - ZVAL_LONG(&new_val, num_idx); + ZVAL_INT(&new_val, num_idx); } zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &new_val); } @@ -2653,21 +2653,21 @@ PHP_FUNCTION(array_count_values) /* Go through input array and add values to the return array */ myht = Z_ARRVAL_P(input); ZEND_HASH_FOREACH_VAL(myht, entry) { - if (Z_TYPE_P(entry) == IS_LONG) { - if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_P(entry))) == NULL) { + if (Z_TYPE_P(entry) == IS_INT) { + if ((tmp = zend_hash_index_find(Z_ARRVAL_P(return_value), Z_IVAL_P(entry))) == NULL) { zval data; - ZVAL_LONG(&data, 1); - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data); + ZVAL_INT(&data, 1); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data); } else { - Z_LVAL_P(tmp)++; + Z_IVAL_P(tmp)++; } } else if (Z_TYPE_P(entry) == IS_STRING) { if ((tmp = zend_symtable_find(Z_ARRVAL_P(return_value), Z_STR_P(entry))) == NULL) { zval data; - ZVAL_LONG(&data, 1); + ZVAL_INT(&data, 1); zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } else { - Z_LVAL_P(tmp)++; + Z_IVAL_P(tmp)++; } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only count STRING and INTEGER values!"); @@ -2684,9 +2684,9 @@ zend_bool array_column_param_helper(zval *param, const char *name TSRMLS_DC) { switch (Z_TYPE_P(param)) { case IS_DOUBLE: - convert_to_long_ex(param); + convert_to_int_ex(param); /* fallthrough */ - case IS_LONG: + case IS_INT: return 1; case IS_OBJECT: @@ -2736,8 +2736,8 @@ PHP_FUNCTION(array_column) } else if ((Z_TYPE_P(zcolumn) == IS_STRING) && ((zcolval = zend_hash_find(ht, Z_STR_P(zcolumn))) == NULL)) { continue; - } else if ((Z_TYPE_P(zcolumn) == IS_LONG) && - ((zcolval = zend_hash_index_find(ht, Z_LVAL_P(zcolumn))) == NULL)) { + } else if ((Z_TYPE_P(zcolumn) == IS_INT) && + ((zcolval = zend_hash_index_find(ht, Z_IVAL_P(zcolumn))) == NULL)) { continue; } @@ -2746,8 +2746,8 @@ PHP_FUNCTION(array_column) */ if (zkey && (Z_TYPE_P(zkey) == IS_STRING)) { zkeyval = zend_hash_find(ht, Z_STR_P(zkey)); - } else if (zkey && (Z_TYPE_P(zkey) == IS_LONG)) { - zkeyval = zend_hash_index_find(ht, Z_LVAL_P(zkey)); + } else if (zkey && (Z_TYPE_P(zkey) == IS_INT)) { + zkeyval = zend_hash_index_find(ht, Z_IVAL_P(zkey)); } if (Z_REFCOUNTED_P(zcolval)) { @@ -2755,8 +2755,8 @@ PHP_FUNCTION(array_column) } if (zkeyval && Z_TYPE_P(zkeyval) == IS_STRING) { zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(zkeyval), zcolval); - } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_LONG) { - add_index_zval(return_value, Z_LVAL_P(zkeyval), zcolval); + } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_INT) { + add_index_zval(return_value, Z_IVAL_P(zkeyval), zcolval); } else if (zkeyval && Z_TYPE_P(zkeyval) == IS_OBJECT) { SEPARATE_ZVAL(zkeyval); convert_to_string(zkeyval); @@ -2775,7 +2775,7 @@ PHP_FUNCTION(array_reverse) zval *input, /* Input array */ *entry; /* An entry in the input array */ zend_string *string_key; - ulong num_key; + php_uint_t num_key; zend_bool preserve_keys = 0; /* whether to preserve keys */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &input, &preserve_keys) == FAILURE) { @@ -2810,20 +2810,20 @@ PHP_FUNCTION(array_pad) zval *pads; /* Array to pass to splice */ HashTable *new_hash;/* Return value from splice */ HashTable old_hash; - long pad_size; /* Size to pad to */ - long pad_size_abs; /* Absolute value of pad_size */ - int input_size; /* Size of the input array */ - int num_pads; /* How many pads do we need */ + php_int_t pad_size; /* Size to pad to */ + php_int_t pad_size_abs; /* Absolute value of pad_size */ + php_int_t input_size; /* Size of the input array */ + php_int_t num_pads; /* How many pads do we need */ int do_pad; /* Whether we should do padding at all */ int i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "alz", &input, &pad_size, &pad_value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "aiz", &input, &pad_size, &pad_value) == FAILURE) { return; } /* Do some initial calculations */ input_size = zend_hash_num_elements(Z_ARRVAL_P(input)); - pad_size_abs = abs(pad_size); + pad_size_abs = ZEND_ABS(pad_size); if (pad_size_abs < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time"); zval_dtor(return_value); @@ -2841,7 +2841,7 @@ PHP_FUNCTION(array_pad) /* Populate the pads array */ num_pads = pad_size_abs - input_size; - if (num_pads > 1048576) { + if (num_pads > Z_I(1048576)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time"); zval_dtor(return_value); RETURN_FALSE; @@ -2874,7 +2874,7 @@ PHP_FUNCTION(array_pad) PHP_FUNCTION(array_flip) { zval *array, *entry, data; - ulong num_idx; + php_uint_t num_idx; zend_string *str_idx; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { @@ -2884,18 +2884,18 @@ PHP_FUNCTION(array_flip) array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL_P(array))); ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { - if (Z_TYPE_P(entry) == IS_LONG) { + if (Z_TYPE_P(entry) == IS_INT) { if (str_idx) { ZVAL_STR(&data, STR_COPY(str_idx)); } else { - ZVAL_LONG(&data, num_idx); + ZVAL_INT(&data, num_idx); } - zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data); + zend_hash_index_update(Z_ARRVAL_P(return_value), Z_IVAL_P(entry), &data); } else if (Z_TYPE_P(entry) == IS_STRING) { if (str_idx) { ZVAL_STR(&data, STR_COPY(str_idx)); } else { - ZVAL_LONG(&data, num_idx); + ZVAL_INT(&data, num_idx); } zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } else { @@ -2912,10 +2912,10 @@ PHP_FUNCTION(array_change_key_case) zval *array, *entry; zend_string *string_key; zend_string *new_key; - ulong num_key; - long change_to_upper=0; + php_uint_t num_key; + php_int_t change_to_upper=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &change_to_upper) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &array, &change_to_upper) == FAILURE) { return; } @@ -2953,9 +2953,9 @@ PHP_FUNCTION(array_unique) }; struct bucketindex *arTmp, *cmpdata, *lastkept; unsigned int i; - long sort_type = PHP_SORT_STRING; + php_int_t sort_type = PHP_SORT_STRING; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &array, &sort_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &array, &sort_type) == FAILURE) { return; } @@ -3035,8 +3035,8 @@ static int zval_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */ return ZEND_NORMALIZE_BOOL(Z_DVAL(result)); } - convert_to_long(&result); - return ZEND_NORMALIZE_BOOL(Z_LVAL(result)); + convert_to_int(&result); + return ZEND_NORMALIZE_BOOL(Z_IVAL(result)); } /* }}} */ @@ -3061,7 +3061,7 @@ static int zval_user_compare(zval *a, zval *b TSRMLS_DC) /* {{{ */ BG(user_compare_fci).no_separation = 0; if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - long ret = zval_get_long(&retval); + php_int_t ret = zval_get_int(&retval); zval_ptr_dtor(&retval); return ret < 0 ? -1 : ret > 0 ? 1 : 0;; } else { @@ -3935,7 +3935,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ php_set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r] TSRMLS_CC); ARRAYG(compare_func)(&temp, &ab[r].val, &bb[r].val TSRMLS_CC); - result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp); + result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_IVAL(temp); if (result != 0) { return result; } @@ -4008,14 +4008,14 @@ PHP_FUNCTION(array_multisort) for (k = 0; k < MULTISORT_LAST; k++) { parse_state[k] = 1; } - } else if (Z_TYPE_P(arg) == IS_LONG) { - switch (Z_LVAL_P(arg) & ~PHP_SORT_FLAG_CASE) { + } else if (Z_TYPE_P(arg) == IS_INT) { + switch (Z_IVAL_P(arg) & ~PHP_SORT_FLAG_CASE) { case PHP_SORT_ASC: case PHP_SORT_DESC: /* flag allowed here */ if (parse_state[MULTISORT_ORDER] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_order = Z_LVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; + sort_order = Z_IVAL(args[i]) == PHP_SORT_DESC ? -1 : 1; parse_state[MULTISORT_ORDER] = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4033,7 +4033,7 @@ PHP_FUNCTION(array_multisort) /* flag allowed here */ if (parse_state[MULTISORT_TYPE] == 1) { /* Save the flag and make sure then next arg is not the current flag. */ - sort_type = Z_LVAL(args[i]); + sort_type = Z_IVAL(args[i]); parse_state[MULTISORT_TYPE] = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); @@ -4141,12 +4141,12 @@ PHP_FUNCTION(array_multisort) PHP_FUNCTION(array_rand) { zval *input; - long randval, num_req = 1; + php_int_t randval, num_req = 1; int num_avail; zend_string *string_key; - ulong num_key; + php_uint_t num_key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &input, &num_req) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|i", &input, &num_req) == FAILURE) { return; } @@ -4178,14 +4178,14 @@ PHP_FUNCTION(array_rand) if (string_key) { RETURN_STR(STR_COPY(string_key)); } else { - RETURN_LONG(num_key); + RETURN_INT(num_key); } } else { /* Append the result to the return value. */ if (string_key) { add_next_index_str(return_value, STR_COPY(string_key)); } else { - add_next_index_long(return_value, num_key); + add_next_index_int(return_value, num_key); } } num_req--; @@ -4207,7 +4207,7 @@ PHP_FUNCTION(array_sum) return; } - ZVAL_LONG(return_value, 0); + ZVAL_INT(return_value, 0); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) { if (Z_TYPE_P(entry) == IS_ARRAY || Z_TYPE_P(entry) == IS_OBJECT) { @@ -4233,7 +4233,7 @@ PHP_FUNCTION(array_product) return; } - ZVAL_LONG(return_value, 1); + ZVAL_INT(return_value, 1); if (!zend_hash_num_elements(Z_ARRVAL_P(input))) { return; } @@ -4245,10 +4245,10 @@ PHP_FUNCTION(array_product) ZVAL_DUP(&entry_n, entry); convert_scalar_to_number(&entry_n TSRMLS_CC); - if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { - dval = (double)Z_LVAL_P(return_value) * (double)Z_LVAL(entry_n); - if ( (double)LONG_MIN <= dval && dval <= (double)LONG_MAX ) { - Z_LVAL_P(return_value) *= Z_LVAL(entry_n); + if (Z_TYPE(entry_n) == IS_INT && Z_TYPE_P(return_value) == IS_INT) { + dval = (double)Z_IVAL_P(return_value) * (double)Z_IVAL(entry_n); + if ( (double)PHP_INT_MIN <= dval && dval <= (double)PHP_INT_MAX ) { + Z_IVAL_P(return_value) *= Z_IVAL(entry_n); continue; } } @@ -4328,13 +4328,13 @@ PHP_FUNCTION(array_filter) zval args[2]; zval retval; zend_bool have_callback = 0; - long use_type = 0; + php_int_t use_type = 0; zend_string *string_key; zend_fcall_info fci = empty_fcall_info; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; - ulong num_key; + php_uint_t num_key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fl", &array, &fci, &fci_cache, &use_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|fi", &array, &fci, &fci_cache, &use_type) == FAILURE) { return; } @@ -4357,9 +4357,9 @@ PHP_FUNCTION(array_filter) if (!string_key) { if (use_type == ARRAY_FILTER_USE_BOTH) { fci.param_count = 2; - ZVAL_LONG(&args[1], num_key); + ZVAL_INT(&args[1], num_key); } else if (use_type == ARRAY_FILTER_USE_KEY) { - ZVAL_LONG(&args[0], num_key); + ZVAL_INT(&args[0], num_key); } } else { if (use_type == ARRAY_FILTER_USE_BOTH) { @@ -4436,7 +4436,7 @@ PHP_FUNCTION(array_map) RETVAL_NULL(); if (n_arrays == 1) { - ulong num_key; + php_uint_t num_key; zend_string *str_key; zval *zv, arg; @@ -4599,8 +4599,8 @@ PHP_FUNCTION(array_key_exists) RETURN_TRUE; } RETURN_FALSE; - case IS_LONG: - if (zend_hash_index_exists(array, Z_LVAL_P(key))) { + case IS_INT: + if (zend_hash_index_exists(array, Z_IVAL_P(key))) { RETURN_TRUE; } RETURN_FALSE; @@ -4622,15 +4622,15 @@ PHP_FUNCTION(array_key_exists) PHP_FUNCTION(array_chunk) { int argc = ZEND_NUM_ARGS(), num_in; - long size, current = 0; + php_int_t size, current = 0; zend_string *str_key; - ulong num_key; + php_uint_t num_key; zend_bool preserve_keys = 0; zval *input = NULL; zval chunk; zval *entry; - if (zend_parse_parameters(argc TSRMLS_CC, "al|b", &input, &size, &preserve_keys) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ai|b", &input, &size, &preserve_keys) == FAILURE) { return; } /* Do bounds checking for size parameter. */ @@ -4716,9 +4716,9 @@ PHP_FUNCTION(array_combine) break; } else if (Z_TYPE(Z_ARRVAL_P(values)->arData[pos_values].val) != IS_UNDEF) { entry_values = &Z_ARRVAL_P(values)->arData[pos_values].val; - if (Z_TYPE_P(entry_keys) == IS_LONG) { + if (Z_TYPE_P(entry_keys) == IS_INT) { zval_add_ref(entry_values); - add_index_zval(return_value, Z_LVAL_P(entry_keys), entry_values); + add_index_zval(return_value, Z_IVAL_P(entry_keys), entry_values); } else { zend_string *key = zval_get_string(entry_keys); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index e64e2e1ecb..8f21a7735c 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -25,10 +25,10 @@ /* }}} */ ZEND_BEGIN_MODULE_GLOBALS(assert) - long active; - long bail; - long warning; - long quiet_eval; + php_int_t active; + php_int_t bail; + php_int_t warning; + php_int_t quiet_eval; zval callback; char *cb; ZEND_END_MODULE_GLOBALS(assert) @@ -98,11 +98,11 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); return SUCCESS; } @@ -164,7 +164,7 @@ PHP_FUNCTION(assert) } compiled_string_description = zend_make_compiled_string_description("assert code" TSRMLS_CC); - if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { + if (zend_eval_stringl(myeval, Z_STRSIZE_P(assertion), &retval, compiled_string_description TSRMLS_CC) == FAILURE) { efree(compiled_string_description); if (description_len == 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval); @@ -205,7 +205,7 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(TSRMLS_C); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_LONG (&args[1], lineno); + ZVAL_INT (&args[1], lineno); ZVAL_STRING(&args[2], SAFE_STRING(myeval)); ZVAL_FALSE(&retval); @@ -256,12 +256,12 @@ PHP_FUNCTION(assert) PHP_FUNCTION(assert_options) { zval *value = NULL; - long what; + php_int_t what; int oldint; int ac = ZEND_NUM_ARGS(); zend_string *key; - if (zend_parse_parameters(ac TSRMLS_CC, "l|z", &what, &value) == FAILURE) { + if (zend_parse_parameters(ac TSRMLS_CC, "i|z", &what, &value) == FAILURE) { return; } @@ -275,7 +275,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_BAIL: @@ -287,7 +287,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_QUIET_EVAL: @@ -299,7 +299,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_WARNING: @@ -311,7 +311,7 @@ PHP_FUNCTION(assert_options) STR_RELEASE(key); STR_RELEASE(value_str); } - RETURN_LONG(oldint); + RETURN_INT(oldint); break; case ASSERT_CALLBACK: diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 3bc96267b2..7ee643a7d5 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -53,7 +53,7 @@ static const short base64_reverse_table[256] = { }; /* }}} */ -PHPAPI zend_string *php_base64_encode(const unsigned char *str, int length) /* {{{ */ +PHPAPI zend_string *php_base64_encode(const unsigned char *str, php_size_t length) /* {{{ */ { const unsigned char *current = str; unsigned char *p; @@ -131,13 +131,13 @@ void php_base64_init(void) */ /* }}} */ -PHPAPI zend_string *php_base64_decode(const unsigned char *str, int length) /* {{{ */ +PHPAPI zend_string *php_base64_decode(const unsigned char *str, php_size_t length) /* {{{ */ { return php_base64_decode_ex(str, length, 0); } /* }}} */ -PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, int length, zend_bool strict) /* {{{ */ +PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t length, zend_bool strict) /* {{{ */ { const unsigned char *current = str; int ch, i = 0, j = 0, k; diff --git a/ext/standard/base64.h b/ext/standard/base64.h index e58565702a..dd07db56e1 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -24,9 +24,9 @@ PHP_FUNCTION(base64_decode); PHP_FUNCTION(base64_encode); -PHPAPI extern zend_string *php_base64_encode(const unsigned char *, int); -PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, int, zend_bool); -PHPAPI extern zend_string *php_base64_decode(const unsigned char *, int); +PHPAPI extern zend_string *php_base64_encode(const unsigned char *, php_size_t); +PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, php_size_t, zend_bool); +PHPAPI extern zend_string *php_base64_decode(const unsigned char *, php_size_t); #endif /* BASE64_H */ diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 17bdae5719..a00b05d44d 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -99,7 +99,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long int) -1) +#define INADDR_NONE ((php_uint_t) -1) #endif #include "zend_globals.h" @@ -395,7 +395,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge, 0, 0, 2) ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ ZEND_ARG_VARIADIC_INFO(0, arrays) ZEND_END_ARG_INFO() - + ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge_recursive, 0, 0, 2) ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ ZEND_ARG_VARIADIC_INFO(0, arrays) @@ -3545,28 +3545,28 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ BG(incomplete_class) = incomplete_class_entry = php_create_incomplete_class(TSRMLS_C); - REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("INI_USER", ZEND_INI_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_PERDIR", ZEND_INI_PERDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_SYSTEM", ZEND_INI_SYSTEM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_ALL", ZEND_INI_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("INI_SCANNER_NORMAL", ZEND_INI_SCANNER_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("INI_SCANNER_RAW", ZEND_INI_SCANNER_RAW, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("PHP_URL_SCHEME", PHP_URL_SCHEME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_HOST", PHP_URL_HOST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_PORT", PHP_URL_PORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_USER", PHP_URL_USER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_PASS", PHP_URL_PASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); #define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) REGISTER_MATH_CONSTANT(M_E); @@ -3589,10 +3589,10 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */ REGISTER_DOUBLE_CONSTANT("INF", php_get_inf(), CONST_CS | CONST_PERSISTENT); REGISTER_DOUBLE_CONSTANT("NAN", php_get_nan(), CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_UP", PHP_ROUND_HALF_UP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_DOWN", PHP_ROUND_HALF_DOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_EVEN", PHP_ROUND_HALF_EVEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PHP_ROUND_HALF_ODD", PHP_ROUND_HALF_ODD, CONST_CS | CONST_PERSISTENT); #if ENABLE_TEST_CLASS test_class_startup(); @@ -3914,7 +3914,7 @@ PHP_FUNCTION(ip2long) #ifdef HAVE_INET_PTON struct in_addr ip; #else - unsigned long int ip; + php_uint_t ip; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { @@ -3925,7 +3925,7 @@ PHP_FUNCTION(ip2long) if (addr_len == 0 || inet_pton(AF_INET, addr, &ip) != 1) { RETURN_FALSE; } - RETURN_LONG(ntohl(ip.s_addr)); + RETURN_INT(ntohl(ip.s_addr)); #else if (addr_len == 0 || (ip = inet_addr(addr)) == INADDR_NONE) { /* The only special case when we should return -1 ourselves, @@ -3934,11 +3934,11 @@ PHP_FUNCTION(ip2long) if (addr_len == sizeof("255.255.255.255") - 1 && !memcmp(addr, "255.255.255.255", sizeof("255.255.255.255") - 1) ) { - RETURN_LONG(0xFFFFFFFF); + RETURN_INT(0xFFFFFFFF); } RETURN_FALSE; } - RETURN_LONG(ntohl(ip)); + RETURN_INT(ntohl(ip)); #endif } /* }}} */ @@ -3950,7 +3950,7 @@ PHP_FUNCTION(long2ip) /* "It's a long but it's not, PHP ints are signed */ char *ip; int ip_len; - unsigned long n; + php_uint_t n; struct in_addr myaddr; #ifdef HAVE_INET_PTON char str[40]; @@ -4342,7 +4342,7 @@ PHP_FUNCTION(getopt) /* Add this option / argument pair to the result hash. */ optname_len = strlen(optname); - if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_LONG) { + if (!(optname_len > 1 && optname[0] == '0') && is_numeric_string(optname, optname_len, NULL, NULL, 0) == IS_INT) { /* numeric string */ int optname_int = atoi(optname); if ((args = zend_hash_index_find(HASH_OF(return_value), optname_int)) != NULL) { @@ -4386,9 +4386,9 @@ PHP_FUNCTION(flush) Delay for a given number of seconds */ PHP_FUNCTION(sleep) { - long num; + php_int_t num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num) == FAILURE) { RETURN_FALSE; } if (num < 0) { @@ -4396,7 +4396,7 @@ PHP_FUNCTION(sleep) RETURN_FALSE; } #ifdef PHP_SLEEP_NON_VOID - RETURN_LONG(php_sleep(num)); + RETURN_INT(php_sleep(num)); #else php_sleep(num); #endif @@ -4409,9 +4409,9 @@ PHP_FUNCTION(sleep) PHP_FUNCTION(usleep) { #if HAVE_USLEEP - long num; + php_int_t num; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &num) == FAILURE) { return; } if (num < 0) { @@ -4428,10 +4428,10 @@ PHP_FUNCTION(usleep) Delay for a number of seconds and nano seconds */ PHP_FUNCTION(time_nanosleep) { - long tv_sec, tv_nsec; + php_int_t tv_sec, tv_nsec; struct timespec php_req, php_rem; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &tv_sec, &tv_nsec) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &tv_sec, &tv_nsec) == FAILURE) { return; } @@ -4450,8 +4450,8 @@ PHP_FUNCTION(time_nanosleep) RETURN_TRUE; } else if (errno == EINTR) { array_init(return_value); - add_assoc_long_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); - add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); + add_assoc_int_ex(return_value, "seconds", sizeof("seconds"), php_rem.tv_sec); + add_assoc_int_ex(return_value, "nanoseconds", sizeof("nanoseconds"), php_rem.tv_nsec); return; } else if (errno == EINVAL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative"); @@ -4626,9 +4626,9 @@ PHP_FUNCTION(error_log) char *message, *opt = NULL, *headers = NULL; int message_len, opt_len = 0, headers_len = 0; int opt_err = 0, argc = ZEND_NUM_ARGS(); - long erropt = 0; + php_int_t erropt = 0; - if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "s|ips", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { return; } @@ -4703,10 +4703,10 @@ PHP_FUNCTION(error_get_last) if (PG(last_error_message)) { array_init(return_value); - add_assoc_long_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); + add_assoc_int_ex(return_value, "type", sizeof("type")-1, PG(last_error_type)); add_assoc_string_ex(return_value, "message", sizeof("message")-1, PG(last_error_message)); add_assoc_string_ex(return_value, "file", sizeof("file")-1, PG(last_error_file)?PG(last_error_file):"-"); - add_assoc_long_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); + add_assoc_int_ex(return_value, "line", sizeof("line")-1, PG(last_error_lineno)); } } /* }}} */ @@ -4937,11 +4937,11 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_ } else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) { zval result; zend_compare_arrays(&result, func1, func2 TSRMLS_CC); - ret = (Z_LVAL(result) == 0); + ret = (Z_IVAL(result) == 0); } else if (Z_TYPE_P(func1) == IS_OBJECT && Z_TYPE_P(func2) == IS_OBJECT) { zval result; zend_compare_objects(&result, func1, func2 TSRMLS_CC); - ret = (Z_LVAL(result) == 0); + ret = (Z_IVAL(result) == 0); } else { ret = 0; } @@ -5242,7 +5242,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze add_assoc_null(&option, "local_value"); } - add_assoc_long(&option, "access", ini_entry->modifiable); + add_assoc_int(&option, "access", ini_entry->modifiable); add_assoc_zval_ex(ini_array, ini_entry->name, ini_entry->name_length, &option); } else { @@ -5450,7 +5450,7 @@ PHP_FUNCTION(print_r) Returns true if client disconnected */ PHP_FUNCTION(connection_aborted) { - RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED); + RETURN_INT(PG(connection_status) & PHP_CONNECTION_ABORTED); } /* }}} */ @@ -5458,7 +5458,7 @@ PHP_FUNCTION(connection_aborted) Returns the connection status bitfield */ PHP_FUNCTION(connection_status) { - RETURN_LONG(PG(connection_status)); + RETURN_INT(PG(connection_status)); } /* }}} */ @@ -5482,7 +5482,7 @@ PHP_FUNCTION(ignore_user_abort) STR_RELEASE(key); } - RETURN_LONG(old_setting); + RETURN_INT(old_setting); } /* }}} */ @@ -5514,7 +5514,7 @@ PHP_FUNCTION(getservbyname) RETURN_FALSE; } - RETURN_LONG(ntohs(serv->s_port)); + RETURN_INT(ntohs(serv->s_port)); } /* }}} */ #endif @@ -5526,10 +5526,10 @@ PHP_FUNCTION(getservbyport) { char *proto; int proto_len; - long port; + php_int_t port; struct servent *serv; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &port, &proto, &proto_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &port, &proto, &proto_len) == FAILURE) { return; } @@ -5563,7 +5563,7 @@ PHP_FUNCTION(getprotobyname) RETURN_FALSE; } - RETURN_LONG(ent->p_proto); + RETURN_INT(ent->p_proto); } /* }}} */ #endif @@ -5573,10 +5573,10 @@ PHP_FUNCTION(getprotobyname) Returns protocol name associated with protocol number proto */ PHP_FUNCTION(getprotobynumber) { - long proto; + php_int_t proto; struct protoent *ent; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &proto) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &proto) == FAILURE) { return; } @@ -5777,8 +5777,8 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal break; } - if (!(Z_STRLEN_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), NULL, NULL, 0) == IS_LONG) { - ulong key = (ulong) zend_atol(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)); + if (!(Z_STRSIZE_P(arg1) > 1 && Z_STRVAL_P(arg1)[0] == '0') && is_numeric_string(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1), NULL, NULL, 0) == IS_INT) { + php_uint_t key = (php_uint_t) zend_atol(Z_STRVAL_P(arg1), Z_STRSIZE_P(arg1)); if ((find_hash = zend_hash_index_find(Z_ARRVAL_P(arr), key)) == NULL) { array_init(&hash); find_hash = zend_hash_index_update(Z_ARRVAL_P(arr), key, &hash); @@ -5797,7 +5797,7 @@ static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int cal ZVAL_DUP(&element, arg2); - if (arg3 && Z_STRLEN_P(arg3) > 0) { + if (arg3 && Z_STRSIZE_P(arg3) > 0) { zend_symtable_update(Z_ARRVAL_P(find_hash), Z_STR_P(arg3), &element); } else { add_next_index_zval(find_hash, &element); @@ -5839,11 +5839,11 @@ PHP_FUNCTION(parse_ini_file) char *filename = NULL; int filename_len = 0; zend_bool process_sections = 0; - long scanner_mode = ZEND_INI_SCANNER_NORMAL; + php_int_t scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_file_handle fh; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bi", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } @@ -5880,10 +5880,10 @@ PHP_FUNCTION(parse_ini_string) char *string = NULL, *str = NULL; int str_len = 0; zend_bool process_sections = 0; - long scanner_mode = ZEND_INI_SCANNER_NORMAL; + php_int_t scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 3cabf87d1a..ee79269cae 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -167,7 +167,7 @@ typedef struct _php_basic_globals { char *locale_string; char *strtok_last; char strtok_table[256]; - ulong strtok_len; + php_uint_t strtok_len; char str_ebuf[40]; zend_fcall_info array_walk_fci; zend_fcall_info_cache array_walk_fci_cache; @@ -178,9 +178,9 @@ typedef struct _php_basic_globals { zval active_ini_file_section; /* pageinfo.c */ - long page_uid; - long page_gid; - long page_inode; + php_int_t page_uid; + php_int_t page_gid; + php_int_t page_inode; time_t page_mtime; /* filestat.c && main/streams/streams.c */ diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index f494cc86b1..c5a4b47744 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -83,15 +83,15 @@ static void convert_browscap_pattern(zval *pattern, int persistent) /* {{{ */ zend_string *res; char *lc_pattern; - res = STR_SAFE_ALLOC(Z_STRLEN_P(pattern), 2, 4, persistent); + res = STR_SAFE_ALLOC(Z_STRSIZE_P(pattern), 2, 4, persistent); t = res->val; - lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern)); + lc_pattern = zend_str_tolower_dup(Z_STRVAL_P(pattern), Z_STRSIZE_P(pattern)); t[j++] = '\xA7'; /* section sign */ t[j++] = '^'; - for (i=0; i<Z_STRLEN_P(pattern); i++, j++) { + for (i=0; i<Z_STRSIZE_P(pattern); i++, j++) { switch (lc_pattern[i]) { case '?': t[j] = '.'; @@ -163,16 +163,16 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb } /* Set proper value for true/false settings */ - if ((Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || - (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || - (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) + if ((Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "on", sizeof("on") - 1)) || + (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "yes", sizeof("yes") - 1)) || + (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "true", sizeof("true") - 1)) ) { ZVAL_NEW_STR(&new_property, STR_INIT("1", sizeof("1")-1, persistent)); } else if ( - (Z_STRLEN_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || - (Z_STRLEN_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || - (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || - (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) + (Z_STRSIZE_P(arg2) == 2 && !strncasecmp(Z_STRVAL_P(arg2), "no", sizeof("no") - 1)) || + (Z_STRSIZE_P(arg2) == 3 && !strncasecmp(Z_STRVAL_P(arg2), "off", sizeof("off") - 1)) || + (Z_STRSIZE_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || + (Z_STRSIZE_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) ) { // TODO: USE STR_EMPTY_ALLOC()? ZVAL_NEW_STR(&new_property, STR_INIT("", sizeof("")-1, persistent)); @@ -203,7 +203,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb pefree(bdata->current_section_name, persistent); } bdata->current_section_name = pestrndup(Z_STRVAL_P(arg1), - Z_STRLEN_P(arg1), persistent); + Z_STRSIZE_P(arg1), persistent); zend_hash_update(bdata->htab, Z_STR_P(arg1), &bdata->current_section); @@ -388,7 +388,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar ua_len = lookup_browser_length; - for (i = 0; i < Z_STRLEN_P(previous_match); i++) { + for (i = 0; i < Z_STRSIZE_P(previous_match); i++) { switch (Z_STRVAL_P(previous_match)[i]) { case '?': case '*': @@ -400,7 +400,7 @@ static int browser_reg_compare(zval *browser TSRMLS_DC, int num_args, va_list ar } } - for (i = 0; i < Z_STRLEN_P(current_match); i++) { + for (i = 0; i < Z_STRSIZE_P(current_match); i++) { switch (Z_STRVAL_P(current_match)[i]) { case '?': case '*': @@ -475,7 +475,7 @@ PHP_FUNCTION(get_browser) RETURN_FALSE; } agent_name = Z_STRVAL_P(http_user_agent); - agent_name_len = Z_STRLEN_P(http_user_agent); + agent_name_len = Z_STRSIZE_P(http_user_agent); } lookup_browser_name = estrndup(agent_name, agent_name_len); diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index e9176e84da..6ff40d57c8 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -39,7 +39,7 @@ PHP_NAMED_FUNCTION(php_if_crc32) for (; nr--; ++p) { crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ]; } - RETVAL_LONG(crc^0xFFFFFFFF); + RETVAL_INT(crc^0xFFFFFFFF); } /* }}} */ diff --git a/ext/standard/credits.c b/ext/standard/credits.c index 3cb6eef724..6df81ca029 100644 --- a/ext/standard/credits.c +++ b/ext/standard/credits.c @@ -69,6 +69,7 @@ PHPAPI void php_print_credits(int flag TSRMLS_DC) /* {{{ */ CREDIT_LINE("Streams Abstraction Layer", "Wez Furlong, Sara Golemon"); CREDIT_LINE("PHP Data Objects Layer", "Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle, Ilia Alshanetsky"); CREDIT_LINE("Output Handler", "Zeev Suraski, Thies C. Arntzen, Marcus Boerger, Michael Wallner"); + CREDIT_LINE("Consistent 64 bit support", "Anthony Ferrara, Anatol Belski"); php_info_print_table_end(); } diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 2a2304be20..47436398ff 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -102,18 +102,18 @@ PHP_MINIT_FUNCTION(crypt) /* {{{ */ { - REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); #ifdef PHP_SHA256_CRYPT - REGISTER_LONG_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_SHA256", PHP_SHA256_CRYPT, CONST_CS | CONST_PERSISTENT); #endif #ifdef PHP_SHA512_CRYPT - REGISTER_LONG_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CRYPT_SHA512", PHP_SHA512_CRYPT, CONST_CS | CONST_PERSISTENT); #endif #if PHP_USE_PHP_CRYPT_R @@ -136,7 +136,7 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */ static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -static void php_to64(char *s, long v, int n) /* {{{ */ +static void php_to64(char *s, php_int_t v, int n) /* {{{ */ { while (--n >= 0) { *s++ = itoa64[v&0x3f]; diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index ccfa66bd60..bf731b256f 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -372,7 +372,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(sha256_rounds_prefix) - 1; char *endp; - unsigned long int srounds = strtoul(num, &endp, 10); + php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10); if (*endp == '$') { salt = endp + 1; rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX)); diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index ebabed9d24..f0732e3e17 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -405,7 +405,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(sha512_rounds_prefix) - 1; char *endp; - unsigned long int srounds = strtoul(num, &endp, 10); + php_uint_t srounds = ZEND_STRTOUI(num, &endp, 10); if (*endp == '$') { salt = endp + 1; diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 80a34a4548..8743708ad9 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -104,14 +104,14 @@ PHP_FUNCTION(strptime) } array_init(return_value); - add_assoc_long(return_value, "tm_sec", parsed_time.tm_sec); - add_assoc_long(return_value, "tm_min", parsed_time.tm_min); - add_assoc_long(return_value, "tm_hour", parsed_time.tm_hour); - add_assoc_long(return_value, "tm_mday", parsed_time.tm_mday); - add_assoc_long(return_value, "tm_mon", parsed_time.tm_mon); - add_assoc_long(return_value, "tm_year", parsed_time.tm_year); - add_assoc_long(return_value, "tm_wday", parsed_time.tm_wday); - add_assoc_long(return_value, "tm_yday", parsed_time.tm_yday); + add_assoc_int(return_value, "tm_sec", parsed_time.tm_sec); + add_assoc_int(return_value, "tm_min", parsed_time.tm_min); + add_assoc_int(return_value, "tm_hour", parsed_time.tm_hour); + add_assoc_int(return_value, "tm_mday", parsed_time.tm_mday); + add_assoc_int(return_value, "tm_mon", parsed_time.tm_mon); + add_assoc_int(return_value, "tm_year", parsed_time.tm_year); + add_assoc_int(return_value, "tm_wday", parsed_time.tm_wday); + add_assoc_int(return_value, "tm_yday", parsed_time.tm_yday); add_assoc_string(return_value, "unparsed", unparsed_part); } /* }}} */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 16cc8db054..bf79a391cf 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -148,44 +148,44 @@ PHP_MINIT_FUNCTION(dir) pathsep_str[1] = '\0'; REGISTER_STRING_CONSTANT("PATH_SEPARATOR", pathsep_str, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCANDIR_SORT_ASCENDING", PHP_SCANDIR_SORT_ASCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCANDIR_SORT_DESCENDING", PHP_SCANDIR_SORT_DESCENDING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SCANDIR_SORT_NONE", PHP_SCANDIR_SORT_NONE, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_GLOB #ifdef GLOB_BRACE - REGISTER_LONG_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_BRACE", GLOB_BRACE, CONST_CS | CONST_PERSISTENT); #else # define GLOB_BRACE 0 #endif #ifdef GLOB_MARK - REGISTER_LONG_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_MARK", GLOB_MARK, CONST_CS | CONST_PERSISTENT); #else # define GLOB_MARK 0 #endif #ifdef GLOB_NOSORT - REGISTER_LONG_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_NOSORT", GLOB_NOSORT, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOSORT 0 #endif #ifdef GLOB_NOCHECK - REGISTER_LONG_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_NOCHECK", GLOB_NOCHECK, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOCHECK 0 #endif #ifdef GLOB_NOESCAPE - REGISTER_LONG_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_NOESCAPE", GLOB_NOESCAPE, CONST_CS | CONST_PERSISTENT); #else # define GLOB_NOESCAPE 0 #endif #ifdef GLOB_ERR - REGISTER_LONG_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_ERR", GLOB_ERR, CONST_CS | CONST_PERSISTENT); #else # define GLOB_ERR 0 #endif @@ -201,8 +201,8 @@ PHP_MINIT_FUNCTION(dir) /* This is used for checking validity of passed flags (passing invalid flags causes segfault in glob()!! */ #define GLOB_AVAILABLE_FLAGS (0 | GLOB_BRACE | GLOB_MARK | GLOB_NOSORT | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ERR | GLOB_ONLYDIR) - REGISTER_LONG_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_ONLYDIR", GLOB_ONLYDIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("GLOB_AVAILABLE_FLAGS", GLOB_AVAILABLE_FLAGS, CONST_CS | CONST_PERSISTENT); #endif /* HAVE_GLOB */ @@ -430,13 +430,13 @@ PHP_FUNCTION(glob) #endif char *pattern = NULL; int pattern_len; - long flags = 0; + php_int_t flags = 0; glob_t globbuf; int n; int ret; zend_bool basedir_limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &pattern, &pattern_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &pattern, &pattern_len, &flags) == FAILURE) { return; } @@ -524,7 +524,7 @@ no_results: * able to filter directories out. */ if (flags & GLOB_ONLYDIR) { - struct stat s; + php_stat_t s; if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) { continue; @@ -553,13 +553,13 @@ PHP_FUNCTION(scandir) { char *dirn; int dirn_len; - long flags = 0; + php_int_t flags = 0; zend_string **namelist; int n, i; zval *zcontext = NULL; php_stream_context *context = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ir", &dirn, &dirn_len, &flags, &zcontext) == FAILURE) { return; } diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 19573d8e42..2f92c82d2c 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -83,7 +83,7 @@ PHPAPI PHP_FUNCTION(dl) } php_dl(filename, MODULE_TEMPORARY, return_value, 0 TSRMLS_CC); - if (Z_LVAL_P(return_value) == 1) { + if (Z_IVAL_P(return_value) == 1) { EG(full_tables_cleanup) = 1; } } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 06df38518e..3ad926820d 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -456,10 +456,10 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t add_assoc_string(subarray, "host", name); add_assoc_string(subarray, "class", "IN"); - add_assoc_long(subarray, "ttl", ttl); + add_assoc_int(subarray, "ttl", ttl); if (raw) { - add_assoc_long(subarray, "type", type); + add_assoc_int(subarray, "type", type); add_assoc_stringl(subarray, "data", (char*) cp, (uint) dlen); cp += dlen; return cp; @@ -477,7 +477,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(2); add_assoc_string(subarray, "type", "MX"); GETSHORT(n, cp); - add_assoc_long(subarray, "pri", n); + add_assoc_int(subarray, "pri", n); /* no break; */ case DNS_T_CNAME: if (type == DNS_T_CNAME) { @@ -564,15 +564,15 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t add_assoc_string(subarray, "rname", name); CHECKCP(5*4); GETLONG(n, cp); - add_assoc_long(subarray, "serial", n); + add_assoc_int(subarray, "serial", n); GETLONG(n, cp); - add_assoc_long(subarray, "refresh", n); + add_assoc_int(subarray, "refresh", n); GETLONG(n, cp); - add_assoc_long(subarray, "retry", n); + add_assoc_int(subarray, "retry", n); GETLONG(n, cp); - add_assoc_long(subarray, "expire", n); + add_assoc_int(subarray, "expire", n); GETLONG(n, cp); - add_assoc_long(subarray, "minimum-ttl", n); + add_assoc_int(subarray, "minimum-ttl", n); break; case DNS_T_AAAA: tp = (u_char*)name; @@ -614,7 +614,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(1); n = ((int)cp[0]) & 0xFF; cp++; - add_assoc_long(subarray, "masklen", n); + add_assoc_int(subarray, "masklen", n); tp = (u_char*)name; if (n > 15) { have_v6_break = 1; @@ -689,11 +689,11 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(3*2); add_assoc_string(subarray, "type", "SRV"); GETSHORT(n, cp); - add_assoc_long(subarray, "pri", n); + add_assoc_int(subarray, "pri", n); GETSHORT(n, cp); - add_assoc_long(subarray, "weight", n); + add_assoc_int(subarray, "weight", n); GETSHORT(n, cp); - add_assoc_long(subarray, "port", n); + add_assoc_int(subarray, "port", n); n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2); if (n < 0) { return NULL; @@ -705,9 +705,9 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t CHECKCP(2*2); add_assoc_string(subarray, "type", "NAPTR"); GETSHORT(n, cp); - add_assoc_long(subarray, "order", n); + add_assoc_int(subarray, "order", n); GETSHORT(n, cp); - add_assoc_long(subarray, "pref", n); + add_assoc_int(subarray, "pref", n); CHECKCP(1); n = (cp[0] & 0xFF); @@ -1047,7 +1047,7 @@ PHP_FUNCTION(dns_get_mx) cp += i; add_next_index_string(mx_list, buf); if (weight_list) { - add_next_index_long(weight_list, weight); + add_next_index_int(weight_list, weight); } } php_dns_free_handle(handle); @@ -1059,20 +1059,20 @@ PHP_FUNCTION(dns_get_mx) #if HAVE_FULL_DNS_FUNCS || defined(PHP_WIN32) PHP_MINIT_FUNCTION(dns) { - REGISTER_LONG_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_A", PHP_DNS_A, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_NS", PHP_DNS_NS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_CNAME", PHP_DNS_CNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_SOA", PHP_DNS_SOA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_PTR", PHP_DNS_PTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_HINFO", PHP_DNS_HINFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_MX", PHP_DNS_MX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_TXT", PHP_DNS_TXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_SRV", PHP_DNS_SRV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_NAPTR", PHP_DNS_NAPTR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_AAAA", PHP_DNS_AAAA, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_A6", PHP_DNS_A6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_ANY", PHP_DNS_ANY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("DNS_ALL", PHP_DNS_ALL, CONST_CS | CONST_PERSISTENT); return SUCCESS; } #endif /* HAVE_FULL_DNS_FUNCS */ diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index f255ebba63..7ef53dd0e7 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -77,7 +77,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */ add_next_index_string(mx_list, pRec->Data.MX.pNameExchange); if (weight_list) { - add_next_index_long(weight_list, srv->wPriority); + add_next_index_int(weight_list, srv->wPriority); } } @@ -158,10 +158,10 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, add_assoc_string(subarray, "host", pRec->pName); add_assoc_string(subarray, "class", "IN"); - add_assoc_long(subarray, "ttl", ttl); + add_assoc_int(subarray, "ttl", ttl); if (raw) { - add_assoc_long(subarray, "type", type); + add_assoc_int(subarray, "type", type); add_assoc_stringl(subarray, "data", (char*) &pRec->Data, (uint) pRec->wDataLength); return; } @@ -177,7 +177,7 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, case DNS_TYPE_MX: add_assoc_string(subarray, "type", "MX"); - add_assoc_long(subarray, "pri", pRec->Data.Srv.wPriority); + add_assoc_int(subarray, "pri", pRec->Data.Srv.wPriority); /* no break; */ case DNS_TYPE_CNAME: @@ -241,11 +241,11 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, add_assoc_string(subarray, "mname", data_soa->pNamePrimaryServer); add_assoc_string(subarray, "rname", data_soa->pNameAdministrator); - add_assoc_long(subarray, "serial", data_soa->dwSerialNo); - add_assoc_long(subarray, "refresh", data_soa->dwRefresh); - add_assoc_long(subarray, "retry", data_soa->dwRetry); - add_assoc_long(subarray, "expire", data_soa->dwExpire); - add_assoc_long(subarray, "minimum-ttl", data_soa->dwDefaultTtl); + add_assoc_int(subarray, "serial", data_soa->dwSerialNo); + add_assoc_int(subarray, "refresh", data_soa->dwRefresh); + add_assoc_int(subarray, "retry", data_soa->dwRetry); + add_assoc_int(subarray, "expire", data_soa->dwExpire); + add_assoc_int(subarray, "minimum-ttl", data_soa->dwDefaultTtl); } break; @@ -309,9 +309,9 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, DNS_SRV_DATA *data_srv = &pRec->Data.Srv; add_assoc_string(subarray, "type", "SRV"); - add_assoc_long(subarray, "pri", data_srv->wPriority); - add_assoc_long(subarray, "weight", data_srv->wWeight); - add_assoc_long(subarray, "port", data_srv->wPort); + add_assoc_int(subarray, "pri", data_srv->wPriority); + add_assoc_int(subarray, "weight", data_srv->wWeight); + add_assoc_int(subarray, "port", data_srv->wPort); add_assoc_string(subarray, "target", data_srv->pNameTarget); } break; @@ -322,8 +322,8 @@ static void php_parserr(PDNS_RECORD pRec, int type_to_fetch, int store, int raw, DNS_NAPTR_DATA * data_naptr = &pRec->Data.Naptr; add_assoc_string(subarray, "type", "NAPTR"); - add_assoc_long(subarray, "order", data_naptr->wOrder); - add_assoc_long(subarray, "pref", data_naptr->wPreference); + add_assoc_int(subarray, "order", data_naptr->wOrder); + add_assoc_int(subarray, "pref", data_naptr->wPreference); add_assoc_string(subarray, "flags", data_naptr->pFlags); add_assoc_string(subarray, "services", data_naptr->pService); add_assoc_string(subarray, "regex", data_naptr->pRegularExpression); diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 6720231089..72878f9c9e 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -200,7 +200,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ } if (ret_code) { zval_dtor(ret_code); - ZVAL_LONG(ret_code, ret); + ZVAL_INT(ret_code, ret); } } /* }}} */ @@ -470,9 +470,9 @@ PHP_FUNCTION(shell_exec) Change the priority of the current process */ PHP_FUNCTION(proc_nice) { - long pri; + php_int_t pri; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &pri) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &pri) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 4551bef8cf..1b599b84a0 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -188,135 +188,135 @@ PHP_MINIT_FUNCTION(file) REGISTER_INI_ENTRIES(); - REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_SH", PHP_LOCK_SH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_EX", PHP_LOCK_EX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_UN", PHP_LOCK_UN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOCK_NB", PHP_LOCK_NB, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_NOTIFY_CONNECT", PHP_STREAM_NOTIFY_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_REQUIRED", PHP_STREAM_NOTIFY_AUTH_REQUIRED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_AUTH_RESULT", PHP_STREAM_NOTIFY_AUTH_RESULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_MIME_TYPE_IS", PHP_STREAM_NOTIFY_MIME_TYPE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_FILE_SIZE_IS", PHP_STREAM_NOTIFY_FILE_SIZE_IS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_REDIRECTED", PHP_STREAM_NOTIFY_REDIRECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_PROGRESS", PHP_STREAM_NOTIFY_PROGRESS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_FAILURE", PHP_STREAM_NOTIFY_FAILURE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_COMPLETED", PHP_STREAM_NOTIFY_COMPLETED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_RESOLVE", PHP_STREAM_NOTIFY_RESOLVE, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_INFO", PHP_STREAM_NOTIFY_SEVERITY_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_WARN", PHP_STREAM_NOTIFY_SEVERITY_WARN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_NOTIFY_SEVERITY_ERR", PHP_STREAM_NOTIFY_SEVERITY_ERR, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_FILTER_READ", PHP_STREAM_FILTER_READ, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_FILTER_WRITE", PHP_STREAM_FILTER_WRITE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_FILTER_ALL", PHP_STREAM_FILTER_ALL, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_CLIENT_PERSISTENT", PHP_STREAM_CLIENT_PERSISTENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT", PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CLIENT_CONNECT", PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_CLIENT", STREAM_CRYPTO_METHOD_ANY_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT", STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT", STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT", STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT", STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT", STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_ANY_SERVER", STREAM_CRYPTO_METHOD_ANY_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER", STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER", STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER", STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER", STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_0_SERVER", STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_1_SERVER", STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_CRYPTO_METHOD_TLSv1_2_SERVER", STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, CONST_CS|CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("STREAM_SHUT_RD", STREAM_SHUT_RD, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SHUT_WR", STREAM_SHUT_WR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SHUT_RDWR", STREAM_SHUT_RDWR, CONST_CS|CONST_PERSISTENT); #ifdef PF_INET - REGISTER_LONG_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET", PF_INET, CONST_CS|CONST_PERSISTENT); #elif defined(AF_INET) - REGISTER_LONG_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET", AF_INET, CONST_CS|CONST_PERSISTENT); #endif #if HAVE_IPV6 # ifdef PF_INET6 - REGISTER_LONG_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET6", PF_INET6, CONST_CS|CONST_PERSISTENT); # elif defined(AF_INET6) - REGISTER_LONG_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_INET6", AF_INET6, CONST_CS|CONST_PERSISTENT); # endif #endif #ifdef PF_UNIX - REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_UNIX", PF_UNIX, CONST_CS|CONST_PERSISTENT); #elif defined(AF_UNIX) - REGISTER_LONG_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PF_UNIX", AF_UNIX, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_IP /* most people will use this one when calling socket() or socketpair() */ - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_IP", IPPROTO_IP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_TCP - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_TCP", IPPROTO_TCP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_UDP - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_UDP", IPPROTO_UDP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_ICMP - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_ICMP", IPPROTO_ICMP, CONST_CS|CONST_PERSISTENT); #endif #ifdef IPPROTO_RAW - REGISTER_LONG_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_IPPROTO_RAW", IPPROTO_RAW, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_STREAM", SOCK_STREAM, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_DGRAM", SOCK_DGRAM, CONST_CS|CONST_PERSISTENT); #ifdef SOCK_RAW - REGISTER_LONG_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_RAW", SOCK_RAW, CONST_CS|CONST_PERSISTENT); #endif #ifdef SOCK_SEQPACKET - REGISTER_LONG_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_SEQPACKET", SOCK_SEQPACKET, CONST_CS|CONST_PERSISTENT); #endif #ifdef SOCK_RDM - REGISTER_LONG_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SOCK_RDM", SOCK_RDM, CONST_CS|CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SERVER_BIND", STREAM_XPORT_BIND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STREAM_SERVER_LISTEN", STREAM_XPORT_LISTEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_USE_INCLUDE_PATH", PHP_FILE_USE_INCLUDE_PATH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_IGNORE_NEW_LINES", PHP_FILE_IGNORE_NEW_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_SKIP_EMPTY_LINES", PHP_FILE_SKIP_EMPTY_LINES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_FNMATCH - REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_PATHNAME", FNM_PATHNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_PERIOD", FNM_PERIOD, CONST_CS | CONST_PERSISTENT); # ifdef FNM_CASEFOLD /* a GNU extension */ /* TODO emulate if not available */ - REGISTER_LONG_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FNM_CASEFOLD", FNM_CASEFOLD, CONST_CS | CONST_PERSISTENT); # endif #endif @@ -342,9 +342,9 @@ PHP_FUNCTION(flock) zval *arg1, *arg3 = NULL; int act; php_stream *stream; - long operation = 0; + php_int_t operation = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &arg1, &operation, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z/", &arg1, &operation, &arg3) == FAILURE) { return; } @@ -358,14 +358,14 @@ PHP_FUNCTION(flock) if (arg3) { zval_dtor(arg3); - ZVAL_LONG(arg3, 0); + ZVAL_INT(arg3, 0); } /* flock_values contains all possible actions if (operation & 4) we won't block on the lock */ act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0); if (php_stream_lock(stream, act)) { if (operation && errno == EWOULDBLOCK && arg3) { - ZVAL_LONG(arg3, 1); + ZVAL_INT(arg3, 1); } RETURN_FALSE; } @@ -526,14 +526,14 @@ PHP_FUNCTION(file_get_contents) int filename_len; zend_bool use_include_path = 0; php_stream *stream; - long offset = -1; - long maxlen = PHP_STREAM_COPY_ALL; + php_int_t offset = -1; + php_int_t maxlen = PHP_STREAM_COPY_ALL; zval *zcontext = NULL; php_stream_context *context = NULL; zend_string *contents; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ll", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|br!ii", &filename, &filename_len, &use_include_path, &zcontext, &offset, &maxlen) == FAILURE) { return; } @@ -552,7 +552,7 @@ PHP_FUNCTION(file_get_contents) } if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", offset); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", offset); php_stream_close(stream); RETURN_FALSE; } @@ -579,14 +579,15 @@ PHP_FUNCTION(file_put_contents) char *filename; int filename_len; zval *data; - long numbytes = 0; - long flags = 0; + php_int_t numbytes = 0; + php_int_t flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *srcstream = NULL; char mode[3] = "wb"; + char ret_ok = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|lr!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pz/|ir!", &filename, &filename_len, &data, &flags, &zcontext) == FAILURE) { return; } @@ -627,30 +628,30 @@ PHP_FUNCTION(file_put_contents) switch (Z_TYPE_P(data)) { case IS_RESOURCE: { - size_t len; + php_size_t len; if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) { - numbytes = -1; + ret_ok = 0; } else { - if (len > LONG_MAX) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %lu to %ld bytes", (unsigned long) len, LONG_MAX); - len = LONG_MAX; + if (len > PHP_INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %zu to " ZEND_INT_FMT " bytes", len, PHP_INT_MAX); + len = PHP_INT_MAX; } numbytes = len; } break; } case IS_NULL: - case IS_LONG: + case IS_INT: case IS_DOUBLE: case IS_FALSE: case IS_TRUE: convert_to_string_ex(data); case IS_STRING: - if (Z_STRLEN_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); - if (numbytes != Z_STRLEN_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN_P(data)); + if (Z_STRSIZE_P(data)) { + numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRSIZE_P(data)); + if (numbytes != Z_STRSIZE_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %zd bytes written, possibly out of free disk space", numbytes, Z_STRSIZE_P(data)); numbytes = -1; } } @@ -658,7 +659,7 @@ PHP_FUNCTION(file_put_contents) case IS_ARRAY: if (zend_hash_num_elements(Z_ARRVAL_P(data))) { - int bytes_written; + php_size_t bytes_written; zval *tmp; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(data), tmp) { @@ -666,13 +667,9 @@ PHP_FUNCTION(file_put_contents) if (str->len) { numbytes += str->len; bytes_written = php_stream_write(stream, str->val, str->len); - if (bytes_written < 0 || bytes_written != str->len) { - if (bytes_written < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %d bytes to %s", str->len, filename); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %d of %d bytes written, possibly out of free disk space", bytes_written, str->len); - } - numbytes = -1; + if (bytes_written != str->len) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write %zd bytes to %s", str->len, filename); + ret_ok = 0; STR_RELEASE(str); break; } @@ -687,9 +684,9 @@ PHP_FUNCTION(file_put_contents) zval out; if (zend_std_cast_object_tostring(data, &out, IS_STRING TSRMLS_CC) == SUCCESS) { - numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); - if (numbytes != Z_STRLEN(out)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %d bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); + numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRSIZE(out)); + if (numbytes != Z_STRSIZE(out)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Only %ld of %zd bytes written, possibly out of free disk space", numbytes, Z_STRSIZE(out)); numbytes = -1; } zval_dtor(&out); @@ -697,16 +694,16 @@ PHP_FUNCTION(file_put_contents) } } default: - numbytes = -1; + ret_ok = 0; break; } php_stream_close(stream); - if (numbytes < 0) { + if (!ret_ok) { RETURN_FALSE; } - RETURN_LONG(numbytes); + RETURN_INT(numbytes); } /* }}} */ @@ -721,7 +718,7 @@ PHP_FUNCTION(file) char *p, *s, *e; register int i = 0; char eol_marker = '\n'; - long flags = 0; + php_int_t flags = 0; zend_bool use_include_path; zend_bool include_new_line; zend_bool skip_blank_lines; @@ -731,11 +728,11 @@ PHP_FUNCTION(file) zend_string *target_buf; /* Parse arguments */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lr!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ir!", &filename, &filename_len, &flags, &zcontext) == FAILURE) { return; } if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%ld' flag is not supported", flags); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'" ZEND_INT_FMT "' flag is not supported", flags); RETURN_FALSE; } @@ -980,7 +977,7 @@ PHP_FUNCTION(pclose) FG(pclose_wait) = 1; zend_list_close(stream->res); FG(pclose_wait) = 0; - RETURN_LONG(FG(pclose_ret)); + RETURN_INT(FG(pclose_ret)); } /* }}} */ @@ -1010,13 +1007,13 @@ PHPAPI PHP_FUNCTION(feof) PHPAPI PHP_FUNCTION(fgets) { zval *arg1; - long len = 1024; + php_int_t len = 1024; char *buf = NULL; int argc = ZEND_NUM_ARGS(); size_t line_len = 0; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &arg1, &len) == FAILURE) { RETURN_FALSE; } @@ -1094,7 +1091,7 @@ PHPAPI PHP_FUNCTION(fgetc) PHPAPI PHP_FUNCTION(fgetss) { zval *fd; - long bytes = 0; + php_int_t bytes = 0; size_t len = 0; size_t actual_len, retval_len; char *buf = NULL, *retval; @@ -1103,7 +1100,7 @@ PHPAPI PHP_FUNCTION(fgetss) char *allowed_tags=NULL; int allowed_tags_len=0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lS", &fd, &bytes, &allowed) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|iS", &fd, &bytes, &allowed) == FAILURE) { RETURN_FALSE; } @@ -1200,11 +1197,11 @@ PHPAPI PHP_FUNCTION(fwrite) int arg2len; int ret; int num_bytes; - long arg3 = 0; + php_int_t arg3 = 0; char *buffer = NULL; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &arg1, &arg2, &arg2len, &arg3) == FAILURE) { RETURN_FALSE; } @@ -1215,7 +1212,7 @@ PHPAPI PHP_FUNCTION(fwrite) } if (!num_bytes) { - RETURN_LONG(0); + RETURN_INT(0); } PHP_STREAM_TO_ZVAL(stream, arg1); @@ -1225,7 +1222,7 @@ PHPAPI PHP_FUNCTION(fwrite) efree(buffer); } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1276,7 +1273,7 @@ PHPAPI PHP_FUNCTION(rewind) PHPAPI PHP_FUNCTION(ftell) { zval *arg1; - long ret; + php_int_t ret; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &arg1) == FAILURE) { @@ -1289,7 +1286,7 @@ PHPAPI PHP_FUNCTION(ftell) if (ret == -1) { RETURN_FALSE; } - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ @@ -1298,16 +1295,16 @@ PHPAPI PHP_FUNCTION(ftell) PHPAPI PHP_FUNCTION(fseek) { zval *arg1; - long arg2, whence = SEEK_SET; + php_int_t arg2, whence = SEEK_SET; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &arg2, &whence) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|i", &arg1, &arg2, &whence) == FAILURE) { RETURN_FALSE; } PHP_STREAM_TO_ZVAL(stream, arg1); - RETURN_LONG(php_stream_seek(stream, arg2, whence)); + RETURN_INT(php_stream_seek(stream, arg2, whence)); } /* }}} */ @@ -1315,7 +1312,7 @@ PHPAPI PHP_FUNCTION(fseek) */ /* DEPRECATED APIs: Use php_stream_mkdir() instead */ -PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC) +PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC) { int ret; @@ -1330,7 +1327,7 @@ PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC) return ret; } -PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC) +PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC) { return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC); } @@ -1343,11 +1340,11 @@ PHP_FUNCTION(mkdir) char *dir; int dir_len; zval *zcontext = NULL; - long mode = 0777; + php_int_t mode = 0777; zend_bool recursive = 0; php_stream_context *context; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ibr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -1398,7 +1395,7 @@ PHP_FUNCTION(readfile) if (stream) { size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_INT(size); } RETURN_FALSE; @@ -1409,7 +1406,7 @@ PHP_FUNCTION(readfile) Return or change the umask */ PHP_FUNCTION(umask) { - long arg1 = 0; + php_int_t arg1 = 0; int oldumask; oldumask = umask(077); @@ -1418,7 +1415,7 @@ PHP_FUNCTION(umask) BG(umask) = oldumask; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &arg1) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &arg1) == FAILURE) { RETURN_FALSE; } @@ -1428,7 +1425,7 @@ PHP_FUNCTION(umask) umask(arg1); } - RETURN_LONG(oldumask); + RETURN_INT(oldumask); } /* }}} */ @@ -1447,7 +1444,7 @@ PHPAPI PHP_FUNCTION(fpassthru) PHP_STREAM_TO_ZVAL(stream, arg1); size = php_stream_passthru(stream); - RETURN_LONG(size); + RETURN_INT(size); } /* }}} */ @@ -1524,10 +1521,10 @@ PHP_FUNCTION(unlink) PHP_NAMED_FUNCTION(php_if_ftruncate) { zval *fp; - long size; + php_int_t size; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &fp, &size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &fp, &size) == FAILURE) { RETURN_FALSE; } @@ -1568,30 +1565,30 @@ PHP_NAMED_FUNCTION(php_if_fstat) array_init(return_value); - ZVAL_LONG(&stat_dev, stat_ssb.sb.st_dev); - ZVAL_LONG(&stat_ino, stat_ssb.sb.st_ino); - ZVAL_LONG(&stat_mode, stat_ssb.sb.st_mode); - ZVAL_LONG(&stat_nlink, stat_ssb.sb.st_nlink); - ZVAL_LONG(&stat_uid, stat_ssb.sb.st_uid); - ZVAL_LONG(&stat_gid, stat_ssb.sb.st_gid); + ZVAL_INT(&stat_dev, stat_ssb.sb.st_dev); + ZVAL_INT(&stat_ino, stat_ssb.sb.st_ino); + ZVAL_INT(&stat_mode, stat_ssb.sb.st_mode); + ZVAL_INT(&stat_nlink, stat_ssb.sb.st_nlink); + ZVAL_INT(&stat_uid, stat_ssb.sb.st_uid); + ZVAL_INT(&stat_gid, stat_ssb.sb.st_gid); #ifdef HAVE_ST_RDEV - ZVAL_LONG(&stat_rdev, stat_ssb.sb.st_rdev); + ZVAL_INT(&stat_rdev, stat_ssb.sb.st_rdev); #else - ZVAL_LONG(&stat_rdev, -1); + ZVAL_INT(&stat_rdev, -1); #endif - ZVAL_LONG(&stat_size, stat_ssb.sb.st_size); - ZVAL_LONG(&stat_atime, stat_ssb.sb.st_atime); - ZVAL_LONG(&stat_mtime, stat_ssb.sb.st_mtime); - ZVAL_LONG(&stat_ctime, stat_ssb.sb.st_ctime); + ZVAL_INT(&stat_size, stat_ssb.sb.st_size); + ZVAL_INT(&stat_atime, stat_ssb.sb.st_atime); + ZVAL_INT(&stat_mtime, stat_ssb.sb.st_mtime); + ZVAL_INT(&stat_ctime, stat_ssb.sb.st_ctime); #ifdef HAVE_ST_BLKSIZE - ZVAL_LONG(&stat_blksize, stat_ssb.sb.st_blksize); + ZVAL_INT(&stat_blksize, stat_ssb.sb.st_blksize); #else - ZVAL_LONG(&stat_blksize,-1); + ZVAL_INT(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_LONG(&stat_blocks, stat_ssb.sb.st_blocks); + ZVAL_INT(&stat_blocks, stat_ssb.sb.st_blocks); #else - ZVAL_LONG(&stat_blocks,-1); + ZVAL_INT(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -1767,10 +1764,10 @@ safe_to_copy: PHPAPI PHP_FUNCTION(fread) { zval *arg1; - long len; + php_int_t len; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &len) == FAILURE) { RETURN_FALSE; } @@ -1782,10 +1779,10 @@ PHPAPI PHP_FUNCTION(fread) } ZVAL_NEW_STR(return_value, STR_ALLOC(len, 0)); - Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); + Z_STRSIZE_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len); /* needed because recv/read/gzread doesnt put a null at the end*/ - Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0; + Z_STRVAL_P(return_value)[Z_STRSIZE_P(return_value)] = 0; } /* }}} */ @@ -1887,12 +1884,12 @@ PHP_FUNCTION(fputcsv) PHP_STREAM_TO_ZVAL(stream, fp); ret = php_fputcsv(stream, fields, delimiter, enclosure, escape_char TSRMLS_CC); - RETURN_LONG(ret); + RETURN_INT(ret); } /* }}} */ -/* {{{ PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ -PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) +/* {{{ PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ +PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) { int count, i = 0, ret; zval *field_tmp; @@ -1959,7 +1956,7 @@ PHP_FUNCTION(fgetcsv) /* first section exactly as php_fgetss */ - long len = 0; + php_int_t len = 0; size_t buf_len; char *buf; php_stream *stream; @@ -2018,7 +2015,7 @@ PHP_FUNCTION(fgetcsv) } if (len_zv != NULL && Z_TYPE_P(len_zv) != IS_NULL) { - len = zval_get_long(len_zv); + len = zval_get_int(len_zv); if (len < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative"); RETURN_FALSE; @@ -2457,9 +2454,9 @@ PHP_FUNCTION(fnmatch) { char *pattern, *filename; int pattern_len, filename_len; - long flags = 0; + php_int_t flags = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp|i", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { return; } diff --git a/ext/standard/file.h b/ext/standard/file.h index 9c044aff1e..b667a29233 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -77,10 +77,10 @@ PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC); PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC); PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk TSRMLS_DC); PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC); -PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC); -PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC); +PHPAPI int php_mkdir_ex(const char *dir, php_int_t mode, int options TSRMLS_DC); +PHPAPI int php_mkdir(const char *dir, php_int_t mode TSRMLS_DC); PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC); -PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); +PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); #define META_DEF_BUFSIZE 8192 @@ -117,8 +117,8 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data * TSRMLS_DC); typedef struct { int pclose_ret; size_t def_chunk_size; - long auto_detect_line_endings; - long default_socket_timeout; + php_int_t auto_detect_line_endings; + php_int_t default_socket_timeout; char *user_agent; /* for the http wrapper */ char *from_address; /* for the ftp and http wrappers */ const char *user_stream_current_filename; /* for simple recursion protection */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 9fb35ef344..8e24fec657 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -158,7 +158,7 @@ static int php_disk_total_space(char *path, double *space TSRMLS_DC) /* {{{ */ /* i know - this is ugly, but i works <thies@thieso.net> */ bytestotal = TotalNumberOfBytes.HighPart * - (double) (((unsigned long)1) << 31) * 2.0 + + (double) (((php_uint_t)1) << 31) * 2.0 + TotalNumberOfBytes.LowPart; } else { /* If it's not available, we just use GetDiskFreeSpace */ if (GetDiskFreeSpace(path, @@ -290,7 +290,7 @@ static int php_disk_free_space(char *path, double *space TSRMLS_DC) /* {{{ */ /* i know - this is ugly, but i works <thies@thieso.net> */ bytesfree = FreeBytesAvailableToCaller.HighPart * - (double) (((unsigned long)1) << 31) * 2.0 + + (double) (((php_uint_t)1) << 31) * 2.0 + FreeBytesAvailableToCaller.LowPart; } else { /* If it's not available, we just use GetDiskFreeSpace */ if (GetDiskFreeSpace(path, @@ -437,9 +437,9 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(group) == IS_LONG) { + if (Z_TYPE_P(group) == IS_INT) { option = PHP_STREAM_META_GROUP; - value = &Z_LVAL_P(group); + value = &Z_IVAL_P(group); } else if (Z_TYPE_P(group) == IS_STRING) { option = PHP_STREAM_META_GROUP_NAME; value = Z_STRVAL_P(group); @@ -465,8 +465,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ /* We have no native chgrp on Windows, nothing left to do if stream doesn't have own implementation */ RETURN_FALSE; #else - if (Z_TYPE_P(group) == IS_LONG) { - gid = (gid_t)Z_LVAL_P(group); + if (Z_TYPE_P(group) == IS_INT) { + gid = (gid_t)Z_IVAL_P(group); } else if (Z_TYPE_P(group) == IS_STRING) { if(php_get_gid_by_name(Z_STRVAL_P(group), &gid TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find gid for %s", Z_STRVAL_P(group)); @@ -574,9 +574,9 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ if(wrapper && wrapper->wops->stream_metadata) { int option; void *value; - if (Z_TYPE_P(user) == IS_LONG) { + if (Z_TYPE_P(user) == IS_INT) { option = PHP_STREAM_META_OWNER; - value = &Z_LVAL_P(user); + value = &Z_IVAL_P(user); } else if (Z_TYPE_P(user) == IS_STRING) { option = PHP_STREAM_META_OWNER_NAME; value = Z_STRVAL_P(user); @@ -603,8 +603,8 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ RETURN_FALSE; #else - if (Z_TYPE_P(user) == IS_LONG) { - uid = (uid_t)Z_LVAL_P(user); + if (Z_TYPE_P(user) == IS_INT) { + uid = (uid_t)Z_IVAL_P(user); } else if (Z_TYPE_P(user) == IS_STRING) { if(php_get_uid_by_name(Z_STRVAL_P(user), &uid TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find uid for %s", Z_STRVAL_P(user)); @@ -668,12 +668,12 @@ PHP_FUNCTION(chmod) { char *filename; int filename_len; - long mode; + php_int_t mode; int ret; mode_t imode; php_stream_wrapper *wrapper; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pi", &filename, &filename_len, &mode) == FAILURE) { return; } @@ -714,14 +714,14 @@ PHP_FUNCTION(touch) { char *filename; int filename_len; - long filetime = 0, fileatime = 0; + php_int_t filetime = 0, fileatime = 0; int ret, argc = ZEND_NUM_ARGS(); FILE *file; struct utimbuf newtimebuf; struct utimbuf *newtime = &newtimebuf; php_stream_wrapper *wrapper; - if (zend_parse_parameters(argc TSRMLS_CC, "p|ll", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "p|ii", &filename, &filename_len, &filetime, &fileatime) == FAILURE) { return; } @@ -850,7 +850,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ { zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev, stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks; - struct stat *stat_sb; + zend_stat_t *stat_sb; php_stream_statbuf ssb; int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */ char *stat_sb_names[13] = { @@ -962,21 +962,21 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ switch (type) { case FS_PERMS: - RETURN_LONG((long)ssb.sb.st_mode); + RETURN_INT((php_int_t)ssb.sb.st_mode); case FS_INODE: - RETURN_LONG((long)ssb.sb.st_ino); + RETURN_INT((php_int_t)ssb.sb.st_ino); case FS_SIZE: - RETURN_LONG((long)ssb.sb.st_size); + RETURN_INT((php_int_t)ssb.sb.st_size); case FS_OWNER: - RETURN_LONG((long)ssb.sb.st_uid); + RETURN_INT((php_int_t)ssb.sb.st_uid); case FS_GROUP: - RETURN_LONG((long)ssb.sb.st_gid); + RETURN_INT((php_int_t)ssb.sb.st_gid); case FS_ATIME: - RETURN_LONG((long)ssb.sb.st_atime); + RETURN_INT((php_int_t)ssb.sb.st_atime); case FS_MTIME: - RETURN_LONG((long)ssb.sb.st_mtime); + RETURN_INT((php_int_t)ssb.sb.st_mtime); case FS_CTIME: - RETURN_LONG((long)ssb.sb.st_ctime); + RETURN_INT((php_int_t)ssb.sb.st_ctime); case FS_TYPE: if (S_ISLNK(ssb.sb.st_mode)) { RETURN_STRING("link"); @@ -1012,30 +1012,30 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ case FS_STAT: array_init(return_value); - ZVAL_LONG(&stat_dev, stat_sb->st_dev); - ZVAL_LONG(&stat_ino, stat_sb->st_ino); - ZVAL_LONG(&stat_mode, stat_sb->st_mode); - ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); - ZVAL_LONG(&stat_uid, stat_sb->st_uid); - ZVAL_LONG(&stat_gid, stat_sb->st_gid); + ZVAL_INT(&stat_dev, stat_sb->st_dev); + ZVAL_INT(&stat_ino, stat_sb->st_ino); + ZVAL_INT(&stat_mode, stat_sb->st_mode); + ZVAL_INT(&stat_nlink, stat_sb->st_nlink); + ZVAL_INT(&stat_uid, stat_sb->st_uid); + ZVAL_INT(&stat_gid, stat_sb->st_gid); #ifdef HAVE_ST_RDEV - ZVAL_LONG(&stat_rdev, stat_sb->st_rdev); + ZVAL_INT(&stat_rdev, stat_sb->st_rdev); #else - ZVAL_LONG(&stat_rdev, -1); + ZVAL_INT(&stat_rdev, -1); #endif - ZVAL_LONG(&stat_size, stat_sb->st_size); - ZVAL_LONG(&stat_atime, stat_sb->st_atime); - ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); - ZVAL_LONG(&stat_ctime, stat_sb->st_ctime); + ZVAL_INT(&stat_size, stat_sb->st_size); + ZVAL_INT(&stat_atime, stat_sb->st_atime); + ZVAL_INT(&stat_mtime, stat_sb->st_mtime); + ZVAL_INT(&stat_ctime, stat_sb->st_ctime); #ifdef HAVE_ST_BLKSIZE - ZVAL_LONG(&stat_blksize, stat_sb->st_blksize); + ZVAL_INT(&stat_blksize, stat_sb->st_blksize); #else - ZVAL_LONG(&stat_blksize,-1); + ZVAL_INT(&stat_blksize,-1); #endif #ifdef HAVE_ST_BLOCKS - ZVAL_LONG(&stat_blocks, stat_sb->st_blocks); + ZVAL_INT(&stat_blocks, stat_sb->st_blocks); #else - ZVAL_LONG(&stat_blocks,-1); + ZVAL_INT(&stat_blocks,-1); #endif /* Store numeric indexes in propper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); @@ -1201,7 +1201,7 @@ PHP_FUNCTION(realpath_cache_size) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(realpath_cache_size(TSRMLS_C)); + RETURN_INT(realpath_cache_size(TSRMLS_C)); } /* {{{ proto bool realpath_cache_get() @@ -1223,14 +1223,14 @@ PHP_FUNCTION(realpath_cache_get) array_init(&entry); /* bucket->key is unsigned long */ - if (LONG_MAX >= bucket->key) { - add_assoc_long(&entry, "key", bucket->key); + if (ZEND_INT_MAX >= bucket->key) { + add_assoc_int(&entry, "key", bucket->key); } else { add_assoc_double(&entry, "key", (double)bucket->key); } add_assoc_bool(&entry, "is_dir", bucket->is_dir); add_assoc_stringl(&entry, "realpath", bucket->realpath, bucket->realpath_len); - add_assoc_long(&entry, "expires", bucket->expires); + add_assoc_int(&entry, "expires", bucket->expires); #ifdef PHP_WIN32 add_assoc_bool(&entry, "is_rvalid", bucket->is_rvalid); add_assoc_bool(&entry, "is_wvalid", bucket->is_wvalid); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index d40321f959..7944cdc4c7 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -263,14 +263,14 @@ static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zv ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { convert_to_string_ex(tmp); smart_str_appendc(&tags_ss, '<'); - smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&tags_ss, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); smart_str_appendc(&tags_ss, '>'); } ZEND_HASH_FOREACH_END(); smart_str_0(&tags_ss); } else { /* FIXME: convert_to_* may clutter zvals and lead it into segfault ? */ convert_to_string_ex(filterparams); - smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRLEN_P(filterparams)); + smart_str_setl(&tags_ss, Z_STRVAL_P(filterparams), Z_STRSIZE_P(filterparams)); } } @@ -1232,7 +1232,7 @@ static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pr } #if IT_WAS_USED -static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretval, char *field_name, size_t field_name_len) +static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, php_int_t *pretval, char *field_name, size_t field_name_len) { zval **tmpval; @@ -1241,13 +1241,13 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretv if (zend_hash_find((HashTable *)ht, field_name, field_name_len, (void **)&tmpval) == SUCCESS) { zval tmp, *ztval = *tmpval; - if (Z_TYPE_PP(tmpval) != IS_LONG) { + if (Z_TYPE_PP(tmpval) != IS_INT) { tmp = *ztval; zval_copy_ctor(&tmp); - convert_to_long(&tmp); + convert_to_int(&tmp); ztval = &tmp; } - *pretval = Z_LVAL_P(ztval); + *pretval = Z_IVAL_P(ztval); } else { return PHP_CONV_ERR_NOT_FOUND; } @@ -1255,7 +1255,7 @@ static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretv } #endif -static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, unsigned long *pretval, char *field_name, size_t field_name_len) +static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, php_uint_t *pretval, char *field_name, size_t field_name_len) { zval *tmpval; @@ -1264,15 +1264,15 @@ static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, unsigned l if ((tmpval = zend_hash_str_find((HashTable *)ht, field_name, field_name_len-1)) != NULL) { zval tmp; - if (Z_TYPE_P(tmpval) != IS_LONG) { + if (Z_TYPE_P(tmpval) != IS_INT) { ZVAL_DUP(&tmp, tmpval);; - convert_to_long(&tmp); + convert_to_int(&tmp); tmpval = &tmp; } - if (Z_LVAL_P(tmpval) < 0) { + if (Z_IVAL_P(tmpval) < 0) { *pretval = 0; } else { - *pretval = Z_LVAL_P(tmpval); + *pretval = Z_IVAL_P(tmpval); } } else { return PHP_CONV_ERR_NOT_FOUND; @@ -1306,7 +1306,7 @@ static php_conv_err_t php_conv_get_bool_prop_ex(const HashTable *ht, int *pretva #if IT_WAS_USED static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len) { - long l; + php_int_t l; php_conv_err_t err; *pretval = 0; @@ -1320,7 +1320,7 @@ static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *fie static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len) { - unsigned long l; + php_uint_t l; php_conv_err_t err; *pretval = 0; diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index edd704b068..3c570d32ee 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -52,7 +52,7 @@ static char HEXCHARS[] = "0123456789ABCDEF"; /* php_spintf_appendchar() {{{ */ inline static void -php_sprintf_appendchar(zend_string **buffer, int *pos, char add TSRMLS_DC) +php_sprintf_appendchar(zend_string **buffer, php_size_t *pos, char add TSRMLS_DC) { if (!*buffer || (*pos + 1) >= (*buffer)->len) { PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), (*buffer)->len)); @@ -65,22 +65,18 @@ php_sprintf_appendchar(zend_string **buffer, int *pos, char add TSRMLS_DC) /* php_spintf_appendstring() {{{ */ inline static void -php_sprintf_appendstring(zend_string **buffer, int *pos, char *add, - int min_width, int max_width, char padding, - int alignment, int len, int neg, int expprec, int always_sign) +php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add, + php_size_t min_width, php_size_t max_width, char padding, + php_size_t alignment, php_size_t len, int neg, int expprec, int always_sign) { - register int npad; - int req_size; - int copy_len; - int m_width; + register php_size_t npad; + php_size_t req_size; + php_size_t copy_len; + php_size_t m_width; copy_len = (expprec ? MIN(max_width, len) : len); - npad = min_width - copy_len; + npad = (min_width < copy_len) ? 0 : min_width - copy_len; - if (npad < 0) { - npad = 0; - } - PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n", *buffer, *pos, (*buffer)->len, add, min_width, padding, alignment)); m_width = MAX(min_width, copy_len); @@ -92,10 +88,10 @@ php_sprintf_appendstring(zend_string **buffer, int *pos, char *add, req_size = *pos + m_width + 1; if (!*buffer || req_size > (*buffer)->len) { - int size = (*buffer)->len; + zend_size_t size = (*buffer)->len; while (req_size > size) { - if (size > INT_MAX/2) { - zend_error_noreturn(E_ERROR, "Field width %d is too long", req_size); + if (size > ZEND_SIZE_MAX/2) { + zend_error_noreturn(E_ERROR, "Field width %zd is too long", req_size); } size <<= 1; } @@ -126,21 +122,21 @@ php_sprintf_appendstring(zend_string **buffer, int *pos, char *add, /* php_spintf_appendint() {{{ */ inline static void -php_sprintf_appendint(zend_string **buffer, int *pos, long number, - int width, char padding, int alignment, +php_sprintf_appendint(zend_string **buffer, php_size_t *pos, php_int_t number, + php_size_t width, char padding, php_size_t alignment, int always_sign) { char numbuf[NUM_BUF_SIZE]; - register unsigned long magn, nmagn; + register php_uint_t magn, nmagn; register unsigned int i = NUM_BUF_SIZE - 1, neg = 0; PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n", *buffer, pos, &(*buffer)->len, number, width, padding, alignment)); if (number < 0) { neg = 1; - magn = ((unsigned long) -(number + 1)) + 1; + magn = ((php_uint_t) -(number + 1)) + 1; } else { - magn = (unsigned long) number; + magn = (php_uint_t) number; } /* Can't right-pad 0's on integers */ @@ -170,17 +166,17 @@ php_sprintf_appendint(zend_string **buffer, int *pos, long number, /* php_spintf_appenduint() {{{ */ inline static void -php_sprintf_appenduint(zend_string **buffer, int *pos, - unsigned long number, - int width, char padding, int alignment) +php_sprintf_appenduint(zend_string **buffer, php_size_t *pos, + php_uint_t number, + php_size_t width, char padding, php_size_t alignment) { char numbuf[NUM_BUF_SIZE]; - register unsigned long magn, nmagn; + register php_uint_t magn, nmagn; register unsigned int i = NUM_BUF_SIZE - 1; PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n", *buffer, pos, &(*buffer)->len, number, width, padding, alignment)); - magn = (unsigned long) number; + magn = (php_uint_t) number; /* Can't right-pad 0's on integers */ if (alignment == 0 && padding == '0') padding = ' '; @@ -202,17 +198,18 @@ php_sprintf_appenduint(zend_string **buffer, int *pos, /* php_spintf_appenddouble() {{{ */ inline static void -php_sprintf_appenddouble(zend_string **buffer, int *pos, +php_sprintf_appenddouble(zend_string **buffer, php_size_t *pos, double number, - int width, char padding, - int alignment, int precision, + php_size_t width, char padding, + php_size_t alignment, int precision, int adjust, char fmt, int always_sign TSRMLS_DC) { char num_buf[NUM_BUF_SIZE]; char *s = NULL; - int s_len = 0, is_negative = 0; + php_size_t s_len = 0; + int is_negative = 0; #ifdef HAVE_LOCALE_H struct lconv *lconv; #endif @@ -293,13 +290,13 @@ php_sprintf_appenddouble(zend_string **buffer, int *pos, /* php_spintf_appendd2n() {{{ */ inline static void -php_sprintf_append2n(zend_string **buffer, int *pos, long number, - int width, char padding, int alignment, int n, +php_sprintf_append2n(zend_string **buffer, php_size_t *pos, php_int_t number, + php_size_t width, char padding, php_size_t alignment, int n, char *chartable, int expprec) { char numbuf[NUM_BUF_SIZE]; - register unsigned long num; - register unsigned int i = NUM_BUF_SIZE - 1; + register php_uint_t num; + register php_uint_t i = NUM_BUF_SIZE - 1; register int andbits = (1 << n) - 1; PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n", @@ -307,7 +304,7 @@ php_sprintf_append2n(zend_string **buffer, int *pos, long number, chartable)); PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits)); - num = (unsigned long) number; + num = (php_uint_t) number; numbuf[i] = '\0'; do { @@ -324,11 +321,11 @@ php_sprintf_append2n(zend_string **buffer, int *pos, long number, /* php_spintf_getnumber() {{{ */ inline static int -php_sprintf_getnumber(char *buffer, int *pos) +php_sprintf_getnumber(char *buffer, php_size_t *pos) { char *endptr; - register long num = strtol(&buffer[*pos], &endptr, 10); - register int i = 0; + register php_int_t num = ZEND_STRTOI(&buffer[*pos], &endptr, 10); + register php_size_t i = 0; if (endptr != NULL) { i = (endptr - &buffer[*pos]); @@ -373,7 +370,8 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) { zval *newargs = NULL; zval *args, *z_format; - int argc, size = 240, inpos = 0, outpos = 0, temppos; + int argc; + php_size_t size = 240, inpos = 0, outpos = 0, temppos; int alignment, currarg, adjusting, argnum, width, precision; char *format, padding; zend_string *result; @@ -416,12 +414,12 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) } format = Z_STRVAL(args[format_offset]); - format_len = Z_STRLEN(args[format_offset]); + format_len = Z_STRSIZE(args[format_offset]); result = STR_ALLOC(size, 0); currarg = 1; - while (inpos < Z_STRLEN(args[format_offset])) { + while (inpos < Z_STRSIZE(args[format_offset])) { int expprec = 0; zval *tmp; @@ -569,14 +567,14 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) case 'd': php_sprintf_appendint(&result, &outpos, - zval_get_long(tmp), + zval_get_int(tmp), width, padding, alignment, always_sign); break; case 'u': php_sprintf_appenduint(&result, &outpos, - zval_get_long(tmp), + zval_get_int(tmp), width, padding, alignment); break; @@ -596,33 +594,33 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) case 'c': php_sprintf_appendchar(&result, &outpos, - (char) zval_get_long(tmp) TSRMLS_CC); + (char) zval_get_int(tmp) TSRMLS_CC); break; case 'o': php_sprintf_append2n(&result, &outpos, - zval_get_long(tmp), + zval_get_int(tmp), width, padding, alignment, 3, hexchars, expprec); break; case 'x': php_sprintf_append2n(&result, &outpos, - zval_get_long(tmp), + zval_get_int(tmp), width, padding, alignment, 4, hexchars, expprec); break; case 'X': php_sprintf_append2n(&result, &outpos, - zval_get_long(tmp), + zval_get_int(tmp), width, padding, alignment, 4, HEXCHARS, expprec); break; case 'b': php_sprintf_append2n(&result, &outpos, - zval_get_long(tmp), + zval_get_int(tmp), width, padding, alignment, 1, hexchars, expprec); break; @@ -680,14 +678,14 @@ PHP_FUNCTION(vsprintf) PHP_FUNCTION(user_printf) { zend_string *result; - int rlen; + php_size_t rlen; if ((result=php_formatted_print(ZEND_NUM_ARGS(), 0, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; } rlen = PHPWRITE(result->val, result->len); STR_FREE(result); - RETURN_LONG(rlen); + RETURN_INT(rlen); } /* }}} */ @@ -696,14 +694,14 @@ PHP_FUNCTION(user_printf) PHP_FUNCTION(vprintf) { zend_string *result; - int rlen; + php_size_t rlen; if ((result=php_formatted_print(ZEND_NUM_ARGS(), 1, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; } rlen = PHPWRITE(result->val, result->len); STR_FREE(result); - RETURN_LONG(rlen); + RETURN_INT(rlen); } /* }}} */ @@ -731,7 +729,7 @@ PHP_FUNCTION(fprintf) php_stream_write(stream, result->val, result->len); - RETVAL_LONG(result->len); + RETVAL_INT(result->len); STR_FREE(result); } /* }}} */ @@ -760,7 +758,7 @@ PHP_FUNCTION(vfprintf) php_stream_write(stream, result->val, result->len); - RETVAL_LONG(result->len); + RETVAL_INT(result->len); STR_FREE(result); } /* }}} */ diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 300df8c1c0..72f892b60b 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -33,30 +33,30 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) { char *host; int host_len; - long port = -1; + php_int_t port = -1; zval *zerrno = NULL, *zerrstr = NULL; double timeout = FG(default_socket_timeout); - unsigned long conv; + php_uint_t conv; struct timeval tv; char *hashkey = NULL; php_stream *stream = NULL; int err; char *hostname = NULL; - long hostname_len; + php_int_t hostname_len; zend_string *errstr = NULL; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|iz/z/d", &host, &host_len, &port, &zerrno, &zerrstr, &timeout) == FAILURE) { RETURN_FALSE; } if (persistent) { - spprintf(&hashkey, 0, "pfsockopen__%s:%ld", host, port); + spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_INT_FMT, host, port); } if (port > 0) { - hostname_len = spprintf(&hostname, 0, "%s:%ld", host, port); + hostname_len = spprintf(&hostname, 0, "%s:" ZEND_INT_FMT, host, port); } else { hostname_len = host_len; hostname = host; @@ -69,7 +69,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, 0); + ZVAL_INT(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -83,7 +83,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) efree(hostname); } if (stream == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:%ld (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:" ZEND_INT_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val); } if (hashkey) { @@ -93,7 +93,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZVAL_INT(zerrno, err); } if (zerrstr && errstr) { /* no need to dup; we need to efree buf anyway */ diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 4833bddc01..709d90840b 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -41,16 +41,16 @@ PHP_FUNCTION(ftok) if (pathname_len == 0){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Pathname is invalid"); - RETURN_LONG(-1); + RETURN_INT(-1); } if (proj_len != 1){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Project identifier is invalid"); - RETURN_LONG(-1); + RETURN_INT(-1); } if (php_check_open_basedir(pathname TSRMLS_CC)) { - RETURN_LONG(-1); + RETURN_INT(-1); } k = ftok(pathname, proj[0]); @@ -58,7 +58,7 @@ PHP_FUNCTION(ftok) php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno)); } - RETURN_LONG(k); + RETURN_INT(k); } /* }}} */ #endif diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 31b96fb68c..ae7f28b7da 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -498,7 +498,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa } else if (read_write == 2) { /* when writing file (but not appending), it must NOT exist, unless a context option exists which allows it */ if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "overwrite")) != NULL) { - allow_overwrite = Z_LVAL_P(tmpzval); + allow_overwrite = Z_IVAL_P(tmpzval); } if (result <= 299 && result >= 200) { if (allow_overwrite) { @@ -529,12 +529,12 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa /* set resume position if applicable */ if (context && (tmpzval = php_stream_context_get_option(context, "ftp", "resume_pos")) != NULL && - Z_TYPE_P(tmpzval) == IS_LONG && - Z_LVAL_P(tmpzval) > 0) { - php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_LVAL_P(tmpzval)); + Z_TYPE_P(tmpzval) == IS_INT && + Z_IVAL_P(tmpzval) > 0) { + php_stream_printf(stream TSRMLS_CC, "REST %ld\r\n", Z_IVAL_P(tmpzval)); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_LVAL_P(tmpzval)); + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %ld", Z_IVAL_P(tmpzval)); goto errexit; } } diff --git a/ext/standard/head.c b/ext/standard/head.c index ad82b9fbbf..928c26293e 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -41,7 +41,7 @@ PHP_FUNCTION(header) zend_bool rep = 1; sapi_header_line ctr = {0}; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &ctr.line, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bi", &ctr.line, &ctr.line_len, &rep, &ctr.response_code) == FAILURE) return; @@ -178,11 +178,11 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t PHP_FUNCTION(setcookie) { char *name, *value = NULL, *path = NULL, *domain = NULL; - long expires = 0; + php_int_t expires = 0; zend_bool secure = 0, httponly = 0; int name_len, value_len = 0, path_len = 0, domain_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name, &name_len, &value, &value_len, &expires, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { return; @@ -201,11 +201,11 @@ PHP_FUNCTION(setcookie) PHP_FUNCTION(setrawcookie) { char *name, *value = NULL, *path = NULL, *domain = NULL; - long expires = 0; + php_int_t expires = 0; zend_bool secure = 0, httponly = 0; int name_len, value_len = 0, path_len = 0, domain_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sissbb", &name, &name_len, &value, &value_len, &expires, &path, &path_len, &domain, &domain_len, &secure, &httponly) == FAILURE) { return; @@ -239,7 +239,7 @@ PHP_FUNCTION(headers_sent) switch(ZEND_NUM_ARGS()) { case 2: zval_dtor(arg2); - ZVAL_LONG(arg2, line); + ZVAL_INT(arg2, line); case 1: zval_dtor(arg1); if (file) { @@ -289,21 +289,21 @@ PHP_FUNCTION(headers_list) Sets a response code, or returns the current HTTP response code */ PHP_FUNCTION(http_response_code) { - long response_code = 0; + php_int_t response_code = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &response_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &response_code) == FAILURE) { return; } if (response_code) { - long old_response_code; + php_int_t old_response_code; old_response_code = SG(sapi_headers).http_response_code; SG(sapi_headers).http_response_code = response_code; if (old_response_code) { - RETURN_LONG(old_response_code); + RETURN_INT(old_response_code); } RETURN_TRUE; @@ -313,7 +313,7 @@ PHP_FUNCTION(http_response_code) RETURN_FALSE; } - RETURN_LONG(SG(sapi_headers).http_response_code); + RETURN_INT(SG(sapi_headers).http_response_code); } /* }}} */ diff --git a/ext/standard/html.c b/ext/standard/html.c index 360639ea76..7df76708a9 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -790,7 +790,7 @@ static inline int numeric_entity_is_allowed(unsigned uni_cp, int document_type) */ static inline int process_numeric_entity(const char **buf, unsigned *code_point) { - long code_l; + php_int_t code_l; int hexadecimal = (**buf == 'x' || **buf == 'X'); /* TODO: XML apparently disallows "X" */ char *endptr; @@ -804,7 +804,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point) return FAILURE; } - code_l = strtol(*buf, &endptr, hexadecimal ? 16 : 10); + code_l = ZEND_STRTOI(*buf, &endptr, hexadecimal ? 16 : 10); /* we're guaranteed there were valid digits, so *endptr > buf */ *buf = endptr; @@ -813,7 +813,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point) /* many more are invalid, but that depends on whether it's HTML * (and which version) or XML. */ - if (code_l > 0x10FFFFL) + if (code_l > Z_I(0x10FFFF)) return FAILURE; if (code_point != NULL) @@ -856,7 +856,7 @@ static inline int process_named_entity_html(const char **buf, const char **start static inline int resolve_named_entity_html(const char *start, size_t length, const entity_ht *ht, unsigned *uni_cp1, unsigned *uni_cp2) { const entity_cp_map *s; - ulong hash = zend_inline_hash_func(start, length); + php_uint_t hash = zend_inline_hash_func(start, length); s = ht->buckets[hash % ht->num_elems]; while (s->entity) { @@ -1442,30 +1442,30 @@ encode_amp: */ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { - char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; - long flags = ENT_COMPAT; + zend_string *str, *hint_charset = NULL; + char *default_charset; + php_int_t flags = ENT_COMPAT; zend_string *replaced; zend_bool double_encode = 1; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!b", &str, &str_len, &flags, &hint_charset, &hint_charset_len, &double_encode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS!b", &str, &flags, &hint_charset, &double_encode) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 4) - Z_PARAM_STRING(str, str_len) + Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_LONG(flags) - Z_PARAM_STRING_EX(hint_charset, hint_charset_len, 1, 0) + Z_PARAM_INT(flags) + Z_PARAM_STR_EX(hint_charset, 1, 0) Z_PARAM_BOOL(double_encode); ZEND_PARSE_PARAMETERS_END(); #endif if (!hint_charset) { - hint_charset = get_default_charset(TSRMLS_C); + default_charset = get_default_charset(TSRMLS_C); } - replaced = php_escape_html_entities_ex((unsigned char*)str, str_len, all, (int) flags, hint_charset, double_encode TSRMLS_CC); + replaced = php_escape_html_entities_ex((unsigned char*)str->val, str->len, all, (int) flags, (hint_charset ? hint_charset->val : default_charset), double_encode TSRMLS_CC); RETVAL_STR(replaced); } /* }}} */ @@ -1477,18 +1477,18 @@ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) */ void register_html_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_IGNORE", ENT_IGNORE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_SUBSTITUTE", ENT_SUBSTITUTE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_DISALLOWED", ENT_DISALLOWED, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_HTML401", ENT_HTML401, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_XML1", ENT_XML1, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_XHTML", ENT_XHTML, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("ENT_HTML5", ENT_HTML5, CONST_PERSISTENT|CONST_CS); } /* }}} */ @@ -1506,10 +1506,10 @@ PHP_FUNCTION(htmlspecialchars_decode) { char *str; int str_len; - long quote_style = ENT_COMPAT; + php_int_t quote_style = ENT_COMPAT; zend_string *replaced; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, "e_style) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, "e_style) == FAILURE) { return; } @@ -1525,30 +1525,30 @@ PHP_FUNCTION(htmlspecialchars_decode) Convert all HTML entities to their applicable characters */ PHP_FUNCTION(html_entity_decode) { - char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; + zend_string *str, *hint_charset = NULL; + char *default_charset; size_t new_len = 0; - long quote_style = ENT_COMPAT; + php_int_t quote_style = ENT_COMPAT; zend_string *replaced; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, - "e_style, &hint_charset, &hint_charset_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iS", &str, + "e_style, &hint_charset) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_STRING(str, str_len) + Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_LONG(quote_style) - Z_PARAM_STRING(hint_charset, hint_charset_len) + Z_PARAM_INT(quote_style) + Z_PARAM_STR(hint_charset) ZEND_PARSE_PARAMETERS_END(); #endif if (!hint_charset) { - hint_charset = get_default_charset(TSRMLS_C); + default_charset = get_default_charset(TSRMLS_C); } - replaced = php_unescape_html_entities((unsigned char*)str, str_len, 1 /*all*/, quote_style, hint_charset TSRMLS_CC); + replaced = php_unescape_html_entities((unsigned char*)str->val, str->len, 1 /*all*/, quote_style, (hint_charset ? hint_charset->val : default_charset) TSRMLS_CC); if (replaced) { RETURN_STR(replaced); @@ -1626,7 +1626,7 @@ static inline void write_s3row_data( Returns the internal translation table used by htmlspecialchars and htmlentities */ PHP_FUNCTION(get_html_translation_table) { - long all = HTML_SPECIALCHARS, + php_int_t all = HTML_SPECIALCHARS, flags = ENT_COMPAT; int doctype; entity_table_opt entity_table; @@ -1639,7 +1639,7 @@ PHP_FUNCTION(get_html_translation_table) * getting the translated table from data structures that are optimized for * random access, not traversal */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lls", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|iis", &all, &flags, &charset_hint, &charset_hint_len) == FAILURE) { return; } diff --git a/ext/standard/http.c b/ext/standard/http.c index 34b8e79389..d5eb78e417 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -35,7 +35,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, char *newprefix, *p; const char *prop_name; int arg_sep_len, newprefix_len, prop_len; - ulong idx; + php_uint_t idx; zval *zdata = NULL, copyzval; if (!ht) { @@ -178,19 +178,19 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, case IS_STRING: { zend_string *ekey; if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)); + ekey = php_raw_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata)); } else { - ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)); + ekey = php_url_encode(Z_STRVAL_P(zdata), Z_STRSIZE_P(zdata)); } smart_str_appendl(formstr, ekey->val, ekey->len); STR_FREE(ekey); } break; - case IS_LONG: + case IS_INT: { char *ekey; int ekey_len; - ekey_len = spprintf(&ekey, 0, "%ld", Z_LVAL_P(zdata)); + ekey_len = spprintf(&ekey, 0, "%ld", Z_IVAL_P(zdata)); smart_str_appendl(formstr, ekey, ekey_len); efree(ekey); } @@ -217,9 +217,9 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, ZVAL_DUP(©zval, zdata); convert_to_string_ex(©zval); if (enc_type == PHP_QUERY_RFC3986) { - ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval)); + ekey = php_raw_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval)); } else { - ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRLEN(copyzval)); + ekey = php_url_encode(Z_STRVAL(copyzval), Z_STRSIZE(copyzval)); } smart_str_appendl(formstr, ekey->val, ekey->len); zval_ptr_dtor(©zval); @@ -241,9 +241,9 @@ PHP_FUNCTION(http_build_query) char *prefix = NULL, *arg_sep=NULL; int arg_sep_len = 0, prefix_len = 0; smart_str formstr = {0}; - long enc_type = PHP_QUERY_RFC1738; + php_int_t enc_type = PHP_QUERY_RFC1738; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssl", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ssi", &formdata, &prefix, &prefix_len, &arg_sep, &arg_sep_len, &enc_type) != SUCCESS) { RETURN_FALSE; } diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 73952dda31..4359c34efa 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -160,7 +160,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (!context || (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) == NULL || Z_TYPE_P(tmpzval) != IS_STRING || - Z_STRLEN_P(tmpzval) <= 0) { + Z_STRSIZE_P(tmpzval) <= 0) { php_url_free(resource); return php_stream_open_wrapper_ex(path, mode, REPORT_ERRORS, NULL, context); } @@ -169,8 +169,8 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, use_ssl = 0; use_proxy = 1; - transport_len = Z_STRLEN_P(tmpzval); - transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + transport_len = Z_STRSIZE_P(tmpzval); + transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); } else { /* Normal http request (possibly with proxy) */ @@ -190,10 +190,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, if (context && (tmpzval = php_stream_context_get_option(context, wrapper->wops->label, "proxy")) != NULL && Z_TYPE_P(tmpzval) == IS_STRING && - Z_STRLEN_P(tmpzval) > 0) { + Z_STRSIZE_P(tmpzval) > 0) { use_proxy = 1; - transport_len = Z_STRLEN_P(tmpzval); - transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + transport_len = Z_STRSIZE_P(tmpzval); + transport_string = estrndup(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); } else { transport_len = spprintf(&transport_string, 0, "%s://%s:%d", use_ssl ? "ssl" : "tcp", resource->host, resource->port); } @@ -271,7 +271,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, } while (*s != 0); } } ZEND_HASH_FOREACH_END(); - } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) { + } else if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) { s = Z_STRVAL_P(tmpzval); do { while (*s == ' ' || *s == '\t') s++; @@ -346,20 +346,20 @@ finish: php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) { - redirect_max = zval_get_long(tmpzval); + redirect_max = zval_get_int(tmpzval); } if (context && (tmpzval = php_stream_context_get_option(context, "http", "method")) != NULL) { - if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) { + if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) { /* As per the RFC, automatically redirected requests MUST NOT use other methods than * GET and HEAD unless it can be confirmed by the user */ if (!redirected - || (Z_STRLEN_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0) - || (Z_STRLEN_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0) + || (Z_STRSIZE_P(tmpzval) == 3 && memcmp("GET", Z_STRVAL_P(tmpzval), 3) == 0) + || (Z_STRSIZE_P(tmpzval) == 4 && memcmp("HEAD",Z_STRVAL_P(tmpzval), 4) == 0) ) { - scratch_len = strlen(path) + 29 + Z_STRLEN_P(tmpzval); + scratch_len = strlen(path) + 29 + Z_STRSIZE_P(tmpzval); scratch = emalloc(scratch_len); - strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval) + 1); + strlcpy(scratch, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval) + 1); strncat(scratch, " ", 1); } } @@ -422,7 +422,7 @@ finish: ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmpzval), tmpheader) { if (Z_TYPE_P(tmpheader) == IS_STRING) { - smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRLEN_P(tmpheader)); + smart_str_appendl(&tmpstr, Z_STRVAL_P(tmpheader), Z_STRSIZE_P(tmpheader)); smart_str_appendl(&tmpstr, "\r\n", sizeof("\r\n") - 1); } } ZEND_HASH_FOREACH_END(); @@ -433,9 +433,9 @@ finish: smart_str_free(&tmpstr); } } - if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval)) { + if (Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ - tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); + tmp = php_trim(Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval), NULL, 0, NULL, 3 TSRMLS_CC); } if (tmp && strlen(tmp) > 0) { char *s; @@ -609,9 +609,9 @@ finish: context && !(have_header & HTTP_HEADER_CONTENT_LENGTH) && (tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL && - Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0 + Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0 ) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval)); php_stream_write(stream, scratch, scratch_len); have_header |= HTTP_HEADER_CONTENT_LENGTH; } @@ -624,9 +624,9 @@ finish: /* Request content, such as for POST requests */ if (header_init && context && (tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL && - Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) { + Z_TYPE_P(tmpzval) == IS_STRING && Z_STRSIZE_P(tmpzval) > 0) { if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) { - scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval)); + scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRSIZE_P(tmpzval)); php_stream_write(stream, scratch, scratch_len); } if (!(have_header & HTTP_HEADER_TYPE)) { @@ -635,7 +635,7 @@ finish: php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); } php_stream_write(stream, "\r\n", sizeof("\r\n")-1); - php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + php_stream_write(stream, Z_STRVAL_P(tmpzval), Z_STRSIZE_P(tmpzval)); } else { php_stream_write(stream, "\r\n", sizeof("\r\n")-1); } @@ -731,7 +731,7 @@ finish: if (!strncasecmp(http_header_line, "Location: ", 10)) { if (context && (tmpzval = php_stream_context_get_option(context, "http", "follow_location")) != NULL) { - follow_location = zval_get_long(tmpzval); + follow_location = zval_get_int(tmpzval); } else if (!(response_code >= 300 && response_code < 304 || 307 == response_code || 308 == response_code)) { /* we shouldn't redirect automatically if follow_location isn't set and response_code not in (300, 301, 302, 303 and 307) @@ -749,7 +749,7 @@ finish: /* create filter to decode response body */ if (!(options & STREAM_ONLY_GET_HEADERS)) { - long decode = 1; + php_int_t decode = 1; if (context && (tmpzval = php_stream_context_get_option(context, "http", "auto_decode")) != NULL) { decode = zend_is_true(tmpzval TSRMLS_CC); diff --git a/ext/standard/image.c b/ext/standard/image.c index 0ec4cd3885..24576fd671 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -72,28 +72,28 @@ struct gfxinfo { * Register IMAGETYPE_<xxx> constants used by GetImageSize(), image_type_to_mime_type, ext/exif */ PHP_MINIT_FUNCTION(imagetypes) { - REGISTER_LONG_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_GIF", IMAGE_FILETYPE_GIF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPEG", IMAGE_FILETYPE_JPEG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_PNG", IMAGE_FILETYPE_PNG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_SWF", IMAGE_FILETYPE_SWF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_PSD", IMAGE_FILETYPE_PSD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_BMP", IMAGE_FILETYPE_BMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_II", IMAGE_FILETYPE_TIFF_II, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_TIFF_MM", IMAGE_FILETYPE_TIFF_MM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPC", IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT); #if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) - REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT); #endif - REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ - REGISTER_LONG_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */ + REGISTER_INT_CONSTANT("IMAGETYPE_XBM", IMAGE_FILETYPE_XBM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_ICO", IMAGE_FILETYPE_ICO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_UNKNOWN", IMAGE_FILETYPE_UNKNOWN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("IMAGETYPE_COUNT", IMAGE_FILETYPE_COUNT, CONST_CS | CONST_PERSISTENT); return SUCCESS; } /* }}} */ @@ -1160,9 +1160,9 @@ PHPAPI char * php_image_type_to_mime_type(int image_type) Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ PHP_FUNCTION(image_type_to_mime_type) { - long p_image_type; + php_int_t p_image_type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &p_image_type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &p_image_type) == FAILURE) { return; } @@ -1174,10 +1174,10 @@ PHP_FUNCTION(image_type_to_mime_type) Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ PHP_FUNCTION(image_type_to_extension) { - long image_type; + php_int_t image_type; zend_bool inc_dot=1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &image_type, &inc_dot) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|b", &image_type, &inc_dot) == FAILURE) { RETURN_FALSE; } @@ -1364,19 +1364,19 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA } if (result) { - char temp[MAX_LENGTH_OF_LONG * 2 + sizeof("width=\"\" height=\"\"")]; + char temp[MAX_LENGTH_OF_ZEND_INT * 2 + sizeof("width=\"\" height=\"\"")]; array_init(return_value); - add_index_long(return_value, 0, result->width); - add_index_long(return_value, 1, result->height); - add_index_long(return_value, 2, itype); + add_index_int(return_value, 0, result->width); + add_index_int(return_value, 1, result->height); + add_index_int(return_value, 2, itype); snprintf(temp, sizeof(temp), "width=\"%d\" height=\"%d\"", result->width, result->height); add_index_string(return_value, 3, temp); if (result->bits != 0) { - add_assoc_long(return_value, "bits", result->bits); + add_assoc_int(return_value, "bits", result->bits); } if (result->channels != 0) { - add_assoc_long(return_value, "channels", result->channels); + add_assoc_int(return_value, "channels", result->channels); } add_assoc_string(return_value, "mime", (char*)php_image_type_to_mime_type(itype)); efree(result); diff --git a/ext/standard/info.c b/ext/standard/info.c index 47249466b0..07c183df8e 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -196,7 +196,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) { zval *data, *tmp, tmp2; zend_string *string_key; - ulong num_key; + php_uint_t num_key; zend_string *key; key = STR_INIT(name, name_length, 0); @@ -244,10 +244,10 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) } if (!sapi_module.phpinfo_as_text) { - if (Z_STRLEN(tmp2) == 0) { + if (Z_STRSIZE(tmp2) == 0) { php_info_print("<i>no value</i>"); } else { - php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRLEN(tmp2)); + php_info_print_html_esc(Z_STRVAL(tmp2), Z_STRSIZE(tmp2)); } } else { php_info_print(Z_STRVAL(tmp2)); @@ -1143,22 +1143,22 @@ PHPAPI void php_info_print_table_row_ex(int num_cols, const char *value_class, */ void register_phpinfo_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS); } /* }}} */ @@ -1166,9 +1166,9 @@ void register_phpinfo_constants(INIT_FUNC_ARGS) Output a page of useful information about PHP and the current request */ PHP_FUNCTION(phpinfo) { - long flag = PHP_INFO_ALL; + php_int_t flag = PHP_INFO_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) { return; } @@ -1210,9 +1210,9 @@ PHP_FUNCTION(phpversion) Prints the list of people who've contributed to the PHP project */ PHP_FUNCTION(phpcredits) { - long flag = PHP_CREDITS_ALL; + php_int_t flag = PHP_CREDITS_ALL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &flag) == FAILURE) { return; } diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index cea43dd8d3..9102b4b07a 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -179,7 +179,7 @@ PHP_FUNCTION(iptcembed) { char *iptcdata, *jpeg_file; int iptcdata_len, jpeg_file_len; - long spool = 0; + php_int_t spool = 0; FILE *fp; unsigned int marker, done = 0; int inx; @@ -187,7 +187,7 @@ PHP_FUNCTION(iptcembed) struct stat sb; zend_bool written = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|l", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sp|i", &iptcdata, &iptcdata_len, &jpeg_file, &jpeg_file_len, &spool) != SUCCESS) { return; } @@ -334,8 +334,8 @@ PHP_FUNCTION(iptcparse) if((inx+6) >= str_len) { break; } - len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) + - (((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ])); + len = (((php_int_t) buffer[ inx + 2 ]) << 24) + (((php_int_t) buffer[ inx + 3 ]) << 16) + + (((php_int_t) buffer[ inx + 4 ]) << 8) + (((php_int_t) buffer[ inx + 5 ])); inx += 6; } else { /* short tag */ len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ]; diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index 786ca052d7..232366e030 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -95,7 +95,7 @@ PHP_FUNCTION(levenshtein) char *str1, *str2; char *callback_name; int str1_len, str2_len, callback_len; - long cost_ins, cost_rep, cost_del; + php_int_t cost_ins, cost_rep, cost_del; int distance = -1; switch (argc) { @@ -107,7 +107,7 @@ PHP_FUNCTION(levenshtein) break; case 5: /* more general version: calc cost by ins/rep/del weights */ - if (zend_parse_parameters(5 TSRMLS_CC, "sslll", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) { + if (zend_parse_parameters(5 TSRMLS_CC, "ssiii", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) { return; } distance = reference_levdist(str1, str1_len, str2, str2_len, cost_ins, cost_rep, cost_del); @@ -128,7 +128,7 @@ PHP_FUNCTION(levenshtein) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument string(s) too long"); } - RETURN_LONG(distance); + RETURN_INT(distance); } /* }}} */ diff --git a/ext/standard/link.c b/ext/standard/link.c index 0f889a9e6a..4265823616 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -106,11 +106,11 @@ PHP_FUNCTION(linkinfo) if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); efree(dirname); - RETURN_LONG(-1L); + RETURN_INT(-1L); } efree(dirname); - RETURN_LONG((long) sb.st_dev); + RETURN_INT((long) sb.st_dev); } /* }}} */ diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index 41ce9d20df..8a04fb3f77 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -88,7 +88,7 @@ PHP_FUNCTION(linkinfo) { char *link; int link_len; - struct stat sb; + php_stat_t sb; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { @@ -98,10 +98,10 @@ PHP_FUNCTION(linkinfo) ret = VCWD_STAT(link, &sb); if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); - RETURN_LONG(-1L); + RETURN_INT(-1L); } - RETURN_LONG((long) sb.st_dev); + RETURN_INT((long) sb.st_dev); } /* }}} */ diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 815f83118f..1bd2fa9016 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -72,7 +72,7 @@ *p = ' '; \ } \ -extern long php_getuid(TSRMLS_D); +extern php_int_t php_getuid(TSRMLS_D); /* {{{ proto int ezmlm_hash(string addr) Calculate EZMLM list hash value. */ @@ -92,7 +92,7 @@ PHP_FUNCTION(ezmlm_hash) h = (h % 53); - RETURN_LONG((int) h); + RETURN_INT((int) h); } /* }}} */ diff --git a/ext/standard/math.c b/ext/standard/math.c index a392eb607c..267b8c0170 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -285,11 +285,11 @@ PHP_FUNCTION(abs) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(fabs(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_LONG) { - if (Z_LVAL_P(value) == LONG_MIN) { - RETURN_DOUBLE(-(double)LONG_MIN); + } else if (Z_TYPE_P(value) == IS_INT) { + if (Z_IVAL_P(value) == ZEND_INT_MIN) { + RETURN_DOUBLE(-(double)ZEND_INT_MIN); } else { - RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value)); + RETURN_INT(Z_IVAL_P(value) < 0 ? -Z_IVAL_P(value) : Z_IVAL_P(value)); } } RETURN_FALSE; @@ -309,7 +309,7 @@ PHP_FUNCTION(ceil) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(ceil(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_LONG) { + } else if (Z_TYPE_P(value) == IS_INT) { RETURN_DOUBLE(zval_get_double(value)); } RETURN_FALSE; @@ -329,7 +329,7 @@ PHP_FUNCTION(floor) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(floor(Z_DVAL_P(value))); - } else if (Z_TYPE_P(value) == IS_LONG) { + } else if (Z_TYPE_P(value) == IS_INT) { RETURN_DOUBLE(zval_get_double(value)); } RETURN_FALSE; @@ -342,11 +342,11 @@ PHP_FUNCTION(round) { zval *value; int places = 0; - long precision = 0; - long mode = PHP_ROUND_HALF_UP; + php_int_t precision = 0; + php_int_t mode = PHP_ROUND_HALF_UP; double return_val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &value, &precision, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ii", &value, &precision, &mode) == FAILURE) { return; } @@ -356,15 +356,15 @@ PHP_FUNCTION(round) convert_scalar_to_number_ex(value); switch (Z_TYPE_P(value)) { - case IS_LONG: + case IS_INT: /* Simple case - long that doesn't need to be rounded. */ if (places >= 0) { - RETURN_DOUBLE((double) Z_LVAL_P(value)); + RETURN_DOUBLE((double) Z_IVAL_P(value)); } /* break omitted intentionally */ case IS_DOUBLE: - return_val = (Z_TYPE_P(value) == IS_LONG) ? (double)Z_LVAL_P(value) : Z_DVAL_P(value); + return_val = (Z_TYPE_P(value) == IS_INT) ? (double)Z_IVAL_P(value) : Z_DVAL_P(value); return_val = _php_math_round(return_val, places, mode); RETURN_DOUBLE(return_val); break; @@ -926,9 +926,9 @@ PHP_FUNCTION(rad2deg) /* * Convert a string representation of a base(2-36) number to a long. */ -PHPAPI long _php_math_basetolong(zval *arg, int base) +PHPAPI php_int_t _php_math_basetolong(zval *arg, int base) { - long num = 0, digit, onum; + php_int_t num = 0, digit, onum; int i; char c, *s; @@ -938,7 +938,7 @@ PHPAPI long _php_math_basetolong(zval *arg, int base) s = Z_STRVAL_P(arg); - for (i = Z_STRLEN_P(arg); i > 0; i--) { + for (i = Z_STRSIZE_P(arg); i > 0; i--) { c = *s++; digit = (c >= '0' && c <= '9') ? c - '0' @@ -959,7 +959,7 @@ PHPAPI long _php_math_basetolong(zval *arg, int base) TSRMLS_FETCH(); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s); - return LONG_MAX; + return ZEND_INT_MAX; } } @@ -973,12 +973,12 @@ PHPAPI long _php_math_basetolong(zval *arg, int base) */ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) { - long num = 0; + php_int_t num = 0; double fnum = 0; int i; int mode = 0; char c, *s; - long cutoff; + php_int_t cutoff; int cutlim; if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { @@ -987,10 +987,10 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) s = Z_STRVAL_P(arg); - cutoff = LONG_MAX / base; - cutlim = LONG_MAX % base; + cutoff = ZEND_INT_MAX / base; + cutlim = ZEND_INT_MAX % base; - for (i = Z_STRLEN_P(arg); i > 0; i--) { + for (i = Z_STRSIZE_P(arg); i > 0; i--) { c = *s++; /* might not work for EBCDIC */ @@ -1024,7 +1024,7 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) if (mode == 1) { ZVAL_DOUBLE(ret, fnum); } else { - ZVAL_LONG(ret, num); + ZVAL_INT(ret, num); } return SUCCESS; } @@ -1038,15 +1038,15 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC) { static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - char buf[(sizeof(unsigned long) << 3) + 1]; + char buf[(sizeof(php_uint_t) << 3) + 1]; char *ptr, *end; - unsigned long value; + php_uint_t value; - if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) { + if (Z_TYPE_P(arg) != IS_INT || base < 2 || base > 36) { return STR_EMPTY_ALLOC(); } - value = Z_LVAL_P(arg); + value = Z_IVAL_P(arg); end = ptr = buf + sizeof(buf) - 1; *ptr = '\0'; @@ -1069,7 +1069,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC) { static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; - if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { + if ((Z_TYPE_P(arg) != IS_INT && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { return STR_EMPTY_ALLOC(); } @@ -1157,7 +1157,7 @@ PHP_FUNCTION(decbin) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { return; } - convert_to_long_ex(arg); + convert_to_int_ex(arg); result = _php_math_longtobase(arg, 2 TSRMLS_CC); RETURN_STR(result); } @@ -1173,7 +1173,7 @@ PHP_FUNCTION(decoct) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { return; } - convert_to_long_ex(arg); + convert_to_int_ex(arg); result = _php_math_longtobase(arg, 8 TSRMLS_CC); RETURN_STR(result); } @@ -1189,7 +1189,7 @@ PHP_FUNCTION(dechex) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) { return; } - convert_to_long_ex(arg); + convert_to_int_ex(arg); result = _php_math_longtobase(arg, 16 TSRMLS_CC); RETURN_STR(result); } @@ -1200,20 +1200,20 @@ PHP_FUNCTION(dechex) PHP_FUNCTION(base_convert) { zval *number, temp; - long frombase, tobase; + php_int_t frombase, tobase; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &number, &frombase, &tobase) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zii", &number, &frombase, &tobase) == FAILURE) { return; } convert_to_string_ex(number); if (frombase < 2 || frombase > 36) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `from base' (%ld)", frombase); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `from base' (%pd)", frombase); RETURN_FALSE; } if (tobase < 2 || tobase > 36) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `to base' (%ld)", tobase); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid `to base' (%pd)", tobase); RETURN_FALSE; } @@ -1350,20 +1350,20 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin PHP_FUNCTION(number_format) { double num; - long dec = 0; + php_int_t dec = 0; char *thousand_sep = NULL, *dec_point = NULL; char thousand_sep_chr = ',', dec_point_chr = '.'; int thousand_sep_len = 0, dec_point_len = 0; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|is!s!", &num, &dec, &dec_point, &dec_point_len, &thousand_sep, &thousand_sep_len) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_DOUBLE(num) Z_PARAM_OPTIONAL - Z_PARAM_LONG(dec) + Z_PARAM_INT(dec) Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0) Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0) ZEND_PARSE_PARAMETERS_END(); @@ -1422,22 +1422,22 @@ PHP_FUNCTION(fmod) Returns the integer division of the numerator by the divisor */ PHP_FUNCTION(intdiv) { - long numerator, divisor; + php_int_t numerator, divisor; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &numerator, &divisor) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ii", &numerator, &divisor) == FAILURE) { return; } if (divisor == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero"); RETURN_BOOL(0); - } else if (divisor == -1 && numerator == LONG_MIN) { + } else if (divisor == -1 && numerator == PHP_INT_MIN) { /* Prevent overflow error/crash We don't return a float here as that violates function contract */ - RETURN_LONG(0); + RETURN_INT(0); } - RETURN_LONG(numerator/divisor); + RETURN_INT(numerator/divisor); } /* }}} */ diff --git a/ext/standard/md5.c b/ext/standard/md5.c index d2545e913a..1a1b9d335b 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -46,20 +46,19 @@ PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len) / Calculate the md5 hash of a string */ PHP_NAMED_FUNCTION(php_if_md5) { - char *arg; - int arg_len; + zend_string *arg; zend_bool raw_output = 0; char md5str[33]; PHP_MD5_CTX context; unsigned char digest[16]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &arg, &raw_output) == FAILURE) { return; } md5str[0] = '\0'; PHP_MD5Init(&context); - PHP_MD5Update(&context, arg, arg_len); + PHP_MD5Update(&context, arg->val, arg->len); PHP_MD5Final(digest, &context); if (raw_output) { RETURN_STRINGL(digest, 16); @@ -82,7 +81,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file) unsigned char buf[1024]; unsigned char digest[16]; PHP_MD5_CTX context; - int n; + php_size_t n; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index 9d22868b8c..880f6c5103 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -25,23 +25,21 @@ #include "php.h" #include "php_metaphone.h" -static int metaphone(unsigned char *word, int word_len, long max_phonemes, zend_string **phoned_word, int traditional); +static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_phonemes, zend_string **phoned_word, int traditional); /* {{{ proto string metaphone(string text[, int phones]) Break english phrases down into their phonemes */ PHP_FUNCTION(metaphone) { - char *str; + zend_string *str; zend_string *result = NULL; - int str_len; - long phones = 0; + php_int_t phones = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, - &phones) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &str, &phones) == FAILURE) { return; } - if (metaphone((unsigned char *)str, str_len, phones, &result, 1) == 0) { + if (metaphone((unsigned char *)str->val, str->len, phones, &result, 1) == 0) { RETVAL_STR(result); } else { if (result) { @@ -167,11 +165,11 @@ static char Lookahead(char *word, int how_far) /* {{{ metaphone */ -static int metaphone(unsigned char *word, int word_len, long max_phonemes, zend_string **phoned_word, int traditional) +static int metaphone(unsigned char *word, php_size_t word_len, php_int_t max_phonemes, zend_string **phoned_word, int traditional) { int w_idx = 0; /* point in the phonization we're at. */ int p_idx = 0; /* end of the phoned phrase */ - int max_buffer_len = 0; /* maximum length of the destination buffer */ + php_size_t max_buffer_len = 0; /* maximum length of the destination buffer */ /*-- Parameter checks --*/ /* Negative phoneme length is meaningless */ diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index f8e19c74ca..58ecbdc881 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -73,11 +73,11 @@ static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode) offset = timelib_get_time_zone_info(tp.tv_sec, get_timezone_info(TSRMLS_C)); array_init(return_value); - add_assoc_long(return_value, "sec", tp.tv_sec); - add_assoc_long(return_value, "usec", tp.tv_usec); + add_assoc_int(return_value, "sec", tp.tv_sec); + add_assoc_int(return_value, "usec", tp.tv_usec); - add_assoc_long(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); - add_assoc_long(return_value, "dsttime", offset->is_dst); + add_assoc_int(return_value, "minuteswest", -offset->offset / SEC_IN_MIN); + add_assoc_int(return_value, "dsttime", offset->is_dst); timelib_time_offset_dtor(offset); } else { @@ -111,10 +111,10 @@ PHP_FUNCTION(gettimeofday) PHP_FUNCTION(getrusage) { struct rusage usg; - long pwho = 0; + php_int_t pwho = 0; int who = RUSAGE_SELF; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &pwho) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &pwho) == FAILURE) { return; } @@ -130,7 +130,7 @@ PHP_FUNCTION(getrusage) array_init(return_value); #define PHP_RUSAGE_PARA(a) \ - add_assoc_long(return_value, #a, usg.a) + add_assoc_int(return_value, #a, usg.a) #if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ PHP_RUSAGE_PARA(ru_oublock); PHP_RUSAGE_PARA(ru_inblock); diff --git a/ext/standard/pack.c b/ext/standard/pack.c index c77a1a40c6..613a58b5fd 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -84,13 +84,13 @@ static int little_endian_long_map[4]; /* {{{ php_pack */ -static void php_pack(zval *val, int size, int *map, char *output) +static void php_pack(zval *val, php_size_t size, int *map, char *output) { int i; char *v; - convert_to_long_ex(val); - v = (char *) &Z_LVAL_P(val); + convert_to_int_ex(val); + v = (char *) &Z_IVAL_P(val); for (i = 0; i < size; i++) { *output++ = v[map[i]]; @@ -126,7 +126,7 @@ PHP_FUNCTION(pack) convert_to_string_ex(&argv[0]); format = Z_STRVAL(argv[0]); - formatlen = Z_STRLEN(argv[0]); + formatlen = Z_STRSIZE(argv[0]); /* We have a maximum of <formatlen> format codes to deal with */ formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0); @@ -185,7 +185,7 @@ PHP_FUNCTION(pack) SEPARATE_ZVAL(&argv[currentarg]); } convert_to_string_ex(&argv[currentarg]); - arg = Z_STRLEN(argv[currentarg]); + arg = Z_STRSIZE(argv[currentarg]); if (code == 'Z') { /* add one because Z is always NUL-terminated: * pack("Z*", "aa") === "aa\0" @@ -480,9 +480,9 @@ PHP_FUNCTION(pack) /* {{{ php_unpack */ -static long php_unpack(char *data, int size, int issigned, int *map) +static php_int_t php_unpack(char *data, php_size_t size, int issigned, int *map) { - long result; + php_int_t result; char *cresult = (char *) &result; int i; @@ -512,19 +512,20 @@ static long php_unpack(char *data, int size, int issigned, int *map) Unpack binary string into named array elements according to format argument */ PHP_FUNCTION(unpack) { - char *format, *input, *formatarg, *inputarg; - int formatlen, formatarg_len, inputarg_len; - int inputpos, inputlen, i; + char *format, *input; + zend_string *formatarg, *inputarg; + php_size_t formatlen, inputpos, inputlen; + int i; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &formatarg, &formatarg_len, - &inputarg, &inputarg_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &formatarg, + &inputarg) == FAILURE) { return; } - format = formatarg; - formatlen = formatarg_len; - input = inputarg; - inputlen = inputarg_len; + format = formatarg->val; + formatlen = formatarg->len; + input = inputarg->val; + inputlen = inputarg->len; inputpos = 0; array_init(return_value); @@ -656,11 +657,11 @@ PHP_FUNCTION(unpack) inputpos = 0; } - if ((inputpos + size) <= inputlen) { + if ((size >=0 && (inputpos + size) <= inputlen) || (size < 0 && -size <= (inputlen - inputpos))) { switch ((int) type) { case 'a': { /* a will not strip any trailing whitespace or null padding */ - int len = inputlen - inputpos; /* Remaining string */ + php_size_t len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -675,7 +676,7 @@ PHP_FUNCTION(unpack) case 'A': { /* A will strip any trailing whitespace */ char padn = '\0'; char pads = ' '; char padt = '\t'; char padc = '\r'; char padl = '\n'; - int len = inputlen - inputpos; /* Remaining string */ + php_size_t len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -702,7 +703,7 @@ PHP_FUNCTION(unpack) case 'Z': { /* Z will strip everything after the first null character */ char pad = '\0'; - int s, + php_size_t s, len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ @@ -726,11 +727,11 @@ PHP_FUNCTION(unpack) case 'h': case 'H': { - int len = (inputlen - inputpos) * 2; /* Remaining */ + php_size_t len = (inputlen - inputpos) * 2; /* Remaining */ int nibbleshift = (type == 'h') ? 0 : 4; int first = 1; char *buf; - int ipos, opos; + php_size_t ipos, opos; /* If size was given take minimum of len and size */ if (size >= 0 && len > (size * 2)) { @@ -770,8 +771,8 @@ PHP_FUNCTION(unpack) case 'c': case 'C': { int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; - long v = php_unpack(&input[inputpos], 1, issigned, byte_map); - add_assoc_long(return_value, n, v); + php_int_t v = php_unpack(&input[inputpos], 1, issigned, byte_map); + add_assoc_int(return_value, n, v); break; } @@ -779,7 +780,7 @@ PHP_FUNCTION(unpack) case 'S': case 'n': case 'v': { - long v; + php_int_t v; int issigned = 0; int *map = machine_endian_short_map; @@ -792,13 +793,13 @@ PHP_FUNCTION(unpack) } v = php_unpack(&input[inputpos], 2, issigned, map); - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } case 'i': case 'I': { - long v; + php_int_t v; int issigned = 0; if (type == 'i') { @@ -806,7 +807,7 @@ PHP_FUNCTION(unpack) } v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map); - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } @@ -816,7 +817,7 @@ PHP_FUNCTION(unpack) case 'V': { int issigned = 0; int *map = machine_endian_long_map; - long v = 0; + php_int_t v = 0; if (type == 'l' || type == 'L') { issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80; @@ -828,19 +829,19 @@ PHP_FUNCTION(unpack) map = little_endian_long_map; } - if (sizeof(long) > 4 && issigned) { + if (SIZEOF_ZEND_INT > 4 && issigned) { v = ~INT_MAX; } v |= php_unpack(&input[inputpos], 4, issigned, map); - if (sizeof(long) > 4) { + if (SIZEOF_ZEND_INT > 4) { if (type == 'l') { v = (signed int) v; } else { v = (unsigned int) v; } } - add_assoc_long(return_value, n, v); + add_assoc_int(return_value, n, v); break; } @@ -903,8 +904,10 @@ PHP_FUNCTION(unpack) } } - formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */ - format++; + if (formatlen > 0) { + formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */ + format++; + } } } /* }}} */ @@ -948,8 +951,8 @@ PHP_MINIT_FUNCTION(pack) } else { zval val; - int size = sizeof(Z_LVAL(val)); - Z_LVAL(val)=0; /*silence a warning*/ + int size = sizeof(Z_IVAL(val)); + Z_IVAL(val)=0; /*silence a warning*/ /* Where to get hi to lo bytes from */ byte_map[0] = size - 1; diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index a9a4e58de0..7381100fab 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -59,7 +59,7 @@ */ PHPAPI void php_statpage(TSRMLS_D) { - struct stat *pstat; + php_stat_t *pstat; pstat = sapi_get_stat(TSRMLS_C); @@ -79,14 +79,14 @@ PHPAPI void php_statpage(TSRMLS_D) /* {{{ php_getuid */ -long php_getuid(TSRMLS_D) +php_int_t php_getuid(TSRMLS_D) { php_statpage(TSRMLS_C); return (BG(page_uid)); } /* }}} */ -long php_getgid(TSRMLS_D) +php_int_t php_getgid(TSRMLS_D) { php_statpage(TSRMLS_C); return (BG(page_gid)); @@ -96,7 +96,7 @@ long php_getgid(TSRMLS_D) Get PHP script owner's UID */ PHP_FUNCTION(getmyuid) { - long uid; + php_int_t uid; if (zend_parse_parameters_none() == FAILURE) { return; @@ -106,7 +106,7 @@ PHP_FUNCTION(getmyuid) if (uid < 0) { RETURN_FALSE; } else { - RETURN_LONG(uid); + RETURN_INT(uid); } } /* }}} */ @@ -115,7 +115,7 @@ PHP_FUNCTION(getmyuid) Get PHP script owner's GID */ PHP_FUNCTION(getmygid) { - long gid; + php_int_t gid; if (zend_parse_parameters_none() == FAILURE) { return; @@ -125,7 +125,7 @@ PHP_FUNCTION(getmygid) if (gid < 0) { RETURN_FALSE; } else { - RETURN_LONG(gid); + RETURN_INT(gid); } } /* }}} */ @@ -134,7 +134,7 @@ PHP_FUNCTION(getmygid) Get current process ID */ PHP_FUNCTION(getmypid) { - int pid; + php_int_t pid; if (zend_parse_parameters_none() == FAILURE) { return; @@ -144,7 +144,7 @@ PHP_FUNCTION(getmypid) if (pid < 0) { RETURN_FALSE; } else { - RETURN_LONG((long) pid); + RETURN_INT(pid); } } /* }}} */ @@ -161,12 +161,12 @@ PHP_FUNCTION(getmyinode) if (BG(page_inode) < 0) { RETURN_FALSE; } else { - RETURN_LONG(BG(page_inode)); + RETURN_INT(BG(page_inode)); } } /* }}} */ -PHPAPI long php_getlastmod(TSRMLS_D) +PHPAPI time_t php_getlastmod(TSRMLS_D) { php_statpage(TSRMLS_C); return BG(page_mtime); @@ -176,7 +176,7 @@ PHPAPI long php_getlastmod(TSRMLS_D) Get time of last page modification */ PHP_FUNCTION(getlastmod) { - long lm; + php_int_t lm; if (zend_parse_parameters_none() == FAILURE) { return; @@ -186,7 +186,7 @@ PHP_FUNCTION(getlastmod) if (lm < 0) { RETURN_FALSE; } else { - RETURN_LONG(lm); + RETURN_INT(lm); } } /* }}} */ diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h index c3c1846058..1dbe6ce1e6 100644 --- a/ext/standard/pageinfo.h +++ b/ext/standard/pageinfo.h @@ -28,8 +28,8 @@ PHP_FUNCTION(getmyinode); PHP_FUNCTION(getlastmod); PHPAPI void php_statpage(TSRMLS_D); -PHPAPI long php_getlastmod(TSRMLS_D); -extern long php_getuid(TSRMLS_D); -extern long php_getgid(TSRMLS_D); +PHPAPI time_t php_getlastmod(TSRMLS_D); +extern php_int_t php_getuid(TSRMLS_D); +extern php_int_t php_getgid(TSRMLS_D); #endif diff --git a/ext/standard/password.c b/ext/standard/password.c index aa50ab1f00..23e0ae4259 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -37,10 +37,10 @@ PHP_MINIT_FUNCTION(password) /* {{{ */ { - REGISTER_LONG_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PASSWORD_BCRYPT_DEFAULT_COST", PHP_PASSWORD_BCRYPT_COST, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -195,9 +195,9 @@ PHP_FUNCTION(password_get_info) switch (algo) { case PHP_PASSWORD_BCRYPT: { - long cost = PHP_PASSWORD_BCRYPT_COST; - sscanf(hash, "$2y$%ld$", &cost); - add_assoc_long(&options, "cost", cost); + php_int_t cost = PHP_PASSWORD_BCRYPT_COST; + sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost); + add_assoc_int(&options, "cost", cost); } break; case PHP_PASSWORD_UNKNOWN: @@ -207,21 +207,21 @@ PHP_FUNCTION(password_get_info) array_init(return_value); - add_assoc_long(return_value, "algo", algo); + add_assoc_int(return_value, "algo", algo); add_assoc_string(return_value, "algoName", algo_name); add_assoc_zval(return_value, "options", &options); } PHP_FUNCTION(password_needs_rehash) { - long new_algo = 0; + php_int_t new_algo = 0; php_password_algo algo; int hash_len; char *hash; HashTable *options = 0; zval *option_buffer; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &hash, &hash_len, &new_algo, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &hash, &hash_len, &new_algo, &options) == FAILURE) { return; } @@ -239,21 +239,21 @@ PHP_FUNCTION(password_needs_rehash) switch (algo) { case PHP_PASSWORD_BCRYPT: { - long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0; + php_int_t new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0; if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_LONG) { + if (Z_TYPE_P(option_buffer) != IS_INT) { zval cast_option_buffer; ZVAL_DUP(&cast_option_buffer, option_buffer); - convert_to_long(&cast_option_buffer); - new_cost = Z_LVAL(cast_option_buffer); + convert_to_int(&cast_option_buffer); + new_cost = Z_IVAL(cast_option_buffer); zval_dtor(&cast_option_buffer); } else { - new_cost = Z_LVAL_P(option_buffer); + new_cost = Z_IVAL_P(option_buffer); } } - sscanf(hash, "$2y$%ld$", &cost); + sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost); if (cost != new_cost) { RETURN_TRUE; } @@ -307,36 +307,36 @@ Hash a password */ PHP_FUNCTION(password_hash) { char *hash_format, *hash, *salt, *password; - long algo = 0; + php_int_t algo = 0; int password_len = 0, hash_len; size_t salt_len = 0, required_salt_len = 0, hash_format_len; HashTable *options = 0; zval *option_buffer; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|H", &password, &password_len, &algo, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si|H", &password, &password_len, &algo, &options) == FAILURE) { return; } switch (algo) { case PHP_PASSWORD_BCRYPT: { - long cost = PHP_PASSWORD_BCRYPT_COST; + php_int_t cost = PHP_PASSWORD_BCRYPT_COST; if (options && (option_buffer = zend_symtable_str_find(options, "cost", sizeof("cost")-1)) != NULL) { - if (Z_TYPE_P(option_buffer) != IS_LONG) { + if (Z_TYPE_P(option_buffer) != IS_INT) { zval cast_option_buffer; ZVAL_DUP(&cast_option_buffer, option_buffer); - convert_to_long(&cast_option_buffer); - cost = Z_LVAL(cast_option_buffer); + convert_to_int(&cast_option_buffer); + cost = Z_IVAL(cast_option_buffer); zval_dtor(&cast_option_buffer); } else { - cost = Z_LVAL_P(option_buffer); + cost = Z_IVAL_P(option_buffer); } } if (cost < 4 || cost > 31) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: %ld", cost); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_INT_FMT, cost); RETURN_NULL(); } @@ -348,7 +348,7 @@ PHP_FUNCTION(password_hash) break; case PHP_PASSWORD_UNKNOWN: default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: %ld", algo); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: " ZEND_INT_FMT, algo); RETURN_NULL(); } @@ -358,10 +358,10 @@ PHP_FUNCTION(password_hash) size_t buffer_len; switch (Z_TYPE_P(option_buffer)) { case IS_STRING: - buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRLEN_P(option_buffer)); - buffer_len_int = Z_STRLEN_P(option_buffer); + buffer = estrndup(Z_STRVAL_P(option_buffer), Z_STRSIZE_P(option_buffer)); + buffer_len_int = Z_STRSIZE_P(option_buffer); break; - case IS_LONG: + case IS_INT: case IS_DOUBLE: case IS_OBJECT: { zval cast_option_buffer; @@ -369,8 +369,8 @@ PHP_FUNCTION(password_hash) ZVAL_DUP(&cast_option_buffer, option_buffer); convert_to_string(&cast_option_buffer); if (Z_TYPE(cast_option_buffer) == IS_STRING) { - buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRLEN(cast_option_buffer)); - buffer_len_int = Z_STRLEN(cast_option_buffer); + buffer = estrndup(Z_STRVAL(cast_option_buffer), Z_STRSIZE(cast_option_buffer)); + buffer_len_int = Z_STRSIZE(cast_option_buffer); zval_dtor(&cast_option_buffer); break; } diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index d123ddfe41..2154e603fa 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -107,7 +107,7 @@ PHPAPI HashTable* php_splice(HashTable *, int, int, zval *, int, HashTable *); PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC); PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src TSRMLS_DC); PHPAPI int php_multisort_compare(const void *a, const void *b TSRMLS_DC); -PHPAPI int php_count_recursive(zval *array, long mode TSRMLS_DC); +PHPAPI php_int_t php_count_recursive(zval *array, php_int_t mode TSRMLS_DC); #define PHP_SORT_REGULAR 0 #define PHP_SORT_NUMERIC 1 diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 9628c0d69d..bf4a62ff2b 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -65,7 +65,7 @@ php_stream_ops php_stream_output_ops = { typedef struct php_stream_input { /* {{{ */ php_stream *body; - off_t position; + zend_off_t position; } php_stream_input_t; /* }}} */ @@ -118,7 +118,7 @@ static int php_stream_input_flush(php_stream *stream TSRMLS_DC) /* {{{ */ } /* }}} */ -static int php_stream_input_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) /* {{{ */ +static int php_stream_input_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */ { php_stream_input_t *input = stream->abstract; @@ -178,7 +178,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa int mode_rw = 0; php_stream * stream = NULL; char *p, *token, *pathdup; - long max_memory; + php_int_t max_memory; FILE *file = NULL; if (!strncasecmp(path, "php://", 6)) { @@ -190,7 +190,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa max_memory = PHP_STREAM_MAX_MEM; if (!strncasecmp(path, "/maxmemory:", 11)) { path += 11; - max_memory = strtol(path, NULL, 10); + max_memory = ZEND_STRTOI(path, NULL, 10); if (max_memory < 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Max memory must be >= 0"); return NULL; @@ -286,7 +286,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa } else if (!strncasecmp(path, "fd/", 3)) { const char *start; char *end; - long fildes_ori; + php_int_t fildes_ori; int dtablesize; if (strcmp(sapi_module.name, "cli")) { @@ -304,7 +304,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa } start = &path[3]; - fildes_ori = strtol(start, &end, 10); + fildes_ori = ZEND_STRTOI(start, &end, 10); if (end == start || *end != '\0') { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "php://fd/ stream must be specified in the form php://fd/<orig fd>"); @@ -326,7 +326,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa fd = dup(fildes_ori); if (fd == -1) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, - "Error duping file descriptor %ld; possibly it doesn't exist: " + "Error duping file descriptor " ZEND_INT_FMT "; possibly it doesn't exist: " "[%d]: %s", fildes_ori, errno, strerror(errno)); return NULL; } @@ -380,9 +380,9 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa #if defined(S_IFSOCK) && !defined(WIN32) && !defined(__BEOS__) do { - struct stat st; + php_stat_t st; memset(&st, 0, sizeof(st)); - if (fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { + if (php_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { stream = php_stream_sock_open_from_socket(fd, NULL); if (stream) { stream->ops = &php_stream_socket_ops; diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h index a2dca282c5..f8be7da42c 100644 --- a/ext/standard/php_math.h +++ b/ext/standard/php_math.h @@ -25,7 +25,7 @@ PHPAPI zend_string *_php_math_number_format(double, int, char, char); PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t); PHPAPI zend_string * _php_math_longtobase(zval *arg, int base TSRMLS_DC); -PHPAPI long _php_math_basetolong(zval *arg, int base); +PHPAPI php_int_t _php_math_basetolong(zval *arg, int base); PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret); PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC); diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index 0e8abb3613..dd41c57d88 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -42,19 +42,19 @@ #endif #define RAND_RANGE(__n, __min, __max, __tmax) \ - (__n) = (__min) + (long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) + (__n) = (__min) + (php_int_t) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) /* MT Rand */ -#define PHP_MT_RAND_MAX ((long) (0x7FFFFFFF)) /* (1<<31) - 1 */ +#define PHP_MT_RAND_MAX ((php_int_t) (0x7FFFFFFF)) /* (1<<31) - 1 */ #ifdef PHP_WIN32 -#define GENERATE_SEED() (((long) (time(0) * GetCurrentProcessId())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C)))) +#define GENERATE_SEED() (((php_int_t) (time(0) * GetCurrentProcessId())) ^ ((php_int_t) (1000000.0 * php_combined_lcg(TSRMLS_C)))) #else -#define GENERATE_SEED() (((long) (time(0) * getpid())) ^ ((long) (1000000.0 * php_combined_lcg(TSRMLS_C)))) +#define GENERATE_SEED() (((php_int_t) (time(0) * getpid())) ^ ((php_int_t) (1000000.0 * php_combined_lcg(TSRMLS_C)))) #endif -PHPAPI void php_srand(long seed TSRMLS_DC); -PHPAPI long php_rand(TSRMLS_D); +PHPAPI void php_srand(php_int_t seed TSRMLS_DC); +PHPAPI php_int_t php_rand(TSRMLS_D); PHPAPI void php_mt_srand(php_uint32 seed TSRMLS_DC); PHPAPI php_uint32 php_mt_rand(TSRMLS_D); diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h index 71bcf0b223..f4913f7b99 100644 --- a/ext/standard/php_smart_str.h +++ b/ext/standard/php_smart_str.h @@ -91,8 +91,8 @@ smart_str_appendl_ex((dest), (src), (len), 0) #define smart_str_append(dest, src) \ smart_str_append_ex((dest), (src), 0) -#define smart_str_append_long(dest, val) \ - smart_str_append_long_ex((dest), (val), 0) +#define smart_str_append_int(dest, val) \ + smart_str_append_int_ex((dest), (val), 0) #define smart_str_append_off_t(dest, val) \ smart_str_append_off_t_ex((dest), (val), 0) #define smart_str_append_unsigned(dest, val) \ @@ -130,15 +130,15 @@ * #define f(..) ({char *r;..;__r;}) */ -static inline char *smart_str_print_long(char *buf, long num) { +static inline char *smart_str_print_long(char *buf, zend_int_t num) { char *r; - _zend_print_signed_to_buf(buf, num, long, r); + _zend_print_signed_to_buf(buf, num, zend_int_t, r); return r; } -static inline char *smart_str_print_unsigned(char *buf, long num) { +static inline char *smart_str_print_unsigned(char *buf, zend_int_t num) { char *r; - _zend_print_unsigned_to_buf(buf, num, unsigned long, r); + _zend_print_unsigned_to_buf(buf, num, zend_uint_t, r); return r; } @@ -150,13 +150,13 @@ static inline char *smart_str_print_unsigned(char *buf, long num) { } while (0) #define smart_str_append_unsigned_ex(dest, num, type) \ - smart_str_append_generic_ex((dest), (num), (type), unsigned long, _unsigned) + smart_str_append_generic_ex((dest), (num), (type), zend_uint_t, _unsigned) -#define smart_str_append_long_ex(dest, num, type) \ - smart_str_append_generic_ex((dest), (num), (type), unsigned long, _signed) +#define smart_str_append_int_ex(dest, num, type) \ + smart_str_append_generic_ex((dest), (num), (type), zend_uint_t, _signed) #define smart_str_append_off_t_ex(dest, num, type) \ - smart_str_append_generic_ex((dest), (num), (type), off_t, _signed) + smart_str_append_generic_ex((dest), (num), (type), zend_off_t, _signed) #define smart_str_append_ex(dest, src, what) \ smart_str_appendl_ex((dest), ((smart_str *)(src))->s->val, \ diff --git a/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h index 02ba9fe84e..83d59054dd 100644 --- a/ext/standard/php_smart_string.h +++ b/ext/standard/php_smart_string.h @@ -119,13 +119,13 @@ __dest->len = __nl; \ } while (0) -static inline char *smart_string_print_long(char *buf, long num) { +static inline char *smart_string_print_long(char *buf, php_int_t num) { char *r; _zend_print_signed_to_buf(buf, num, unsigned long, r); return r; } -static inline char *smart_string_print_unsigned(char *buf, long num) { +static inline char *smart_string_print_unsigned(char *buf, php_int_t num) { char *r; _zend_print_unsigned_to_buf(buf, num, unsigned long, r); return r; diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 0f4240ea57..325467d534 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -120,25 +120,25 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out); PHPAPI char *php_strtoupper(char *s, size_t len); PHPAPI char *php_strtolower(char *s, size_t len); -PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); -PHPAPI zend_string *php_addslashes(char *str, int length, int should_free TSRMLS_DC); -PHPAPI zend_string *php_addcslashes(const char *str, int length, int freeit, char *what, int wlength TSRMLS_DC); -PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); -PHPAPI void php_stripcslashes(char *str, int *len); +PHPAPI char *php_strtr(char *str, php_size_t len, char *str_from, char *str_to, php_size_t trlen); +PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free TSRMLS_DC); +PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int freeit, char *what, php_size_t wlength TSRMLS_DC); +PHPAPI void php_stripslashes(char *str, php_size_t *len TSRMLS_DC); +PHPAPI void php_stripcslashes(char *str, php_size_t *len); PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t sufflen TSRMLS_DC); PHPAPI size_t php_dirname(char *str, size_t len); PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len); -PHPAPI zend_string *php_str_to_str_ex(char *haystack, int length, char *needle, - int needle_len, char *str, int str_len, int case_sensitivity, int *replace_count); -PHPAPI zend_string *php_str_to_str(char *haystack, int length, char *needle, - int needle_len, char *str, int str_len); -PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC); -PHPAPI size_t php_strip_tags(char *rbuf, int len, int *state, char *allow, int allow_len); -PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, int allow_len, zend_bool allow_tag_spaces); -PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count); -PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result); +PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, char *needle, + php_size_t needle_len, char *str, php_size_t str_len, int case_sensitivity, php_size_t *replace_count); +PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *needle, + php_size_t needle_len, char *str, php_size_t str_len); +PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC); +PHPAPI size_t php_strip_tags(char *rbuf, php_size_t len, int *state, char *allow, php_size_t allow_len); +PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len, zend_bool allow_tag_spaces); +PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count); +PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result); PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC); -PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit); +PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t limit); PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h index fedfe660e9..670fa3f63e 100644 --- a/ext/standard/php_uuencode.h +++ b/ext/standard/php_uuencode.h @@ -24,8 +24,8 @@ PHP_FUNCTION(convert_uudecode); PHP_FUNCTION(convert_uuencode); -PHPAPI zend_string *php_uudecode(char *src, int src_len); -PHPAPI zend_string *php_uuencode(char *src, int src_len); +PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len); +PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len); #endif /* PHP_UUENCODE_H */ diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index dea8c16c07..903b3a7be1 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -260,9 +260,9 @@ PHP_FUNCTION(proc_terminate) { zval *zproc; struct php_process_handle *proc; - long sig_no = SIGTERM; + php_int_t sig_no = SIGTERM; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zproc, &sig_no) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &zproc, &sig_no) == FAILURE) { RETURN_FALSE; } @@ -300,7 +300,7 @@ PHP_FUNCTION(proc_close) FG(pclose_wait) = 1; zend_list_close(Z_RES_P(zproc)); FG(pclose_wait) = 0; - RETURN_LONG(FG(pclose_ret)); + RETURN_INT(FG(pclose_ret)); } /* }}} */ @@ -328,7 +328,7 @@ PHP_FUNCTION(proc_get_status) array_init(return_value); add_assoc_string(return_value, "command", proc->command); - add_assoc_long(return_value, "pid", (long) proc->child); + add_assoc_int(return_value, "pid", (php_int_t) proc->child); #ifdef PHP_WIN32 @@ -368,9 +368,9 @@ PHP_FUNCTION(proc_get_status) add_assoc_bool(return_value, "running", running); add_assoc_bool(return_value, "signaled", signaled); add_assoc_bool(return_value, "stopped", stopped); - add_assoc_long(return_value, "exitcode", exitcode); - add_assoc_long(return_value, "termsig", termsig); - add_assoc_long(return_value, "stopsig", stopsig); + add_assoc_int(return_value, "exitcode", exitcode); + add_assoc_int(return_value, "termsig", termsig); + add_assoc_int(return_value, "stopsig", stopsig); } /* }}} */ @@ -427,7 +427,7 @@ PHP_FUNCTION(proc_open) int i; zval *descitem = NULL; zend_string *str_index; - ulong nindex; + php_uint_t nindex; struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS]; #ifdef PHP_WIN32 PROCESS_INFORMATION pi; @@ -471,14 +471,14 @@ PHP_FUNCTION(proc_open) if (other_options) { zval *item = zend_hash_str_find(Z_ARRVAL_P(other_options), "suppress_errors", sizeof("suppress_errors") - 1); if (item != NULL) { - if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) { + if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) { suppress_errors = 1; } } item = zend_hash_str_find(Z_ARRVAL_P(other_options), "bypass_shell", sizeof("bypass_shell") - 1); if (item != NULL) { - if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) { + if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_INT) && Z_IVAL_P(item))) { bypass_shell = 1; } } @@ -584,7 +584,7 @@ PHP_FUNCTION(proc_open) #endif descriptors[ndesc].mode_flags = descriptors[ndesc].mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; #ifdef PHP_WIN32 - if (Z_STRLEN_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b') + if (Z_STRSIZE_P(zmode) >= 2 && Z_STRVAL_P(zmode)[1] == 'b') descriptors[ndesc].mode_flags |= O_BINARY; #endif diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index aa3d256c3a..1d13d56678 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -147,7 +147,7 @@ PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t lengt PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t length) /* {{{ */ { - unsigned long lp = 0; + php_uint_t lp = 0; unsigned char c, *d; char *hex = "0123456789ABCDEF"; zend_string *ret; @@ -201,21 +201,22 @@ PHPAPI zend_string *php_quot_print_encode(const unsigned char *str, size_t lengt Convert a quoted-printable string to an 8 bit string */ PHP_FUNCTION(quoted_printable_decode) { - char *arg1, *str_in; + zend_string *arg1; + char *str_in; zend_string *str_out; - int arg1_len, i = 0, j = 0, k; + php_size_t i = 0, j = 0, k; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg1, &arg1_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg1) == FAILURE) { return; } - if (arg1_len == 0) { + if (arg1->len == 0) { /* shortcut */ RETURN_EMPTY_STRING(); } - str_in = arg1; - str_out = STR_ALLOC(arg1_len, 0); + str_in = arg1->val; + str_out = STR_ALLOC(arg1->len, 0); while (str_in[i]) { switch (str_in[i]) { case '=': @@ -263,19 +264,18 @@ PHP_FUNCTION(quoted_printable_decode) /* {{{ proto string quoted_printable_encode(string str) */ PHP_FUNCTION(quoted_printable_encode) { - char *str; + zend_string *str; zend_string *new_str; - int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) != SUCCESS) { return; } - if (!str_len) { + if (!str->len) { RETURN_EMPTY_STRING(); } - new_str = php_quot_print_encode((unsigned char *)str, (size_t)str_len); + new_str = php_quot_print_encode((unsigned char *)str->val, (size_t)str->len); RETURN_STR(new_str); } /* }}} */ diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 702fec2311..972f015948 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -38,7 +38,7 @@ /* {{{ php_srand */ -PHPAPI void php_srand(long seed TSRMLS_DC) +PHPAPI void php_srand(php_int_t seed TSRMLS_DC) { #ifdef ZTS BG(rand_seed) = (unsigned int) seed; @@ -59,9 +59,9 @@ PHPAPI void php_srand(long seed TSRMLS_DC) /* {{{ php_rand */ -PHPAPI long php_rand(TSRMLS_D) +PHPAPI php_int_t php_rand(TSRMLS_D) { - long ret; + php_int_t ret; if (!BG(rand_is_seeded)) { php_srand(GENERATE_SEED() TSRMLS_CC); @@ -229,9 +229,9 @@ PHPAPI php_uint32 php_mt_rand(TSRMLS_D) Seeds random number generator */ PHP_FUNCTION(srand) { - long seed = 0; + php_int_t seed = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &seed) == FAILURE) return; if (ZEND_NUM_ARGS() == 0) @@ -245,9 +245,9 @@ PHP_FUNCTION(srand) Seeds Mersenne Twister random number generator */ PHP_FUNCTION(mt_srand) { - long seed = 0; + php_int_t seed = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|i", &seed) == FAILURE) return; if (ZEND_NUM_ARGS() == 0) @@ -288,12 +288,12 @@ PHP_FUNCTION(mt_srand) Returns a random number */ PHP_FUNCTION(rand) { - long min; - long max; - long number; + php_int_t min; + php_int_t max; + php_int_t number; int argc = ZEND_NUM_ARGS(); - if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) + if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ii", &min, &max) == FAILURE) return; number = php_rand(TSRMLS_C); @@ -301,7 +301,7 @@ PHP_FUNCTION(rand) RAND_RANGE(number, min, max, PHP_RAND_MAX); } - RETURN_LONG(number); + RETURN_INT(number); } /* }}} */ @@ -309,16 +309,16 @@ PHP_FUNCTION(rand) Returns a random number from Mersenne Twister */ PHP_FUNCTION(mt_rand) { - long min; - long max; - long number; + php_int_t min; + php_int_t max; + php_int_t number; int argc = ZEND_NUM_ARGS(); if (argc != 0) { - if (zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ii", &min, &max) == FAILURE) { return; } else if (max < min) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(%ld) is smaller than min(%ld)", max, min); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(" ZEND_INT_FMT ") is smaller than min(" ZEND_INT_FMT ")", max, min); RETURN_FALSE; } } @@ -335,12 +335,12 @@ PHP_FUNCTION(mt_rand) * Update: * I talked with Cokus via email and it won't ruin the algorithm */ - number = (long) (php_mt_rand(TSRMLS_C) >> 1); + number = (php_int_t) (php_mt_rand(TSRMLS_C) >> 1); if (argc == 2) { RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); } - RETURN_LONG(number); + RETURN_INT(number); } /* }}} */ @@ -352,7 +352,7 @@ PHP_FUNCTION(getrandmax) return; } - RETURN_LONG(PHP_RAND_MAX); + RETURN_INT(PHP_RAND_MAX); } /* }}} */ @@ -368,7 +368,7 @@ PHP_FUNCTION(mt_getrandmax) * Melo: it could be 2^^32 but we only use 2^^31 to maintain * compatibility with the previous php_rand */ - RETURN_LONG(PHP_MT_RAND_MAX); /* 2^^31 */ + RETURN_INT(PHP_MT_RAND_MAX); /* 2^^31 */ } /* }}} */ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index f5f97161f2..815d7c7290 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -356,7 +356,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) * must not be a mixture of XPG3 specs and non-XPG3 specs * in the same format string. */ - value = strtoul(format-1, &end, 10); + value = ZEND_STRTOUI(format-1, &end, 10); if (*end != '$') { goto notXpg; } @@ -403,7 +403,7 @@ xpgCheckDone: * Parse any width specifier. */ if (isdigit(UCHAR(*ch))) { - value = strtoul(format-1, &format, 10); + value = ZEND_STRTOUI(format-1, &format, 10); flags |= SCAN_WIDTH; ch = format++; } @@ -582,7 +582,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, { int numVars, nconversions, totalVars = -1; int i, result; - long value; + php_int_t value; int objIndex; char *end, *baseString; zval *current; @@ -590,7 +590,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, int base = 0; int underflow = 0; size_t width; - long (*fn)() = NULL; + php_int_t (*fn)() = NULL; char *ch, sch; int flags; char buf[64]; /* Temporary buffer to hold scanned number @@ -708,7 +708,7 @@ literal: flags |= SCAN_SUPPRESS; ch = format++; } else if ( isdigit(UCHAR(*ch))) { - value = strtoul(format-1, &end, 10); + value = ZEND_STRTOUI(format-1, &end, 10); if (*end == '$') { format = end+1; ch = format++; @@ -720,7 +720,7 @@ literal: * Parse any width specifier. */ if ( isdigit(UCHAR(*ch))) { - width = strtoul(format-1, &format, 10); + width = ZEND_STRTOUI(format-1, &format, 10); ch = format++; } else { width = 0; @@ -744,9 +744,9 @@ literal: } else if (numVars) { current = Z_REFVAL(args[objIndex++]); zval_ptr_dtor(current); - ZVAL_LONG(current, (long)(string - baseString) ); + ZVAL_INT(current, (php_int_t)(string - baseString) ); } else { - add_index_long(return_value, objIndex++, string - baseString); + add_index_int(return_value, objIndex++, string - baseString); } } nconversions++; @@ -756,29 +756,29 @@ literal: case 'D': op = 'i'; base = 10; - fn = (long (*)())strtol; + fn = (php_int_t (*)())ZEND_STRTOI_PTR; break; case 'i': op = 'i'; base = 0; - fn = (long (*)())strtol; + fn = (php_int_t (*)())ZEND_STRTOI_PTR; break; case 'o': op = 'i'; base = 8; - fn = (long (*)())strtol; + fn = (php_int_t (*)())ZEND_STRTOI_PTR; break; case 'x': case 'X': op = 'i'; base = 16; - fn = (long (*)())strtol; + fn = (php_int_t (*)())ZEND_STRTOI_PTR; break; case 'u': op = 'i'; base = 10; flags |= SCAN_UNSIGNED; - fn = (long (*)())strtoul; + fn = (php_int_t (*)())ZEND_STRTOUI_PTR; break; case 'f': @@ -1049,9 +1049,9 @@ addToInt: */ if (!(flags & SCAN_SUPPRESS)) { *end = '\0'; - value = (long) (*fn)(buf, NULL, base); + value = (php_int_t) (*fn)(buf, NULL, base); if ((flags & SCAN_UNSIGNED) && (value < 0)) { - snprintf(buf, sizeof(buf), "%lu", value); /* INTL: ISO digit */ + snprintf(buf, sizeof(buf), ZEND_UINT_FMT, value); /* INTL: ISO digit */ if (numVars && objIndex >= argCount) { break; } else if (numVars) { @@ -1068,9 +1068,9 @@ addToInt: } else if (numVars) { current = Z_REFVAL(args[objIndex++]); zval_ptr_dtor(current); - ZVAL_LONG(current, value); + ZVAL_INT(current, value); } else { - add_index_long(return_value, objIndex++, value); + add_index_int(return_value, objIndex++, value); } } } @@ -1190,8 +1190,8 @@ done: scan_set_error_return( numVars, return_value ); result = SCAN_ERROR_EOF; } else if (numVars) { - convert_to_long(return_value ); - Z_LVAL_P(return_value) = nconversions; + convert_to_int(return_value ); + Z_IVAL_P(return_value) = nconversions; } else if (nconversions < totalVars) { /* TODO: not all elements converted. we need to prune the list - cc */ } @@ -1203,7 +1203,7 @@ done: static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */ { if (numVars) { - ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */ + ZVAL_INT(return_value, SCAN_ERROR_EOF); /* EOF marker */ } else { /* convert_to_null calls destructor */ convert_to_null(return_value); diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index 84a7d258c1..4e8c68f13b 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -34,20 +34,19 @@ PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest) Calculate the sha1 hash of a string */ PHP_FUNCTION(sha1) { - char *arg; - int arg_len; + zend_string *arg; zend_bool raw_output = 0; char sha1str[41]; PHP_SHA1_CTX context; unsigned char digest[20]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &arg, &raw_output) == FAILURE) { return; } sha1str[0] = '\0'; PHP_SHA1Init(&context); - PHP_SHA1Update(&context, arg, arg_len); + PHP_SHA1Update(&context, arg->val, arg->len); PHP_SHA1Final(digest, &context); if (raw_output) { RETURN_STRINGL(digest, 20); @@ -181,7 +180,7 @@ PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context) context. */ PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, - unsigned int inputLen) + php_size_t inputLen) { unsigned int i, index, partLen; diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h index ea63a234cf..72c793f656 100644 --- a/ext/standard/sha1.h +++ b/ext/standard/sha1.h @@ -31,7 +31,7 @@ typedef struct { } PHP_SHA1_CTX; PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *); -PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, unsigned int); +PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, php_size_t); PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *); PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 652512ce07..baa28a14b1 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -51,11 +51,11 @@ static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC) Creates a pair of connected, indistinguishable socket streams */ PHP_FUNCTION(stream_socket_pair) { - long domain, type, protocol; + php_int_t domain, type, protocol; php_stream *s1, *s2; php_socket_t pair[2]; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &domain, &type, &protocol)) { RETURN_FALSE; } @@ -96,13 +96,13 @@ PHP_FUNCTION(stream_socket_client) char *hashkey = NULL; php_stream *stream = NULL; int err; - long flags = PHP_STREAM_CLIENT_CONNECT; + php_int_t flags = PHP_STREAM_CLIENT_CONNECT; zend_string *errstr = NULL; php_stream_context *context = NULL; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dlr", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/dir", &host, &host_len, &zerrno, &zerrstr, &timeout, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -123,7 +123,7 @@ PHP_FUNCTION(stream_socket_client) #endif if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, 0); + ZVAL_INT(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -151,7 +151,7 @@ PHP_FUNCTION(stream_socket_client) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZVAL_INT(zerrno, err); } if (zerrstr && errstr) { zval_dtor(zerrstr); @@ -180,13 +180,13 @@ PHP_FUNCTION(stream_socket_server) zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; php_stream *stream = NULL; int err = 0; - long flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN; + php_int_t flags = STREAM_XPORT_BIND | STREAM_XPORT_LISTEN; zend_string *errstr = NULL; php_stream_context *context = NULL; RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/lr", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/z/ir", &host, &host_len, &zerrno, &zerrstr, &flags, &zcontext) == FAILURE) { RETURN_FALSE; } @@ -198,7 +198,7 @@ PHP_FUNCTION(stream_socket_server) if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, 0); + ZVAL_INT(zerrno, 0); } if (zerrstr) { zval_dtor(zerrstr); @@ -216,7 +216,7 @@ PHP_FUNCTION(stream_socket_server) if (stream == NULL) { if (zerrno) { zval_dtor(zerrno); - ZVAL_LONG(zerrno, err); + ZVAL_INT(zerrno, err); } if (zerrstr && errstr) { zval_dtor(zerrstr); @@ -321,13 +321,13 @@ PHP_FUNCTION(stream_socket_sendto) { php_stream *stream; zval *zstream; - long flags = 0; + php_int_t flags = 0; char *data, *target_addr = NULL; int datalen, target_addr_len = 0; php_sockaddr_storage sa; socklen_t sl = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|ls", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|is", &zstream, &data, &datalen, &flags, &target_addr, &target_addr_len) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, zstream); @@ -340,7 +340,7 @@ PHP_FUNCTION(stream_socket_sendto) } } - RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); + RETURN_INT(php_stream_xport_sendto(stream, data, datalen, flags, target_addr ? &sa : NULL, sl TSRMLS_CC)); } /* }}} */ @@ -351,12 +351,12 @@ PHP_FUNCTION(stream_socket_recvfrom) php_stream *stream; zval *zstream, *zremote = NULL; zend_string *remote_addr = NULL; - long to_read = 0; + php_int_t to_read = 0; zend_string *read_buf; - long flags = 0; + php_int_t flags = 0; int recvd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|lz/", &zstream, &to_read, &flags, &zremote) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|iz/", &zstream, &to_read, &flags, &zremote) == FAILURE) { RETURN_FALSE; } @@ -398,11 +398,11 @@ PHP_FUNCTION(stream_get_contents) { php_stream *stream; zval *zsrc; - long maxlen = PHP_STREAM_COPY_ALL, + php_int_t maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; zend_string *contents; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ii", &zsrc, &maxlen, &desiredpos) == FAILURE) { RETURN_FALSE; } @@ -446,11 +446,11 @@ PHP_FUNCTION(stream_copy_to_stream) { php_stream *src, *dest; zval *zsrc, *zdest; - long maxlen = PHP_STREAM_COPY_ALL, pos = 0; + php_int_t maxlen = PHP_STREAM_COPY_ALL, pos = 0; size_t len; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ll", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|ii", &zsrc, &zdest, &maxlen, &pos) == FAILURE) { RETURN_FALSE; } @@ -458,7 +458,7 @@ PHP_FUNCTION(stream_copy_to_stream) php_stream_from_zval(dest, zdest); if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", pos); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", pos); RETURN_FALSE; } @@ -467,7 +467,7 @@ PHP_FUNCTION(stream_copy_to_stream) if (ret != SUCCESS) { RETURN_FALSE; } - RETURN_LONG(len); + RETURN_INT(len); } /* }}} */ @@ -511,7 +511,7 @@ PHP_FUNCTION(stream_get_meta_data) } #endif - add_assoc_long(return_value, "unread_bytes", stream->writepos - stream->readpos); + add_assoc_int(return_value, "unread_bytes", stream->writepos - stream->readpos); add_assoc_bool(return_value, "seekable", (stream->ops->seek) && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0); if (stream->orig_path) { @@ -619,7 +619,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC) php_stream *stream; int ret = 0; zend_string *key; - ulong num_ind; + php_uint_t num_ind; if (Z_TYPE_P(stream_array) != IS_ARRAY) { return 0; @@ -723,10 +723,10 @@ PHP_FUNCTION(stream_select) fd_set rfds, wfds, efds; php_socket_t max_fd = 0; int retval, sets = 0; - long usec = 0; + php_int_t usec = 0; int set_count, max_set_count = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!a/!a/!z!|i", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) return; FD_ZERO(&rfds); @@ -763,9 +763,9 @@ PHP_FUNCTION(stream_select) /* If seconds is not set to null, build the timeval, else we wait indefinitely */ if (sec != NULL) { - convert_to_long_ex(sec); + convert_to_int_ex(sec); - if (Z_LVAL_P(sec) < 0) { + if (Z_IVAL_P(sec) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds parameter must be greater than 0"); RETURN_FALSE; } else if (usec < 0) { @@ -775,10 +775,10 @@ PHP_FUNCTION(stream_select) /* Solaris + BSD do not like microsecond values which are >= 1 sec */ if (usec > 999999) { - tv.tv_sec = Z_LVAL_P(sec) + (usec / 1000000); + tv.tv_sec = Z_IVAL_P(sec) + (usec / 1000000); tv.tv_usec = usec % 1000000; } else { - tv.tv_sec = Z_LVAL_P(sec); + tv.tv_sec = Z_IVAL_P(sec); tv.tv_usec = usec; } @@ -798,7 +798,7 @@ PHP_FUNCTION(stream_select) if (e_array != NULL) { zend_hash_clean(Z_ARRVAL_P(e_array)); } - RETURN_LONG(retval); + RETURN_INT(retval); } } @@ -814,7 +814,7 @@ PHP_FUNCTION(stream_select) if (w_array != NULL) stream_array_from_fd_set(w_array, &wfds TSRMLS_CC); if (e_array != NULL) stream_array_from_fd_set(e_array, &efds TSRMLS_CC); - RETURN_LONG(retval); + RETURN_INT(retval); } /* }}} */ @@ -827,16 +827,16 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco zval zvs[6]; int i; - ZVAL_LONG(&zvs[0], notifycode); - ZVAL_LONG(&zvs[1], severity); + ZVAL_INT(&zvs[0], notifycode); + ZVAL_INT(&zvs[1], severity); if (xmsg) { ZVAL_STRING(&zvs[2], xmsg); } else { ZVAL_NULL(&zvs[2]); } - ZVAL_LONG(&zvs[3], xcode); - ZVAL_LONG(&zvs[4], bytes_sofar); - ZVAL_LONG(&zvs[5], bytes_max); + ZVAL_INT(&zvs[3], xcode); + ZVAL_INT(&zvs[4], bytes_sofar); + ZVAL_INT(&zvs[5], bytes_max); if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, zvs, 0, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call user notifier"); @@ -1118,12 +1118,12 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) php_stream *stream; char *filtername; int filternamelen; - long read_write = 0; + php_int_t read_write = 0; zval *filterparams = NULL; php_stream_filter *filter = NULL; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lz", &zstream, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|iz", &zstream, &filtername, &filternamelen, &read_write, &filterparams) == FAILURE) { RETURN_FALSE; } @@ -1242,12 +1242,12 @@ PHP_FUNCTION(stream_get_line) { char *str = NULL; int str_len = 0; - long max_length; + php_int_t max_length; zval *zstream; zend_string *buf; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|s", &zstream, &max_length, &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|s", &zstream, &max_length, &str, &str_len) == FAILURE) { RETURN_FALSE; } @@ -1276,10 +1276,10 @@ PHP_FUNCTION(stream_set_blocking) { zval *arg1; int block; - long arg2; + php_int_t arg2; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) { return; } @@ -1302,12 +1302,12 @@ PHP_FUNCTION(stream_set_blocking) PHP_FUNCTION(stream_set_timeout) { zval *socket; - long seconds, microseconds = 0; + php_int_t seconds, microseconds = 0; struct timeval t; php_stream *stream; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &socket, &seconds, µseconds) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, "ri|i", &socket, &seconds, µseconds) == FAILURE) { return; } @@ -1337,11 +1337,11 @@ PHP_FUNCTION(stream_set_write_buffer) { zval *arg1; int ret; - long arg2; + php_int_t arg2; size_t buff; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } @@ -1356,7 +1356,7 @@ PHP_FUNCTION(stream_set_write_buffer) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } - RETURN_LONG(ret == 0 ? 0 : EOF); + RETURN_INT(ret == 0 ? 0 : EOF); } /* }}} */ @@ -1365,16 +1365,16 @@ PHP_FUNCTION(stream_set_write_buffer) PHP_FUNCTION(stream_set_chunk_size) { int ret; - long csize; + php_int_t csize; zval *zstream; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &csize) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &csize) == FAILURE) { RETURN_FALSE; } if (csize <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given %ld", csize); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given " ZEND_INT_FMT, csize); RETURN_FALSE; } /* stream.chunk_size is actually a size_t, but php_stream_set_option @@ -1390,7 +1390,7 @@ PHP_FUNCTION(stream_set_chunk_size) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_SET_CHUNK_SIZE, (int)csize, NULL); - RETURN_LONG(ret > 0 ? (long)ret : (long)EOF); + RETURN_INT(ret > 0 ? (php_int_t)ret : (php_int_t)EOF); } /* }}} */ @@ -1400,11 +1400,11 @@ PHP_FUNCTION(stream_set_read_buffer) { zval *arg1; int ret; - long arg2; + php_int_t arg2; size_t buff; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } @@ -1419,7 +1419,7 @@ PHP_FUNCTION(stream_set_read_buffer) ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } - RETURN_LONG(ret == 0 ? 0 : EOF); + RETURN_INT(ret == 0 ? 0 : EOF); } /* }}} */ @@ -1427,13 +1427,13 @@ PHP_FUNCTION(stream_set_read_buffer) Enable or disable a specific kind of crypto on the stream */ PHP_FUNCTION(stream_socket_enable_crypto) { - long cryptokind = 0; + php_int_t cryptokind = 0; zval *zstream, *zsessstream = NULL; php_stream *stream, *sessstream = NULL; zend_bool enable, cryptokindnull; int ret; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|l!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|i!r", &zstream, &enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) { RETURN_FALSE; } @@ -1448,7 +1448,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_FALSE; } - cryptokind = Z_LVAL_P(val); + cryptokind = Z_IVAL_P(val); } if (zsessstream) { @@ -1466,7 +1466,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_FALSE; case 0: - RETURN_LONG(0); + RETURN_INT(0); default: RETURN_TRUE; @@ -1558,11 +1558,11 @@ PHP_FUNCTION(stream_supports_lock) disallowed. */ PHP_FUNCTION(stream_socket_shutdown) { - long how; + php_int_t how; zval *zstream; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zstream, &how) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &zstream, &how) == FAILURE) { RETURN_FALSE; } diff --git a/ext/standard/string.c b/ext/standard/string.c index 82b98eb094..4ead166495 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -81,13 +81,13 @@ */ void register_string_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT); #ifdef HAVE_LOCALECONV /* If last members of struct lconv equal CHAR_MAX, no grouping is done */ @@ -97,25 +97,25 @@ void register_string_constants(INIT_FUNC_ARGS) # define CHAR_MAX 127 # endif - REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT); #endif #ifdef HAVE_LOCALE_H - REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT); # ifdef LC_MESSAGES - REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT); # endif #endif } /* }}} */ -int php_tag_find(char *tag, int len, char *set); +int php_tag_find(char *tag, php_size_t len, char *set); /* this is read-only, so it's ok */ static char hexconvtab[] = "0123456789abcdef"; @@ -237,14 +237,13 @@ PHP_MSHUTDOWN_FUNCTION(localeconv) PHP_FUNCTION(bin2hex) { zend_string *result; - char *data; - int datalen; + zend_string *data; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &datalen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &data) == FAILURE) { return; } - result = php_bin2hex((unsigned char *)data, datalen); + result = php_bin2hex((unsigned char *)data->val, data->len); if (!result) { RETURN_FALSE; @@ -282,55 +281,54 @@ PHP_FUNCTION(hex2bin) static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /* {{{ */ { - char *s11, *s22; - int len1, len2; - long start = 0, len = 0; + zend_string *s11, *s22; + php_int_t start = 0, len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1, - &s22, &len2, &start, &len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ii", &s11, + &s22, &start, &len) == FAILURE) { return; } if (ZEND_NUM_ARGS() < 4) { - len = len1; + len = s11->len; } /* look at substr() function for more information */ if (start < 0) { - start += len1; + start += (php_int_t)s11->len; if (start < 0) { start = 0; } - } else if (start > len1) { + } else if ((php_size_t)start > s11->len) { RETURN_FALSE; } if (len < 0) { - len += (len1 - start); + len += (s11->len - start); if (len < 0) { len = 0; } } - if (len > len1 - start) { - len = len1 - start; + if (len > (php_int_t)s11->len - start) { + len = s11->len - start; } if(len == 0) { - RETURN_LONG(0); + RETURN_INT(0); } if (behavior == STR_STRSPN) { - RETURN_LONG(php_strspn(s11 + start /*str1_start*/, - s22 /*str2_start*/, - s11 + start + len /*str1_end*/, - s22 + len2 /*str2_end*/)); + RETURN_INT(php_strspn(s11->val + start /*str1_start*/, + s22->val /*str2_start*/, + s11->val + start + len /*str1_end*/, + s22->val + s22->len /*str2_end*/)); } else if (behavior == STR_STRCSPN) { - RETURN_LONG(php_strcspn(s11 + start /*str1_start*/, - s22 /*str2_start*/, - s11 + start + len /*str1_end*/, - s22 + len2 /*str2_end*/)); + RETURN_INT(php_strcspn(s11->val + start /*str1_start*/, + s22->val /*str2_start*/, + s11->val + start + len /*str1_end*/, + s22->val + s22->len /*str2_end*/)); } } @@ -356,7 +354,7 @@ PHP_FUNCTION(strcspn) #if HAVE_NL_LANGINFO PHP_MINIT_FUNCTION(nl_langinfo) { -#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) +#define REGISTER_NL_LANGINFO_CONSTANT(x) REGISTER_INT_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) #ifdef ABDAY_1 REGISTER_NL_LANGINFO_CONSTANT(ABDAY_1); REGISTER_NL_LANGINFO_CONSTANT(ABDAY_2); @@ -526,10 +524,10 @@ PHP_MINIT_FUNCTION(nl_langinfo) Query language and locale information */ PHP_FUNCTION(nl_langinfo) { - long item; + php_int_t item; char *value; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &item) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &item) == FAILURE) { return; } @@ -694,7 +692,7 @@ PHP_FUNCTION(nl_langinfo) #endif break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '%ld' is not valid", item); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '" ZEND_INT_FMT "' is not valid", item); RETURN_FALSE; } /* }}} */ @@ -714,15 +712,14 @@ PHP_FUNCTION(nl_langinfo) Compares two strings using the current locale */ PHP_FUNCTION(strcoll) { - char *s1, *s2; - int s1len, s2len; + zend_string *s1, *s2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1len, &s2, &s2len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s2) == FAILURE) { return; } - RETURN_LONG(strcoll((const char *) s1, - (const char *) s2)); + RETURN_INT(strcoll((const char *) s1->val, + (const char *) s2->val)); } /* }}} */ #endif @@ -732,7 +729,7 @@ PHP_FUNCTION(strcoll) * it needs to be incrementing. * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range errors) */ -static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_DC) +static inline int php_charmask(unsigned char *input, php_size_t len, char *mask TSRMLS_DC) { unsigned char *end; unsigned char c; @@ -781,9 +778,9 @@ static inline int php_charmask(unsigned char *input, int len, char *mask TSRMLS_ * mode 3 : trim left and right * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0') */ -PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_value, int mode TSRMLS_DC) +PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC) { - register int i; + register php_int_t i; int trimmed = 0; char mask[256]; @@ -828,23 +825,22 @@ PHPAPI char *php_trim(char *c, int len, char *what, int what_len, zval *return_v */ static void php_do_trim(INTERNAL_FUNCTION_PARAMETERS, int mode) { - char *str; - char *what = NULL; - int str_len, what_len = 0; + zend_string *str; + zend_string *what = NULL; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &what, &what_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &what) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STRING(str, str_len) + Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_STRING(what, what_len) + Z_PARAM_STR(what) ZEND_PARSE_PARAMETERS_END(); #endif - php_trim(str, str_len, what, what_len, return_value, mode TSRMLS_CC); + php_trim(str->val, str->len, (what ? what->val : NULL), (what ? what->len : 0), return_value, mode TSRMLS_CC); } /* }}} */ @@ -876,23 +872,33 @@ PHP_FUNCTION(ltrim) Wraps buffer to selected number of characters using string break char */ PHP_FUNCTION(wordwrap) { - const char *text, *breakchar = "\n"; - int textlen, breakcharlen = 1, newtextlen, chk; + zend_string *text, *breakchar = NULL, *breakchar_save = NULL; + php_size_t newtextlen, chk; size_t alloced; - long current = 0, laststart = 0, lastspace = 0; - long linelength = 75; + php_int_t current = 0, laststart = 0, lastspace = 0; + php_int_t linelength = 75; zend_bool docut = 0; zend_string *newtext; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lsb", &text, &textlen, &linelength, &breakchar, &breakcharlen, &docut) == FAILURE) { + breakchar = breakchar_save = STR_INIT("\n", 1, 1); + if (!breakchar) { return; } - if (textlen == 0) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|iSb", &text, &linelength, &breakchar, &docut) == FAILURE) { + STR_FREE(breakchar); + return; + } + + if (breakchar != breakchar_save) { + STR_FREE(breakchar_save); + } + + if (text->len == 0) { RETURN_EMPTY_STRING(); } - if (breakcharlen == 0) { + if (breakchar->len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Break string cannot be empty"); RETURN_FALSE; } @@ -904,21 +910,21 @@ PHP_FUNCTION(wordwrap) /* Special case for a single-character break as it needs no additional storage space */ - if (breakcharlen == 1 && !docut) { - newtext = STR_INIT(text, textlen, 0); + if (breakchar->len == 1 && !docut) { + newtext = STR_INIT(text->val, text->len, 0); laststart = lastspace = 0; - for (current = 0; current < textlen; current++) { - if (text[current] == breakchar[0]) { + for (current = 0; current < text->len; current++) { + if (text->val[current] == breakchar->val[0]) { laststart = lastspace = current + 1; - } else if (text[current] == ' ') { + } else if (text->val[current] == ' ') { if (current - laststart >= linelength) { - newtext->val[current] = breakchar[0]; + newtext->val[current] = breakchar->val[0]; laststart = current + 1; } lastspace = current; } else if (current - laststart >= linelength && laststart != lastspace) { - newtext->val[lastspace] = breakchar[0]; + newtext->val[lastspace] = breakchar->val[0]; laststart = lastspace + 1; } } @@ -927,44 +933,44 @@ PHP_FUNCTION(wordwrap) } else { /* Multiple character line break or forced cut */ if (linelength > 0) { - chk = (int)(textlen/linelength + 1); - newtext = STR_ALLOC(chk * breakcharlen + textlen, 0); - alloced = textlen + chk * breakcharlen + 1; + chk = (php_size_t)(text->len/linelength + 1); + newtext = STR_ALLOC(chk * breakchar->len + text->len, 0); + alloced = text->len + chk * breakchar->len + 1; } else { - chk = textlen; - alloced = textlen * (breakcharlen + 1) + 1; - newtext = STR_ALLOC(textlen * (breakcharlen + 1), 0); + chk = text->len; + alloced = text->len * (breakchar->len + 1) + 1; + newtext = STR_ALLOC(text->len * (breakchar->len + 1), 0); } /* now keep track of the actual new text length */ newtextlen = 0; laststart = lastspace = 0; - for (current = 0; current < textlen; current++) { + for (current = 0; current < text->len; current++) { if (chk <= 0) { - alloced += (int) (((textlen - current + 1)/linelength + 1) * breakcharlen) + 1; + alloced += (php_size_t) (((text->len - current + 1)/linelength + 1) * breakchar->len) + 1; newtext = STR_REALLOC(newtext, alloced, 0); - chk = (int) ((textlen - current)/linelength) + 1; + chk = (php_size_t) ((text->len - current)/linelength) + 1; } /* when we hit an existing break, copy to new buffer, and * fix up laststart and lastspace */ - if (text[current] == breakchar[0] - && current + breakcharlen < textlen - && !strncmp(text+current, breakchar, breakcharlen)) { - memcpy(newtext->val + newtextlen, text + laststart, current - laststart + breakcharlen); - newtextlen += current - laststart + breakcharlen; - current += breakcharlen - 1; + if (text->val[current] == breakchar->val[0] + && current + breakchar->len < text->len + && !strncmp(text->val+current, breakchar->val, breakchar->len)) { + memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart + breakchar->len); + newtextlen += current - laststart + breakchar->len; + current += breakchar->len - 1; laststart = lastspace = current + 1; chk--; } /* if it is a space, check if it is at the line boundary, * copy and insert a break, or just keep track of it */ - else if (text[current] == ' ') { + else if (text->val[current] == ' ') { if (current - laststart >= linelength) { - memcpy(newtext->val + newtextlen, text + laststart, current - laststart); + memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart); newtextlen += current - laststart; - memcpy(newtext->val + newtextlen, breakchar, breakcharlen); - newtextlen += breakcharlen; + memcpy(newtext->val + newtextlen, breakchar->val, breakchar->len); + newtextlen += breakchar->len; laststart = current + 1; chk--; } @@ -975,10 +981,10 @@ PHP_FUNCTION(wordwrap) * copy and insert a break. */ else if (current - laststart >= linelength && docut && laststart >= lastspace) { - memcpy(newtext->val + newtextlen, text + laststart, current - laststart); + memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart); newtextlen += current - laststart; - memcpy(newtext->val + newtextlen, breakchar, breakcharlen); - newtextlen += breakcharlen; + memcpy(newtext->val + newtextlen, breakchar->val, breakchar->len); + newtextlen += breakchar->len; laststart = lastspace = current; chk--; } @@ -987,10 +993,10 @@ PHP_FUNCTION(wordwrap) * up the laststart */ else if (current - laststart >= linelength && laststart < lastspace) { - memcpy(newtext->val + newtextlen, text + laststart, lastspace - laststart); + memcpy(newtext->val + newtextlen, text->val + laststart, lastspace - laststart); newtextlen += lastspace - laststart; - memcpy(newtext->val + newtextlen, breakchar, breakcharlen); - newtextlen += breakcharlen; + memcpy(newtext->val + newtextlen, breakchar->val, breakchar->len); + newtextlen += breakchar->len; laststart = lastspace = lastspace + 1; chk--; } @@ -998,7 +1004,7 @@ PHP_FUNCTION(wordwrap) /* copy over any stragglers */ if (laststart != current) { - memcpy(newtext->val + newtextlen, text + laststart, current - laststart); + memcpy(newtext->val + newtextlen, text->val + laststart, current - laststart); newtextlen += current - laststart; } @@ -1013,22 +1019,22 @@ PHP_FUNCTION(wordwrap) /* {{{ php_explode */ -PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) +PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, php_int_t limit) { char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); p1 = Z_STRVAL_P(str); - p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); if (p2 == NULL) { - add_next_index_stringl(return_value, p1, Z_STRLEN_P(str)); + add_next_index_stringl(return_value, p1, Z_STRSIZE_P(str)); } else { do { add_next_index_stringl(return_value, p1, p2 - p1); - p1 = p2 + Z_STRLEN_P(delim); - } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL && + p1 = p2 + Z_STRSIZE_P(delim); + } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL && --limit > 1); if (p1 <= endp) @@ -1039,15 +1045,15 @@ PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, long limit) /* {{{ php_explode_negative_limit */ -PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_value, long limit) +PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_value, php_int_t limit) { #define EXPLODE_ALLOC_STEP 64 char *p1, *p2, *endp; - endp = Z_STRVAL_P(str) + Z_STRLEN_P(str); + endp = Z_STRVAL_P(str) + Z_STRSIZE_P(str); p1 = Z_STRVAL_P(str); - p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp); + p2 = (char*)php_memnstr(Z_STRVAL_P(str), Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp); if (p2 == NULL) { /* @@ -1055,8 +1061,8 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu by doing nothing we return empty array */ } else { - int allocated = EXPLODE_ALLOC_STEP, found = 0; - long i, to_return; + php_size_t allocated = EXPLODE_ALLOC_STEP, found = 0; + php_int_t i, to_return; char **positions = emalloc(allocated * sizeof(char *)); positions[found++] = p1; @@ -1065,14 +1071,14 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu allocated = found + EXPLODE_ALLOC_STEP;/* make sure we have enough memory */ positions = erealloc(positions, allocated*sizeof(char *)); } - positions[found++] = p1 = p2 + Z_STRLEN_P(delim); - } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRLEN_P(delim), endp)) != NULL); + positions[found++] = p1 = p2 + Z_STRSIZE_P(delim); + } while ((p2 = (char*)php_memnstr(p1, Z_STRVAL_P(delim), Z_STRSIZE_P(delim), endp)) != NULL); to_return = limit + found; /* limit is at least -1 therefore no need of bounds checking : i will be always less than found */ for (i = 0;i < to_return;i++) { /* this checks also for to_return > 0 */ add_next_index_stringl(return_value, positions[i], - (positions[i+1] - Z_STRLEN_P(delim)) - positions[i]); + (positions[i+1] - Z_STRSIZE_P(delim)) - positions[i]); } efree(positions); } @@ -1085,11 +1091,11 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu PHP_FUNCTION(explode) { zend_string *str, *delim; - long limit = LONG_MAX; /* No limit */ + php_int_t limit = PHP_INT_MAX; /* No limit */ zval zdelim, zstr; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|l", &delim, &str, &limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|i", &delim, &str, &limit) == FAILURE) { return; } #else @@ -1097,7 +1103,7 @@ PHP_FUNCTION(explode) Z_PARAM_STR(delim) Z_PARAM_STR(str) Z_PARAM_OPTIONAL - Z_PARAM_LONG(limit) + Z_PARAM_INT(limit) ZEND_PARSE_PARAMETERS_END(); #endif @@ -1150,11 +1156,11 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC) again: switch (Z_TYPE_P(tmp)) { case IS_STRING: - smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_appendl(&implstr, Z_STRVAL_P(tmp), Z_STRSIZE_P(tmp)); break; - case IS_LONG: - smart_str_append_long(&implstr, Z_LVAL_P(tmp)); + case IS_INT: + smart_str_append_int(&implstr, Z_IVAL_P(tmp)); break; case IS_TRUE: @@ -1167,7 +1173,7 @@ again: case IS_DOUBLE: { char *stmp; - int str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_P(tmp)); + php_size_t str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_P(tmp)); smart_str_appendl(&implstr, stmp, str_len); efree(stmp); } @@ -1186,7 +1192,7 @@ again: } if (++i != numelems) { - smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRLEN_P(delim)); + smart_str_appendl(&implstr, Z_STRVAL_P(delim), Z_STRSIZE_P(delim)); } } ZEND_HASH_FOREACH_END(); @@ -1255,26 +1261,24 @@ PHP_FUNCTION(implode) Tokenize a string */ PHP_FUNCTION(strtok) { - char *str, *tok = NULL; - int str_len, tok_len = 0; + zend_string *str, *tok = NULL; char *token; char *token_end; char *p; char *pe; int skipped = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &tok, &tok_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &tok) == FAILURE) { return; } if (ZEND_NUM_ARGS() == 1) { tok = str; - tok_len = str_len; } else { zval_ptr_dtor(&BG(strtok_zval)); - ZVAL_STRINGL(&BG(strtok_zval), str, str_len); + ZVAL_STRINGL(&BG(strtok_zval), str->val, str->len); BG(strtok_last) = BG(strtok_string) = Z_STRVAL(BG(strtok_zval)); - BG(strtok_len) = str_len; + BG(strtok_len) = str->len; } p = BG(strtok_last); /* Where we start to search */ @@ -1284,8 +1288,8 @@ PHP_FUNCTION(strtok) RETURN_FALSE; } - token = tok; - token_end = token + tok_len; + token = tok->val; + token_end = token + tok->len; while (token < token_end) { STRTOK_TABLE(token++) = 1; @@ -1320,7 +1324,7 @@ return_token: /* Restore table -- usually faster then memset'ing the table on every invocation */ restore: - token = tok; + token = tok->val; while (token < token_end) { STRTOK_TABLE(token++) = 0; @@ -1349,15 +1353,14 @@ PHPAPI char *php_strtoupper(char *s, size_t len) Makes a string uppercase */ PHP_FUNCTION(strtoupper) { - char *arg; - int arglen; + zend_string *arg; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg) == FAILURE) { return; } - result = STR_INIT(arg, arglen, 0); + result = STR_INIT(arg->val, arg->len, 0); php_strtoupper(result->val, result->len); RETURN_NEW_STR(result); } @@ -1384,21 +1387,20 @@ PHPAPI char *php_strtolower(char *s, size_t len) Makes a string lowercase */ PHP_FUNCTION(strtolower) { - char *str; - int arglen; + zend_string *str; zend_string *result; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(str, arglen) + Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); #endif - result = STR_INIT(str, arglen, 0); + result = STR_INIT(str->val, str->len, 0); php_strtolower(result->val, result->len); RETURN_NEW_STR(result); } @@ -1533,10 +1535,10 @@ PHP_FUNCTION(pathinfo) zval tmp; char *path, *dirname; int path_len, have_basename; - long opt = PHP_PATHINFO_ALL; + php_int_t opt = PHP_PATHINFO_ALL; zend_string *ret = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &path, &path_len, &opt) == FAILURE) { return; } @@ -1661,8 +1663,8 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) static int php_needle_char(zval *needle, char *target TSRMLS_DC) { switch (Z_TYPE_P(needle)) { - case IS_LONG: - *target = (char)Z_LVAL_P(needle); + case IS_INT: + *target = (char)Z_IVAL_P(needle); return SUCCESS; case IS_NULL: case IS_FALSE: @@ -1678,11 +1680,11 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC) { zval holder = *needle; zval_copy_ctor(&(holder)); - convert_to_long(&(holder)); - if(Z_TYPE(holder) != IS_LONG) { + convert_to_int(&(holder)); + if(Z_TYPE(holder) != IS_INT) { return FAILURE; } - *target = (char)Z_LVAL(holder); + *target = (char)Z_IVAL(holder); return SUCCESS; } default: { @@ -1698,29 +1700,28 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC) PHP_FUNCTION(stristr) { zval *needle; - char *haystack; - int haystack_len; + zend_string *haystack; char *found = NULL; - int found_offset; + php_size_t found_offset; char *haystack_dup; char needle_char[2]; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &needle, &part) == FAILURE) { return; } - haystack_dup = estrndup(haystack, haystack_len); + haystack_dup = estrndup(haystack->val, haystack->len); if (Z_TYPE_P(needle) == IS_STRING) { char *orig_needle; - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); efree(haystack_dup); RETURN_FALSE; } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, haystack_len, Z_STRLEN_P(needle)); + orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); + found = php_stristr(haystack_dup, orig_needle, haystack->len, Z_STRSIZE_P(needle)); efree(orig_needle); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { @@ -1729,15 +1730,15 @@ PHP_FUNCTION(stristr) } needle_char[1] = 0; - found = php_stristr(haystack_dup, needle_char, haystack_len, 1); + found = php_stristr(haystack_dup, needle_char, haystack->len, 1); } if (found) { found_offset = found - haystack_dup; if (part) { - RETVAL_STRINGL(haystack, found_offset); + RETVAL_STRINGL(haystack->val, found_offset); } else { - RETVAL_STRINGL(haystack + found_offset, haystack_len - found_offset); + RETVAL_STRINGL(haystack->val + found_offset, haystack->len - found_offset); } } else { RETVAL_FALSE; @@ -1752,39 +1753,38 @@ PHP_FUNCTION(stristr) PHP_FUNCTION(strstr) { zval *needle; - char *haystack; - int haystack_len; + zend_string *haystack; char *found = NULL; char needle_char[2]; - long found_offset; + php_int_t found_offset; zend_bool part = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &haystack, &haystack_len, &needle, &part) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|b", &haystack, &needle, &part) == FAILURE) { return; } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } - found = (char*)php_memnstr(haystack, Z_STRVAL_P(needle), Z_STRLEN_P(needle), haystack + haystack_len); + found = (char*)php_memnstr(haystack->val, Z_STRVAL_P(needle), Z_STRSIZE_P(needle), haystack->val + haystack->len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { RETURN_FALSE; } needle_char[1] = 0; - found = (char*)php_memnstr(haystack, needle_char, 1, haystack + haystack_len); + found = (char*)php_memnstr(haystack->val, needle_char, 1, haystack->val + haystack->len); } if (found) { - found_offset = found - haystack; + found_offset = found - haystack->val; if (part) { - RETURN_STRINGL(haystack, found_offset); + RETURN_STRINGL(haystack->val, found_offset); } else { - RETURN_STRINGL(found, haystack_len - found_offset); + RETURN_STRINGL(found, haystack->len - found_offset); } } RETURN_FALSE; @@ -1800,54 +1800,53 @@ PHP_FUNCTION(strstr) PHP_FUNCTION(strpos) { zval *needle; - char *haystack; + zend_string *haystack; char *found = NULL; char needle_char[2]; - long offset = 0; - int haystack_len; + php_int_t offset = 0; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &needle, &offset) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STRING(haystack, haystack_len) + Z_PARAM_STR(haystack) Z_PARAM_ZVAL(needle) Z_PARAM_OPTIONAL - Z_PARAM_LONG(offset) + Z_PARAM_INT(offset) ZEND_PARSE_PARAMETERS_END(); #endif - if (offset < 0 || offset > haystack_len) { + if (offset < 0 || offset > haystack->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { + if (!Z_STRSIZE_P(needle)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle"); RETURN_FALSE; } - found = (char*)php_memnstr(haystack + offset, + found = (char*)php_memnstr(haystack->val + offset, Z_STRVAL_P(needle), - Z_STRLEN_P(needle), - haystack + haystack_len); + Z_STRSIZE_P(needle), + haystack->val + haystack->len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { RETURN_FALSE; } needle_char[1] = 0; - found = (char*)php_memnstr(haystack + offset, + found = (char*)php_memnstr(haystack->val + offset, needle_char, 1, - haystack + haystack_len); + haystack->val + haystack->len); } if (found) { - RETURN_LONG(found - haystack); + RETURN_INT(found - haystack->val); } else { RETURN_FALSE; } @@ -1859,38 +1858,37 @@ PHP_FUNCTION(strpos) PHP_FUNCTION(stripos) { char *found = NULL; - char *haystack; - int haystack_len; - long offset = 0; + zend_string *haystack; + php_int_t offset = 0; char *needle_dup = NULL, *haystack_dup; char needle_char[2]; zval *needle; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &needle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &needle, &offset) == FAILURE) { return; } - if (offset < 0 || offset > haystack_len) { + if (offset < 0 || offset > haystack->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } - if (haystack_len == 0) { + if (haystack->len == 0) { RETURN_FALSE; } - haystack_dup = estrndup(haystack, haystack_len); - php_strtolower(haystack_dup, haystack_len); + haystack_dup = estrndup(haystack->val, haystack->len); + php_strtolower(haystack_dup, haystack->len); if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > haystack_len) { + if (Z_STRSIZE_P(needle) == 0 || Z_STRSIZE_P(needle) > haystack->len) { efree(haystack_dup); RETURN_FALSE; } - needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - php_strtolower(needle_dup, Z_STRLEN_P(needle)); - found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRLEN_P(needle), haystack_dup + haystack_len); + needle_dup = estrndup(Z_STRVAL_P(needle), Z_STRSIZE_P(needle)); + php_strtolower(needle_dup, Z_STRSIZE_P(needle)); + found = (char*)php_memnstr(haystack_dup + offset, needle_dup, Z_STRSIZE_P(needle), haystack_dup + haystack->len); } else { if (php_needle_char(needle, needle_char TSRMLS_CC) != SUCCESS) { efree(haystack_dup); @@ -1901,7 +1899,7 @@ PHP_FUNCTION(stripos) found = (char*)php_memnstr(haystack_dup + offset, needle_char, sizeof(needle_char) - 1, - haystack_dup + haystack_len); + haystack_dup + haystack->len); } efree(haystack_dup); @@ -1910,7 +1908,7 @@ PHP_FUNCTION(stripos) } if (found) { - RETURN_LONG(found - haystack_dup); + RETURN_INT(found - haystack_dup); } else { RETURN_FALSE; } @@ -1922,27 +1920,28 @@ PHP_FUNCTION(stripos) PHP_FUNCTION(strrpos) { zval *zneedle; - char *needle, *haystack; - int needle_len, haystack_len; - long offset = 0; + char *needle; + zend_string *haystack; + php_size_t needle_len; + php_int_t offset = 0; char *p, *e, ord_needle[2]; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } #else ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STRING(haystack, haystack_len) + Z_PARAM_STR(haystack) Z_PARAM_ZVAL(zneedle) Z_PARAM_OPTIONAL - Z_PARAM_LONG(offset) + Z_PARAM_INT(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); #endif if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); + needle_len = Z_STRSIZE_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -1952,28 +1951,28 @@ PHP_FUNCTION(strrpos) needle_len = 1; } - if ((haystack_len == 0) || (needle_len == 0)) { + if ((haystack->len == 0) || (needle_len == 0)) { RETURN_FALSE; } if (offset >= 0) { - if (offset > haystack_len) { + if (offset > haystack->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } - p = haystack + offset; - e = haystack + haystack_len - needle_len; + p = haystack->val + offset; + e = haystack->val + haystack->len - needle_len; } else { - if (offset < -INT_MAX || -offset > haystack_len) { + if (offset < -INT_MAX || -offset > haystack->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } - p = haystack; + p = haystack->val; if (needle_len > -offset) { - e = haystack + haystack_len - needle_len; + e = haystack->val + haystack->len - needle_len; } else { - e = haystack + haystack_len + offset; + e = haystack->val + haystack->len + offset; } } @@ -1981,7 +1980,7 @@ PHP_FUNCTION(strrpos) /* Single character search can shortcut memcmps */ while (e >= p) { if (*e == *needle) { - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -1990,7 +1989,7 @@ PHP_FUNCTION(strrpos) while (e >= p) { if (memcmp(e, needle, needle_len) == 0) { - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2004,19 +2003,20 @@ PHP_FUNCTION(strrpos) PHP_FUNCTION(strripos) { zval *zneedle; - char *needle, *haystack; - int needle_len, haystack_len; - long offset = 0; + char *needle; + zend_string *haystack; + php_size_t needle_len; + php_int_t offset = 0; char *p, *e, ord_needle[2]; char *needle_dup, *haystack_dup; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &haystack, &haystack_len, &zneedle, &offset) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|i", &haystack, &zneedle, &offset) == FAILURE) { RETURN_FALSE; } if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); + needle_len = Z_STRSIZE_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle TSRMLS_CC) != SUCCESS) { RETURN_FALSE; @@ -2026,7 +2026,7 @@ PHP_FUNCTION(strripos) needle_len = 1; } - if ((haystack_len == 0) || (needle_len == 0)) { + if ((haystack->len == 0) || (needle_len == 0)) { RETURN_FALSE; } @@ -2034,25 +2034,25 @@ PHP_FUNCTION(strripos) /* Single character search can shortcut memcmps Can also avoid tolower emallocs */ if (offset >= 0) { - if (offset > haystack_len) { + if (offset > haystack->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } - p = haystack + offset; - e = haystack + haystack_len - 1; + p = haystack->val + offset; + e = haystack->val + haystack->len - 1; } else { - p = haystack; - if (offset < -INT_MAX || -offset > haystack_len) { + p = haystack->val; + if (offset < -INT_MAX || -offset > haystack->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } - e = haystack + haystack_len + offset; + e = haystack->val + haystack->len + offset; } /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */ *ord_needle = tolower(*needle); while (e >= p) { if (tolower(*e) == *ord_needle) { - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2061,20 +2061,20 @@ PHP_FUNCTION(strripos) needle_dup = estrndup(needle, needle_len); php_strtolower(needle_dup, needle_len); - haystack_dup = estrndup(haystack, haystack_len); - php_strtolower(haystack_dup, haystack_len); + haystack_dup = estrndup(haystack->val, haystack->len); + php_strtolower(haystack_dup, haystack->len); if (offset >= 0) { - if (offset > haystack_len) { + if (offset > haystack->len) { efree(needle_dup); efree(haystack_dup); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } p = haystack_dup + offset; - e = haystack_dup + haystack_len - needle_len; + e = haystack_dup + haystack->len - needle_len; } else { - if (offset < -INT_MAX || -offset > haystack_len) { + if (offset < -INT_MAX || -offset > haystack->len) { efree(needle_dup); efree(haystack_dup); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset is greater than the length of haystack string"); @@ -2082,9 +2082,9 @@ PHP_FUNCTION(strripos) } p = haystack_dup; if (needle_len > -offset) { - e = haystack_dup + haystack_len - needle_len; + e = haystack_dup + haystack->len - needle_len; } else { - e = haystack_dup + haystack_len + offset; + e = haystack_dup + haystack->len + offset; } } @@ -2092,7 +2092,7 @@ PHP_FUNCTION(strripos) if (memcmp(e, needle_dup, needle_len) == 0) { efree(haystack_dup); efree(needle_dup); - RETURN_LONG(e - p + (offset > 0 ? offset : 0)); + RETURN_INT(e - p + (offset > 0 ? offset : 0)); } e--; } @@ -2108,29 +2108,28 @@ PHP_FUNCTION(strripos) PHP_FUNCTION(strrchr) { zval *needle; - char *haystack; + zend_string *haystack; const char *found = NULL; - long found_offset; - int haystack_len; + php_int_t found_offset; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &haystack, &haystack_len, &needle) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &haystack, &needle) == FAILURE) { return; } if (Z_TYPE_P(needle) == IS_STRING) { - found = zend_memrchr(haystack, *Z_STRVAL_P(needle), haystack_len); + found = zend_memrchr(haystack->val, *Z_STRVAL_P(needle), haystack->len); } else { char needle_chr; if (php_needle_char(needle, &needle_chr TSRMLS_CC) != SUCCESS) { RETURN_FALSE; } - found = zend_memrchr(haystack, needle_chr, haystack_len); + found = zend_memrchr(haystack->val, needle_chr, haystack->len); } if (found) { - found_offset = found - haystack; - RETURN_STRINGL(found, haystack_len - found_offset); + found_offset = found - haystack->val; + RETURN_STRINGL(found, haystack->len - found_offset); } else { RETURN_FALSE; } @@ -2139,12 +2138,12 @@ PHP_FUNCTION(strrchr) /* {{{ php_chunk_split */ -static zend_string *php_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen) +static zend_string *php_chunk_split(char *src, php_size_t srclen, char *end, php_size_t endlen, php_size_t chunklen) { char *p, *q; - int chunks; /* complete chunks! */ - int restlen; - int out_len; + php_size_t chunks; /* complete chunks! */ + php_size_t restlen; + php_size_t out_len; zend_string *dest; chunks = srclen / chunklen; @@ -2191,14 +2190,13 @@ static zend_string *php_chunk_split(char *src, int srclen, char *end, int endlen Returns split line */ PHP_FUNCTION(chunk_split) { - char *str; + zend_string *str; char *end = "\r\n"; int endlen = 2; - long chunklen = 76; - int str_len; + php_int_t chunklen = 76; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &chunklen, &end, &endlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", &str, &chunklen, &end, &endlen) == FAILURE) { return; } @@ -2207,20 +2205,20 @@ PHP_FUNCTION(chunk_split) RETURN_FALSE; } - if (chunklen > str_len) { + if (chunklen > str->len) { /* to maintain BC, we must return original string + ending */ - result = STR_ALLOC(endlen + str_len, 0); - memcpy(result->val, str, str_len); - memcpy(result->val + str_len, end, endlen); + result = STR_ALLOC(endlen + str->len, 0); + memcpy(result->val, str->val, str->len); + memcpy(result->val + str->len, end, endlen); result->val[result->len] = '\0'; RETURN_NEW_STR(result); } - if (!str_len) { + if (!str->len) { RETURN_EMPTY_STRING(); } - result = php_chunk_split(str, str_len, end, endlen, chunklen); + result = php_chunk_split(str->val, str->len, end, endlen, chunklen); if (result) { RETURN_STR(result); @@ -2234,41 +2232,40 @@ PHP_FUNCTION(chunk_split) Returns part of a string */ PHP_FUNCTION(substr) { - char *str; - long l = 0, f; - int str_len; + zend_string *str; + php_int_t l = 0, f; int argc = ZEND_NUM_ARGS(); #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &str, &str_len, &f, &l) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &str, &f, &l) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(2, 3) - Z_PARAM_STRING(str, str_len) - Z_PARAM_LONG(f) + Z_PARAM_STR(str) + Z_PARAM_INT(f) Z_PARAM_OPTIONAL - Z_PARAM_LONG(l) + Z_PARAM_INT(l) ZEND_PARSE_PARAMETERS_END(); #endif if (argc > 2) { - if ((l < 0 && -l > str_len)) { + if ((l < 0 && -l > str->len)) { RETURN_FALSE; - } else if (l > str_len) { - l = str_len; + } else if (l > (php_int_t)str->len) { + l = str->len; } } else { - l = str_len; + l = str->len; } - if (f > str_len) { + if (f > (php_int_t)str->len) { RETURN_FALSE; - } else if (f < 0 && -f > str_len) { + } else if (f < 0 && -f > str->len) { f = 0; } - if (l < 0 && (l + str_len - f) < 0) { + if (l < 0 && (l + (php_int_t)str->len - f) < 0) { RETURN_FALSE; } @@ -2276,7 +2273,7 @@ PHP_FUNCTION(substr) * of the string */ if (f < 0) { - f = str_len + f; + f = (php_int_t)str->len + f; if (f < 0) { f = 0; } @@ -2286,21 +2283,21 @@ PHP_FUNCTION(substr) * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (str_len - f) + l; + l = ((php_int_t)str->len - f) + l; if (l < 0) { l = 0; } } - if (f >= str_len) { + if (f >= (php_int_t)str->len) { RETURN_FALSE; } - if ((f + l) > str_len) { - l = str_len - f; + if ((f + l) > (php_int_t)str->len) { + l = str->len - f; } - RETURN_STRINGL(str + f, l); + RETURN_STRINGL(str->val + f, l); } /* }}} */ @@ -2312,8 +2309,8 @@ PHP_FUNCTION(substr_replace) zval *from; zval *len = NULL; zval *repl; - int l = 0; - int f; + php_int_t l = 0; /* l and f should be size_t, however this needs much closer below logic investigation.*/ + php_int_t f; int argc = ZEND_NUM_ARGS(); zend_string *result; @@ -2331,16 +2328,16 @@ PHP_FUNCTION(substr_replace) convert_to_string_ex(repl); } if (Z_TYPE_P(from) != IS_ARRAY) { - convert_to_long_ex(from); + convert_to_int_ex(from); } if (argc > 3) { if (Z_TYPE_P(len) != IS_ARRAY) { - l = zval_get_long(len); + l = zval_get_int(len); } } else { if (Z_TYPE_P(str) != IS_ARRAY) { - l = Z_STRLEN_P(str); + l = Z_STRSIZE_P(str); } } @@ -2362,57 +2359,57 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_P(str) != IS_ARRAY) { if (Z_TYPE_P(from) != IS_ARRAY) { - int repl_len = 0; + php_size_t repl_len = 0; - f = Z_LVAL_P(from); + f = Z_IVAL_P(from); /* if "from" position is negative, count start position from the end * of the string */ if (f < 0) { - f = Z_STRLEN_P(str) + f; + f = Z_STRSIZE_P(str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(str)) { - f = Z_STRLEN_P(str); + } else if (f > Z_STRSIZE_P(str)) { + f = Z_STRSIZE_P(str); } /* if "length" position is negative, set it to the length * needed to stop that many chars from the end of the string */ if (l < 0) { - l = (Z_STRLEN_P(str) - f) + l; + l = (Z_STRSIZE_P(str) - f) + l; if (l < 0) { l = 0; } } - if (f > Z_STRLEN_P(str) || (f < 0 && -f > Z_STRLEN_P(str))) { + if (f > Z_STRSIZE_P(str) || (f < 0 && -f > Z_STRSIZE_P(str))) { RETURN_FALSE; - } else if (l > Z_STRLEN_P(str) || (l < 0 && -l > Z_STRLEN_P(str))) { - l = Z_STRLEN_P(str); + } else if (l > Z_STRSIZE_P(str) || (l < 0 && -l > Z_STRSIZE_P(str))) { + l = Z_STRSIZE_P(str); } - if ((f + l) > Z_STRLEN_P(str)) { - l = Z_STRLEN_P(str) - f; + if ((f + l) > Z_STRSIZE_P(str)) { + l = Z_STRSIZE_P(str) - f; } if (Z_TYPE_P(repl) == IS_ARRAY) { zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(repl), &pos_repl); if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) { convert_to_string_ex(tmp_repl); - repl_len = Z_STRLEN_P(tmp_repl); + repl_len = Z_STRSIZE_P(tmp_repl); } } else { - repl_len = Z_STRLEN_P(repl); + repl_len = Z_STRSIZE_P(repl); } - result = STR_ALLOC(Z_STRLEN_P(str) - l + repl_len, 0); + result = STR_ALLOC(Z_STRSIZE_P(str) - l + repl_len, 0); memcpy(result->val, Z_STRVAL_P(str), f); if (repl_len) { memcpy((result->val + f), (Z_TYPE_P(repl) == IS_ARRAY ? Z_STRVAL_P(tmp_repl) : Z_STRVAL_P(repl)), repl_len); } - memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l); + memcpy((result->val + f + repl_len), Z_STRVAL_P(str) + f + l, Z_STRSIZE_P(str) - f - l); result->val[result->len] = '\0'; RETURN_NEW_STR(result); } else { @@ -2421,8 +2418,8 @@ PHP_FUNCTION(substr_replace) } } else { /* str is array of strings */ zend_string *str_index = NULL; - ulong num_index; - int result_len; + php_size_t result_len; + php_uint_t num_index; array_init(return_value); @@ -2461,57 +2458,57 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_P(from) == IS_ARRAY) { if (NULL != (tmp_from = zend_hash_get_current_data_ex(Z_ARRVAL_P(from), &pos_from))) { - f = zval_get_long(tmp_from); + f = zval_get_int(tmp_from); if (f < 0) { - f = Z_STRLEN_P(orig_str) + f; + f = Z_STRSIZE_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(orig_str)) { - f = Z_STRLEN_P(orig_str); + } else if (f > Z_STRSIZE_P(orig_str)) { + f = Z_STRSIZE_P(orig_str); } zend_hash_move_forward_ex(Z_ARRVAL_P(from), &pos_from); } else { f = 0; } } else { - f = Z_LVAL_P(from); + f = Z_IVAL_P(from); if (f < 0) { - f = Z_STRLEN_P(orig_str) + f; + f = Z_STRSIZE_P(orig_str) + f; if (f < 0) { f = 0; } - } else if (f > Z_STRLEN_P(orig_str)) { - f = Z_STRLEN_P(orig_str); + } else if (f > Z_STRSIZE_P(orig_str)) { + f = Z_STRSIZE_P(orig_str); } } if (argc > 3 && Z_TYPE_P(len) == IS_ARRAY) { if (NULL != (tmp_len = zend_hash_get_current_data_ex(Z_ARRVAL_P(len), &pos_len))) { - l = zval_get_long(tmp_len); + l = zval_get_int(tmp_len); zend_hash_move_forward_ex(Z_ARRVAL_P(len), &pos_len); } else { - l = Z_STRLEN_P(orig_str); + l = Z_STRSIZE_P(orig_str); } } else if (argc > 3) { - l = Z_LVAL_P(len); + l = Z_IVAL_P(len); } else { - l = Z_STRLEN_P(orig_str); + l = Z_STRSIZE_P(orig_str); } if (l < 0) { - l = (Z_STRLEN_P(orig_str) - f) + l; + l = (Z_STRSIZE_P(orig_str) - f) + l; if (l < 0) { l = 0; } } - if ((f + l) > Z_STRLEN_P(orig_str)) { - l = Z_STRLEN_P(orig_str) - f; + if ((f + l) > Z_STRSIZE_P(orig_str)) { + l = Z_STRSIZE_P(orig_str) - f; } - result_len = Z_STRLEN_P(orig_str) - l; + result_len = Z_STRSIZE_P(orig_str) - l; if (Z_TYPE_P(repl) == IS_ARRAY) { if (NULL != (tmp_repl = zend_hash_get_current_data_ex(Z_ARRVAL_P(repl), &pos_repl))) { @@ -2536,13 +2533,13 @@ PHP_FUNCTION(substr_replace) } */ - result_len += Z_STRLEN_P(repl_str); + result_len += Z_STRSIZE_P(repl_str); zend_hash_move_forward_ex(Z_ARRVAL_P(repl), &pos_repl); result = STR_ALLOC(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRLEN_P(repl_str)); - memcpy((result->val + f + Z_STRLEN_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(repl_str), Z_STRSIZE_P(repl_str)); + memcpy((result->val + f + Z_STRSIZE_P(repl_str)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); if(Z_TYPE_P(tmp_repl) != IS_STRING) { zval_dtor(repl_str); } @@ -2550,16 +2547,16 @@ PHP_FUNCTION(substr_replace) result = STR_ALLOC(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); } } else { - result_len += Z_STRLEN_P(repl); + result_len += Z_STRSIZE_P(repl); result = STR_ALLOC(result_len, 0); memcpy(result->val, Z_STRVAL_P(orig_str), f); - memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl)); - memcpy((result->val + f + Z_STRLEN_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRLEN_P(orig_str) - f - l); + memcpy((result->val + f), Z_STRVAL_P(repl), Z_STRSIZE_P(repl)); + memcpy((result->val + f + Z_STRSIZE_P(repl)), Z_STRVAL_P(orig_str) + f + l, Z_STRSIZE_P(orig_str) - f - l); } result->val[result->len] = '\0'; @@ -2587,26 +2584,25 @@ PHP_FUNCTION(substr_replace) Quotes meta characters */ PHP_FUNCTION(quotemeta) { - char *old; + zend_string *old; char *old_end; char *p, *q; char c; - int old_len; zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &old, &old_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &old) == FAILURE) { return; } - old_end = old + old_len; + old_end = old->val + old->len; - if (old == old_end) { + if (old->val == old_end) { RETURN_FALSE; } - str = STR_ALLOC(2 * old_len, 0); + str = STR_ALLOC(2 * old->len, 0); - for (p = old, q = str->val; p != old_end; p++) { + for (p = old->val, q = str->val; p != old_end; p++) { c = *p; switch (c) { case '.': @@ -2650,7 +2646,7 @@ PHP_FUNCTION(ord) ZEND_PARSE_PARAMETERS_END(); #endif - RETURN_LONG((unsigned char) str[0]); + RETURN_INT((unsigned char) str[0]); } /* }}} */ @@ -2658,14 +2654,14 @@ PHP_FUNCTION(ord) Converts ASCII code to a character */ PHP_FUNCTION(chr) { - long c; + php_int_t c; char temp[2]; if (ZEND_NUM_ARGS() != 1) { WRONG_PARAM_COUNT; } - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == FAILURE) { + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "i", &c) == FAILURE) { c = 0; } @@ -2690,24 +2686,23 @@ static void php_ucfirst(char *str) Makes a string's first character uppercase */ PHP_FUNCTION(ucfirst) { - char *str; - int str_len; + zend_string *str; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(str, str_len) + Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); #endif - if (!str_len) { + if (!str->len) { RETURN_EMPTY_STRING(); } - ZVAL_STRINGL(return_value, str, str_len); + ZVAL_STRINGL(return_value, str->val, str->len); php_ucfirst(Z_STRVAL_P(return_value)); } /* }}} */ @@ -2726,18 +2721,17 @@ static void php_lcfirst(char *str) Make a string's first character lowercase */ PHP_FUNCTION(lcfirst) { - char *str; - int str_len; + zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } - if (!str_len) { + if (!str->len) { RETURN_EMPTY_STRING(); } - ZVAL_STRINGL(return_value, str, str_len); + ZVAL_STRINGL(return_value, str->val, str->len); php_lcfirst(Z_STRVAL_P(return_value)); } /* }}} */ @@ -2746,34 +2740,35 @@ PHP_FUNCTION(lcfirst) Uppercase the first character of every word in a string */ PHP_FUNCTION(ucwords) { - char *str, *delims = " \t\r\n\f\v"; + zend_string *str; + char *delims = " \t\r\n\f\v"; register char *r, *r_end; - int str_len, delims_len = 6; + int delims_len = 6; char mask[256]; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &delims, &delims_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|s", &str, &delims, &delims_len) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STRING(str, str_len) + Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_STRING(delims, delims_len) ZEND_PARSE_PARAMETERS_END(); #endif - if (!str_len) { + if (!str->len) { RETURN_EMPTY_STRING(); } php_charmask((unsigned char *)delims, delims_len, mask TSRMLS_CC); - ZVAL_STRINGL(return_value, str, str_len); + ZVAL_STRINGL(return_value, str->val, str->len); r = Z_STRVAL_P(return_value); *r = toupper((unsigned char) *r); - for (r_end = r + Z_STRLEN_P(return_value) - 1; r < r_end; ) { + for (r_end = r + Z_STRSIZE_P(return_value) - 1; r < r_end; ) { if (mask[(unsigned char)*r++]) { *r = toupper((unsigned char) *r); } @@ -2783,9 +2778,9 @@ PHP_FUNCTION(ucwords) /* {{{ php_strtr */ -PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen) +PHPAPI char *php_strtr(char *str, php_size_t len, char *str_from, char *str_to, php_size_t trlen) { - int i; + php_size_t i; unsigned char xlat[256]; if ((trlen < 1) || (len < 1)) { @@ -2816,14 +2811,14 @@ static int php_strtr_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ /* }}} */ /* {{{ php_strtr_array */ -static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *pats TSRMLS_DC) +static void php_strtr_array(zval *return_value, char *str, php_size_t slen, HashTable *pats TSRMLS_DC) { - ulong num_key; + php_uint_t num_key; zend_string *str_key; - int len, pos, found; + php_size_t len, pos, found; int num_keys = 0; - int minlen = 128*1024; - int maxlen = 0; + php_size_t minlen = 128*1024; + php_size_t maxlen = 0; HashTable str_hash, num_hash; zval *entry, tmp, dummy; char *key; @@ -2861,7 +2856,7 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable * zend_hash_init(&str_hash, zend_hash_num_elements(pats), NULL, NULL, 0); ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) { if (UNEXPECTED(!str_key)) { - ZVAL_LONG(&tmp, num_key); + ZVAL_INT(&tmp, num_key); convert_to_string(&tmp); str_key = Z_STR(tmp); len = str_key->len; @@ -3005,10 +3000,10 @@ PHP_FUNCTION(strtr) ZVAL_STRINGL(return_value, str, str_len); php_strtr(Z_STRVAL_P(return_value), - Z_STRLEN_P(return_value), + Z_STRSIZE_P(return_value), Z_STRVAL_P(from), to, - MIN(Z_STRLEN_P(from), + MIN(Z_STRSIZE_P(from), to_len)); } } @@ -3018,21 +3013,20 @@ PHP_FUNCTION(strtr) Reverse a string */ PHP_FUNCTION(strrev) { - char *str; + zend_string *str; char *e, *p; - int str_len; zend_string *n; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } - n = STR_ALLOC(str_len, 0); + n = STR_ALLOC(str->len, 0); p = n->val; - e = str + str_len; + e = str->val + str->len; - while (--e>=str) { + while (--e>=str->val) { *p++ = *e; } @@ -3044,12 +3038,12 @@ PHP_FUNCTION(strrev) /* {{{ php_similar_str */ -static void php_similar_str(const char *txt1, int len1, const char *txt2, int len2, int *pos1, int *pos2, int *max) +static void php_similar_str(const char *txt1, php_size_t len1, const char *txt2, php_size_t len2, php_size_t *pos1, php_size_t *pos2, php_size_t *max) { char *p, *q; char *end1 = (char *) txt1 + len1; char *end2 = (char *) txt2 + len2; - int l; + php_size_t l; *max = 0; for (p = (char *) txt1; p < end1; p++) { @@ -3067,10 +3061,10 @@ static void php_similar_str(const char *txt1, int len1, const char *txt2, int le /* {{{ php_similar_char */ -static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2) +static php_size_t php_similar_char(const char *txt1, php_size_t len1, const char *txt2, php_size_t len2) { - int sum; - int pos1 = 0, pos2 = 0, max; + php_size_t sum; + php_size_t pos1 = 0, pos2 = 0, max; php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); if ((sum = max)) { @@ -3092,13 +3086,12 @@ static int php_similar_char(const char *txt1, int len1, const char *txt2, int le Calculates the similarity between two strings */ PHP_FUNCTION(similar_text) { - char *t1, *t2; + zend_string *t1, *t2; zval *percent = NULL; int ac = ZEND_NUM_ARGS(); - int sim; - int t1_len, t2_len; + php_size_t sim; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z/", &t1, &t1_len, &t2, &t2_len, &percent) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/", &t1, &t2, &percent) == FAILURE) { return; } @@ -3106,31 +3099,31 @@ PHP_FUNCTION(similar_text) convert_to_double_ex(percent); } - if (t1_len + t2_len == 0) { + if (t1->len + t2->len == 0) { if (ac > 2) { Z_DVAL_P(percent) = 0; } - RETURN_LONG(0); + RETURN_INT(0); } - sim = php_similar_char(t1, t1_len, t2, t2_len); + sim = php_similar_char(t1->val, t1->len, t2->val, t2->len); if (ac > 2) { - Z_DVAL_P(percent) = sim * 200.0 / (t1_len + t2_len); + Z_DVAL_P(percent) = sim * 200.0 / (t1->len + t2->len); } - RETURN_LONG(sim); + RETURN_INT(sim); } /* }}} */ /* {{{ php_stripslashes * * be careful, this edits the string in-place */ -PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) +PHPAPI void php_stripslashes(char *str, php_size_t *len TSRMLS_DC) { char *s, *t; - int l; + php_size_t l; if (len != NULL) { l = *len; @@ -3171,22 +3164,21 @@ PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC) Escapes all chars mentioned in charlist with backslash. It creates octal representations if asked to backslash characters with 8th bit set or with ASCII<32 (except '\n', '\r', '\t' etc...) */ PHP_FUNCTION(addcslashes) { - char *str, *what; - int str_len, what_len; + zend_string *str, *what; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &str, &str_len, &what, &what_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &str, &what) == FAILURE) { return; } - if (str_len == 0) { + if (str->len == 0) { RETURN_EMPTY_STRING(); } - if (what_len == 0) { - RETURN_STRINGL(str, str_len); + if (what->len == 0) { + RETURN_STRINGL(str->val, str->len); } - RETURN_STR(php_addcslashes(str, str_len, 0, what, what_len TSRMLS_CC)); + RETURN_STR(php_addcslashes(str->val, str->len, 0, what->val, what->len TSRMLS_CC)); } /* }}} */ @@ -3194,24 +3186,23 @@ PHP_FUNCTION(addcslashes) Escapes single quote, double quotes and backslash characters in a string with backslashes */ PHP_FUNCTION(addslashes) { - char *str; - int str_len; + zend_string *str; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(str, str_len) + Z_PARAM_STR(str) ZEND_PARSE_PARAMETERS_END(); #endif - if (str_len == 0) { + if (str->len == 0) { RETURN_EMPTY_STRING(); } - RETURN_STR(php_addslashes(str, str_len, 0 TSRMLS_CC)); + RETURN_STR(php_addslashes(str->val, str->len, 0 TSRMLS_CC)); } /* }}} */ @@ -3219,15 +3210,14 @@ PHP_FUNCTION(addslashes) Strips backslashes from a string. Uses C-style conventions */ PHP_FUNCTION(stripcslashes) { - char *str; - int str_len; + zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } - ZVAL_STRINGL(return_value, str, str_len); - php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value)); + ZVAL_STRINGL(return_value, str->val, str->len); + php_stripcslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value)); } /* }}} */ @@ -3235,15 +3225,14 @@ PHP_FUNCTION(stripcslashes) Strips backslashes from a string */ PHP_FUNCTION(stripslashes) { - char *str; - int str_len; + zend_string *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { return; } - ZVAL_STRINGL(return_value, str, str_len); - php_stripslashes(Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC); + ZVAL_STRINGL(return_value, str->val, str->len); + php_stripslashes(Z_STRVAL_P(return_value), &Z_STRSIZE_P(return_value) TSRMLS_CC); } /* }}} */ @@ -3268,10 +3257,10 @@ char *php_strerror(int errnum) /* {{{ php_stripcslashes */ -PHPAPI void php_stripcslashes(char *str, int *len) +PHPAPI void php_stripcslashes(char *str, php_size_t *len) { char *source, *target, *end; - int nlen = *len, i; + php_size_t nlen = *len, i; char numtmp[4]; for (source=str, end=str+nlen, target=str; source < end; source++) { @@ -3331,13 +3320,13 @@ PHPAPI void php_stripcslashes(char *str, int *len) /* {{{ php_addcslashes */ -PHPAPI zend_string *php_addcslashes(const char *str, int length, int should_free, char *what, int wlength TSRMLS_DC) +PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int should_free, char *what, php_size_t wlength TSRMLS_DC) { char flags[256]; char *source, *target; char *end; char c; - int newlen; + php_size_t newlen; zend_string *new_str = STR_ALLOC(4 * (length? length : (length = strlen(str))), 0); if (!wlength) { @@ -3381,7 +3370,7 @@ PHPAPI zend_string *php_addcslashes(const char *str, int length, int should_free /* {{{ php_addslashes */ -PHPAPI zend_string *php_addslashes(char *str, int length, int should_free TSRMLS_DC) +PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free TSRMLS_DC) { /* maximum string length, worst case situation */ char *source, *target; @@ -3434,10 +3423,10 @@ PHPAPI zend_string *php_addslashes(char *str, int length, int should_free TSRMLS /* {{{ php_char_to_str_ex */ -PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_len, zval *result, int case_sensitivity, int *replace_count) +PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count) { - int char_count = 0; - int replaced = 0; + php_size_t char_count = 0; + php_size_t replaced = 0; char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL; if (case_sensitivity) { @@ -3507,7 +3496,7 @@ PHPAPI int php_char_to_str_ex(char *str, uint len, char from, char *to, int to_l /* {{{ php_char_to_str */ -PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, zval *result) +PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result) { return php_char_to_str_ex(str, len, from, to, to_len, result, 1, NULL); } @@ -3515,8 +3504,8 @@ PHPAPI int php_char_to_str(char *str, uint len, char from, char *to, int to_len, /* {{{ php_str_to_str_ex */ -PHPAPI zend_string *php_str_to_str_ex(char *haystack, int length, - char *needle, int needle_len, char *str, int str_len, int case_sensitivity, int *replace_count) +PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, + char *needle, php_size_t needle_len, char *str, php_size_t str_len, int case_sensitivity, php_size_t *replace_count) { zend_string *new_str; @@ -3562,7 +3551,7 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, int length, if (str_len < needle_len) { new_str = STR_ALLOC(length, 0); } else { - int count = 0; + php_size_t count = 0; char *o, *n, *endp; if (case_sensitivity) { @@ -3680,7 +3669,7 @@ nothing_todo: /* {{{ php_str_to_str */ -PHPAPI zend_string *php_str_to_str(char *haystack, int length, char *needle, int needle_len, char *str, int str_len) +PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *needle, php_size_t needle_len, char *str, php_size_t str_len) { return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, 1, NULL); } @@ -3688,14 +3677,14 @@ PHPAPI zend_string *php_str_to_str(char *haystack, int length, char *needle, int /* {{{ php_str_replace_in_subject */ -static void php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity, int *replace_count TSRMLS_DC) +static void php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity, php_size_t *replace_count TSRMLS_DC) { zval *search_entry, *replace_entry = NULL, temp_result, tmp_subject; char *replace_value = NULL; - int replace_len = 0; + php_size_t replace_len = 0; HashPosition pos; /* Make sure we're dealing with strings. */ @@ -3708,7 +3697,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec convert_to_string_ex(&tmp_subject); subject = &tmp_subject; } - if (Z_STRLEN_P(subject) == 0) { + if (Z_STRSIZE_P(subject) == 0) { zval_ptr_dtor(&tmp_subject); ZVAL_EMPTY_STRING(result); return; @@ -3725,7 +3714,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec } else { /* Set replacement value to the passed one */ replace_value = Z_STRVAL_P(replace); - replace_len = Z_STRLEN_P(replace); + replace_len = Z_STRSIZE_P(replace); } /* For each entry in the search array, get the entry */ @@ -3733,7 +3722,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec /* Make sure we're dealing with strings. */ SEPARATE_ZVAL(search_entry); convert_to_string(search_entry); - if (Z_STRLEN_P(search_entry) == 0) { + if (Z_STRSIZE_P(search_entry) == 0) { if (Z_TYPE_P(replace) == IS_ARRAY) { zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } @@ -3749,7 +3738,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec /* Set replacement value to the one we got from array */ replace_value = Z_STRVAL_P(replace_entry); - replace_len = Z_STRLEN_P(replace_entry); + replace_len = Z_STRSIZE_P(replace_entry); zend_hash_move_forward_ex(Z_ARRVAL_P(replace), &pos); } else { @@ -3759,18 +3748,18 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec } } - if (Z_STRLEN_P(search_entry) == 1) { + if (Z_STRSIZE_P(search_entry) == 1) { php_char_to_str_ex(Z_STRVAL_P(result), - Z_STRLEN_P(result), + Z_STRSIZE_P(result), Z_STRVAL_P(search_entry)[0], replace_value, replace_len, &temp_result, case_sensitivity, replace_count); - } else if (Z_STRLEN_P(search_entry) > 1) { - ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRLEN_P(result), - Z_STRVAL_P(search_entry), Z_STRLEN_P(search_entry), + } else if (Z_STRSIZE_P(search_entry) > 1) { + ZVAL_STR(&temp_result, php_str_to_str_ex(Z_STRVAL_P(result), Z_STRSIZE_P(result), + Z_STRVAL_P(search_entry), Z_STRSIZE_P(search_entry), replace_value, replace_len, case_sensitivity, replace_count)); } @@ -3778,25 +3767,25 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval *subjec Z_STR_P(result) = Z_STR(temp_result); Z_TYPE_INFO_P(result) = Z_TYPE_INFO(temp_result); - if (Z_STRLEN_P(result) == 0) { + if (Z_STRSIZE_P(result) == 0) { zval_ptr_dtor(&tmp_subject); return; } } ZEND_HASH_FOREACH_END(); } else { - if (Z_STRLEN_P(search) == 1) { + if (Z_STRSIZE_P(search) == 1) { php_char_to_str_ex(Z_STRVAL_P(subject), - Z_STRLEN_P(subject), + Z_STRSIZE_P(subject), Z_STRVAL_P(search)[0], Z_STRVAL_P(replace), - Z_STRLEN_P(replace), + Z_STRSIZE_P(replace), result, case_sensitivity, replace_count); - } else if (Z_STRLEN_P(search) > 1) { - ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRLEN_P(subject), - Z_STRVAL_P(search), Z_STRLEN_P(search), - Z_STRVAL_P(replace), Z_STRLEN_P(replace), case_sensitivity, replace_count)); + } else if (Z_STRSIZE_P(search) > 1) { + ZVAL_STR(result, php_str_to_str_ex(Z_STRVAL_P(subject), Z_STRSIZE_P(subject), + Z_STRVAL_P(search), Z_STRSIZE_P(search), + Z_STRVAL_P(replace), Z_STRSIZE_P(replace), case_sensitivity, replace_count)); } else { ZVAL_DUP(result, subject); } @@ -3812,8 +3801,8 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit zval *subject, *search, *replace, *subject_entry, *zcount = NULL; zval result; zend_string *string_key; - ulong num_key; - int count = 0; + php_uint_t num_key; + php_int_t count = 0; int argc = ZEND_NUM_ARGS(); #ifndef FAST_ZPP @@ -3867,7 +3856,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit } if (argc > 3) { zval_dtor(zcount); - ZVAL_LONG(zcount, count); + ZVAL_INT(zcount, count); } } /* }}} */ @@ -3898,12 +3887,12 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) char *str; char *heb_str, *tmp, *target; int block_start, block_end, block_type, block_length, i; - long max_chars=0; + php_int_t max_chars=0; int begin, end, char_count, orig_begin; int str_len; zend_string *broken_str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &max_chars) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &max_chars) == FAILURE) { return; } @@ -4081,19 +4070,19 @@ PHP_FUNCTION(hebrevc) PHP_FUNCTION(nl2br) { /* in brief this inserts <br /> or <br> before matched regexp \n\r?|\r\n? */ - char *tmp, *str; + char *tmp; + zend_string *str; char *end, *target; - int repl_cnt = 0; - int str_len; + php_size_t repl_cnt = 0; zend_bool is_xhtml = 1; zend_string *result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &is_xhtml) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", &str, &is_xhtml) == FAILURE) { return; } - tmp = str; - end = str + str_len; + tmp = str->val; + end = str->val + str->len; /* it is really faster to scan twice and allocate mem once instead of scanning once and constantly reallocing */ @@ -4114,18 +4103,19 @@ PHP_FUNCTION(nl2br) } if (repl_cnt == 0) { - RETURN_STRINGL(str, str_len); + RETURN_STRINGL(str->val, str->len); } { size_t repl_len = is_xhtml ? (sizeof("<br />") - 1) : (sizeof("<br>") - 1); - result = STR_ALLOC(repl_cnt * repl_len + str_len, 0); + result = STR_ALLOC(repl_cnt * repl_len + str->len, 0); target = result->val; } - while (str < end) { - switch (*str) { + tmp = str->val; + while (tmp < end) { + switch (*tmp) { case '\r': case '\n': *target++ = '<'; @@ -4139,15 +4129,15 @@ PHP_FUNCTION(nl2br) *target++ = '>'; - if ((*str == '\r' && *(str+1) == '\n') || (*str == '\n' && *(str+1) == '\r')) { - *target++ = *str++; + if ((*tmp == '\r' && *(tmp+1) == '\n') || (*tmp == '\n' && *(tmp+1) == '\r')) { + *target++ = *tmp++; } /* lack of a break; is intentional */ default: - *target++ = *str; + *target++ = *tmp; } - str++; + tmp++; } *target = '\0'; @@ -4161,13 +4151,12 @@ PHP_FUNCTION(nl2br) PHP_FUNCTION(strip_tags) { zend_string *buf; - char *str; + zend_string *str; zval *allow=NULL; char *allowed_tags=NULL; int allowed_tags_len=0; - int str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &str, &str_len, &allow) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|z", &str, &allow) == FAILURE) { return; } @@ -4176,16 +4165,16 @@ PHP_FUNCTION(strip_tags) convert_to_string_ex(allow); // TODO: reimplement to avoid reallocation ??? if (IS_INTERNED(Z_STR_P(allow))) { - allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRLEN_P(allow)); - allowed_tags_len = Z_STRLEN_P(allow); + allowed_tags = estrndup(Z_STRVAL_P(allow), Z_STRSIZE_P(allow)); + allowed_tags_len = Z_STRSIZE_P(allow); } else { allowed_tags = Z_STRVAL_P(allow); - allowed_tags_len = Z_STRLEN_P(allow); + allowed_tags_len = Z_STRSIZE_P(allow); } } - buf = STR_INIT(str, str_len, 0); - buf->len = php_strip_tags_ex(buf->val, str_len, NULL, allowed_tags, allowed_tags_len, 0); + buf = STR_INIT(str->val, str->len, 0); + buf->len = php_strip_tags_ex(buf->val, str->len, NULL, allowed_tags, allowed_tags_len, 0); // TODO: reimplement to avoid reallocation ??? if (allow && IS_INTERNED(Z_STR_P(allow))) { @@ -4210,8 +4199,8 @@ PHP_FUNCTION(setlocale) } #ifdef HAVE_SETLOCALE - if (Z_TYPE_P(pcategory) == IS_LONG) { - cat = Z_LVAL_P(pcategory); + if (Z_TYPE_P(pcategory) == IS_INT) { + cat = Z_IVAL_P(pcategory); } else { /* FIXME: The following behaviour should be removed. */ char *category; @@ -4272,7 +4261,7 @@ PHP_FUNCTION(setlocale) loc = NULL; } else { loc = Z_STRVAL(tmp); - if (Z_STRLEN(tmp) >= 255) { + if (Z_STRSIZE(tmp) >= 255) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Specified locale name is too long"); zval_dtor(&tmp); break; @@ -4352,7 +4341,7 @@ PHP_FUNCTION(parse_str) * 0 start tag * 1 first non-whitespace char seen */ -int php_tag_find(char *tag, int len, char *set) { +int php_tag_find(char *tag, php_size_t len, char *set) { char c, *n, *t; int state=0, done=0; char *norm; @@ -4407,7 +4396,7 @@ int php_tag_find(char *tag, int len, char *set) { } /* }}} */ -PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int allow_len) /* {{{ */ +PHPAPI php_size_t php_strip_tags(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len) /* {{{ */ { return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0); } @@ -4433,7 +4422,7 @@ PHPAPI size_t php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, in swm: Added ability to strip <?xml tags without assuming it PHP code. */ -PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow, int allow_len, zend_bool allow_tag_spaces) +PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len, zend_bool allow_tag_spaces) { char *tbuf, *buf, *p, *tp, *rp, c, lc; int br, i=0, depth=0, in_q = 0; @@ -4711,11 +4700,12 @@ reg_char: Parse a CSV string into an array */ PHP_FUNCTION(str_getcsv) { - char *str, delim = ',', enc = '"', esc = '\\'; + zend_string *str; + char delim = ',', enc = '"', esc = '\\'; char *delim_str = NULL, *enc_str = NULL, *esc_str = NULL; - int str_len = 0, delim_len = 0, enc_len = 0, esc_len = 0; + int delim_len = 0, enc_len = 0, esc_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sss", &str, &str_len, &delim_str, &delim_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|sss", &str, &delim_str, &delim_len, &enc_str, &enc_len, &esc_str, &esc_len) == FAILURE) { return; } @@ -4724,7 +4714,7 @@ PHP_FUNCTION(str_getcsv) enc = enc_len ? enc_str[0] : enc; esc = esc_len ? esc_str[0] : esc; - php_fgetcsv(NULL, delim, enc, esc, str_len, str, return_value TSRMLS_CC); + php_fgetcsv(NULL, delim, enc, esc, str->len, str->val, return_value TSRMLS_CC); } /* }}} */ @@ -4732,13 +4722,12 @@ PHP_FUNCTION(str_getcsv) Returns the input string repeat mult times */ PHP_FUNCTION(str_repeat) { - char *input_str; /* Input string */ - int input_len; - long mult; /* Multiplier */ + zend_string *input_str; /* Input string */ + php_int_t mult; /* Multiplier */ zend_string *result; /* Resulting string */ size_t result_len; /* Length of the resulting string */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &input_str, &input_len, &mult) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si", &input_str, &mult) == FAILURE) { return; } @@ -4749,22 +4738,22 @@ PHP_FUNCTION(str_repeat) /* Don't waste our time if it's empty */ /* ... or if the multiplier is zero */ - if (input_len == 0 || mult == 0) + if (input_str->len == 0 || mult == 0) RETURN_EMPTY_STRING(); /* Initialize the result string */ - result = STR_SAFE_ALLOC(input_len, mult, 0, 0); - result_len = input_len * mult; + result = STR_SAFE_ALLOC(input_str->len, mult, 0, 0); + result_len = input_str->len * mult; /* Heavy optimization for situations where input string is 1 byte long */ - if (input_len == 1) { - memset(result->val, *(input_str), mult); + if (input_str->len == 1) { + memset(result->val, *(input_str->val), mult); } else { char *s, *e, *ee; - int l=0; - memcpy(result->val, input_str, input_len); + ptrdiff_t l=0; + memcpy(result->val, input_str->val, input_str->len); s = result->val; - e = result->val + input_len; + e = result->val + input_str->len; ee = result->val + result_len; while (e<ee) { @@ -4784,15 +4773,16 @@ PHP_FUNCTION(str_repeat) Returns info about what characters are used in input */ PHP_FUNCTION(count_chars) { - char *input; + zend_string *input; int chars[256]; - long mymode=0; + php_int_t mymode=0; unsigned char *buf; - int len, inx; + int inx; char retstr[256]; - int retlen=0; + php_size_t retlen=0; + php_size_t tmp = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &input, &len, &mymode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &input, &mymode) == FAILURE) { return; } @@ -4801,13 +4791,13 @@ PHP_FUNCTION(count_chars) RETURN_FALSE; } - buf = (unsigned char *) input; + buf = (unsigned char *) input->val; memset((void*) chars, 0, sizeof(chars)); - while (len > 0) { + while (tmp < input->len) { chars[*buf]++; buf++; - len--; + tmp++; } if (mymode < 3) { @@ -4817,16 +4807,16 @@ PHP_FUNCTION(count_chars) for (inx = 0; inx < 256; inx++) { switch (mymode) { case 0: - add_index_long(return_value, inx, chars[inx]); + add_index_int(return_value, inx, chars[inx]); break; case 1: if (chars[inx] != 0) { - add_index_long(return_value, inx, chars[inx]); + add_index_int(return_value, inx, chars[inx]); } break; case 2: if (chars[inx] == 0) { - add_index_long(return_value, inx, chars[inx]); + add_index_int(return_value, inx, chars[inx]); } break; case 3: @@ -4852,15 +4842,14 @@ PHP_FUNCTION(count_chars) */ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case) { - char *s1, *s2; - int s1_len, s2_len; + zend_string *s1, *s2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &s1, &s1_len, &s2, &s2_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &s1, &s2) == FAILURE) { return; } - RETURN_LONG(strnatcmp_ex(s1, s1_len, - s2, s2_len, + RETURN_INT(strnatcmp_ex(s1->val, s1->len, + s2->val, s2->len, fold_case)); } /* }}} */ @@ -4870,7 +4859,7 @@ PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2 zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_LONG(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive)); + ZVAL_INT(result, strnatcmp_ex(str1->val, str1->len, str2->val, str2->len, case_insensitive)); STR_RELEASE(str1); STR_RELEASE(str2); @@ -4924,14 +4913,14 @@ PHP_FUNCTION(localeconv) len = strlen(currlocdata.grouping); for (i = 0; i < len; i++) { - add_index_long(&grouping, i, currlocdata.grouping[i]); + add_index_int(&grouping, i, currlocdata.grouping[i]); } /* Grab the monetary grouping data out of the array */ len = strlen(currlocdata.mon_grouping); for (i = 0; i < len; i++) { - add_index_long(&mon_grouping, i, currlocdata.mon_grouping[i]); + add_index_int(&mon_grouping, i, currlocdata.mon_grouping[i]); } add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point); @@ -4942,21 +4931,21 @@ PHP_FUNCTION(localeconv) add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep); add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign); add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign); - add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits); - add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits); - add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); - add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); - add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); - add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); - add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn); - add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn); + add_assoc_int( return_value, "int_frac_digits", currlocdata.int_frac_digits); + add_assoc_int( return_value, "frac_digits", currlocdata.frac_digits); + add_assoc_int( return_value, "p_cs_precedes", currlocdata.p_cs_precedes); + add_assoc_int( return_value, "p_sep_by_space", currlocdata.p_sep_by_space); + add_assoc_int( return_value, "n_cs_precedes", currlocdata.n_cs_precedes); + add_assoc_int( return_value, "n_sep_by_space", currlocdata.n_sep_by_space); + add_assoc_int( return_value, "p_sign_posn", currlocdata.p_sign_posn); + add_assoc_int( return_value, "n_sign_posn", currlocdata.n_sign_posn); } #else /* Ok, it doesn't look like we have locale info floating around, so I guess it wouldn't hurt to just go ahead and return the POSIX locale information? */ - add_index_long(&grouping, 0, -1); - add_index_long(&mon_grouping, 0, -1); + add_index_int(&grouping, 0, -1); + add_index_int(&mon_grouping, 0, -1); add_assoc_string(return_value, "decimal_point", "\x2E"); add_assoc_string(return_value, "thousands_sep", ""); @@ -4966,14 +4955,14 @@ PHP_FUNCTION(localeconv) add_assoc_string(return_value, "mon_thousands_sep", ""); add_assoc_string(return_value, "positive_sign", ""); add_assoc_string(return_value, "negative_sign", ""); - add_assoc_long( return_value, "int_frac_digits", CHAR_MAX); - add_assoc_long( return_value, "frac_digits", CHAR_MAX); - add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX); - add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX); - add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX); - add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX); - add_assoc_long( return_value, "p_sign_posn", CHAR_MAX); - add_assoc_long( return_value, "n_sign_posn", CHAR_MAX); + add_assoc_int( return_value, "int_frac_digits", CHAR_MAX); + add_assoc_int( return_value, "frac_digits", CHAR_MAX); + add_assoc_int( return_value, "p_cs_precedes", CHAR_MAX); + add_assoc_int( return_value, "p_sep_by_space", CHAR_MAX); + add_assoc_int( return_value, "n_cs_precedes", CHAR_MAX); + add_assoc_int( return_value, "n_sep_by_space", CHAR_MAX); + add_assoc_int( return_value, "p_sign_posn", CHAR_MAX); + add_assoc_int( return_value, "n_sign_posn", CHAR_MAX); #endif zend_hash_str_update(Z_ARRVAL_P(return_value), "grouping", sizeof("grouping")-1, &grouping); @@ -4994,13 +4983,13 @@ PHP_FUNCTION(strnatcasecmp) PHP_FUNCTION(substr_count) { char *haystack, *needle; - long offset = 0, length = 0; + php_int_t offset = 0, length = 0; int ac = ZEND_NUM_ARGS(); int count = 0; int haystack_len, needle_len; char *p, *endp, cmp; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ii", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { return; } @@ -5018,7 +5007,7 @@ PHP_FUNCTION(substr_count) } if (offset > haystack_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value %ld exceeds string length", offset); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value " ZEND_INT_FMT " exceeds string length", offset); RETURN_FALSE; } p += offset; @@ -5030,7 +5019,7 @@ PHP_FUNCTION(substr_count) RETURN_FALSE; } if (length > (haystack_len - offset)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string length", length); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value " ZEND_INT_FMT " exceeds string length", length); RETURN_FALSE; } endp = p + length; @@ -5050,7 +5039,7 @@ PHP_FUNCTION(substr_count) } } - RETURN_LONG(count); + RETURN_INT(count); } /* }}} */ @@ -5059,30 +5048,37 @@ PHP_FUNCTION(substr_count) PHP_FUNCTION(str_pad) { /* Input arguments */ - char *input; /* Input string */ - int input_len; - long pad_length; /* Length to pad to */ + zend_string *input; /* Input string */ + php_int_t pad_length; /* Length to pad to */ /* Helper variables */ size_t num_pad_chars; /* Number of padding characters (total - input size) */ - char *pad_str_val = " "; /* Pointer to padding string */ - int pad_str_len = 1; /* Length of the padding string */ - long pad_type_val = STR_PAD_RIGHT; /* The padding type value */ + zend_string *pad_str, *pad_str_save; /* Pointer to padding string */ + php_int_t pad_type_val = STR_PAD_RIGHT; /* The padding type value */ int i, left_pad=0, right_pad=0; zend_string *result = NULL; /* Resulting string */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|sl", &input, &input_len, &pad_length, - &pad_str_val, &pad_str_len, &pad_type_val) == FAILURE) { + pad_str = pad_str_save = STR_INIT(" ", 1, 1); + if (!pad_str) { + return; + } + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|Si", &input, &pad_length, &pad_str, &pad_type_val) == FAILURE) { + STR_FREE(pad_str); return; } + if (pad_str != pad_str_save) { + STR_FREE(pad_str_save); + } + /* If resulting string turns out to be shorter than input string, we simply copy the input and return. */ - if (pad_length <= 0 || (pad_length - input_len) <= 0) { - RETURN_STRINGL(input, input_len); + if (pad_length < 0 || pad_length <= input->len) { + RETURN_STRINGL(input->val, input->len); } - if (pad_str_len == 0) { + if (pad_str->len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding string cannot be empty"); return; } @@ -5092,13 +5088,13 @@ PHP_FUNCTION(str_pad) return; } - num_pad_chars = pad_length - input_len; + num_pad_chars = pad_length - input->len; if (num_pad_chars >= INT_MAX) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Padding length is too long"); return; } - result = STR_ALLOC(input_len + num_pad_chars, 0); + result = STR_ALLOC(input->len + num_pad_chars, 0); result->len = 0; /* We need to figure out the left/right padding lengths. */ @@ -5121,15 +5117,15 @@ PHP_FUNCTION(str_pad) /* First we pad on the left. */ for (i = 0; i < left_pad; i++) - result->val[result->len++] = pad_str_val[i % pad_str_len]; + result->val[result->len++] = pad_str->val[i % pad_str->len]; /* Then we copy the input string. */ - memcpy(result->val + result->len, input, input_len); - result->len += input_len; + memcpy(result->val + result->len, input->val, input->len); + result->len += input->len; /* Finally, we pad on the right. */ for (i = 0; i < right_pad; i++) - result->val[result->len++] = pad_str_val[i % pad_str_len]; + result->val[result->len++] = pad_str->val[i % pad_str->len]; result->val[result->len] = '\0'; @@ -5165,22 +5161,21 @@ static char rot13_to[] = "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; Perform the rot13 transform on a string */ PHP_FUNCTION(str_rot13) { - char *arg; - int arglen; + zend_string *arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg) == FAILURE) { return; } - RETVAL_STRINGL(arg, arglen); + RETVAL_STRINGL(arg->val, arg->len); - php_strtr(Z_STRVAL_P(return_value), Z_STRLEN_P(return_value), rot13_from, rot13_to, 52); + php_strtr(Z_STRVAL_P(return_value), Z_STRSIZE_P(return_value), rot13_from, rot13_to, 52); } /* }}} */ -static void php_string_shuffle(char *str, long len TSRMLS_DC) /* {{{ */ +static void php_string_shuffle(char *str, php_int_t len TSRMLS_DC) /* {{{ */ { - long n_elems, rnd_idx, n_left; + php_int_t n_elems, rnd_idx, n_left; char temp; /* The implementation is stolen from array_data_shuffle */ /* Thus the characteristics of the randomization are the same */ @@ -5208,16 +5203,15 @@ static void php_string_shuffle(char *str, long len TSRMLS_DC) /* {{{ */ Shuffles string. One permutation of all possible is created */ PHP_FUNCTION(str_shuffle) { - char *arg; - int arglen; + zend_string *arg; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arglen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg) == FAILURE) { return; } - RETVAL_STRINGL(arg, arglen); - if (Z_STRLEN_P(return_value) > 1) { - php_string_shuffle(Z_STRVAL_P(return_value), (long) Z_STRLEN_P(return_value) TSRMLS_CC); + RETVAL_STRINGL(arg->val, arg->len); + if (Z_STRSIZE_P(return_value) > 1) { + php_string_shuffle(Z_STRVAL_P(return_value), (php_int_t) Z_STRSIZE_P(return_value) TSRMLS_CC); } } /* }}} */ @@ -5235,11 +5229,12 @@ PHP_FUNCTION(str_shuffle) */ PHP_FUNCTION(str_word_count) { - char *str, *char_list = NULL, *p, *e, *s, ch[256]; - int str_len, char_list_len = 0, word_count = 0; - long type = 0; + zend_string *str; + char *char_list = NULL, *p, *e, *s, ch[256]; + int char_list_len = 0, word_count = 0; + php_int_t type = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|is", &str, &type, &char_list, &char_list_len) == FAILURE) { return; } @@ -5247,18 +5242,18 @@ PHP_FUNCTION(str_word_count) case 1: case 2: array_init(return_value); - if (!str_len) { + if (!str->len) { return; } break; case 0: - if (!str_len) { - RETURN_LONG(0); + if (!str->len) { + RETURN_INT(0); } /* nothing to be done */ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value %ld", type); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value " ZEND_INT_FMT, type); RETURN_FALSE; } @@ -5266,8 +5261,8 @@ PHP_FUNCTION(str_word_count) php_charmask((unsigned char *)char_list, char_list_len, ch TSRMLS_CC); } - p = str; - e = str + str_len; + p = str->val; + e = str->val + str->len; /* first character cannot be ' or -, unless explicitly allowed by the user */ if ((*p == '\'' && (!char_list || !ch['\''])) || (*p == '-' && (!char_list || !ch['-']))) { @@ -5290,7 +5285,7 @@ PHP_FUNCTION(str_word_count) add_next_index_stringl(return_value, s, p - s); break; case 2: - add_index_stringl(return_value, (s - str), s, p - s); + add_index_stringl(return_value, (s - str->val), s, p - s); break; default: word_count++; @@ -5301,7 +5296,7 @@ PHP_FUNCTION(str_word_count) } if (!type) { - RETURN_LONG(word_count); + RETURN_INT(word_count); } } @@ -5352,13 +5347,12 @@ PHP_FUNCTION(money_format) Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long. */ PHP_FUNCTION(str_split) { - char *str; - int str_len; - long split_length = 1; + zend_string *str; + php_int_t split_length = 1; char *p; - int n_reg_segments; + php_size_t n_reg_segments; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &split_length) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|i", &str, &split_length) == FAILURE) { return; } @@ -5367,23 +5361,25 @@ PHP_FUNCTION(str_split) RETURN_FALSE; } - array_init_size(return_value, ((str_len - 1) / split_length) + 1); - if (split_length >= str_len) { - add_next_index_stringl(return_value, str, str_len); + if (0 == str->len || split_length >= str->len) { + array_init_size(return_value, 1); + add_next_index_stringl(return_value, str->val, str->len); return; } - n_reg_segments = str_len / split_length; - p = str; + array_init_size(return_value, ((str->len - 1) / split_length) + 1); + + n_reg_segments = str->len / split_length; + p = str->val; while (n_reg_segments-- > 0) { add_next_index_stringl(return_value, p, split_length); p += split_length; } - if (p != (str + str_len)) { - add_next_index_stringl(return_value, p, (str + str_len - p)); + if (p != (str->val + str->len)) { + add_next_index_stringl(return_value, p, (str->val + str->len - p)); } } /* }}} */ @@ -5392,23 +5388,22 @@ PHP_FUNCTION(str_split) Search a string for any of a set of characters */ PHP_FUNCTION(strpbrk) { - char *haystack, *char_list; - int haystack_len, char_list_len; + zend_string *haystack, *char_list; char *haystack_ptr, *cl_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &haystack, &haystack_len, &char_list, &char_list_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &haystack, &char_list) == FAILURE) { RETURN_FALSE; } - if (!char_list_len) { + if (!char_list->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The character list cannot be empty"); RETURN_FALSE; } - for (haystack_ptr = haystack; haystack_ptr < (haystack + haystack_len); ++haystack_ptr) { - for (cl_ptr = char_list; cl_ptr < (char_list + char_list_len); ++cl_ptr) { + for (haystack_ptr = haystack->val; haystack_ptr < (haystack->val + haystack->len); ++haystack_ptr) { + for (cl_ptr = char_list->val; cl_ptr < (char_list->val + char_list->len); ++cl_ptr) { if (*cl_ptr == *haystack_ptr) { - RETURN_STRINGL(haystack_ptr, (haystack + haystack_len - haystack_ptr)); + RETURN_STRINGL(haystack_ptr, (haystack->val + haystack->len - haystack_ptr)); } } } @@ -5421,19 +5416,18 @@ PHP_FUNCTION(strpbrk) Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters */ PHP_FUNCTION(substr_compare) { - char *s1, *s2; - int s1_len, s2_len; - long offset, len=0; + zend_string *s1, *s2; + php_int_t offset, len=0; zend_bool cs=0; - uint cmp_len; + php_size_t cmp_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl|lb", &s1, &s1_len, &s2, &s2_len, &offset, &len, &cs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSi|ib", &s1, &s2, &offset, &len, &cs) == FAILURE) { RETURN_FALSE; } if (ZEND_NUM_ARGS() >= 4 && len <= 0) { if (len == 0) { - RETURN_LONG(0L); + RETURN_INT(0L); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length must be greater than or equal to zero"); RETURN_FALSE; @@ -5441,21 +5435,21 @@ PHP_FUNCTION(substr_compare) } if (offset < 0) { - offset = s1_len + offset; + offset = s1->len + offset; offset = (offset < 0) ? 0 : offset; } - if (offset >= s1_len) { + if (offset >= s1->len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length"); RETURN_FALSE; } - cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset))); + cmp_len = (php_size_t) (len ? len : MAX(s2->len, (s1->len - offset))); if (!cs) { - RETURN_LONG(zend_binary_strncmp(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + RETURN_INT(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); } else { - RETURN_LONG(zend_binary_strncasecmp_l(s1 + offset, (s1_len - offset), s2, s2_len, cmp_len)); + RETURN_INT(zend_binary_strncasecmp_l(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); } } /* }}} */ diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index acbffe49ad..65dda069d5 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -41,59 +41,59 @@ PHP_MINIT_FUNCTION(syslog) { /* error levels */ - REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ - REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ - REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ - REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */ + REGISTER_INT_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */ + REGISTER_INT_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */ + REGISTER_INT_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT); /* facility: type of program logging the message */ - REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ - REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ - REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ - REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */ + REGISTER_INT_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */ + REGISTER_INT_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */ + REGISTER_INT_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT); #ifdef LOG_NEWS /* No LOG_NEWS on HP-UX */ - REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ + REGISTER_INT_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */ #endif #ifdef LOG_UUCP /* No LOG_UUCP on HP-UX */ - REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_CRON /* apparently some systems don't have this one */ - REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_AUTHPRIV /* AIX doesn't have LOG_AUTHPRIV */ - REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); #endif #ifndef PHP_WIN32 - REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT); #endif /* options */ - REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT); #ifdef LOG_NOWAIT - REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT); #endif #ifdef LOG_PERROR /* AIX doesn't have LOG_PERROR */ - REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ + REGISTER_INT_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/ #endif BG(syslog_device)=NULL; @@ -135,10 +135,10 @@ PHP_MSHUTDOWN_FUNCTION(syslog) PHP_FUNCTION(openlog) { char *ident; - long option, facility; + php_int_t option, facility; int ident_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sll", &ident, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sii", &ident, &ident_len, &option, &facility) == FAILURE) { return; } @@ -175,11 +175,11 @@ PHP_FUNCTION(closelog) Generate a system log message */ PHP_FUNCTION(syslog) { - long priority; + php_int_t priority; char *message; int message_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &priority, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "is", &priority, &message, &message_len) == FAILURE) { return; } diff --git a/ext/standard/type.c b/ext/standard/type.c index 2a2988dee5..574744d9ba 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -41,7 +41,7 @@ PHP_FUNCTION(gettype) RETVAL_STRING("boolean"); break; - case IS_LONG: + case IS_INT: RETVAL_STRING("integer"); break; @@ -103,9 +103,9 @@ PHP_FUNCTION(settype) ZVAL_DEREF(var); SEPARATE_ZVAL_NOREF(var); if (!strcasecmp(type, "integer")) { - convert_to_long(var); + convert_to_int(var); } else if (!strcasecmp(type, "int")) { - convert_to_long(var); + convert_to_int(var); } else if (!strcasecmp(type, "float")) { convert_to_double(var); } else if (!strcasecmp(type, "double")) { /* deprecated */ @@ -138,25 +138,25 @@ PHP_FUNCTION(settype) PHP_FUNCTION(intval) { zval *num; - long base = 10; + php_int_t base = 10; if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 2) { WRONG_PARAM_COUNT; } #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &num, &base) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|i", &num, &base) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(num) Z_PARAM_OPTIONAL - Z_PARAM_LONG(base) + Z_PARAM_INT(base) ZEND_PARSE_PARAMETERS_END(); #endif RETVAL_ZVAL(num, 1, 0); - convert_to_long_base(return_value, base); + convert_to_int_base(return_value, base); } /* }}} */ @@ -277,7 +277,7 @@ PHP_FUNCTION(is_bool) Returns true if variable is a long (integer) */ PHP_FUNCTION(is_long) { - php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); + php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_INT); } /* }}} */ @@ -324,13 +324,13 @@ PHP_FUNCTION(is_numeric) } switch (Z_TYPE_P(arg)) { - case IS_LONG: + case IS_INT: case IS_DOUBLE: RETURN_TRUE; break; case IS_STRING: - if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 0)) { + if (is_numeric_string(Z_STRVAL_P(arg), Z_STRSIZE_P(arg), NULL, NULL, 0)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -364,7 +364,7 @@ PHP_FUNCTION(is_scalar) case IS_FALSE: case IS_TRUE: case IS_DOUBLE: - case IS_LONG: + case IS_INT: case IS_STRING: RETURN_TRUE; break; diff --git a/ext/standard/url.c b/ext/standard/url.c index 3b9b22af90..f0f199c00b 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -186,10 +186,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) } if (pp - p > 0 && pp - p < 6 && (*pp == '/' || *pp == '\0')) { - long port; + php_int_t port; memcpy(port_buf, p, (pp - p)); port_buf[pp - p] = '\0'; - port = strtol(port_buf, NULL, 10); + port = ZEND_STRTOI(port_buf, NULL, 10); if (port > 0 && port <= 65535) { ret->port = (unsigned short) port; } else { @@ -280,10 +280,10 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) efree(ret); return NULL; } else if (e - p > 0) { - long port; + php_int_t port; memcpy(port_buf, p, (e - p)); port_buf[e - p] = '\0'; - port = strtol(port_buf, NULL, 10); + port = ZEND_STRTOI(port_buf, NULL, 10); if (port > 0 && port <= 65535) { ret->port = (unsigned short)port; } else { @@ -377,9 +377,9 @@ PHP_FUNCTION(parse_url) char *str; int str_len; php_url *resource; - long key = -1; + php_int_t key = -1; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &key) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &str, &str_len, &key) == FAILURE) { return; } @@ -398,7 +398,7 @@ PHP_FUNCTION(parse_url) if (resource->host != NULL) RETVAL_STRING(resource->host); break; case PHP_URL_PORT: - if (resource->port != 0) RETVAL_LONG(resource->port); + if (resource->port != 0) RETVAL_INT(resource->port); break; case PHP_URL_USER: if (resource->user != NULL) RETVAL_STRING(resource->user); @@ -416,7 +416,7 @@ PHP_FUNCTION(parse_url) if (resource->fragment != NULL) RETVAL_STRING(resource->fragment); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier %ld", key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier " ZEND_INT_FMT, key); RETVAL_FALSE; } goto done; @@ -431,7 +431,7 @@ PHP_FUNCTION(parse_url) if (resource->host != NULL) add_assoc_string(return_value, "host", resource->host); if (resource->port != 0) - add_assoc_long(return_value, "port", resource->port); + add_assoc_int(return_value, "port", resource->port); if (resource->user != NULL) add_assoc_string(return_value, "user", resource->user); if (resource->pass != NULL) @@ -719,9 +719,9 @@ PHP_FUNCTION(get_headers) php_stream *stream; zval *prev_val, *hdr = NULL, *h; HashTable *hashT; - long format = 0; + php_int_t format = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &url, &url_len, &format) == FAILURE) { return; } context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); @@ -769,10 +769,10 @@ no_name_header: } if ((prev_val = zend_hash_str_find(HASH_OF(return_value), Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr)))) == NULL) { - add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); + add_assoc_stringl_ex(return_value, Z_STRVAL_P(hdr), (p - Z_STRVAL_P(hdr) + 1), s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr)))); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(prev_val); - add_next_index_stringl(prev_val, s, (Z_STRLEN_P(hdr) - (s - Z_STRVAL_P(hdr)))); + add_next_index_stringl(prev_val, s, (Z_STRSIZE_P(hdr) - (s - Z_STRVAL_P(hdr)))); } *p = c; diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index fc865b64a7..8ed49e6efc 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -1,5 +1,4 @@ /* Generated by re2c 0.13.5 */ -#line 1 "ext/standard/url_scanner_ex.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -100,7 +99,6 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=,fieldset=", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals) PHP_INI_END() -#line 107 "ext/standard/url_scanner_ex.re" #define YYFILL(n) goto done @@ -119,7 +117,6 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st scan: -#line 123 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -165,19 +162,13 @@ scan: if (yych <= '9') goto yy6; if (yych >= ';') goto yy4; ++YYCURSOR; -#line 125 "ext/standard/url_scanner_ex.re" { smart_str_append(dest, url); return; } -#line 171 "ext/standard/url_scanner_ex.c" yy4: ++YYCURSOR; -#line 126 "ext/standard/url_scanner_ex.re" { sep = separator; goto scan; } -#line 176 "ext/standard/url_scanner_ex.c" yy6: ++YYCURSOR; -#line 127 "ext/standard/url_scanner_ex.re" { bash = p - 1; goto done; } -#line 181 "ext/standard/url_scanner_ex.c" yy8: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -185,11 +176,8 @@ yy8: if (yybm[0+yych] & 128) { goto yy8; } -#line 128 "ext/standard/url_scanner_ex.re" { goto scan; } -#line 191 "ext/standard/url_scanner_ex.c" } -#line 129 "ext/standard/url_scanner_ex.re" done: @@ -374,7 +362,6 @@ state_plain_begin: state_plain: start = YYCURSOR; -#line 378 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -417,9 +404,7 @@ state_plain: goto yy15; } ++YYCURSOR; -#line 313 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_TAG; goto state_tag; } -#line 423 "ext/standard/url_scanner_ex.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -427,17 +412,13 @@ yy15: if (yybm[0+yych] & 128) { goto yy15; } -#line 314 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain; } -#line 433 "ext/standard/url_scanner_ex.c" } -#line 315 "ext/standard/url_scanner_ex.re" state_tag: start = YYCURSOR; -#line 441 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -488,14 +469,10 @@ yy20: yych = *YYCURSOR; goto yy25; yy21: -#line 320 "ext/standard/url_scanner_ex.re" { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); if (STATE == STATE_PLAIN) goto state_plain; else goto state_next_arg; } -#line 494 "ext/standard/url_scanner_ex.c" yy22: ++YYCURSOR; -#line 321 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 499 "ext/standard/url_scanner_ex.c" yy24: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -506,7 +483,6 @@ yy25: } goto yy21; } -#line 322 "ext/standard/url_scanner_ex.re" state_next_arg_begin: @@ -515,7 +491,6 @@ state_next_arg_begin: state_next_arg: start = YYCURSOR; -#line 519 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -580,28 +555,20 @@ yy28: ++YYCURSOR; if ((yych = *YYCURSOR) == '>') goto yy39; yy29: -#line 333 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_plain_begin; } -#line 586 "ext/standard/url_scanner_ex.c" yy30: ++YYCURSOR; yy31: -#line 330 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_form(STD_ARGS); goto state_plain_begin; } -#line 592 "ext/standard/url_scanner_ex.c" yy32: ++YYCURSOR; yych = *YYCURSOR; goto yy38; yy33: -#line 331 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg; } -#line 600 "ext/standard/url_scanner_ex.c" yy34: ++YYCURSOR; -#line 332 "ext/standard/url_scanner_ex.re" { --YYCURSOR; STATE = STATE_ARG; goto state_arg; } -#line 605 "ext/standard/url_scanner_ex.c" yy36: yych = *++YYCURSOR; goto yy29; @@ -619,13 +586,11 @@ yy39: yych = *YYCURSOR; goto yy31; } -#line 334 "ext/standard/url_scanner_ex.re" state_arg: start = YYCURSOR; -#line 629 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -673,14 +638,10 @@ yy42: yych = *YYCURSOR; goto yy47; yy43: -#line 339 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; goto state_before_val; } -#line 679 "ext/standard/url_scanner_ex.c" yy44: ++YYCURSOR; -#line 340 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; goto state_next_arg; } -#line 684 "ext/standard/url_scanner_ex.c" yy46: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -691,13 +652,11 @@ yy47: } goto yy43; } -#line 341 "ext/standard/url_scanner_ex.re" state_before_val: start = YYCURSOR; -#line 701 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -744,17 +703,13 @@ yy50: if (yych == ' ') goto yy57; if (yych == '=') goto yy55; yy51: -#line 347 "ext/standard/url_scanner_ex.re" { --YYCURSOR; goto state_next_arg_begin; } -#line 750 "ext/standard/url_scanner_ex.c" yy52: ++YYCURSOR; yych = *YYCURSOR; goto yy56; yy53: -#line 346 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); STATE = STATE_VAL; goto state_val; } -#line 758 "ext/standard/url_scanner_ex.c" yy54: yych = *++YYCURSOR; goto yy51; @@ -776,14 +731,12 @@ yy57: YYCURSOR = YYMARKER; goto yy51; } -#line 348 "ext/standard/url_scanner_ex.re" state_val: start = YYCURSOR; -#line 787 "ext/standard/url_scanner_ex.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -844,9 +797,7 @@ state_val: yych = *(YYMARKER = ++YYCURSOR); if (yych != '>') goto yy76; yy63: -#line 357 "ext/standard/url_scanner_ex.re" { passthru(STD_ARGS); goto state_next_arg_begin; } -#line 850 "ext/standard/url_scanner_ex.c" yy64: yych = *(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy63; @@ -856,9 +807,7 @@ yy65: yych = *YYCURSOR; goto yy69; yy66: -#line 356 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 0, ' '); goto state_next_arg_begin; } -#line 862 "ext/standard/url_scanner_ex.c" yy67: yych = *++YYCURSOR; goto yy63; @@ -885,9 +834,7 @@ yy72: goto yy63; yy73: ++YYCURSOR; -#line 355 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 1, '\''); goto state_next_arg_begin; } -#line 891 "ext/standard/url_scanner_ex.c" yy75: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -898,11 +845,8 @@ yy76: } if (yych >= '>') goto yy72; ++YYCURSOR; -#line 354 "ext/standard/url_scanner_ex.re" { handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; } -#line 904 "ext/standard/url_scanner_ex.c" } -#line 358 "ext/standard/url_scanner_ex.re" stop: diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 7dce126ac3..f9c94186f1 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -113,13 +113,13 @@ PHP_MINIT_FUNCTION(user_filters) return FAILURE; } - REGISTER_LONG_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_PASS_ON", PSFS_PASS_ON, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FEED_ME", PSFS_FEED_ME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_ERR_FATAL", PSFS_ERR_FATAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FLAG_NORMAL", PSFS_FLAG_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_INC", PSFS_FLAG_FLUSH_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("PSFS_FLAG_FLUSH_CLOSE", PSFS_FLAG_FLUSH_CLOSE, CONST_CS | CONST_PERSISTENT); return SUCCESS; } @@ -203,7 +203,7 @@ php_stream_filter_status_t userfilter_filter( ZEND_REGISTER_RESOURCE(&args[1], buckets_out, le_bucket_brigade); if (bytes_consumed) { - ZVAL_LONG(&args[2], *bytes_consumed); + ZVAL_INT(&args[2], *bytes_consumed); } else { ZVAL_NULL(&args[2]); } @@ -220,14 +220,14 @@ php_stream_filter_status_t userfilter_filter( zval_ptr_dtor(&func_name); if (call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { - convert_to_long(&retval); - ret = Z_LVAL(retval); + convert_to_int(&retval); + ret = Z_IVAL(retval); } else if (call_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to call filter function"); } if (bytes_consumed) { - *bytes_consumed = Z_LVAL_P(&args[2]); + *bytes_consumed = Z_IVAL_P(&args[2]); } if (buckets_in->head) { @@ -424,7 +424,7 @@ PHP_FUNCTION(stream_bucket_make_writeable) /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); - add_property_long(return_value, "datalen", bucket->buflen); + add_property_int(return_value, "datalen", bucket->buflen); } } /* }}} */ @@ -453,9 +453,9 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if (!bucket->own_buf) { bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); } - if ((int)bucket->buflen != Z_STRLEN_P(pzdata)) { - bucket->buf = perealloc(bucket->buf, Z_STRLEN_P(pzdata), bucket->is_persistent); - bucket->buflen = Z_STRLEN_P(pzdata); + if ((int)bucket->buflen != Z_STRSIZE_P(pzdata)) { + bucket->buf = perealloc(bucket->buf, Z_STRSIZE_P(pzdata), bucket->is_persistent); + bucket->buflen = Z_STRSIZE_P(pzdata); } memcpy(bucket->buf, Z_STRVAL_P(pzdata), bucket->buflen); } @@ -525,7 +525,7 @@ PHP_FUNCTION(stream_bucket_new) /* add_property_zval increments the refcount which is unwanted here */ zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen); - add_property_long(return_value, "datalen", bucket->buflen); + add_property_int(return_value, "datalen", bucket->buflen); } /* }}} */ diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index 0689de5636..5e2ad73c72 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -65,9 +65,9 @@ #define PHP_UU_DEC(c) (((c) - ' ') & 077) -PHPAPI zend_string *php_uuencode(char *src, int src_len) /* {{{ */ +PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */ { - int len = 45; + php_size_t len = 45; char *p, *s, *e, *ee; zend_string *dest; @@ -127,9 +127,9 @@ PHPAPI zend_string *php_uuencode(char *src, int src_len) /* {{{ */ } /* }}} */ -PHPAPI zend_string *php_uudecode(char *src, int src_len) /* {{{ */ +PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len) /* {{{ */ { - int len, total_len=0; + php_size_t len, total_len=0; char *s, *e, *p, *ee; zend_string *dest; @@ -199,14 +199,13 @@ err: uuencode a string */ PHP_FUNCTION(convert_uuencode) { - char *src; - int src_len; + zend_string *src; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &src) == FAILURE || src->len < 1) { RETURN_FALSE; } - RETURN_STR(php_uuencode(src, src_len)); + RETURN_STR(php_uuencode(src->val, src->len)); } /* }}} */ @@ -214,15 +213,14 @@ PHP_FUNCTION(convert_uuencode) decode a uuencoded string */ PHP_FUNCTION(convert_uudecode) { - char *src; - int src_len; + zend_string *src; zend_string *dest; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &src, &src_len) == FAILURE || src_len < 1) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &src) == FAILURE || src->len < 1) { RETURN_FALSE; } - if ((dest = php_uudecode(src, src_len)) == NULL) { + if ((dest = php_uudecode(src->val, src->len)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The given parameter is not a valid uuencoded string"); RETURN_FALSE; } diff --git a/ext/standard/var.c b/ext/standard/var.c index 96b1ee40ec..2c94942b94 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -54,10 +54,10 @@ static uint zend_obj_num_elements(HashTable *ht) return num; } -static void php_array_element_dump(zval *zv, ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void php_array_element_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ - php_printf("%*c[%ld]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ php_printf("%*c[\"", level + 1, ' '); PHPWRITE(key->val, key->len); @@ -67,12 +67,12 @@ static void php_array_element_dump(zval *zv, ulong index, zend_string *key, int } /* }}} */ -static void php_object_property_dump(zval *zv, ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void php_object_property_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { const char *prop_name, *class_name; if (key == NULL) { /* numeric key */ - php_printf("%*c[%ld]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ int unmangle = zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); @@ -100,7 +100,7 @@ PHPAPI void php_var_dump(zval *struc, int level TSRMLS_DC) /* {{{ */ zend_string *class_name; int is_temp; int is_ref = 0; - ulong num; + php_uint_t num; zend_string *key; zval *val; @@ -119,15 +119,15 @@ again: case IS_NULL: php_printf("%sNULL\n", COMMON); break; - case IS_LONG: - php_printf("%sint(%ld)\n", COMMON, Z_LVAL_P(struc)); + case IS_INT: + php_printf("%sint(" ZEND_INT_FMT ")\n", COMMON, Z_IVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc)); - PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc)); + PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); PUTS("\"\n"); break; case IS_ARRAY: @@ -171,7 +171,7 @@ again: php_printf("%sobject(unknown class)#%d (%d) {\n", COMMON, Z_OBJ_HANDLE_P(struc), myht ? zend_obj_num_elements(myht) : 0); } if (myht) { - ulong num; + php_uint_t num; zend_string *key; zval *val; @@ -227,10 +227,10 @@ PHP_FUNCTION(var_dump) } /* }}} */ -static void zval_array_element_dump(zval *zv, ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void zval_array_element_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ - php_printf("%*c[%ld]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ php_printf("%*c[\"", level + 1, ' '); PHPWRITE(key->val, key->len); @@ -240,12 +240,12 @@ static void zval_array_element_dump(zval *zv, ulong index, zend_string *key, int } /* }}} */ -static void zval_object_property_dump(zval *zv, ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ +static void zval_object_property_dump(zval *zv, php_uint_t index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { const char *prop_name, *class_name; if (key == NULL) { /* numeric key */ - php_printf("%*c[%ld]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); @@ -271,7 +271,7 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level TSRMLS_DC) /* {{{ */ zend_string *class_name; int is_temp = 0; int is_ref = 0; - ulong index; + php_uint_t index; zend_string *key; zval *val; @@ -290,15 +290,15 @@ again: case IS_NULL: php_printf("%sNULL\n", COMMON); break; - case IS_LONG: - php_printf("%slong(%ld)\n", COMMON, Z_LVAL_P(struc)); + case IS_INT: + php_printf("%slong(" ZEND_INT_FMT ")\n", COMMON, Z_IVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sdouble(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); break; case IS_STRING: - php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc)); - PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_printf("%sstring(%d) \"", COMMON, Z_STRSIZE_P(struc)); + PHPWRITE(Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); php_printf("\" refcount(%u)\n", IS_INTERNED(Z_STR_P(struc)) ? 1 : Z_REFCOUNT_P(struc)); break; case IS_ARRAY: @@ -354,7 +354,7 @@ again: break; case IS_RESOURCE: { const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc) TSRMLS_CC); - php_printf("%sresource(%ld) of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc)); + php_printf("%sresource(" ZEND_INT_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc)); break; } case IS_REFERENCE: @@ -398,11 +398,11 @@ PHP_FUNCTION(debug_zval_dump) efree(tmp_spaces); \ } while(0); -static void php_array_element_export(zval *zv, ulong index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ +static void php_array_element_export(zval *zv, php_uint_t index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ buffer_append_spaces(buf, level+1); - smart_str_append_long(buf, (long) index); + smart_str_append_int(buf, (php_int_t) index); smart_str_appendl(buf, " => ", 4); } else { /* string key */ @@ -426,7 +426,7 @@ static void php_array_element_export(zval *zv, ulong index, zend_string *key, in } /* }}} */ -static void php_object_element_export(zval *zv, ulong index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ +static void php_object_element_export(zval *zv, php_uint_t index, zend_string *key, int level, smart_str *buf TSRMLS_DC) /* {{{ */ { buffer_append_spaces(buf, level + 2); if (key != NULL) { @@ -443,7 +443,7 @@ static void php_object_element_export(zval *zv, ulong index, zend_string *key, i smart_str_appendc(buf, '\''); STR_RELEASE(pname_esc); } else { - smart_str_append_long(buf, (long) index); + smart_str_append_int(buf, (php_int_t) index); } smart_str_appendl(buf, " => ", 4); php_var_export_ex(zv, level + 2, buf TSRMLS_CC); @@ -456,10 +456,10 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf TSRMLS_DC) { HashTable *myht; char *tmp_str; - int tmp_len; + php_size_t tmp_len; zend_string *class_name; zend_string *ztmp, *ztmp2; - ulong index; + php_uint_t index; zend_string *key; zval *val; @@ -474,8 +474,8 @@ again: case IS_NULL: smart_str_appendl(buf, "NULL", 4); break; - case IS_LONG: - smart_str_append_long(buf, Z_LVAL_P(struc)); + case IS_INT: + smart_str_append_int(buf, Z_IVAL_P(struc)); break; case IS_DOUBLE: tmp_len = spprintf(&tmp_str, 0,"%.*H", PG(serialize_precision), Z_DVAL_P(struc)); @@ -483,7 +483,7 @@ again: efree(tmp_str); break; case IS_STRING: - ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRLEN_P(struc), 0, "'\\", 2 TSRMLS_CC); + ztmp = php_addcslashes(Z_STRVAL_P(struc), Z_STRSIZE_P(struc), 0, "'\\", 2 TSRMLS_CC); ztmp2 = php_str_to_str_ex(ztmp->val, ztmp->len, "\0", 1, "' . \"\\0\" . '", 12, 0, NULL); smart_str_appendc(buf, '\''); @@ -613,16 +613,16 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var } if ((Z_TYPE_P(var) == IS_OBJECT) && Z_OBJ_HT_P(var)->get_class_entry) { p = smart_str_print_long(id + sizeof(id) - 1, - (long) Z_OBJ_P(var)); + (php_int_t) Z_OBJ_P(var)); *(--p) = 'O'; len = id + sizeof(id) - 1 - p; } else if (var_ptr != var) { p = smart_str_print_long(id + sizeof(id) - 1, - (long) Z_REF_P(var_ptr)); + (php_int_t) Z_REF_P(var_ptr)); *(--p) = 'R'; len = id + sizeof(id) - 1 - p; } else { - p = smart_str_print_long(id + sizeof(id) - 1, (long) var); + p = smart_str_print_long(id + sizeof(id) - 1, (php_int_t) var); len = id + sizeof(id) - 1 - p; } @@ -631,29 +631,29 @@ static inline int php_add_var_hash(HashTable *var_hash, zval *var_ptr, zval *var if (var == var_ptr) { /* we still need to bump up the counter, since non-refs will * be counted separately by unserializer */ - ZVAL_LONG(&var_no, -1); + ZVAL_INT(&var_no, -1); zend_hash_next_index_insert(var_hash, &var_no); } #if 0 - fprintf(stderr, "- had var (%d): %lu\n", Z_TYPE_P(var), **(ulong**)var_old); + fprintf(stderr, "- had var (%d): %lu\n", Z_TYPE_P(var), **(php_uint_t**)var_old); #endif return FAILURE; } /* +1 because otherwise hash will think we are trying to store NULL pointer */ - ZVAL_LONG(&var_no, zend_hash_num_elements(var_hash) + 1); + ZVAL_INT(&var_no, zend_hash_num_elements(var_hash) + 1); zend_hash_str_add(var_hash, p, len, &var_no); #if 0 - fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_LVAL(var_no)); + fprintf(stderr, "+ add var (%d): %lu\n", Z_TYPE_P(var), Z_IVAL(var_no)); #endif return SUCCESS; } /* }}} */ -static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ +static inline void php_var_serialize_long(smart_str *buf, php_int_t val) /* {{{ */ { smart_str_appendl(buf, "i:", 2); - smart_str_append_long(buf, val); + smart_str_append_int(buf, val); smart_str_appendc(buf, ';'); } /* }}} */ @@ -661,7 +661,7 @@ static inline void php_var_serialize_long(smart_str *buf, long val) /* {{{ */ static inline void php_var_serialize_string(smart_str *buf, char *str, int len) /* {{{ */ { smart_str_appendl(buf, "s:", 2); - smart_str_append_long(buf, len); + smart_str_append_int(buf, len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, str, len); smart_str_appendl(buf, "\";", 2); @@ -674,7 +674,7 @@ static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, (int)class_name->len); + smart_str_append_int(buf, (int)class_name->len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name->val, class_name->len); smart_str_appendl(buf, "\":", 2); @@ -695,7 +695,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt if (incomplete_class) { --count; } - smart_str_append_long(buf, count); + smart_str_append_int(buf, count); smart_str_appendl(buf, ":{", 2); if (count > 0) { @@ -728,7 +728,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt continue; } } - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); } else { zend_class_entry *ce; @@ -737,7 +737,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt zend_string *prot_name, *priv_name; do { - priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS); + priv_name = zend_mangle_property_name(ce->name->val, ce->name->len, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS); if ((d = zend_hash_find(propers, priv_name)) != NULL) { if (Z_TYPE_P(d) == IS_INDIRECT) { d = Z_INDIRECT_P(d); @@ -751,7 +751,7 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } STR_FREE(priv_name); - prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRLEN_P(name), ce->type & ZEND_INTERNAL_CLASS); + prot_name = zend_mangle_property_name("*", 1, Z_STRVAL_P(name), Z_STRSIZE_P(name), ce->type & ZEND_INTERNAL_CLASS); if ((d = zend_hash_find(propers, prot_name)) != NULL) { if (Z_TYPE_P(d) == IS_INDIRECT) { d = Z_INDIRECT_P(d); @@ -766,12 +766,12 @@ static void php_var_serialize_class(smart_str *buf, zval *struc, zval *retval_pt break; } STR_FREE(prot_name); - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%s\" returned as member variable from __sleep() but does not exist", Z_STRVAL_P(name)); } while (0); } else { - php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRLEN_P(name)); + php_var_serialize_string(buf, Z_STRVAL_P(name), Z_STRSIZE_P(name)); php_var_serialize_intern(buf, nvalp, var_hash TSRMLS_CC); } } @@ -797,12 +797,12 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, HashTable *var php_add_var_hash(var_hash, struc, &var_already TSRMLS_CC) == FAILURE) { if (Z_ISREF_P(struc)) { smart_str_appendl(buf, "R:", 2); - smart_str_append_long(buf, Z_LVAL(var_already)); + smart_str_append_int(buf, Z_IVAL(var_already)); smart_str_appendc(buf, ';'); return; } else if (Z_TYPE_P(struc) == IS_OBJECT) { smart_str_appendl(buf, "r:", 2); - smart_str_append_long(buf, Z_LVAL(var_already)); + smart_str_append_int(buf, Z_IVAL(var_already)); smart_str_appendc(buf, ';'); return; } @@ -822,8 +822,8 @@ again: smart_str_appendl(buf, "N;", 2); return; - case IS_LONG: - php_var_serialize_long(buf, Z_LVAL_P(struc)); + case IS_INT: + php_var_serialize_long(buf, Z_IVAL_P(struc)); return; case IS_DOUBLE: { @@ -839,7 +839,7 @@ again: } case IS_STRING: - php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRLEN_P(struc)); + php_var_serialize_string(buf, Z_STRVAL_P(struc), Z_STRSIZE_P(struc)); return; case IS_OBJECT: { @@ -859,12 +859,12 @@ again: if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name->len); + smart_str_append_int(buf, (int)Z_OBJCE_P(struc)->name->len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name->val, Z_OBJCE_P(struc)->name->len); smart_str_appendl(buf, "\":", 2); - smart_str_append_long(buf, (int)serialized_length); + smart_str_append_int(buf, (int)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); @@ -923,12 +923,12 @@ again: if (i > 0 && incomplete_class) { --i; } - smart_str_append_long(buf, i); + smart_str_append_int(buf, i); smart_str_appendl(buf, ":{", 2); if (i > 0) { zend_string *key; zval *data; - ulong index; + php_uint_t index; ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, data) { @@ -1031,7 +1031,7 @@ PHP_FUNCTION(unserialize) PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_dtor(return_value); if (!EG(exception)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset %ld of %d bytes", (long)((char*)p - buf), buf_len); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_INT_FMT " of %d bytes", (php_int_t)((char*)p - buf), buf_len); } RETURN_FALSE; } @@ -1048,7 +1048,7 @@ PHP_FUNCTION(memory_get_usage) { RETURN_FALSE; } - RETURN_LONG(zend_memory_usage(real_usage TSRMLS_CC)); + RETURN_INT(zend_memory_usage(real_usage TSRMLS_CC)); } /* }}} */ @@ -1061,7 +1061,7 @@ PHP_FUNCTION(memory_get_peak_usage) { RETURN_FALSE; } - RETURN_LONG(zend_memory_peak_usage(real_usage TSRMLS_CC)); + RETURN_INT(zend_memory_peak_usage(real_usage TSRMLS_CC)); } /* }}} */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index b6fcd79c2d..810f3c8f8c 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,5 +1,4 @@ /* Generated by re2c 0.13.5 */ -#line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ | PHP Version 5 | @@ -30,13 +29,13 @@ typedef struct { zval *data[VAR_ENTRIES_MAX]; - long used_slots; + php_int_t used_slots; void *next; } var_entries; typedef struct { zval data[VAR_ENTRIES_MAX]; - long used_slots; + php_int_t used_slots; void *next; } var_dtor_entries; @@ -119,7 +118,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval) { - long i; + php_int_t i; var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); @@ -136,7 +135,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz } } -static zval *var_access(php_unserialize_data_t *var_hashx, long id) +static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id) { var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG @@ -158,7 +157,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, long id) PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) { void *next; - long i; + php_int_t i; var_entries *var_hash = (*var_hashx)->first; var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor; #if VAR_ENTRIES_DBG @@ -233,15 +232,14 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t #define YYMARKER marker -#line 241 "ext/standard/var_unserializer.re" -static inline long parse_iv2(const unsigned char *p, const unsigned char **q) +static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q) { char cursor; - long result = 0; + php_int_t result = 0; int neg = 0; switch (*p) { @@ -266,7 +264,7 @@ static inline long parse_iv2(const unsigned char *p, const unsigned char **q) return result; } -static inline long parse_iv(const unsigned char *p) +static inline php_int_t parse_iv(const unsigned char *p) { return parse_iv2(p, NULL); } @@ -296,7 +294,7 @@ static inline size_t parse_uiv(const unsigned char *p) #define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC #define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC -static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops) +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops) { while (elements-- > 0) { zval key, *data, d, *old_data; @@ -307,7 +305,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long return 0; } - if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) { + if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) { zval_dtor(&key); return 0; } @@ -317,12 +315,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long if (!objprops) { switch (Z_TYPE(key)) { - case IS_LONG: - if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) { + case IS_INT: + if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) { //??? update hash var_push_dtor(var_hash, old_data); } - data = zend_hash_index_update(ht, Z_LVAL(key), &d); + data = zend_hash_index_update(ht, Z_IVAL(key), &d); break; case IS_STRING: if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) { @@ -380,14 +378,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER) static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - long datalen; + php_int_t datalen; datalen = parse_iv2((*p) + 2, p); (*p) += 2; if (datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p))); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (php_int_t)(max - (*p))); return 0; } @@ -403,9 +401,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) return finish_nested_data(UNSERIALIZE_PASSTHRU); } -static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - long elements; + php_int_t elements; elements = parse_iv2((*p) + 2, p); @@ -426,7 +424,7 @@ static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) #ifdef PHP_WIN32 # pragma optimize("", off) #endif -static inline int object_common2(UNSERIALIZE_PARAMETER, long elements) +static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements) { zval retval; zval fname; @@ -481,7 +479,6 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) start = cursor; -#line 485 "ext/standard/var_unserializer.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -541,9 +538,7 @@ yy2: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy95; yy3: -#line 826 "ext/standard/var_unserializer.re" { return 0; } -#line 547 "ext/standard/var_unserializer.c" yy4: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy89; @@ -586,13 +581,11 @@ yy13: goto yy3; yy14: ++YYCURSOR; -#line 820 "ext/standard/var_unserializer.re" { /* this is the case where we have less data than planned */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); return 0; /* not sure if it should be 0 or 1 here? */ } -#line 596 "ext/standard/var_unserializer.c" yy16: yych = *++YYCURSOR; goto yy3; @@ -622,10 +615,9 @@ yy20: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 681 "ext/standard/var_unserializer.re" { size_t len, len2, len3, maxlen; - long elements; + php_int_t elements; char *str; zend_string *class_name; zend_class_entry *ce; @@ -761,7 +753,6 @@ yy20: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 765 "ext/standard/var_unserializer.c" yy25: yych = *++YYCURSOR; if (yych <= ',') { @@ -786,7 +777,6 @@ yy27: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 673 "ext/standard/var_unserializer.re" { //??? INIT_PZVAL(rval); @@ -794,7 +784,6 @@ yy27: return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 798 "ext/standard/var_unserializer.c" yy32: yych = *++YYCURSOR; if (yych == '+') goto yy33; @@ -815,9 +804,8 @@ yy34: yych = *++YYCURSOR; if (yych != '{') goto yy18; ++YYCURSOR; -#line 652 "ext/standard/var_unserializer.re" { - long elements = parse_iv(start + 2); + php_int_t elements = parse_iv(start + 2); /* use iv() not uiv() in order to check data range */ *p = YYCURSOR; @@ -836,7 +824,6 @@ yy34: return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 840 "ext/standard/var_unserializer.c" yy39: yych = *++YYCURSOR; if (yych == '+') goto yy40; @@ -857,7 +844,6 @@ yy41: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 624 "ext/standard/var_unserializer.re" { size_t len, maxlen; zend_string *str; @@ -885,7 +871,6 @@ yy41: ZVAL_STR(rval, str); return 1; } -#line 889 "ext/standard/var_unserializer.c" yy46: yych = *++YYCURSOR; if (yych == '+') goto yy47; @@ -906,7 +891,6 @@ yy48: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 597 "ext/standard/var_unserializer.re" { size_t len, maxlen; char *str; @@ -933,7 +917,6 @@ yy48: ZVAL_STRINGL(rval, str, len); return 1; } -#line 937 "ext/standard/var_unserializer.c" yy53: yych = *++YYCURSOR; if (yych <= '/') { @@ -1021,16 +1004,14 @@ yy61: } yy63: ++YYCURSOR; -#line 588 "ext/standard/var_unserializer.re" { -#if SIZEOF_LONG == 4 +#if SIZEOF_ZEND_INT == 4 use_double: #endif *p = YYCURSOR; ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1034 "ext/standard/var_unserializer.c" yy65: yych = *++YYCURSOR; if (yych <= ',') { @@ -1089,7 +1070,6 @@ yy73: yych = *++YYCURSOR; if (yych != ';') goto yy18; ++YYCURSOR; -#line 572 "ext/standard/var_unserializer.re" { *p = YYCURSOR; @@ -1105,7 +1085,6 @@ yy73: return 1; } -#line 1109 "ext/standard/var_unserializer.c" yy76: yych = *++YYCURSOR; if (yych == 'N') goto yy73; @@ -1132,19 +1111,18 @@ yy79: if (yych <= '9') goto yy79; if (yych != ';') goto yy18; ++YYCURSOR; -#line 546 "ext/standard/var_unserializer.re" { -#if SIZEOF_LONG == 4 +#if SIZEOF_ZEND_INT == 4 int digits = YYCURSOR - start - 3; if (start[2] == '-' || start[2] == '+') { digits--; } - /* Use double for large long values that were serialized on a 64-bit system */ - if (digits >= MAX_LENGTH_OF_LONG - 1) { - if (digits == MAX_LENGTH_OF_LONG - 1) { - int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); + /* Use double for large php_int_t values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { + int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1); if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { goto use_double; @@ -1155,10 +1133,9 @@ yy79: } #endif *p = YYCURSOR; - ZVAL_LONG(rval, parse_iv(start + 2)); + ZVAL_INT(rval, parse_iv(start + 2)); return 1; } -#line 1162 "ext/standard/var_unserializer.c" yy83: yych = *++YYCURSOR; if (yych <= '/') goto yy18; @@ -1166,22 +1143,18 @@ yy83: yych = *++YYCURSOR; if (yych != ';') goto yy18; ++YYCURSOR; -#line 540 "ext/standard/var_unserializer.re" { *p = YYCURSOR; ZVAL_BOOL(rval, parse_iv(start + 2)); return 1; } -#line 1176 "ext/standard/var_unserializer.c" yy87: ++YYCURSOR; -#line 534 "ext/standard/var_unserializer.re" { *p = YYCURSOR; ZVAL_NULL(rval); return 1; } -#line 1185 "ext/standard/var_unserializer.c" yy89: yych = *++YYCURSOR; if (yych <= ',') { @@ -1204,9 +1177,8 @@ yy91: if (yych <= '9') goto yy91; if (yych != ';') goto yy18; ++YYCURSOR; -#line 511 "ext/standard/var_unserializer.re" { - long id; + php_int_t id; *p = YYCURSOR; if (!var_hash) return 0; @@ -1227,7 +1199,6 @@ yy91: return 1; } -#line 1231 "ext/standard/var_unserializer.c" yy95: yych = *++YYCURSOR; if (yych <= ',') { @@ -1250,9 +1221,8 @@ yy97: if (yych <= '9') goto yy97; if (yych != ';') goto yy18; ++YYCURSOR; -#line 489 "ext/standard/var_unserializer.re" { - long id; + php_int_t id; *p = YYCURSOR; if (!var_hash) return 0; @@ -1272,9 +1242,7 @@ yy97: return 1; } -#line 1276 "ext/standard/var_unserializer.c" } -#line 828 "ext/standard/var_unserializer.re" return 0; diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 5636429c8b..40876563a8 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -28,13 +28,13 @@ typedef struct { zval *data[VAR_ENTRIES_MAX]; - long used_slots; + php_int_t used_slots; void *next; } var_entries; typedef struct { zval data[VAR_ENTRIES_MAX]; - long used_slots; + php_int_t used_slots; void *next; } var_dtor_entries; @@ -117,7 +117,7 @@ PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval *rva PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nzval) { - long i; + php_int_t i; var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG fprintf(stderr, "var_replace(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(nzval)); @@ -134,7 +134,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval *nz } } -static zval *var_access(php_unserialize_data_t *var_hashx, long id) +static zval *var_access(php_unserialize_data_t *var_hashx, php_int_t id) { var_entries *var_hash = (*var_hashx)->first; #if VAR_ENTRIES_DBG @@ -156,7 +156,7 @@ static zval *var_access(php_unserialize_data_t *var_hashx, long id) PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) { void *next; - long i; + php_int_t i; var_entries *var_hash = (*var_hashx)->first; var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor; #if VAR_ENTRIES_DBG @@ -242,10 +242,10 @@ object = [OC]; -static inline long parse_iv2(const unsigned char *p, const unsigned char **q) +static inline php_int_t parse_iv2(const unsigned char *p, const unsigned char **q) { char cursor; - long result = 0; + php_int_t result = 0; int neg = 0; switch (*p) { @@ -270,7 +270,7 @@ static inline long parse_iv2(const unsigned char *p, const unsigned char **q) return result; } -static inline long parse_iv(const unsigned char *p) +static inline php_int_t parse_iv(const unsigned char *p) { return parse_iv2(p, NULL); } @@ -300,7 +300,7 @@ static inline size_t parse_uiv(const unsigned char *p) #define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC #define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC -static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops) +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, php_int_t elements, int objprops) { while (elements-- > 0) { zval key, *data, d, *old_data; @@ -311,7 +311,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long return 0; } - if (Z_TYPE(key) != IS_LONG && Z_TYPE(key) != IS_STRING) { + if (Z_TYPE(key) != IS_INT && Z_TYPE(key) != IS_STRING) { zval_dtor(&key); return 0; } @@ -321,12 +321,12 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long if (!objprops) { switch (Z_TYPE(key)) { - case IS_LONG: - if ((old_data = zend_hash_index_find(ht, Z_LVAL(key))) != NULL) { + case IS_INT: + if ((old_data = zend_hash_index_find(ht, Z_IVAL(key))) != NULL) { //??? update hash var_push_dtor(var_hash, old_data); } - data = zend_hash_index_update(ht, Z_LVAL(key), &d); + data = zend_hash_index_update(ht, Z_IVAL(key), &d); break; case IS_STRING: if ((old_data = zend_symtable_find(ht, Z_STR(key))) != NULL) { @@ -384,14 +384,14 @@ static inline int finish_nested_data(UNSERIALIZE_PARAMETER) static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - long datalen; + php_int_t datalen; datalen = parse_iv2((*p) + 2, p); (*p) += 2; if (datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p))); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (php_int_t)(max - (*p))); return 0; } @@ -407,9 +407,9 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) return finish_nested_data(UNSERIALIZE_PASSTHRU); } -static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +static inline php_int_t object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - long elements; + php_int_t elements; elements = parse_iv2((*p) + 2, p); @@ -430,7 +430,7 @@ static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) #ifdef PHP_WIN32 # pragma optimize("", off) #endif -static inline int object_common2(UNSERIALIZE_PARAMETER, long elements) +static inline int object_common2(UNSERIALIZE_PARAMETER, php_int_t elements) { zval retval; zval fname; @@ -487,7 +487,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) /*!re2c "R:" iv ";" { - long id; + php_int_t id; *p = YYCURSOR; if (!var_hash) return 0; @@ -509,7 +509,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) } "r:" iv ";" { - long id; + php_int_t id; *p = YYCURSOR; if (!var_hash) return 0; @@ -544,17 +544,17 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) } "i:" iv ";" { -#if SIZEOF_LONG == 4 +#if SIZEOF_ZEND_INT == 4 int digits = YYCURSOR - start - 3; if (start[2] == '-' || start[2] == '+') { digits--; } - /* Use double for large long values that were serialized on a 64-bit system */ - if (digits >= MAX_LENGTH_OF_LONG - 1) { - if (digits == MAX_LENGTH_OF_LONG - 1) { - int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1); + /* Use double for large php_int_t values that were serialized on a 64-bit system */ + if (digits >= MAX_LENGTH_OF_ZEND_INT - 1) { + if (digits == MAX_LENGTH_OF_ZEND_INT - 1) { + int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_ZEND_INT, int_min_digits, MAX_LENGTH_OF_ZEND_INT - 1); if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) { goto use_double; @@ -565,7 +565,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) } #endif *p = YYCURSOR; - ZVAL_LONG(rval, parse_iv(start + 2)); + ZVAL_INT(rval, parse_iv(start + 2)); return 1; } @@ -586,7 +586,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) } "d:" (iv | nv | nvexp) ";" { -#if SIZEOF_LONG == 4 +#if SIZEOF_ZEND_INT == 4 use_double: #endif *p = YYCURSOR; @@ -650,7 +650,7 @@ use_double: } "a:" uiv ":" "{" { - long elements = parse_iv(start + 2); + php_int_t elements = parse_iv(start + 2); /* use iv() not uiv() in order to check data range */ *p = YYCURSOR; @@ -680,7 +680,7 @@ use_double: object ":" uiv ":" ["] { size_t len, len2, len3, maxlen; - long elements; + php_int_t elements; char *str; zend_string *class_name; zend_class_entry *ce; diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index 9eb3829a08..85085b0b97 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -221,7 +221,7 @@ PHP_FUNCTION(version_compare) } compare = php_version_compare(v1, v2); if (argc == 2) { - RETURN_LONG(compare); + RETURN_INT(compare); } if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { RETURN_BOOL(compare == -1); diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 97aa204892..56244ec343 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -419,19 +419,19 @@ static int _call_message_handler(zval *callback_name, CS_SERVERMSG *srvmsg TSRML /* Build arguments */ MAKE_STD_ZVAL(msgnumber); - ZVAL_LONG(msgnumber, srvmsg->msgnumber); + ZVAL_INT(msgnumber, srvmsg->msgnumber); args[0] = &msgnumber; MAKE_STD_ZVAL(severity); - ZVAL_LONG(severity, srvmsg->severity); + ZVAL_INT(severity, srvmsg->severity); args[1] = &severity; MAKE_STD_ZVAL(state); - ZVAL_LONG(state, srvmsg->state); + ZVAL_INT(state, srvmsg->state); args[2] = &state; MAKE_STD_ZVAL(line); - ZVAL_LONG(line, srvmsg->line); + ZVAL_INT(line, srvmsg->line); args[3] = &line; MAKE_STD_ZVAL(text); @@ -559,7 +559,7 @@ static PHP_GINIT_FUNCTION(sybase) * signals to implement timeouts, they are actually implemented * by using poll() or select() on Solaris and Linux. */ - if (cfg_get_long("sybct.timeout", &opt)==SUCCESS) { + if (cfg_get_int("sybct.timeout", &opt)==SUCCESS) { CS_INT cs_timeout = opt; if (ct_config(sybase_globals->context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update the timeout"); @@ -678,7 +678,7 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char } } - if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { + if (cfg_get_int("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize"); } @@ -864,7 +864,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ptr = zend_list_find(link, &type); /* check if the link is still there */ if (ptr && (type==le_link || type==le_plink)) { zend_list_addref(link); - Z_LVAL_P(return_value) = SybCtG(default_link) = link; + Z_IVAL_P(return_value) = SybCtG(default_link) = link; Z_TYPE_P(return_value) = IS_RESOURCE; efree(hashed_details); return; @@ -889,7 +889,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_link); /* add it to the hash */ - new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); + new_index_ptr.ptr = (void *) Z_IVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) { ct_close(sybase_ptr->connection, CS_UNUSED); @@ -901,7 +901,7 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) SybCtG(num_links)++; } efree(hashed_details); - SybCtG(default_link)=Z_LVAL_P(return_value); + SybCtG(default_link)=Z_IVAL_P(return_value); zend_list_addref(SybCtG(default_link)); } @@ -1225,7 +1225,7 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS switch (result->numerics[j]) { case 1: { /* This indicates a long */ - ZVAL_LONG(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); + ZVAL_INT(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); break; } @@ -1238,14 +1238,14 @@ static int php_sybase_fetch_result_row(sybase_result *result, int numrows TSRMLS case 3: { /* This indicates either a long or a float, which ever fits */ errno = 0; - Z_LVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); + Z_IVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); if (errno == ERANGE) { /* An overflow occurred, so try to fit it into a double */ RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); break; } - Z_TYPE(result->data[i][j]) = IS_LONG; + Z_TYPE(result->data[i][j]) = IS_INT; break; } @@ -1469,7 +1469,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) /* Get the resultset and free it */ ALLOC_ZVAL(tmp); - Z_LVAL_P(tmp)= sybase_ptr->active_result_index; + Z_IVAL_P(tmp)= sybase_ptr->active_result_index; Z_TYPE_P(tmp)= IS_RESOURCE; INIT_PZVAL(tmp); ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); @@ -1701,7 +1701,7 @@ PHP_FUNCTION(sybase_free_result) php_sybase_finish_results(result TSRMLS_CC); } - zend_list_delete(Z_LVAL_P(sybase_result_index)); + zend_list_delete(Z_IVAL_P(sybase_result_index)); RETURN_TRUE; } @@ -1727,8 +1727,8 @@ PHP_FUNCTION(sybase_num_rows) } ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); - Z_LVAL_P(return_value) = result->num_rows; - Z_TYPE_P(return_value) = IS_LONG; + Z_IVAL_P(return_value) = result->num_rows; + Z_TYPE_P(return_value) = IS_INT; } /* }}} */ @@ -1745,8 +1745,8 @@ PHP_FUNCTION(sybase_num_fields) } ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result); - Z_LVAL_P(return_value) = result->num_fields; - Z_TYPE_P(return_value) = IS_LONG; + Z_IVAL_P(return_value) = result->num_fields; + Z_TYPE_P(return_value) = IS_INT; } /* }}} */ @@ -1867,7 +1867,7 @@ PHP_FUNCTION(sybase_fetch_object) zend_class_entry **pce = NULL; convert_to_string(object); - if (zend_lookup_class(Z_STRVAL_P(object), Z_STRLEN_P(object), &pce TSRMLS_CC) == FAILURE) { + if (zend_lookup_class(Z_STRVAL_P(object), Z_STRSIZE_P(object), &pce TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Class %s has not been declared", Z_STRVAL_P(object)); /* Use default (ZEND_STANDARD_CLASS_DEF_PTR) */ } else { @@ -2002,9 +2002,9 @@ PHP_FUNCTION(sybase_fetch_field) object_init(return_value); add_property_string(return_value, "name", result->fields[field_offset].name); - add_property_long(return_value, "max_length", result->fields[field_offset].max_length); + add_property_int(return_value, "max_length", result->fields[field_offset].max_length); add_property_string(return_value, "column_source", result->fields[field_offset].column_source); - add_property_long(return_value, "numeric", result->fields[field_offset].numeric); + add_property_int(return_value, "numeric", result->fields[field_offset].numeric); add_property_string(return_value, "type", php_sybase_get_field_name(Z_TYPE(result->fields[field_offset]))); } /* }}} */ @@ -2076,8 +2076,8 @@ PHP_FUNCTION(sybase_result) break; } default: - convert_to_long(field); - field_offset = Z_LVAL_P(field); + convert_to_int(field); + field_offset = Z_IVAL_P(field); if (field_offset < 0 || field_offset >= result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset specified"); RETURN_FALSE; @@ -2110,8 +2110,8 @@ PHP_FUNCTION(sybase_affected_rows) ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink); - Z_LVAL_P(return_value) = sybase_ptr->affected_rows; - Z_TYPE_P(return_value) = IS_LONG; + Z_IVAL_P(return_value) = sybase_ptr->affected_rows; + Z_TYPE_P(return_value) = IS_INT; } /* }}} */ diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h index df8c4d4235..033a89cfb6 100644 --- a/ext/sysvmsg/php_sysvmsg.h +++ b/ext/sysvmsg/php_sysvmsg.h @@ -52,11 +52,11 @@ PHP_FUNCTION(msg_queue_exists); typedef struct { key_t key; - long id; + php_int_t id; } sysvmsg_queue_t; struct php_msgbuf { - long mtype; + php_int_t mtype; char mtext[1]; }; diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index b1cbedbbc1..afeffcc092 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -130,11 +130,11 @@ static void sysvmsg_release(zend_resource *rsrc TSRMLS_DC) PHP_MINIT_FUNCTION(sysvmsg) { le_sysvmsg = zend_register_list_destructors_ex(sysvmsg_release, NULL, "sysvmsg queue", module_number); - REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS); - REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_ENOMSG", ENOMSG, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR, CONST_PERSISTENT|CONST_CS); + REGISTER_INT_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT, CONST_PERSISTENT|CONST_CS); return SUCCESS; } /* }}} */ @@ -171,20 +171,20 @@ PHP_FUNCTION(msg_set_queue) /* now pull out members of data and set them in the stat buffer */ if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.uid", sizeof("msg_perm.uid") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_perm.uid = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_perm.uid = Z_IVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.gid", sizeof("msg_perm.gid") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_perm.gid = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_perm.gid = Z_IVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_perm.mode", sizeof("msg_perm.mode") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_perm.mode = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_perm.mode = Z_IVAL_P(item); } if ((item = zend_hash_str_find(Z_ARRVAL_P(data), "msg_qbytes", sizeof("msg_qbytes") - 1)) != NULL) { - convert_to_long_ex(item); - stat.msg_qbytes = Z_LVAL_P(item); + convert_to_int_ex(item); + stat.msg_qbytes = Z_IVAL_P(item); } if (msgctl(mq->id, IPC_SET, &stat) == 0) { RETVAL_TRUE; @@ -212,16 +212,16 @@ PHP_FUNCTION(msg_stat_queue) if (msgctl(mq->id, IPC_STAT, &stat) == 0) { array_init(return_value); - add_assoc_long(return_value, "msg_perm.uid", stat.msg_perm.uid); - add_assoc_long(return_value, "msg_perm.gid", stat.msg_perm.gid); - add_assoc_long(return_value, "msg_perm.mode", stat.msg_perm.mode); - add_assoc_long(return_value, "msg_stime", stat.msg_stime); - add_assoc_long(return_value, "msg_rtime", stat.msg_rtime); - add_assoc_long(return_value, "msg_ctime", stat.msg_ctime); - add_assoc_long(return_value, "msg_qnum", stat.msg_qnum); - add_assoc_long(return_value, "msg_qbytes", stat.msg_qbytes); - add_assoc_long(return_value, "msg_lspid", stat.msg_lspid); - add_assoc_long(return_value, "msg_lrpid", stat.msg_lrpid); + add_assoc_int(return_value, "msg_perm.uid", stat.msg_perm.uid); + add_assoc_int(return_value, "msg_perm.gid", stat.msg_perm.gid); + add_assoc_int(return_value, "msg_perm.mode", stat.msg_perm.mode); + add_assoc_int(return_value, "msg_stime", stat.msg_stime); + add_assoc_int(return_value, "msg_rtime", stat.msg_rtime); + add_assoc_int(return_value, "msg_ctime", stat.msg_ctime); + add_assoc_int(return_value, "msg_qnum", stat.msg_qnum); + add_assoc_int(return_value, "msg_qbytes", stat.msg_qbytes); + add_assoc_int(return_value, "msg_lspid", stat.msg_lspid); + add_assoc_int(return_value, "msg_lrpid", stat.msg_lrpid); } } /* }}} */ @@ -230,9 +230,9 @@ PHP_FUNCTION(msg_stat_queue) Check whether a message queue exists */ PHP_FUNCTION(msg_queue_exists) { - long key; + php_int_t key; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &key) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &key) == FAILURE) { return; } @@ -248,11 +248,11 @@ PHP_FUNCTION(msg_queue_exists) Attach to a message queue */ PHP_FUNCTION(msg_get_queue) { - long key; - long perms = 0666; + php_int_t key; + php_int_t perms = 0666; sysvmsg_queue_t *mq; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &key, &perms) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|i", &key, &perms) == FAILURE) { return; } @@ -299,8 +299,8 @@ PHP_FUNCTION(msg_remove_queue) PHP_FUNCTION(msg_receive) { zval *out_message, *queue, *out_msgtype, *zerrcode = NULL; - long desiredmsgtype, maxsize, flags = 0; - long realflags = 0; + php_int_t desiredmsgtype, maxsize, flags = 0; + php_int_t realflags = 0; zend_bool do_unserialize = 1; sysvmsg_queue_t *mq = NULL; struct php_msgbuf *messagebuffer = NULL; /* buffer to transmit */ @@ -308,7 +308,7 @@ PHP_FUNCTION(msg_receive) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/lz/|blz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz/iz/|biz/", &queue, &desiredmsgtype, &out_msgtype, &maxsize, &out_message, &do_unserialize, &flags, &zerrcode) == FAILURE) { return; @@ -344,18 +344,18 @@ PHP_FUNCTION(msg_receive) zval_dtor(out_msgtype); zval_dtor(out_message); - ZVAL_LONG(out_msgtype, 0); + ZVAL_INT(out_msgtype, 0); ZVAL_FALSE(out_message); if (zerrcode) { ZVAL_DEREF(zerrcode); zval_dtor(zerrcode); - ZVAL_LONG(zerrcode, 0); + ZVAL_INT(zerrcode, 0); } if (result >= 0) { /* got it! */ - ZVAL_LONG(out_msgtype, messagebuffer->mtype); + ZVAL_INT(out_msgtype, messagebuffer->mtype); RETVAL_TRUE; if (do_unserialize) { @@ -375,7 +375,7 @@ PHP_FUNCTION(msg_receive) ZVAL_STRINGL(out_message, messagebuffer->mtext, result); } } else if (zerrcode) { - ZVAL_LONG(zerrcode, errno); + ZVAL_INT(zerrcode, errno); } efree(messagebuffer); } @@ -386,7 +386,7 @@ PHP_FUNCTION(msg_receive) PHP_FUNCTION(msg_send) { zval *message, *queue, *zerror=NULL; - long msgtype; + php_int_t msgtype; zend_bool do_serialize = 1, blocking = 1; sysvmsg_queue_t * mq = NULL; struct php_msgbuf * messagebuffer = NULL; /* buffer to transmit */ @@ -395,7 +395,7 @@ PHP_FUNCTION(msg_send) RETVAL_FALSE; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz|bbz/", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz|bbz/", &queue, &msgtype, &message, &do_serialize, &blocking, &zerror) == FAILURE) { return; } @@ -421,11 +421,11 @@ PHP_FUNCTION(msg_send) switch (Z_TYPE_P(message)) { case IS_STRING: p = Z_STRVAL_P(message); - message_len = Z_STRLEN_P(message); + message_len = Z_STRSIZE_P(message); break; - case IS_LONG: - message_len = spprintf(&p, 0, "%ld", Z_LVAL_P(message)); + case IS_INT: + message_len = spprintf(&p, 0, "%pd", Z_IVAL_P(message)); break; case IS_FALSE: message_len = spprintf(&p, 0, "0"); @@ -459,7 +459,7 @@ PHP_FUNCTION(msg_send) if (result == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "msgsnd failed: %s", strerror(errno)); if (zerror) { - ZVAL_LONG(zerror, errno); + ZVAL_INT(zerror, errno); } } else { RETVAL_TRUE; diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index 75c5f8baa5..cdf596acc0 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -187,13 +187,13 @@ PHP_MINIT_FUNCTION(sysvsem) Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */ PHP_FUNCTION(sem_get) { - long key, max_acquire = 1, perm = 0666, auto_release = 1; + php_int_t key, max_acquire = 1, perm = 0666, auto_release = 1; int semid; struct sembuf sop[3]; int count; sysvsem_sem *sem_ptr; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|lll", &key, &max_acquire, &perm, &auto_release)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|iii", &key, &max_acquire, &perm, &auto_release)) { RETURN_FALSE; } @@ -309,7 +309,7 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire) ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, arg_id, -1, "SysV semaphore", php_sysvsem_module.le_sem); if (!acquire && sem_ptr->count == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_IVAL_P(arg_id), sem_ptr->key); RETURN_FALSE; } @@ -374,7 +374,7 @@ PHP_FUNCTION(sem_remove) #else if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_LVAL_P(arg_id)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_IVAL_P(arg_id)); RETURN_FALSE; } @@ -383,7 +383,7 @@ PHP_FUNCTION(sem_remove) #else if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) { #endif - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_LVAL_P(arg_id), strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for SysV sempphore %ld: %s", Z_IVAL_P(arg_id), strerror(errno)); RETURN_FALSE; } diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h index ba8849d2c4..359c9f7ae2 100644 --- a/ext/sysvshm/php_sysvshm.h +++ b/ext/sysvshm/php_sysvshm.h @@ -34,27 +34,27 @@ extern zend_module_entry sysvshm_module_entry; typedef struct { int le_shm; - long init_mem; + php_int_t init_mem; } sysvshm_module; typedef struct { - long key; - long length; - long next; + php_int_t key; + php_int_t length; + php_int_t next; char mem; } sysvshm_chunk; typedef struct { char magic[8]; - long start; - long end; - long free; - long total; + php_int_t start; + php_int_t end; + php_int_t free; + php_int_t total; } sysvshm_chunk_head; typedef struct { key_t key; /* key set by user */ - long id; /* returned by shmget */ + php_int_t id; /* returned by shmget */ sysvshm_chunk_head *ptr; /* memory address of shared memory */ } sysvshm_shm; diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index bb908a4113..97fa4df8d7 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -116,9 +116,9 @@ ZEND_GET_MODULE(sysvshm) THREAD_LS sysvshm_module php_sysvshm; -static int php_put_shm_data(sysvshm_chunk_head *ptr, long key, const char *data, long len); -static long php_check_shm_data(sysvshm_chunk_head *ptr, long key); -static int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos); +static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *data, php_int_t len); +static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key); +static int php_remove_shm_data(sysvshm_chunk_head *ptr, php_int_t shm_varpos); /* {{{ php_release_sysvshm */ @@ -136,7 +136,7 @@ PHP_MINIT_FUNCTION(sysvshm) { php_sysvshm.le_shm = zend_register_list_destructors_ex(php_release_sysvshm, NULL, PHP_SHM_RSRC_NAME, module_number); - if (cfg_get_long("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { + if (cfg_get_int("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { php_sysvshm.init_mem=10000; } return SUCCESS; @@ -150,9 +150,9 @@ PHP_FUNCTION(shm_attach) sysvshm_shm *shm_list_ptr; char *shm_ptr; sysvshm_chunk_head *chunk_ptr; - long shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666; + php_int_t shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &shm_key, &shm_size, &shm_flag)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i|ii", &shm_key, &shm_size, &shm_flag)) { return; } @@ -166,19 +166,19 @@ PHP_FUNCTION(shm_attach) /* get the id from a specified key or create new shared memory */ if ((shm_id = shmget(shm_key, 0, 0)) < 0) { if (shm_size < sizeof(sysvshm_chunk_head)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: memorysize too small", shm_key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%px: memorysize too small", shm_key); efree(shm_list_ptr); RETURN_FALSE; } if ((shm_id = shmget(shm_key, shm_size, shm_flag | IPC_CREAT | IPC_EXCL)) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", shm_key, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%px: %s", shm_key, strerror(errno)); efree(shm_list_ptr); RETURN_FALSE; } } if ((shm_ptr = shmat(shm_id, NULL, 0)) == (void *) -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", shm_key, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%px: %s", shm_key, strerror(errno)); efree(shm_list_ptr); RETURN_FALSE; } @@ -229,7 +229,7 @@ PHP_FUNCTION(shm_remove) SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); if (shmctl(shm_list_ptr->id, IPC_RMID, NULL) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_IVAL_P(shm_id), strerror(errno)); RETURN_FALSE; } @@ -243,12 +243,12 @@ PHP_FUNCTION(shm_put_var) { zval *shm_id, *arg_var; int ret; - long shm_key; + php_int_t shm_key; sysvshm_shm *shm_list_ptr; smart_str shm_var = {0}; php_serialize_data_t var_hash; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &shm_id, &shm_key, &arg_var)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &shm_id, &shm_key, &arg_var)) { return; } @@ -282,14 +282,14 @@ PHP_FUNCTION(shm_put_var) PHP_FUNCTION(shm_get_var) { zval *shm_id; - long shm_key; + php_int_t shm_key; sysvshm_shm *shm_list_ptr; char *shm_data; - long shm_varpos; + php_int_t shm_varpos; sysvshm_chunk *shm_var; php_unserialize_data_t var_hash; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) { return; } SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); @@ -299,7 +299,7 @@ PHP_FUNCTION(shm_get_var) shm_varpos = php_check_shm_data((shm_list_ptr->ptr), shm_key); if (shm_varpos < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable key %ld doesn't exist", shm_key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable key %pd doesn't exist", shm_key); RETURN_FALSE; } shm_var = (sysvshm_chunk*) ((char *)shm_list_ptr->ptr + shm_varpos); @@ -319,10 +319,10 @@ PHP_FUNCTION(shm_get_var) PHP_FUNCTION(shm_has_var) { zval *shm_id; - long shm_key; + php_int_t shm_key; sysvshm_shm *shm_list_ptr; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) { return; } SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); @@ -335,10 +335,10 @@ PHP_FUNCTION(shm_has_var) PHP_FUNCTION(shm_remove_var) { zval *shm_id; - long shm_key, shm_varpos; + php_int_t shm_key, shm_varpos; sysvshm_shm *shm_list_ptr; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &shm_id, &shm_key)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &shm_id, &shm_key)) { return; } SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); @@ -346,7 +346,7 @@ PHP_FUNCTION(shm_remove_var) shm_varpos = php_check_shm_data((shm_list_ptr->ptr), shm_key); if (shm_varpos < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable key %ld doesn't exist", shm_key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "variable key %pd doesn't exist", shm_key); RETURN_FALSE; } php_remove_shm_data((shm_list_ptr->ptr), shm_varpos); @@ -356,13 +356,13 @@ PHP_FUNCTION(shm_remove_var) /* {{{ php_put_shm_data * inserts an ascii-string into shared memory */ -static int php_put_shm_data(sysvshm_chunk_head *ptr, long key, const char *data, long len) +static int php_put_shm_data(sysvshm_chunk_head *ptr, php_int_t key, const char *data, php_int_t len) { sysvshm_chunk *shm_var; - long total_size; - long shm_varpos; + php_int_t total_size; + php_int_t shm_varpos; - total_size = ((long) (len + sizeof(sysvshm_chunk) - 1) / sizeof(long)) * sizeof(long) + sizeof(long); /* long alligment */ + total_size = ((php_int_t) (len + sizeof(sysvshm_chunk) - 1) / sizeof(php_int_t)) * sizeof(php_int_t) + sizeof(php_int_t); /* php_int_t alligment */ if ((shm_varpos = php_check_shm_data(ptr, key)) > 0) { php_remove_shm_data(ptr, shm_varpos); @@ -385,9 +385,9 @@ static int php_put_shm_data(sysvshm_chunk_head *ptr, long key, const char *data, /* {{{ php_check_shm_data */ -static long php_check_shm_data(sysvshm_chunk_head *ptr, long key) +static php_int_t php_check_shm_data(sysvshm_chunk_head *ptr, php_int_t key) { - long pos; + php_int_t pos; sysvshm_chunk *shm_var; pos = ptr->start; @@ -412,10 +412,10 @@ static long php_check_shm_data(sysvshm_chunk_head *ptr, long key) /* {{{ php_remove_shm_data */ -static int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos) +static int php_remove_shm_data(sysvshm_chunk_head *ptr, php_int_t shm_varpos) { sysvshm_chunk *chunk_ptr, *next_chunk_ptr; - long memcpy_len; + php_int_t memcpy_len; chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos); next_chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos + chunk_ptr->next); diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 5617dca7d6..84425950a8 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -98,8 +98,8 @@ tidy_object_handlers_ ## name.clone_obj = NULL; \ } -#define TIDY_TAG_CONST(tag) REGISTER_LONG_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) -#define TIDY_NODE_CONST(name, type) REGISTER_LONG_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) +#define TIDY_TAG_CONST(tag) REGISTER_INT_CONSTANT("TIDY_TAG_" #tag, TidyTag_##tag, CONST_CS | CONST_PERSISTENT) +#define TIDY_NODE_CONST(name, type) REGISTER_INT_CONSTANT("TIDY_NODETYPE_" #name, TidyNode_##type, CONST_CS | CONST_PERSISTENT) #ifndef TRUE #define TRUE 1 @@ -134,7 +134,7 @@ #define ADD_PROPERTY_LONG(_table, _key, _long) \ { \ zval tmp; \ - ZVAL_LONG(&tmp, _long); \ + ZVAL_INT(&tmp, _long); \ zend_hash_str_update(_table, #_key, sizeof(#_key) - 1, &tmp); \ } @@ -524,21 +524,21 @@ static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS break; case TidyInteger: - if (Z_TYPE(conv) != IS_LONG) { + if (Z_TYPE(conv) != IS_INT) { zval_copy_ctor(&conv); - convert_to_long(&conv); + convert_to_int(&conv); } - if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_LVAL(conv))) { + if (tidyOptSetInt(doc, tidyOptGetId(opt), Z_IVAL(conv))) { return SUCCESS; } break; case TidyBoolean: - if (Z_TYPE(conv) != IS_LONG) { + if (Z_TYPE(conv) != IS_INT) { zval_copy_ctor(&conv); - convert_to_long(&conv); + convert_to_int(&conv); } - if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_LVAL(conv))) { + if (tidyOptSetBool(doc, tidyOptGetId(opt), Z_IVAL(conv))) { return SUCCESS; } break; @@ -734,8 +734,8 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type TSRMLS_DC) PHPTidyObj *obj; switch (type) { - case IS_LONG: - ZVAL_LONG(out, 0); + case IS_INT: + ZVAL_INT(out, 0); break; case IS_DOUBLE: @@ -767,8 +767,8 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type TSRMLS_DC) PHPTidyObj *obj; switch(type) { - case IS_LONG: - ZVAL_LONG(out, 0); + case IS_INT: + ZVAL_INT(out, 0); break; case IS_DOUBLE: @@ -1396,7 +1396,7 @@ static PHP_FUNCTION(tidy_get_config) break; case TidyInteger: - add_assoc_long(return_value, opt_name, (long)opt_value); + add_assoc_int(return_value, opt_name, (long)opt_value); break; case TidyBoolean: @@ -1415,7 +1415,7 @@ static PHP_FUNCTION(tidy_get_status) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyStatus(obj->ptdoc->doc)); + RETURN_INT(tidyStatus(obj->ptdoc->doc)); } /* }}} */ @@ -1425,7 +1425,7 @@ static PHP_FUNCTION(tidy_get_html_ver) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyDetectedHtmlVersion(obj->ptdoc->doc)); + RETURN_INT(tidyDetectedHtmlVersion(obj->ptdoc->doc)); } /* }}} */ @@ -1455,7 +1455,7 @@ static PHP_FUNCTION(tidy_error_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyErrorCount(obj->ptdoc->doc)); + RETURN_INT(tidyErrorCount(obj->ptdoc->doc)); } /* }}} */ @@ -1465,7 +1465,7 @@ static PHP_FUNCTION(tidy_warning_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyWarningCount(obj->ptdoc->doc)); + RETURN_INT(tidyWarningCount(obj->ptdoc->doc)); } /* }}} */ @@ -1475,7 +1475,7 @@ static PHP_FUNCTION(tidy_access_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyAccessWarningCount(obj->ptdoc->doc)); + RETURN_INT(tidyAccessWarningCount(obj->ptdoc->doc)); } /* }}} */ @@ -1485,7 +1485,7 @@ static PHP_FUNCTION(tidy_config_count) { TIDY_FETCH_OBJECT; - RETURN_LONG(tidyConfigErrorCount(obj->ptdoc->doc)); + RETURN_INT(tidyConfigErrorCount(obj->ptdoc->doc)); } /* }}} */ @@ -1529,7 +1529,7 @@ static PHP_FUNCTION(tidy_getopt) return; case TidyInteger: - RETURN_LONG((long)optval); + RETURN_INT((long)optval); break; case TidyBoolean: diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 1a5411ca27..be0b6a302a 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -131,7 +131,7 @@ static void tokenize(zval *return_value TSRMLS_DC) if (token_type >= 256) { array_init(&keyword); - add_next_index_long(&keyword, token_type); + add_next_index_int(&keyword, token_type); if (token_type == T_END_HEREDOC) { if (CG(increment_lineno)) { token_line = ++CG(zend_lineno); @@ -139,7 +139,7 @@ static void tokenize(zval *return_value TSRMLS_DC) } } add_next_index_stringl(&keyword, (char *)zendtext, zendleng); - add_next_index_long(&keyword, token_line); + add_next_index_int(&keyword, token_line); add_next_index_zval(return_value, &keyword); } else { add_next_index_stringl(return_value, (char *)zendtext, zendleng); @@ -158,9 +158,9 @@ static void tokenize(zval *return_value TSRMLS_DC) // fetch the rest into a T_INLINE_HTML if (zendcursor != zendlimit) { array_init(&keyword); - add_next_index_long(&keyword, T_INLINE_HTML); + add_next_index_int(&keyword, T_INLINE_HTML); add_next_index_stringl(&keyword, (char *)zendcursor, zendlimit - zendcursor); - add_next_index_long(&keyword, token_line); + add_next_index_int(&keyword, token_line); add_next_index_zval(return_value, &keyword); } break; @@ -206,9 +206,9 @@ PHP_FUNCTION(token_get_all) */ PHP_FUNCTION(token_name) { - long type; + php_int_t type; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &type) == FAILURE) { return; } diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c index beb9ea8e5b..b797518ed7 100644 --- a/ext/tokenizer/tokenizer_data.c +++ b/ext/tokenizer/tokenizer_data.c @@ -29,139 +29,139 @@ void tokenizer_register_constants(INIT_FUNC_ARGS) { - REGISTER_LONG_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_REQUIRE_ONCE", T_REQUIRE_ONCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_REQUIRE", T_REQUIRE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EVAL", T_EVAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INCLUDE_ONCE", T_INCLUDE_ONCE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INCLUDE", T_INCLUDE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LOGICAL_OR", T_LOGICAL_OR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LOGICAL_XOR", T_LOGICAL_XOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LOGICAL_AND", T_LOGICAL_AND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PRINT", T_PRINT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_YIELD", T_YIELD, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_POW_EQUAL", T_POW_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SR_EQUAL", T_SR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SL_EQUAL", T_SL_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_XOR_EQUAL", T_XOR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OR_EQUAL", T_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_AND_EQUAL", T_AND_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_MOD_EQUAL", T_MOD_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONCAT_EQUAL", T_CONCAT_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DIV_EQUAL", T_DIV_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_MUL_EQUAL", T_MUL_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_MINUS_EQUAL", T_MINUS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PLUS_EQUAL", T_PLUS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BOOLEAN_OR", T_BOOLEAN_OR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BOOLEAN_AND", T_BOOLEAN_AND, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_NOT_IDENTICAL", T_IS_NOT_IDENTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_IDENTICAL", T_IS_IDENTICAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_NOT_EQUAL", T_IS_NOT_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_EQUAL", T_IS_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_GREATER_OR_EQUAL", T_IS_GREATER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IS_SMALLER_OR_EQUAL", T_IS_SMALLER_OR_EQUAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SR", T_SR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SL", T_SL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INSTANCEOF", T_INSTANCEOF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_UNSET_CAST", T_UNSET_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BOOL_CAST", T_BOOL_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OBJECT_CAST", T_OBJECT_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ARRAY_CAST", T_ARRAY_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STRING_CAST", T_STRING_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOUBLE_CAST", T_DOUBLE_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INT_CAST", T_INT_CAST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DEC", T_DEC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INC", T_INC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_POW", T_POW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLONE", T_CLONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NEW", T_NEW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EXIT", T_EXIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IF", T_IF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ELSEIF", T_ELSEIF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ELSE", T_ELSE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDIF", T_ENDIF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LNUMBER", T_LNUMBER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DNUMBER", T_DNUMBER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STRING", T_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STRING_VARNAME", T_STRING_VARNAME, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_VARIABLE", T_VARIABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NUM_STRING", T_NUM_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INLINE_HTML", T_INLINE_HTML, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENCAPSED_AND_WHITESPACE", T_ENCAPSED_AND_WHITESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONSTANT_ENCAPSED_STRING", T_CONSTANT_ENCAPSED_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ECHO", T_ECHO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DO", T_DO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_WHILE", T_WHILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDWHILE", T_ENDWHILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FOR", T_FOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDFOR", T_ENDFOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FOREACH", T_FOREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDFOREACH", T_ENDFOREACH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DECLARE", T_DECLARE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDDECLARE", T_ENDDECLARE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_AS", T_AS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_SWITCH", T_SWITCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ENDSWITCH", T_ENDSWITCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CASE", T_CASE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DEFAULT", T_DEFAULT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_BREAK", T_BREAK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONTINUE", T_CONTINUE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_GOTO", T_GOTO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FUNCTION", T_FUNCTION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CONST", T_CONST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_RETURN", T_RETURN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_TRY", T_TRY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CATCH", T_CATCH, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FINALLY", T_FINALLY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_THROW", T_THROW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_USE", T_USE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INSTEADOF", T_INSTEADOF, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_GLOBAL", T_GLOBAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PUBLIC", T_PUBLIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PROTECTED", T_PROTECTED, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PRIVATE", T_PRIVATE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FINAL", T_FINAL, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ABSTRACT", T_ABSTRACT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_STATIC", T_STATIC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_VAR", T_VAR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_UNSET", T_UNSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ISSET", T_ISSET, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EMPTY", T_EMPTY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_HALT_COMPILER", T_HALT_COMPILER, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLASS", T_CLASS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_TRAIT", T_TRAIT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_INTERFACE", T_INTERFACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_EXTENDS", T_EXTENDS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_IMPLEMENTS", T_IMPLEMENTS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OBJECT_OPERATOR", T_OBJECT_OPERATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOUBLE_ARROW", T_DOUBLE_ARROW, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LIST", T_LIST, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ARRAY", T_ARRAY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CALLABLE", T_CALLABLE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLASS_C", T_CLASS_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_TRAIT_C", T_TRAIT_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_METHOD_C", T_METHOD_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FUNC_C", T_FUNC_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_LINE", T_LINE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_FILE", T_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_COMMENT", T_COMMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOC_COMMENT", T_DOC_COMMENT, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OPEN_TAG", T_OPEN_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_OPEN_TAG_WITH_ECHO", T_OPEN_TAG_WITH_ECHO, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CLOSE_TAG", T_CLOSE_TAG, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_WHITESPACE", T_WHITESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_START_HEREDOC", T_START_HEREDOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_END_HEREDOC", T_END_HEREDOC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOLLAR_OPEN_CURLY_BRACES", T_DOLLAR_OPEN_CURLY_BRACES, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_CURLY_OPEN", T_CURLY_OPEN, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_PAAMAYIM_NEKUDOTAYIM", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NAMESPACE", T_NAMESPACE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NS_C", T_NS_C, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DIR", T_DIR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_NS_SEPARATOR", T_NS_SEPARATOR, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_ELLIPSIS", T_ELLIPSIS, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT); } char *get_token_type_name(int token_type) diff --git a/ext/tokenizer/tokenizer_data_gen.sh b/ext/tokenizer/tokenizer_data_gen.sh index 9a675c4f97..1ed76e3617 100755 --- a/ext/tokenizer/tokenizer_data_gen.sh +++ b/ext/tokenizer/tokenizer_data_gen.sh @@ -45,8 +45,8 @@ echo '/* echo 'void tokenizer_register_constants(INIT_FUNC_ARGS) {' >> $OUTFILE -$AWK '/^#define T_/ { print " REGISTER_LONG_CONSTANT(\"" $2 "\", " $2 ", CONST_CS | CONST_PERSISTENT);" }' < $INFILE >> $OUTFILE -echo ' REGISTER_LONG_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);' >> $OUTFILE +$AWK '/^#define T_/ { print " REGISTER_INT_CONSTANT(\"" $2 "\", " $2 ", CONST_CS | CONST_PERSISTENT);" }' < $INFILE >> $OUTFILE +echo ' REGISTER_INT_CONSTANT("T_DOUBLE_COLON", T_PAAMAYIM_NEKUDOTAYIM, CONST_CS | CONST_PERSISTENT);' >> $OUTFILE echo '}' >> $OUTFILE diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 0b853f34f2..e0cde68cc1 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -300,7 +300,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx) if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) { if (key == NULL) { - key = zend_long_to_str(idx); + key = zend_int_to_str(idx); } else { STR_ADDREF(key); } @@ -389,10 +389,10 @@ static void php_wddx_serialize_string(wddx_packet *packet, zval *var TSRMLS_DC) { php_wddx_add_chunk_static(packet, WDDX_STRING_S); - if (Z_STRLEN_P(var) > 0) { + if (Z_STRSIZE_P(var) > 0) { zend_string *buf; - buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRLEN_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC); + buf = php_escape_html_entities(Z_STRVAL_P(var), Z_STRSIZE_P(var), 0, ENT_QUOTES, NULL TSRMLS_CC); php_wddx_add_chunk_ex(packet, buf->val, buf->len); @@ -512,7 +512,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) php_wddx_serialize_var(packet, ent, tmp TSRMLS_CC); STR_RELEASE(tmp); } else { - key = zend_long_to_str(idx); + key = zend_int_to_str(idx); php_wddx_serialize_var(packet, ent, key TSRMLS_CC); STR_RELEASE(key); } @@ -568,7 +568,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) if (key) { php_wddx_serialize_var(packet, ent, key TSRMLS_CC); } else { - key = zend_long_to_str(idx); + key = zend_int_to_str(idx); php_wddx_serialize_var(packet, ent, key TSRMLS_CC); STR_RELEASE(key); } @@ -612,7 +612,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name TS php_wddx_serialize_string(packet, var TSRMLS_CC); break; - case IS_LONG: + case IS_INT: case IS_DOUBLE: php_wddx_serialize_number(packet, var); break; @@ -750,7 +750,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_NUMBER; SET_STACK_VARNAME; - ZVAL_LONG(&ent.data, 0); + ZVAL_INT(&ent.data, 0); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp((char *)name, EL_BOOLEAN)) { int i; @@ -854,7 +854,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_DATETIME; SET_STACK_VARNAME; - ZVAL_LONG(&ent.data, 0); + ZVAL_INT(&ent.data, 0); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } } @@ -886,7 +886,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (!strcmp((char *)name, EL_BINARY)) { zend_string *new_str; - new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + new_str = php_base64_decode(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); zval_ptr_dtor(&ent1->data); ZVAL_STR(&ent1->data, new_str); } @@ -919,10 +919,10 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) if (ent1->varname) { if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) && - Z_TYPE(ent1->data) == IS_STRING && Z_STRLEN(ent1->data)) { + Z_TYPE(ent1->data) == IS_STRING && Z_STRSIZE(ent1->data)) { zend_bool incomplete_class = 0; - zend_str_tolower(Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + zend_str_tolower(Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); STR_FORGET_HASH_VAL(Z_STR(ent1->data)); if ((pce = zend_hash_find_ptr(EG(class_table), Z_STR(ent1->data))) == NULL) { incomplete_class = 1; @@ -938,7 +938,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) zval_add_ref, 0); if (incomplete_class) { - php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRLEN(ent1->data)); + php_store_class_name(&obj, Z_STRVAL(ent1->data), Z_STRSIZE(ent1->data)); } /* Clean up old array entry */ @@ -992,13 +992,13 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) switch (ent->type) { case ST_BINARY: case ST_STRING: - if (Z_STRLEN(ent->data) == 0) { + if (Z_STRSIZE(ent->data) == 0) { zval_ptr_dtor(&ent->data); ZVAL_STRINGL(&ent->data, (char *)s, len); } else { - Z_STR(ent->data) = STR_REALLOC(Z_STR(ent->data), Z_STRLEN(ent->data) + len, 0); - memcpy(Z_STRVAL(ent->data) + Z_STRLEN(ent->data) - len, (char *)s, len); - Z_STRVAL(ent->data)[Z_STRLEN(ent->data)] = '\0'; + Z_STR(ent->data) = STR_REALLOC(Z_STR(ent->data), Z_STRSIZE(ent->data) + len, 0); + memcpy(Z_STRVAL(ent->data) + Z_STRSIZE(ent->data) - len, (char *)s, len); + Z_STRVAL(ent->data)[Z_STRSIZE(ent->data)] = '\0'; } break; case ST_NUMBER: @@ -1008,9 +1008,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) case ST_BOOLEAN: if (!strcmp((char *)s, "true")) { - Z_LVAL(ent->data) = 1; + Z_IVAL(ent->data) = 1; } else if (!strcmp((char *)s, "false")) { - Z_LVAL(ent->data) = 0; + Z_IVAL(ent->data) = 0; } else { stack->top--; zval_ptr_dtor(&ent->data); @@ -1027,9 +1027,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) memcpy(tmp, (char *)s, len); tmp[len] = '\0'; - Z_LVAL(ent->data) = php_parse_date(tmp, NULL); + Z_IVAL(ent->data) = php_parse_date(tmp, NULL); /* date out of range < 1969 or > 2038 */ - if (Z_LVAL(ent->data) == -1) { + if (Z_IVAL(ent->data) == -1) { ZVAL_STRINGL(&ent->data, (char *)s, len); } efree(tmp); diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 28b5fc2e0e..1ae1f02889 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -314,33 +314,33 @@ PHP_MINIT_FUNCTION(xml) { le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number); - REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT); /* this object should not be pre-initialised at compile time, as the order of members may vary */ @@ -456,7 +456,7 @@ static void xml_set_handler(zval *handler, zval *data) /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */ if (Z_TYPE_P(data) != IS_ARRAY && Z_TYPE_P(data) != IS_OBJECT) { convert_to_string_ex(data); - if (Z_STRLEN_P(data) == 0) { + if (Z_STRSIZE_P(data) == 0) { ZVAL_UNDEF(handler); return; } @@ -663,9 +663,9 @@ static int _xml_xmlcharlen(const XML_Char *s) PHPAPI char *_xml_zval_strdup(zval *val) { if (Z_TYPE_P(val) == IS_STRING) { - char *buf = emalloc(Z_STRLEN_P(val) + 1); - memcpy(buf, Z_STRVAL_P(val), Z_STRLEN_P(val)); - buf[Z_STRLEN_P(val)] = '\0'; + char *buf = emalloc(Z_STRSIZE_P(val) + 1); + memcpy(buf, Z_STRVAL_P(val), Z_STRSIZE_P(val)); + buf[Z_STRSIZE_P(val)] = '\0'; return buf; } return NULL; @@ -687,7 +687,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name) element = zend_hash_str_update(Z_ARRVAL(parser->info), name, strlen(name), &values); } - add_next_index_long(element, parser->curtag); + add_next_index_int(element, parser->curtag); parser->curtag++; } @@ -756,7 +756,7 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */ add_assoc_string(&tag, "type", "open"); - add_assoc_long(&tag, "level", parser->level); + add_assoc_int(&tag, "level", parser->level); parser->ltags[parser->level-1] = estrdup(tag_name->val); parser->lastwasopen = 1; @@ -827,7 +827,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name) add_assoc_string(&tag, "tag", tag_name->val + parser->toffset); /* cast to avoid gcc-warning */ add_assoc_string(&tag, "type", "close"); - add_assoc_long(&tag, "level", parser->level); + add_assoc_int(&tag, "level", parser->level); zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag); } @@ -887,9 +887,9 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) /* check if the current tag already has a value - if yes append to that! */ if ((myval = zend_hash_str_find(Z_ARRVAL_P(parser->ctag), "value", sizeof("value") - 1))) { - int newlen = Z_STRLEN_P(myval) + decoded_value->len; + int newlen = Z_STRSIZE_P(myval) + decoded_value->len; Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0); - strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len, + strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len, decoded_value->val, decoded_value->len + 1); STR_RELEASE(decoded_value); } else { @@ -904,9 +904,9 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) if ((mytype = zend_hash_str_find(Z_ARRVAL_P(curtag),"type", sizeof("type") - 1))) { if (!strcmp(Z_STRVAL_P(mytype), "cdata")) { if ((myval = zend_hash_str_find(Z_ARRVAL_P(curtag), "value", sizeof("value") - 1))) { - int newlen = Z_STRLEN_P(myval) + decoded_value->len; + int newlen = Z_STRSIZE_P(myval) + decoded_value->len; Z_STR_P(myval) = STR_REALLOC(Z_STR_P(myval), newlen, 0); - strncpy(Z_STRVAL_P(myval) + Z_STRLEN_P(myval) - decoded_value->len, + strncpy(Z_STRVAL_P(myval) + Z_STRSIZE_P(myval) - decoded_value->len, decoded_value->val, decoded_value->len + 1); STR_RELEASE(decoded_value); return; @@ -924,7 +924,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len) add_assoc_string(&tag, "tag", parser->ltags[parser->level-1] + parser->toffset); add_assoc_str(&tag, "value", decoded_value); add_assoc_string(&tag, "type", "cdata"); - add_assoc_long(&tag, "level", parser->level); + add_assoc_int(&tag, "level", parser->level); zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag); } else if (parser->level == (XML_MAXLEVEL + 1)) { @@ -1041,8 +1041,8 @@ int _xml_externalEntityRefHandler(XML_Parser parserPtr, _xml_xmlchar_zval(publicId, 0, parser->target_encoding, &args[4]); xml_call_handler(parser, &parser->externalEntityRefHandler, parser->externalEntityRefPtr, 5, args, &retval); if (!Z_ISUNDEF(retval)) { - convert_to_long(&retval); - ret = Z_LVAL(retval); + convert_to_int(&retval); + ret = Z_IVAL(retval); } else { ret = 0; } @@ -1366,9 +1366,9 @@ PHP_FUNCTION(xml_parse) zval *pind; char *data; int data_len, ret; - long isFinal = 0; + php_int_t isFinal = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pind, &data, &data_len, &isFinal) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|i", &pind, &data, &data_len, &isFinal) == FAILURE) { return; } ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); @@ -1376,7 +1376,7 @@ PHP_FUNCTION(xml_parse) parser->isparsing = 1; ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, isFinal); parser->isparsing = 0; - RETVAL_LONG(ret); + RETVAL_INT(ret); } /* }}} */ @@ -1422,7 +1422,7 @@ PHP_FUNCTION(xml_parse_into_struct) ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, 1); parser->isparsing = 0; - RETVAL_LONG(ret); + RETVAL_INT(ret); } /* }}} */ @@ -1439,7 +1439,7 @@ PHP_FUNCTION(xml_get_error_code) ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETURN_LONG((long)XML_GetErrorCode(parser->parser)); + RETURN_INT((long)XML_GetErrorCode(parser->parser)); } /* }}} */ @@ -1447,10 +1447,10 @@ PHP_FUNCTION(xml_get_error_code) Get XML parser error string */ PHP_FUNCTION(xml_error_string) { - long code; + php_int_t code; char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &code) == FAILURE) { return; } @@ -1474,7 +1474,7 @@ PHP_FUNCTION(xml_get_current_line_number) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser)); + RETVAL_INT(XML_GetCurrentLineNumber(parser->parser)); } /* }}} */ @@ -1491,7 +1491,7 @@ PHP_FUNCTION(xml_get_current_column_number) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser)); + RETVAL_INT(XML_GetCurrentColumnNumber(parser->parser)); } /* }}} */ @@ -1508,7 +1508,7 @@ PHP_FUNCTION(xml_get_current_byte_index) ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); - RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser)); + RETVAL_INT(XML_GetCurrentByteIndex(parser->parser)); } /* }}} */ @@ -1544,9 +1544,9 @@ PHP_FUNCTION(xml_parser_set_option) { xml_parser *parser; zval *pind, *val; - long opt; + php_int_t opt; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &pind, &opt, &val) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "riz", &pind, &opt, &val) == FAILURE) { return; } @@ -1554,16 +1554,16 @@ PHP_FUNCTION(xml_parser_set_option) switch (opt) { case PHP_XML_OPTION_CASE_FOLDING: - convert_to_long_ex(val); - parser->case_folding = Z_LVAL_P(val); + convert_to_int_ex(val); + parser->case_folding = Z_IVAL_P(val); break; case PHP_XML_OPTION_SKIP_TAGSTART: - convert_to_long_ex(val); - parser->toffset = Z_LVAL_P(val); + convert_to_int_ex(val); + parser->toffset = Z_IVAL_P(val); break; case PHP_XML_OPTION_SKIP_WHITE: - convert_to_long_ex(val); - parser->skipwhite = Z_LVAL_P(val); + convert_to_int_ex(val); + parser->skipwhite = Z_IVAL_P(val); break; case PHP_XML_OPTION_TARGET_ENCODING: { xml_encoding *enc; @@ -1591,16 +1591,16 @@ PHP_FUNCTION(xml_parser_get_option) { xml_parser *parser; zval *pind; - long opt; + php_int_t opt; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &pind, &opt) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &pind, &opt) == FAILURE) { return; } ZEND_FETCH_RESOURCE(parser, xml_parser *, pind, -1, "XML Parser", le_xml_parser); switch (opt) { case PHP_XML_OPTION_CASE_FOLDING: - RETURN_LONG(parser->case_folding); + RETURN_INT(parser->case_folding); break; case PHP_XML_OPTION_TARGET_ENCODING: RETURN_STRING((char *)parser->target_encoding); diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 443fca3355..79d41065cf 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -100,8 +100,8 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl case IS_FALSE: ZVAL_BOOL(rv, retint); break; - case IS_LONG: - ZVAL_LONG(rv, retint); + case IS_INT: + ZVAL_INT(rv, retint); break; default: ZVAL_NULL(rv); @@ -561,11 +561,11 @@ Get value of an attribute at index from current element */ PHP_METHOD(xmlreader, getAttributeNo) { zval *id; - long attr_pos; + php_int_t attr_pos; char *retchar = NULL; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) { return; } @@ -618,11 +618,11 @@ Indicates whether given property (one of the parser option constants) is set or PHP_METHOD(xmlreader, getParserProperty) { zval *id; - long property; + php_int_t property; int retval = -1; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &property) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &property) == FAILURE) { return; } @@ -697,11 +697,11 @@ Returns TRUE on success and FALSE on failure */ PHP_METHOD(xmlreader, moveToAttributeNo) { zval *id; - long attr_pos; + php_int_t attr_pos; int retval; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr_pos) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &attr_pos) == FAILURE) { return; } @@ -847,14 +847,14 @@ PHP_METHOD(xmlreader, open) { zval *id; int source_len = 0, encoding_len = 0; - long options = 0; + php_int_t options = 0; xmlreader_object *intern = NULL; char *source, *valid_file = NULL; char *encoding = NULL; char resolved_path[MAXPATHLEN + 1]; xmlTextReaderPtr reader = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { return; } @@ -978,12 +978,12 @@ Properties must be set after open() or XML() and before the first read() is call PHP_METHOD(xmlreader, setParserProperty) { zval *id; - long property; + php_int_t property; int retval = -1; zend_bool value; xmlreader_object *intern; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &property, &value) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ib", &property, &value) == FAILURE) { return; } @@ -1030,7 +1030,7 @@ PHP_METHOD(xmlreader, XML) { zval *id; int source_len = 0, encoding_len = 0; - long options = 0; + php_int_t options = 0; xmlreader_object *intern = NULL; char *source, *uri = NULL, *encoding = NULL; int resolved_path_len, ret = 0; @@ -1038,7 +1038,7 @@ PHP_METHOD(xmlreader, XML) xmlParserInputBufferPtr inputbfr; xmlTextReaderPtr reader; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!i", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) { return; } @@ -1313,9 +1313,9 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_hash_init(&xmlreader_prop_handlers, 0, NULL, php_xmlreader_free_prop_handler, 1); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_LONG TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_INT TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "baseURI", NULL, xmlTextReaderConstBaseUri, IS_STRING TSRMLS_CC); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_LONG TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "depth", xmlTextReaderDepth, NULL, IS_INT TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasAttributes", xmlTextReaderHasAttributes, NULL, IS_FALSE TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "hasValue", xmlTextReaderHasValue, NULL, IS_FALSE TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "isDefault", xmlTextReaderIsDefault, NULL, IS_FALSE TSRMLS_CC); @@ -1323,43 +1323,43 @@ PHP_MINIT_FUNCTION(xmlreader) xmlreader_register_prop_handler(&xmlreader_prop_handlers, "localName", NULL, xmlTextReaderConstLocalName, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "name", NULL, xmlTextReaderConstName, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "namespaceURI", NULL, xmlTextReaderConstNamespaceUri, IS_STRING TSRMLS_CC); - xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_LONG TSRMLS_CC); + xmlreader_register_prop_handler(&xmlreader_prop_handlers, "nodeType", xmlTextReaderNodeType, NULL, IS_INT TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "prefix", NULL, xmlTextReaderConstPrefix, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "value", NULL, xmlTextReaderConstValue, IS_STRING TSRMLS_CC); xmlreader_register_prop_handler(&xmlreader_prop_handlers, "xmlLang", NULL, xmlTextReaderConstXmlLang, IS_STRING TSRMLS_CC); /* Constants for NodeType - cannot define common types to share with dom as there are differences in these types */ - REGISTER_XMLREADER_CLASS_CONST_LONG("NONE", XML_READER_TYPE_NONE); - REGISTER_XMLREADER_CLASS_CONST_LONG("ELEMENT", XML_READER_TYPE_ELEMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE); - REGISTER_XMLREADER_CLASS_CONST_LONG("TEXT", XML_READER_TYPE_TEXT); - REGISTER_XMLREADER_CLASS_CONST_LONG("CDATA", XML_READER_TYPE_CDATA); - REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE); - REGISTER_XMLREADER_CLASS_CONST_LONG("ENTITY", XML_READER_TYPE_ENTITY); - REGISTER_XMLREADER_CLASS_CONST_LONG("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION); - REGISTER_XMLREADER_CLASS_CONST_LONG("COMMENT", XML_READER_TYPE_COMMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("DOC", XML_READER_TYPE_DOCUMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE); - REGISTER_XMLREADER_CLASS_CONST_LONG("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("NOTATION", XML_READER_TYPE_NOTATION); - REGISTER_XMLREADER_CLASS_CONST_LONG("WHITESPACE", XML_READER_TYPE_WHITESPACE); - REGISTER_XMLREADER_CLASS_CONST_LONG("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE); - REGISTER_XMLREADER_CLASS_CONST_LONG("END_ELEMENT", XML_READER_TYPE_END_ELEMENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("END_ENTITY", XML_READER_TYPE_END_ENTITY); - REGISTER_XMLREADER_CLASS_CONST_LONG("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION); + REGISTER_XMLREADER_CLASS_CONST_INT("NONE", XML_READER_TYPE_NONE); + REGISTER_XMLREADER_CLASS_CONST_INT("ELEMENT", XML_READER_TYPE_ELEMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("ATTRIBUTE", XML_READER_TYPE_ATTRIBUTE); + REGISTER_XMLREADER_CLASS_CONST_INT("TEXT", XML_READER_TYPE_TEXT); + REGISTER_XMLREADER_CLASS_CONST_INT("CDATA", XML_READER_TYPE_CDATA); + REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY_REF", XML_READER_TYPE_ENTITY_REFERENCE); + REGISTER_XMLREADER_CLASS_CONST_INT("ENTITY", XML_READER_TYPE_ENTITY); + REGISTER_XMLREADER_CLASS_CONST_INT("PI", XML_READER_TYPE_PROCESSING_INSTRUCTION); + REGISTER_XMLREADER_CLASS_CONST_INT("COMMENT", XML_READER_TYPE_COMMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("DOC", XML_READER_TYPE_DOCUMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("DOC_TYPE", XML_READER_TYPE_DOCUMENT_TYPE); + REGISTER_XMLREADER_CLASS_CONST_INT("DOC_FRAGMENT", XML_READER_TYPE_DOCUMENT_FRAGMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("NOTATION", XML_READER_TYPE_NOTATION); + REGISTER_XMLREADER_CLASS_CONST_INT("WHITESPACE", XML_READER_TYPE_WHITESPACE); + REGISTER_XMLREADER_CLASS_CONST_INT("SIGNIFICANT_WHITESPACE", XML_READER_TYPE_SIGNIFICANT_WHITESPACE); + REGISTER_XMLREADER_CLASS_CONST_INT("END_ELEMENT", XML_READER_TYPE_END_ELEMENT); + REGISTER_XMLREADER_CLASS_CONST_INT("END_ENTITY", XML_READER_TYPE_END_ENTITY); + REGISTER_XMLREADER_CLASS_CONST_INT("XML_DECLARATION", XML_READER_TYPE_XML_DECLARATION); /* Constants for Parser options */ - REGISTER_XMLREADER_CLASS_CONST_LONG("LOADDTD", XML_PARSER_LOADDTD); - REGISTER_XMLREADER_CLASS_CONST_LONG("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS); - REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDATE", XML_PARSER_VALIDATE); - REGISTER_XMLREADER_CLASS_CONST_LONG("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES); + REGISTER_XMLREADER_CLASS_CONST_INT("LOADDTD", XML_PARSER_LOADDTD); + REGISTER_XMLREADER_CLASS_CONST_INT("DEFAULTATTRS", XML_PARSER_DEFAULTATTRS); + REGISTER_XMLREADER_CLASS_CONST_INT("VALIDATE", XML_PARSER_VALIDATE); + REGISTER_XMLREADER_CLASS_CONST_INT("SUBST_ENTITIES", XML_PARSER_SUBST_ENTITIES); /* Constants for Errors when loading - not yet used until we implement custom error handling - REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT); - REGISTER_XMLREADER_CLASS_CONST_LONG("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_WARNING", XML_PARSER_SEVERITY_VALIDITY_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("VALIDITY_ERROR", XML_PARSER_SEVERITY_VALIDITY_ERROR, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("WARNING", XML_PARSER_SEVERITY_WARNING, CONST_CS | CONST_PERSISTENT); + REGISTER_XMLREADER_CLASS_CONST_INT("ERROR", XML_PARSER_SEVERITY_ERROR, CONST_CS | CONST_PERSISTENT); */ return SUCCESS; diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h index 63653213fe..1ceb2e1e61 100644 --- a/ext/xmlreader/php_xmlreader.h +++ b/ext/xmlreader/php_xmlreader.h @@ -50,8 +50,8 @@ PHP_MINIT_FUNCTION(xmlreader); PHP_MSHUTDOWN_FUNCTION(xmlreader); PHP_MINFO_FUNCTION(xmlreader); -#define REGISTER_XMLREADER_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +#define REGISTER_XMLREADER_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(xmlreader_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); #ifdef ZTS #define XMLREADER_G(v) TSRMG(xmlreader_globals_id, zend_xmlreader_globals *, v) diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 5f019a87ef..fe0c794d1d 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -316,8 +316,8 @@ PHP_MINFO_FUNCTION(xmlrpc) */ #if 0 static int add_long(zval* list, char* id, int num) { - if(id) return add_assoc_long(list, id, num); - else return add_next_index_long(list, num); + if(id) return add_assoc_int(list, id, num); + else return add_next_index_int(list, num); } static int add_double(zval* list, char* id, double num) { @@ -342,7 +342,7 @@ static void add_zval(zval* list, const char* id, zval* val) if (list && val) { if (id) { int id_len = strlen(id); - if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_LONG) { + if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_INT) { long index = strtol(id, NULL, 0); zend_hash_index_update(Z_ARRVAL_P(list), index, val); } else { @@ -516,7 +516,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep xReturn = XMLRPC_CreateValueEmpty(); XMLRPC_SetValueID(xReturn, key, 0); } else { - xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRLEN(val)); + xReturn = XMLRPC_CreateValueBase64(key, Z_STRVAL(val), Z_STRSIZE(val)); } break; case xmlrpc_datetime: @@ -528,8 +528,8 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep xReturn = XMLRPC_CreateValueBoolean(key, Z_TYPE(val) == IS_TRUE); break; case xmlrpc_int: - convert_to_long(&val); - xReturn = XMLRPC_CreateValueInt(key, Z_LVAL(val)); + convert_to_int(&val); + xReturn = XMLRPC_CreateValueInt(key, Z_IVAL(val)); break; case xmlrpc_double: convert_to_double(&val); @@ -537,7 +537,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep break; case xmlrpc_string: convert_to_string(&val); - xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRLEN(val)); + xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRSIZE(val)); break; case xmlrpc_vector: { @@ -618,7 +618,7 @@ static void XMLRPC_to_PHP(XMLRPC_VALUE el, zval *elem) } break; case xmlrpc_int: - ZVAL_LONG(elem, XMLRPC_GetValueInt(el)); + ZVAL_INT(elem, XMLRPC_GetValueInt(el)); break; case xmlrpc_boolean: ZVAL_BOOL(elem, XMLRPC_GetValueBoolean(el)); @@ -1130,9 +1130,9 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data) if (xDesc) { int retval = XMLRPC_ServerAddIntrospectionData(server->server_ptr, xDesc); XMLRPC_CleanupValue(xDesc); - RETURN_LONG(retval); + RETURN_INT(retval); } - RETURN_LONG(0); + RETURN_INT(0); } /* }}} */ @@ -1276,7 +1276,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */ if (timestamp != -1) { zval ztimestamp; - ZVAL_LONG(&ztimestamp, timestamp); + ZVAL_INT(&ztimestamp, timestamp); convert_to_object(value); if (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type)) { @@ -1321,7 +1321,7 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */ #else case IS_BOOL: #endif - case IS_LONG: + case IS_INT: case IS_RESOURCE: type = xmlrpc_int; break; diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index d743a29113..a3d9b59f6e 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -635,7 +635,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i dir_len = php_dirname(file_dirname, strlen(source)); if (dir_len > 0) { - struct stat buf; + php_stat_t buf; if (php_sys_stat(file_dirname, &buf) != 0) { xmlFreeURI(uri); return NULL; @@ -1756,7 +1756,7 @@ static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string) xmlBufferEmpty(buffer); } } else { - RETVAL_LONG(output_bytes); + RETVAL_INT(output_bytes); } return; } diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c index bda02498ed..2b08a8a49b 100644 --- a/ext/xsl/php_xsl.c +++ b/ext/xsl/php_xsl.c @@ -161,23 +161,23 @@ PHP_MINIT_FUNCTION(xsl) xsl_ext_function_object_php); xsltSetGenericErrorFunc(NULL, php_libxml_error_handler); - REGISTER_LONG_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT); - - REGISTER_LONG_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_CLONE_AUTO", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_CLONE_NEVER", -1, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_CLONE_ALWAYS", 1, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("XSL_SECPREF_NONE", XSL_SECPREF_NONE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_READ_FILE", XSL_SECPREF_READ_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_FILE", XSL_SECPREF_WRITE_FILE, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_CREATE_DIRECTORY", XSL_SECPREF_CREATE_DIRECTORY, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_READ_NETWORK", XSL_SECPREF_READ_NETWORK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_WRITE_NETWORK", XSL_SECPREF_WRITE_NETWORK, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("XSL_SECPREF_DEFAULT", XSL_SECPREF_DEFAULT, CONST_CS | CONST_PERSISTENT); + + REGISTER_INT_CONSTANT("LIBXSLT_VERSION", LIBXSLT_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXSLT_DOTTED_VERSION", LIBXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); #if HAVE_XSL_EXSLT - REGISTER_LONG_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("LIBEXSLT_VERSION", LIBEXSLT_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBEXSLT_DOTTED_VERSION", LIBEXSLT_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h index f6ad3712dc..e1702ebaa8 100644 --- a/ext/xsl/php_xsl.h +++ b/ext/xsl/php_xsl.h @@ -64,7 +64,7 @@ typedef struct _xsl_object { HashTable *node_list; php_libxml_node_object *doc; char *profiling; - long securityPrefs; + php_int_t securityPrefs; int securityPrefsSet; zend_object std; } xsl_object; diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 100d167138..2bf3269b3f 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -138,7 +138,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS zval *value; char *xpath_expr; zend_string *string_key; - ulong num_key; + php_uint_t num_key; char **params = NULL; int i = 0; @@ -160,7 +160,7 @@ static char **php_xsl_xslt_make_params(HashTable *parht, int xpath_params TSRMLS if (!xpath_params) { xpath_expr = php_xsl_xslt_string_to_xpathexpr(Z_STRVAL_P(value) TSRMLS_CC); } else { - xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); + xpath_expr = estrndup(Z_STRVAL_P(value), Z_STRSIZE_P(value)); } if (xpath_expr) { params[i++] = estrndup(string_key->val, string_key->len); @@ -351,7 +351,7 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t nodep = dom_object_get_node(obj); valuePush(ctxt, xmlXPathNewNodeSet(nodep)); } else if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) { - valuePush(ctxt, xmlXPathNewBoolean(Z_LVAL(retval))); + valuePush(ctxt, xmlXPathNewBoolean(Z_IVAL(retval))); } else if (Z_TYPE(retval) == IS_OBJECT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A PHP Object cannot be converted to a XPath-string"); valuePush(ctxt, xmlXPathNewString("")); @@ -437,8 +437,8 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet) ZVAL_STRING(&member, "cloneDocument"); cloneDocu = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC); if (Z_TYPE_P(cloneDocu) != IS_NULL) { - convert_to_long(cloneDocu); - clone_docu = Z_LVAL_P(cloneDocu); + convert_to_int(cloneDocu); + clone_docu = Z_IVAL_P(cloneDocu); } zval_ptr_dtor(&member); if (clone_docu == 0) { @@ -536,8 +536,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl ZVAL_STRING(&member, "doXInclude"); doXInclude = std_hnd->read_property(id, &member, BP_VAR_IS, NULL, &rv TSRMLS_CC); if (Z_TYPE_P(doXInclude) != IS_NULL) { - convert_to_long(doXInclude); - ctxt->xinclude = Z_LVAL_P(doXInclude); + convert_to_int(doXInclude); + ctxt->xinclude = Z_IVAL_P(doXInclude); } zval_ptr_dtor(&member); @@ -715,7 +715,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri) xmlFreeDoc(newdocp); } - RETVAL_LONG(ret); + RETVAL_INT(ret); } /* }}} end xsl_xsltprocessor_transform_to_uri */ @@ -765,7 +765,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter) zval *id; zval *array_value, *entry, new_string; xsl_object *intern; - ulong idx; + php_uint_t idx; char *namespace; int namespace_len; zend_string *string_key, *name, *value; @@ -868,7 +868,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(array_value), entry) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); - ZVAL_LONG(&new_string ,1); + ZVAL_INT(&new_string ,1); zend_hash_update(intern->registered_phpfunctions, Z_STR_P(entry), &new_string); } ZEND_HASH_FOREACH_END(); @@ -876,7 +876,7 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "S", &name) == SUCCESS) { intern = Z_XSL_P(id); - ZVAL_LONG(&new_string,1); + ZVAL_INT(&new_string,1); zend_hash_update(intern->registered_phpfunctions, name, &new_string); intern->registerPhpFunctions = 2; @@ -919,10 +919,10 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) { zval *id; xsl_object *intern; - long securityPrefs, oldSecurityPrefs; + php_int_t securityPrefs, oldSecurityPrefs; DOM_GET_THIS(id); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &securityPrefs) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &securityPrefs) == FAILURE) { return; } intern = Z_XSL_P(id); @@ -930,7 +930,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs) intern->securityPrefs = securityPrefs; /* set this to 1 so that we know, it was set through this method. Can be removed, when we remove the ini setting */ intern->securityPrefsSet = 1; - RETURN_LONG(oldSecurityPrefs); + RETURN_INT(oldSecurityPrefs); } /* }}} end xsl_xsltprocessor_set_security_prefs */ @@ -943,7 +943,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs) DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "") == SUCCESS) { intern = Z_XSL_P(id); - RETURN_LONG(intern->securityPrefs); + RETURN_INT(intern->securityPrefs); } else { WRONG_PARAM_COUNT; } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 633644e4e9..9fd3e8ce4a 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -90,7 +90,7 @@ static int le_zip_entry; /* }}} */ # define add_ascii_assoc_string add_assoc_string -# define add_ascii_assoc_long add_assoc_long +# define add_ascii_assoc_long add_assoc_int /* Flatten a path by making a relative path (to .)*/ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */ @@ -311,18 +311,18 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam } /* }}} */ -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; - if (Z_TYPE_P(option) != IS_LONG) { + php_int_t opt; + if (Z_TYPE_P(option) != IS_INT) { zval tmp; ZVAL_DUP(&tmp, option); - convert_to_long(&tmp); - opt = Z_LVAL(tmp); + convert_to_int(&tmp); + opt = Z_IVAL(tmp); } else { - opt = Z_LVAL_P(option); + opt = Z_IVAL_P(option); } *remove_all_path = opt; } @@ -334,17 +334,17 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, char **re return -1; } - if (Z_STRLEN_P(option) < 1) { + if (Z_STRSIZE_P(option) < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as remove_path option"); return -1; } - if (Z_STRLEN_P(option) >= MAXPATHLEN) { + if (Z_STRSIZE_P(option) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "remove_path string is too long (max: %i, %i given)", - MAXPATHLEN - 1, Z_STRLEN_P(option)); + MAXPATHLEN - 1, Z_STRSIZE_P(option)); return -1; } - *remove_path_len = Z_STRLEN_P(option); + *remove_path_len = Z_STRSIZE_P(option); *remove_path = Z_STRVAL_P(option); } @@ -354,26 +354,26 @@ static int php_zip_parse_options(zval *options, long *remove_all_path, char **re return -1; } - if (Z_STRLEN_P(option) < 1) { + if (Z_STRSIZE_P(option) < 1) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Empty string given as the add_path option"); return -1; } - if (Z_STRLEN_P(option) >= MAXPATHLEN) { + if (Z_STRSIZE_P(option) >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "add_path string too long (max: %i, %i given)", - MAXPATHLEN - 1, Z_STRLEN_P(option)); + MAXPATHLEN - 1, Z_STRSIZE_P(option)); return -1; } - *add_path_len = Z_STRLEN_P(option); + *add_path_len = Z_STRSIZE_P(option); *add_path = Z_STRVAL_P(option); } return 1; } /* }}} */ -/* {{{ REGISTER_ZIP_CLASS_CONST_LONG */ -#define REGISTER_ZIP_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); +/* {{{ REGISTER_ZIP_CLASS_CONST_INT */ +#define REGISTER_ZIP_CLASS_CONST_INT(const_name, value) \ + zend_declare_class_constant_int(zip_class_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); /* }}} */ /* {{{ ZIP_FROM_OBJECT */ @@ -481,7 +481,7 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len TSRMLS_DC) /* #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]; @@ -565,7 +565,7 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value * 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; @@ -637,7 +637,7 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val /* 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; @@ -818,8 +818,8 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, case IS_FALSE: ZVAL_BOOL(rv, (long)retint); break; - case IS_LONG: - ZVAL_LONG(rv, (long)retint); + case IS_INT: + ZVAL_INT(rv, (long)retint); break; default: ZVAL_NULL(rv); @@ -1124,7 +1124,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open) rsrc_int->za = zip_open(resolved_path, 0, &err); if (rsrc_int->za == NULL) { efree(rsrc_int); - RETURN_LONG((long)err); + RETURN_INT((long)err); } rsrc_int->index_current = 0; @@ -1244,12 +1244,12 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close) 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; } @@ -1296,10 +1296,10 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ RETURN_STRING((char *)zr_rsrc->sb.name); break; case 1: - RETURN_LONG((long) (zr_rsrc->sb.comp_size)); + RETURN_INT((php_int_t) (zr_rsrc->sb.comp_size)); break; case 2: - RETURN_LONG((long) (zr_rsrc->sb.size)); + RETURN_INT((php_int_t) (zr_rsrc->sb.size)); break; case 3: switch (zr_rsrc->sb.comp_method) { @@ -1333,7 +1333,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ default: RETURN_FALSE; } - RETURN_LONG((long) (zr_rsrc->sb.comp_method)); + RETURN_INT((php_int_t) (zr_rsrc->sb.comp_method)); break; } @@ -1378,13 +1378,13 @@ static ZIPARCHIVE_METHOD(open) { 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; } @@ -1423,7 +1423,7 @@ static ZIPARCHIVE_METHOD(open) intern = zip_open(resolved_path, flags, &err); if (!intern || err) { efree(resolved_path); - RETURN_LONG((long)err); + RETURN_INT((php_int_t)err); } ze_obj->filename = resolved_path; ze_obj->filename_len = strlen(resolved_path); @@ -1576,8 +1576,8 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* 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; @@ -1589,7 +1589,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* 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; } @@ -1632,20 +1632,20 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(return_value), i)) != NULL) { if (remove_all_path) { - basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0 TSRMLS_CC); + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), NULL, 0 TSRMLS_CC); file_stripped = basename->val; file_stripped_len = basename->len; } else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) { file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1; - file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1; + file_stripped_len = Z_STRSIZE_P(zval_file) - remove_path_len - 1; } else { file_stripped = Z_STRVAL_P(zval_file); - file_stripped_len = Z_STRLEN_P(zval_file); + file_stripped_len = Z_STRSIZE_P(zval_file); } 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; @@ -1656,13 +1656,13 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* entry_name_len = strlen(entry_name); } else { entry_name = Z_STRVAL_P(zval_file); - entry_name_len = Z_STRLEN_P(zval_file); + entry_name_len = Z_STRSIZE_P(zval_file); } if (basename) { STR_RELEASE(basename); basename = NULL; } - if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), + if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file), entry_name, entry_name_len, 0, 0 TSRMLS_CC) < 0) { zval_dtor(return_value); RETURN_FALSE; @@ -1697,7 +1697,7 @@ static ZIPARCHIVE_METHOD(addFile) 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) { @@ -1706,7 +1706,7 @@ static ZIPARCHIVE_METHOD(addFile) 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; } @@ -1735,8 +1735,9 @@ static ZIPARCHIVE_METHOD(addFromString) { 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; @@ -1748,8 +1749,8 @@ static ZIPARCHIVE_METHOD(addFromString) 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; } @@ -1762,10 +1763,10 @@ static ZIPARCHIVE_METHOD(addFromString) 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; @@ -1796,7 +1797,7 @@ static ZIPARCHIVE_METHOD(statName) { struct zip *intern; zval *self = getThis(); - long flags = 0; + php_int_t flags = 0; struct zip_stat sb; zend_string *name; @@ -1806,7 +1807,7 @@ static ZIPARCHIVE_METHOD(statName) 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; } @@ -1822,7 +1823,7 @@ static ZIPARCHIVE_METHOD(statIndex) { struct zip *intern; zval *self = getThis(); - long index, flags = 0; + php_int_t index, flags = 0; struct zip_stat sb; @@ -1832,7 +1833,7 @@ static ZIPARCHIVE_METHOD(statIndex) 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; } @@ -1850,8 +1851,8 @@ static ZIPARCHIVE_METHOD(locateName) { 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) { @@ -1860,7 +1861,7 @@ static ZIPARCHIVE_METHOD(locateName) 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; } @@ -1868,10 +1869,10 @@ static ZIPARCHIVE_METHOD(locateName) 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_LONG(idx); + RETURN_INT(idx); } else { RETURN_FALSE; } @@ -1885,7 +1886,7 @@ static ZIPARCHIVE_METHOD(getNameIndex) 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; @@ -1893,7 +1894,7 @@ static ZIPARCHIVE_METHOD(getNameIndex) 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; } @@ -1940,7 +1941,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) { struct zip *intern; zval *self = getThis(); - long flags = 0; + php_int_t flags = 0; const char * comment; int comment_len = 0; @@ -1950,7 +1951,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) 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; } @@ -1958,7 +1959,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) if(comment==NULL) { RETURN_FALSE; } - RETURN_STRINGL((char *)comment, (long)comment_len); + RETURN_STRINGL((char *)comment, (php_int_t)comment_len); } /* }}} */ @@ -2001,7 +2002,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex) { struct zip *intern; zval *self = getThis(); - long index; + php_int_t index; int comment_len; char * comment; struct zip_stat sb; @@ -2012,7 +2013,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex) 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; } @@ -2033,7 +2034,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName) 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) { @@ -2042,7 +2043,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName) 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; } @@ -2069,7 +2070,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex) { 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) { @@ -2078,7 +2079,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex) 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; } @@ -2100,7 +2101,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) 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; @@ -2111,7 +2112,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) 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; } @@ -2129,9 +2130,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) RETURN_FALSE; } zval_ptr_dtor(z_opsys); - ZVAL_LONG(z_opsys, opsys); + ZVAL_INT(z_opsys, opsys); zval_ptr_dtor(z_attr); - ZVAL_LONG(z_attr, attr); + ZVAL_INT(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2142,7 +2143,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) { 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; @@ -2153,7 +2154,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) 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; } @@ -2164,9 +2165,9 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) RETURN_FALSE; } zval_dtor(z_opsys); - ZVAL_LONG(z_opsys, opsys); + ZVAL_INT(z_opsys, opsys); zval_dtor(z_attr); - ZVAL_LONG(z_attr, attr); + ZVAL_INT(z_attr, attr); RETURN_TRUE; } /* }}} */ @@ -2179,7 +2180,7 @@ static ZIPARCHIVE_METHOD(getCommentName) 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; @@ -2190,7 +2191,7 @@ static ZIPARCHIVE_METHOD(getCommentName) 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; } @@ -2205,7 +2206,7 @@ static ZIPARCHIVE_METHOD(getCommentName) } 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); } /* }}} */ @@ -2215,7 +2216,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex) { 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; @@ -2226,14 +2227,14 @@ static ZIPARCHIVE_METHOD(getCommentIndex) 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); } /* }}} */ @@ -2243,7 +2244,7 @@ static ZIPARCHIVE_METHOD(deleteIndex) { struct zip *intern; zval *self = getThis(); - long index; + php_int_t index; if (!self) { RETURN_FALSE; @@ -2251,7 +2252,7 @@ static ZIPARCHIVE_METHOD(deleteIndex) 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; } @@ -2307,7 +2308,7 @@ static ZIPARCHIVE_METHOD(renameIndex) char *new_name; int new_name_len; - long index; + php_int_t index; if (!self) { RETURN_FALSE; @@ -2315,7 +2316,7 @@ static ZIPARCHIVE_METHOD(renameIndex) 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; } @@ -2374,7 +2375,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex) { struct zip *intern; zval *self = getThis(); - long index; + php_int_t index; if (!self) { RETURN_FALSE; @@ -2382,7 +2383,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex) 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; } @@ -2518,7 +2519,7 @@ static ZIPARCHIVE_METHOD(extractTo) if (zval_files && (Z_TYPE_P(zval_files) != IS_NULL)) { switch (Z_TYPE_P(zval_files)) { case IS_STRING: - if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) { + if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRSIZE_P(zval_files) TSRMLS_CC)) { RETURN_FALSE; } break; @@ -2530,10 +2531,10 @@ static ZIPARCHIVE_METHOD(extractTo) for (i = 0; i < nelems; i++) { if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(zval_files), i)) != NULL) { switch (Z_TYPE_P(zval_file)) { - case IS_LONG: + case IS_INT: break; case IS_STRING: - if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file) TSRMLS_CC)) { + if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRSIZE_P(zval_file) TSRMLS_CC)) { RETURN_FALSE; } break; @@ -2541,7 +2542,7 @@ static ZIPARCHIVE_METHOD(extractTo) } } break; - case IS_LONG: + case IS_INT: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); break; @@ -2574,9 +2575,9 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ 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; @@ -2590,12 +2591,12 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ 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); @@ -2897,88 +2898,88 @@ static PHP_MINIT_FUNCTION(zip) zip_class_entry = zend_register_internal_class(&ce TSRMLS_CC); zend_hash_init(&zip_prop_handlers, 0, NULL, php_zip_free_prop_handler, 1); - php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_LONG TSRMLS_CC); - php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_LONG TSRMLS_CC); - php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_LONG TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "status", php_zip_status, NULL, NULL, IS_INT TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "statusSys", php_zip_status_sys, NULL, NULL, IS_INT TSRMLS_CC); + php_zip_register_prop_handler(&zip_prop_handlers, "numFiles", php_zip_get_num_files, NULL, NULL, IS_INT TSRMLS_CC); php_zip_register_prop_handler(&zip_prop_handlers, "filename", NULL, NULL, php_zipobj_get_filename, IS_STRING TSRMLS_CC); php_zip_register_prop_handler(&zip_prop_handlers, "comment", NULL, php_zipobj_get_zip_comment, NULL, IS_STRING TSRMLS_CC); - REGISTER_ZIP_CLASS_CONST_LONG("CREATE", ZIP_CREATE); - REGISTER_ZIP_CLASS_CONST_LONG("EXCL", ZIP_EXCL); - REGISTER_ZIP_CLASS_CONST_LONG("CHECKCONS", ZIP_CHECKCONS); - REGISTER_ZIP_CLASS_CONST_LONG("OVERWRITE", ZIP_OVERWRITE); - - REGISTER_ZIP_CLASS_CONST_LONG("FL_NOCASE", ZIP_FL_NOCASE); - REGISTER_ZIP_CLASS_CONST_LONG("FL_NODIR", ZIP_FL_NODIR); - REGISTER_ZIP_CLASS_CONST_LONG("FL_COMPRESSED", ZIP_FL_COMPRESSED); - REGISTER_ZIP_CLASS_CONST_LONG("FL_UNCHANGED", ZIP_FL_UNCHANGED); - REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFAULT", ZIP_CM_DEFAULT); - REGISTER_ZIP_CLASS_CONST_LONG("CM_STORE", ZIP_CM_STORE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_SHRINK", ZIP_CM_SHRINK); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_1", ZIP_CM_REDUCE_1); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_2", ZIP_CM_REDUCE_2); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_3", ZIP_CM_REDUCE_3); - REGISTER_ZIP_CLASS_CONST_LONG("CM_REDUCE_4", ZIP_CM_REDUCE_4); - REGISTER_ZIP_CLASS_CONST_LONG("CM_IMPLODE", ZIP_CM_IMPLODE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE", ZIP_CM_DEFLATE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_DEFLATE64", ZIP_CM_DEFLATE64); - REGISTER_ZIP_CLASS_CONST_LONG("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_BZIP2", ZIP_CM_BZIP2); - REGISTER_ZIP_CLASS_CONST_LONG("CM_LZMA", ZIP_CM_LZMA); - REGISTER_ZIP_CLASS_CONST_LONG("CM_TERSE", ZIP_CM_TERSE); - REGISTER_ZIP_CLASS_CONST_LONG("CM_LZ77", ZIP_CM_LZ77); - REGISTER_ZIP_CLASS_CONST_LONG("CM_WAVPACK", ZIP_CM_WAVPACK); - REGISTER_ZIP_CLASS_CONST_LONG("CM_PPMD", ZIP_CM_PPMD); + REGISTER_ZIP_CLASS_CONST_INT("CREATE", ZIP_CREATE); + REGISTER_ZIP_CLASS_CONST_INT("EXCL", ZIP_EXCL); + REGISTER_ZIP_CLASS_CONST_INT("CHECKCONS", ZIP_CHECKCONS); + REGISTER_ZIP_CLASS_CONST_INT("OVERWRITE", ZIP_OVERWRITE); + + REGISTER_ZIP_CLASS_CONST_INT("FL_NOCASE", ZIP_FL_NOCASE); + REGISTER_ZIP_CLASS_CONST_INT("FL_NODIR", ZIP_FL_NODIR); + REGISTER_ZIP_CLASS_CONST_INT("FL_COMPRESSED", ZIP_FL_COMPRESSED); + REGISTER_ZIP_CLASS_CONST_INT("FL_UNCHANGED", ZIP_FL_UNCHANGED); + REGISTER_ZIP_CLASS_CONST_INT("CM_DEFAULT", ZIP_CM_DEFAULT); + REGISTER_ZIP_CLASS_CONST_INT("CM_STORE", ZIP_CM_STORE); + REGISTER_ZIP_CLASS_CONST_INT("CM_SHRINK", ZIP_CM_SHRINK); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_1", ZIP_CM_REDUCE_1); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_2", ZIP_CM_REDUCE_2); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_3", ZIP_CM_REDUCE_3); + REGISTER_ZIP_CLASS_CONST_INT("CM_REDUCE_4", ZIP_CM_REDUCE_4); + REGISTER_ZIP_CLASS_CONST_INT("CM_IMPLODE", ZIP_CM_IMPLODE); + REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE", ZIP_CM_DEFLATE); + REGISTER_ZIP_CLASS_CONST_INT("CM_DEFLATE64", ZIP_CM_DEFLATE64); + REGISTER_ZIP_CLASS_CONST_INT("CM_PKWARE_IMPLODE", ZIP_CM_PKWARE_IMPLODE); + REGISTER_ZIP_CLASS_CONST_INT("CM_BZIP2", ZIP_CM_BZIP2); + REGISTER_ZIP_CLASS_CONST_INT("CM_LZMA", ZIP_CM_LZMA); + REGISTER_ZIP_CLASS_CONST_INT("CM_TERSE", ZIP_CM_TERSE); + REGISTER_ZIP_CLASS_CONST_INT("CM_LZ77", ZIP_CM_LZ77); + REGISTER_ZIP_CLASS_CONST_INT("CM_WAVPACK", ZIP_CM_WAVPACK); + REGISTER_ZIP_CLASS_CONST_INT("CM_PPMD", ZIP_CM_PPMD); /* Error code */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_OK", ZIP_ER_OK); /* N No error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_READ", ZIP_ER_READ); /* S Read error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_WRITE", ZIP_ER_WRITE); /* S Write error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_CRC", ZIP_ER_CRC); /* N CRC error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_NOENT", ZIP_ER_NOENT); /* N No such file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */ - REGISTER_ZIP_CLASS_CONST_LONG("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */ + REGISTER_ZIP_CLASS_CONST_INT("ER_OK", ZIP_ER_OK); /* N No error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_MULTIDISK", ZIP_ER_MULTIDISK); /* N Multi-disk zip archives not supported */ + REGISTER_ZIP_CLASS_CONST_INT("ER_RENAME", ZIP_ER_RENAME); /* S Renaming temporary file failed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_CLOSE", ZIP_ER_CLOSE); /* S Closing zip archive failed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_SEEK", ZIP_ER_SEEK); /* S Seek error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_READ", ZIP_ER_READ); /* S Read error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_WRITE", ZIP_ER_WRITE); /* S Write error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_CRC", ZIP_ER_CRC); /* N CRC error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_ZIPCLOSED", ZIP_ER_ZIPCLOSED); /* N Containing zip archive was closed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_NOENT", ZIP_ER_NOENT); /* N No such file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_EXISTS", ZIP_ER_EXISTS); /* N File already exists */ + REGISTER_ZIP_CLASS_CONST_INT("ER_OPEN", ZIP_ER_OPEN); /* S Can't open file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_TMPOPEN", ZIP_ER_TMPOPEN); /* S Failure to create temporary file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_ZLIB", ZIP_ER_ZLIB); /* Z Zlib error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_MEMORY", ZIP_ER_MEMORY); /* N Malloc failure */ + REGISTER_ZIP_CLASS_CONST_INT("ER_CHANGED", ZIP_ER_CHANGED); /* N Entry has been changed */ + REGISTER_ZIP_CLASS_CONST_INT("ER_COMPNOTSUPP", ZIP_ER_COMPNOTSUPP);/* N Compression method not supported */ + REGISTER_ZIP_CLASS_CONST_INT("ER_EOF", ZIP_ER_EOF); /* N Premature EOF */ + REGISTER_ZIP_CLASS_CONST_INT("ER_INVAL", ZIP_ER_INVAL); /* N Invalid argument */ + REGISTER_ZIP_CLASS_CONST_INT("ER_NOZIP", ZIP_ER_NOZIP); /* N Not a zip archive */ + REGISTER_ZIP_CLASS_CONST_INT("ER_INTERNAL", ZIP_ER_INTERNAL); /* N Internal error */ + REGISTER_ZIP_CLASS_CONST_INT("ER_INCONS", ZIP_ER_INCONS); /* N Zip archive inconsistent */ + REGISTER_ZIP_CLASS_CONST_INT("ER_REMOVE", ZIP_ER_REMOVE); /* S Can't remove file */ + REGISTER_ZIP_CLASS_CONST_INT("ER_DELETED", ZIP_ER_DELETED); /* N Entry has been deleted */ #ifdef ZIP_OPSYS_DEFAULT - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DOS", ZIP_OPSYS_DOS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_AMIGA", ZIP_OPSYS_AMIGA); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_UNIX", ZIP_OPSYS_UNIX); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_2", ZIP_OPSYS_OS_2); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_Z_CPM", ZIP_OPSYS_CPM); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_MVS", ZIP_OPSYS_MVS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VSE", ZIP_OPSYS_VSE); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_VFAT", ZIP_OPSYS_VFAT); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_BEOS", ZIP_OPSYS_BEOS); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_TANDEM", ZIP_OPSYS_TANDEM); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_400", ZIP_OPSYS_OS_400); - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_OS_X", ZIP_OPSYS_OS_X); - - REGISTER_ZIP_CLASS_CONST_LONG("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DOS", ZIP_OPSYS_DOS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_AMIGA", ZIP_OPSYS_AMIGA); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OPENVMS", ZIP_OPSYS_OPENVMS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_UNIX", ZIP_OPSYS_UNIX); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VM_CMS", ZIP_OPSYS_VM_CMS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ATARI_ST", ZIP_OPSYS_ATARI_ST); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_2", ZIP_OPSYS_OS_2); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MACINTOSH", ZIP_OPSYS_MACINTOSH); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_SYSTEM", ZIP_OPSYS_Z_SYSTEM); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_Z_CPM", ZIP_OPSYS_CPM); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_WINDOWS_NTFS", ZIP_OPSYS_WINDOWS_NTFS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_MVS", ZIP_OPSYS_MVS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VSE", ZIP_OPSYS_VSE); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ACORN_RISC", ZIP_OPSYS_ACORN_RISC); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_VFAT", ZIP_OPSYS_VFAT); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_ALTERNATE_MVS", ZIP_OPSYS_ALTERNATE_MVS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_BEOS", ZIP_OPSYS_BEOS); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_TANDEM", ZIP_OPSYS_TANDEM); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_400", ZIP_OPSYS_OS_400); + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_OS_X", ZIP_OPSYS_OS_X); + + REGISTER_ZIP_CLASS_CONST_INT("OPSYS_DEFAULT", ZIP_OPSYS_DEFAULT); #endif /* ifdef ZIP_OPSYS_DEFAULT */ php_register_url_stream_wrapper("zip", &php_stream_zip_wrapper TSRMLS_CC); diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index bd2a85bea6..5a2985c11b 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -50,11 +50,11 @@ typedef struct _php_zlib_context { ZEND_BEGIN_MODULE_GLOBALS(zlib) /* variables for transparent gzip encoding */ int compression_coding; - long output_compression; - long output_compression_level; + php_int_t output_compression; + php_int_t output_compression_level; char *output_handler; php_zlib_context *ob_gzhandler; - long output_compression_default; + php_int_t output_compression_default; zend_bool handler_registered; ZEND_END_MODULE_GLOBALS(zlib); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index c38d6eca2c..67f575ec9a 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -448,7 +448,7 @@ static PHP_FUNCTION(ob_gzhandler) { char *in_str; int in_len; - long flags = 0; + php_int_t flags = 0; php_output_context ctx = {0}; int encoding, rv; @@ -460,7 +460,7 @@ static PHP_FUNCTION(ob_gzhandler) * - OG(running) is not set or set to any other output handler * - we have to mess around with php_output_context */ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &in_str, &in_len, &flags)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &in_str, &in_len, &flags)) { RETURN_FALSE; } @@ -537,10 +537,10 @@ static PHP_FUNCTION(gzfile) int flags = REPORT_ERRORS; char buf[8192] = {0}; register int i = 0; - long use_include_path = 0; + php_int_t use_include_path = 0; php_stream *stream; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &use_include_path)) { return; } @@ -578,9 +578,9 @@ static PHP_FUNCTION(gzopen) int filename_len, mode_len; int flags = REPORT_ERRORS; php_stream *stream; - long use_include_path = 0; + php_int_t use_include_path = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) { return; } @@ -606,9 +606,9 @@ static PHP_FUNCTION(readgzfile) int flags = REPORT_ERRORS; php_stream *stream; int size; - long use_include_path = 0; + php_int_t use_include_path = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &use_include_path) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &filename, &filename_len, &use_include_path) == FAILURE) { return; } @@ -623,7 +623,7 @@ static PHP_FUNCTION(readgzfile) } size = php_stream_passthru(stream); php_stream_close(stream); - RETURN_LONG(size); + RETURN_INT(size); } /* }}} */ @@ -631,19 +631,19 @@ static PHP_FUNCTION(readgzfile) static PHP_FUNCTION(name) \ { \ zend_string *in, *out; \ - long level = -1; \ - long encoding = default_encoding; \ + php_int_t level = -1; \ + php_int_t encoding = default_encoding; \ if (default_encoding) { \ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &in, &level, &encoding)) { \ + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &in, &level, &encoding)) { \ return; \ } \ } else { \ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &in, &encoding, &level)) { \ + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &in, &encoding, &level)) { \ return; \ } \ } \ if (level < -1 || level > 9) { \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level (%ld) must be within -1..9", level); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level (%pd) must be within -1..9", level); \ RETURN_FALSE; \ } \ switch (encoding) { \ @@ -667,12 +667,12 @@ static PHP_FUNCTION(name) \ char *in_buf, *out_buf; \ int in_len; \ size_t out_len; \ - long max_len = 0; \ - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &in_buf, &in_len, &max_len)) { \ + php_int_t max_len = 0; \ + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &in_buf, &in_len, &max_len)) { \ return; \ } \ if (max_len < 0) { \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "length (%ld) must be greater or equal zero", max_len); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "length (%pd) must be greater or equal zero", max_len); \ RETURN_FALSE; \ } \ if (SUCCESS != php_zlib_decode(in_buf, in_len, &out_buf, &out_len, encoding, max_len TSRMLS_CC)) { \ @@ -937,12 +937,12 @@ static PHP_MINIT_FUNCTION(zlib) php_output_handler_conflict_register(ZEND_STRL("ob_gzhandler"), php_zlib_output_conflict_check TSRMLS_CC); php_output_handler_conflict_register(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), php_zlib_output_conflict_check TSRMLS_CC); - REGISTER_LONG_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ZLIB_ENCODING_RAW", PHP_ZLIB_ENCODING_RAW, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ZLIB_ENCODING_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); + REGISTER_INT_CONSTANT("ZLIB_ENCODING_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); REGISTER_INI_ENTRIES(); return SUCCESS; } diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c index a7ce895646..72a67740be 100644 --- a/ext/zlib/zlib_filter.c +++ b/ext/zlib/zlib_filter.c @@ -332,11 +332,11 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f /* log-2 base of history window (9 - 15) */ ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); - if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 32) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL(tmp)); + convert_to_int(&tmp); + if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 32) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_IVAL(tmp)); } else { - windowBits = Z_LVAL(tmp); + windowBits = Z_IVAL(tmp); } } } @@ -363,25 +363,25 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f case IS_OBJECT: if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "memory", sizeof("memory") -1))) { ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); + convert_to_int(&tmp); /* Memory Level (1 - 9) */ - if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > MAX_MEM_LEVEL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < 1 || Z_IVAL(tmp) > MAX_MEM_LEVEL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for memory level. (%ld)", Z_IVAL(tmp)); } else { - memLevel = Z_LVAL(tmp); + memLevel = Z_IVAL(tmp); } } if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "window", sizeof("window") - 1))) { ZVAL_DUP(&tmp, tmpzval); - convert_to_long(&tmp); + convert_to_int(&tmp); /* log-2 base of history window (9 - 15) */ - if (Z_LVAL(tmp) < -MAX_WBITS || Z_LVAL(tmp) > MAX_WBITS + 16) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < -MAX_WBITS || Z_IVAL(tmp) > MAX_WBITS + 16) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_IVAL(tmp)); } else { - windowBits = Z_LVAL(tmp); + windowBits = Z_IVAL(tmp); } } @@ -394,17 +394,17 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f break; case IS_STRING: case IS_DOUBLE: - case IS_LONG: + case IS_INT: ZVAL_COPY_VALUE(&tmp, filterparams); factory_setlevel: zval_copy_ctor(&tmp); - convert_to_long(&tmp); + convert_to_int(&tmp); /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */ - if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp)); + if (Z_IVAL(tmp) < -1 || Z_IVAL(tmp) > 9) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_IVAL(tmp)); } else { - level = Z_LVAL(tmp); + level = Z_IVAL(tmp); } break; default: diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c index be0ebd4382..713a6ecfb2 100644 --- a/ext/zlib/zlib_fopen_wrapper.c +++ b/ext/zlib/zlib_fopen_wrapper.c @@ -56,7 +56,7 @@ static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count return (wrote < 0) ? 0 : wrote; } -static int php_gziop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_gziop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract; |