summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-16 17:31:40 +0200
committerAnatol Belski <ab@php.net>2014-08-16 17:31:40 +0200
commit864172d9a49a6201513d83c06b77b5d309dc50ab (patch)
tree6aa4b3249a59aa8f3b21a06cb28a1fc2f0f5dae6 /ext/standard
parent54906c760fb578079b6783a2aa4184372a3179d3 (diff)
downloadphp-git-864172d9a49a6201513d83c06b77b5d309dc50ab.tar.gz
further fixes to ext/standard and zend
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c4
-rw-r--r--ext/standard/php_rand.h12
-rw-r--r--ext/standard/rand.c34
-rw-r--r--ext/standard/string.c2
4 files changed, 26 insertions, 26 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 605d9ddc7d..4137823257 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -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)
@@ -4428,7 +4428,7 @@ PHP_FUNCTION(usleep)
Delay for a number of seconds and nano seconds */
PHP_FUNCTION(time_nanosleep)
{
- php_int_t tv_sec, tv_nsec;
+ long 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) {
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/rand.c b/ext/standard/rand.c
index 3029ed28bc..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);
@@ -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,7 +335,7 @@ 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);
}
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 6dd6d5930e..0761f88387 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4730,7 +4730,7 @@ PHP_FUNCTION(str_repeat)
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, &mult) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si", &input_str, &mult) == FAILURE) {
return;
}