diff options
Diffstat (limited to 'ext/gmp/gmp.c')
-rw-r--r-- | ext/gmp/gmp.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 0f4b317fd0..800878e278 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -72,7 +72,7 @@ PHP_GMP_API zend_class_entry *php_gmp_class_entry(void) { typedef struct _gmp_temp { mpz_t num; - zend_bool is_used; + bool is_used; } gmp_temp_t; #define GMP_ROUND_ZERO 0 @@ -527,9 +527,7 @@ static ZEND_GINIT_FUNCTION(gmp) /* {{{ ZEND_MINIT_FUNCTION */ ZEND_MINIT_FUNCTION(gmp) { - zend_class_entry tmp_ce; - INIT_CLASS_ENTRY(tmp_ce, "GMP", class_GMP_methods); - gmp_ce = zend_register_internal_class(&tmp_ce); + gmp_ce = register_class_GMP(); gmp_ce->create_object = gmp_create_object; gmp_ce->serialize = gmp_serialize; gmp_ce->unserialize = gmp_unserialize; @@ -598,13 +596,16 @@ static zend_result convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base, ui return SUCCESS; case IS_STRING: { char *numstr = Z_STRVAL_P(val); - zend_bool skip_lead = 0; + bool skip_lead = 0; int ret; if (Z_STRLEN_P(val) >= 2 && numstr[0] == '0') { if ((base == 0 || base == 16) && (numstr[1] == 'x' || numstr[1] == 'X')) { base = 16; skip_lead = 1; + } else if ((base == 0 || base == 8) && (numstr[1] == 'o' || numstr[1] == 'O')) { + base = 8; + skip_lead = 1; } else if ((base == 0 || base == 2) && (numstr[1] == 'b' || numstr[1] == 'B')) { base = 2; skip_lead = 1; @@ -627,7 +628,7 @@ static zend_result convert_to_gmp(mpz_t gmpnumber, zval *val, zend_long base, ui } default: { zend_long lval; - if (!zend_parse_arg_long_slow(val, &lval)) { + if (!zend_parse_arg_long_slow(val, &lval, arg_pos)) { zend_argument_type_error(arg_pos, "must be of type GMP|string|int, %s given", zend_zval_type_name(val)); return FAILURE; } @@ -674,7 +675,7 @@ static void gmp_cmp(zval *return_value, zval *a_arg, zval *b_arg) /* {{{ */ { mpz_ptr gmpnum_a, gmpnum_b; gmp_temp_t temp_a, temp_b; - zend_bool use_si = 0; + bool use_si = 0; zend_long res; FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a, 1); @@ -1624,7 +1625,7 @@ ZEND_FUNCTION(gmp_kronecker) zval *a_arg, *b_arg; mpz_ptr gmpnum_a, gmpnum_b; gmp_temp_t temp_a, temp_b; - zend_bool use_a_si = 0, use_b_si = 0; + bool use_a_si = 0, use_b_si = 0; int result; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){ @@ -1861,7 +1862,7 @@ ZEND_FUNCTION(gmp_setbit) { zval *a_arg; zend_long index; - zend_bool set = 1; + bool set = 1; mpz_ptr gmpnum_a; if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) { |