summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-18 16:50:54 +0200
committerAnatol Belski <ab@php.net>2014-08-18 16:50:54 +0200
commitb8324e6d635450562ecb253af38f22105e19e460 (patch)
treeeadecc2f5c251a20013c600212104b0ba4cce8bc /ext/standard
parent97e9d058f09c12161863e5c3832552eb5da3f3c6 (diff)
downloadphp-git-b8324e6d635450562ecb253af38f22105e19e460.tar.gz
further fixes to ext/standard
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/array.c46
-rw-r--r--ext/standard/math.c6
-rw-r--r--ext/standard/md5.c9
-rw-r--r--ext/standard/metaphone.c16
-rw-r--r--ext/standard/microtime.c4
-rw-r--r--ext/standard/pageinfo.c16
-rw-r--r--ext/standard/pageinfo.h6
-rw-r--r--ext/standard/php_array.h2
-rw-r--r--ext/standard/php_fopen_wrapper.c18
-rw-r--r--ext/standard/php_uuencode.h4
-rw-r--r--ext/standard/proc_open.c6
-rw-r--r--ext/standard/quot_print.c22
-rw-r--r--ext/standard/sha1.c9
-rw-r--r--ext/standard/sha1.h2
-rw-r--r--ext/standard/string.c10
-rw-r--r--ext/standard/url.c18
-rw-r--r--ext/standard/uuencode.c22
-rw-r--r--ext/standard/var.c6
18 files changed, 108 insertions, 114 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index b420dfb307..1894ceabbb 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -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:
@@ -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,7 +253,7 @@ 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) /* {{{ */
{
php_int_t cnt = 0;
zval *element;
@@ -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_int(&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]);
@@ -1357,7 +1357,7 @@ 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;
php_uint_t num_key;
@@ -1365,7 +1365,7 @@ PHP_FUNCTION(extract)
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;
}
@@ -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;
}
@@ -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_int(&retval);
+ php_int_t ret = zval_get_int(&retval);
zval_ptr_dtor(&retval);
return ret < 0 ? -1 : ret > 0 ? 1 : 0;;
} else {
@@ -4324,13 +4324,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;
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;
}
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 648408e840..267b8c0170 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1422,16 +1422,16 @@ 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_INT(0);
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 3cadf729cc..58ecbdc881 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -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;
}
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index a92457e842..7381100fab 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.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;
@@ -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;
@@ -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_INT((long) pid);
+ RETURN_INT(pid);
}
}
/* }}} */
@@ -166,7 +166,7 @@ PHP_FUNCTION(getmyinode)
}
/* }}} */
-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;
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/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_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 cd74ecac51..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;
}
@@ -328,7 +328,7 @@ PHP_FUNCTION(proc_get_status)
array_init(return_value);
add_assoc_string(return_value, "command", proc->command);
- add_assoc_int(return_value, "pid", (long) proc->child);
+ add_assoc_int(return_value, "pid", (php_int_t) proc->child);
#ifdef PHP_WIN32
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index c2e659d43e..1d13d56678 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -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/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/string.c b/ext/standard/string.c
index a411eed748..a1a87e8476 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -115,7 +115,7 @@ void register_string_constants(INIT_FUNC_ARGS)
}
/* }}} */
-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";
@@ -2410,8 +2410,8 @@ PHP_FUNCTION(substr_replace)
}
} else { /* str is array of strings */
zend_string *str_index = NULL;
- php_uint_t num_index;
php_size_t result_len;
+ php_uint_t num_index;
array_init(return_value);
@@ -3879,12 +3879,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;
}
@@ -4333,7 +4333,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;
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 71c2d8fb0c..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;
}
@@ -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;
@@ -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));
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 aa555c3344..129f4ae0b4 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -402,7 +402,7 @@ static void php_array_element_export(zval *zv, php_uint_t index, zend_string *ke
{
if (key == NULL) { /* numeric key */
buffer_append_spaces(buf, level+1);
- smart_str_append_int(buf, (long) index);
+ smart_str_append_int(buf, (php_int_t) index);
smart_str_appendl(buf, " => ", 4);
} else { /* string key */
@@ -443,7 +443,7 @@ static void php_object_element_export(zval *zv, php_uint_t index, zend_string *k
smart_str_appendc(buf, '\'');
STR_RELEASE(pname_esc);
} else {
- smart_str_append_int(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,7 +456,7 @@ 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;
php_uint_t index;