case IS_DOUBLE:
return_val = (Z_TYPE_P(value) == IS_LONG) ? (double)Z_LVAL_P(value) : Z_DVAL_P(value);
- return_val = _php_math_round(return_val, places, mode);
+ return_val = _php_math_round(return_val, (int)places, (int)mode);
RETURN_DOUBLE(return_val);
break;
PHPAPI zend_long _php_math_basetolong(zval *arg, int base)
{
zend_long num = 0, digit, onum;
- int i;
+ zend_long i;
char c, *s;
if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
{
zend_long num = 0;
double fnum = 0;
- int i;
+ zend_long i;
int mode = 0;
char c, *s;
zend_long cutoff;
num = num * base + c;
break;
} else {
- fnum = num;
+ fnum = (double)num;
mode = 1;
}
/* fall-through */
RETURN_FALSE;
}
- if(_php_math_basetozval(number, frombase, &temp) == FAILURE) {
+ if(_php_math_basetozval(number, (int)frombase, &temp) == FAILURE) {
RETURN_FALSE;
}
- result = _php_math_zvaltobase(&temp, tobase TSRMLS_CC);
+ result = _php_math_zvaltobase(&temp, (int)tobase TSRMLS_CC);
RETVAL_STR(result);
}
/* }}} */
/* calculate the length of the return buffer */
if (dp) {
- integral = dp - tmpbuf->val;
+ integral = (int)(dp - tmpbuf->val);
} else {
/* no decimal point was found */
- integral = tmpbuf->len;
+ integral = (int)tmpbuf->len;
}
/* allow for thousand separators */
if (thousand_sep) {
- integral += thousand_sep_len * ((integral-1) / 3);
+ integral += (int)(thousand_sep_len * ((integral-1) / 3));
}
reslen = integral;
reslen += dec;
if (dec_point) {
- reslen += dec_point_len;
+ reslen += (int)dec_point_len;
}
}
* Take care, as the sprintf implementation may return less places than
* we requested due to internal buffer limitations */
if (dec) {
- int declen = dp ? s - dp : 0;
+ int declen = (int)(dp ? s - dp : 0);
int topad = dec > declen ? dec - declen : 0;
/* pad with '0's */
RETURN_STR(_php_math_number_format(num, 0, dec_point_chr, thousand_sep_chr));
break;
case 2:
- RETURN_STR(_php_math_number_format(num, dec, dec_point_chr, thousand_sep_chr));
+ RETURN_STR(_php_math_number_format(num, (int)dec, dec_point_chr, thousand_sep_chr));
break;
case 4:
if (dec_point == NULL) {
thousand_sep_len = 1;
}
- RETVAL_STR(_php_math_number_format_ex(num, dec,
+ RETVAL_STR(_php_math_number_format_ex(num, (int)dec,
dec_point, dec_point_len, thousand_sep, thousand_sep_len));
break;
default: