#include "php_bcmath.h"
#include "libbcmath/src/bcmath.h"
-ZEND_DECLARE_MODULE_GLOBALS(bcmath);
+ZEND_DECLARE_MODULE_GLOBALS(bcmath)
static PHP_GINIT_FUNCTION(bcmath);
static PHP_GSHUTDOWN_FUNCTION(bcmath);
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
int left_len, right_len, modulous_len;
bc_num first, second, mod, result;
long 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) {
return;
php_str2num(&first, left TSRMLS_CC);
php_str2num(&second, right TSRMLS_CC);
php_str2num(&mod, modulous TSRMLS_CC);
- bc_raisemod(first, second, mod, &result, scale TSRMLS_CC);
+
+ scale_int = (int) ((int)scale < 0) ? 0 : scale;
+
+ bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC);
if (result->n_scale > scale) {
result->n_scale = scale;
}
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
- scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
+ scale = (int) ((int)Z_LVAL_PP(scale_param) < 0) ? 0 : Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;