p = (long *) (base+(size_t) mh_arg1);
- *p = zend_atoi(new_value, new_value_length);
+ *p = zend_atol(new_value, new_value_length);
return SUCCESS;
}
/* }}} */
base = (char *) ts_resource(*((int *) mh_arg2));
#endif
- tmp = zend_atoi(new_value, new_value_length);
+ tmp = zend_atol(new_value, new_value_length);
if (tmp < 0) {
return FAILURE;
}
return retval;
}
+ZEND_API long zend_atol(const char *str, int str_len)
+{
+ long retval;
+
+ if (!str_len) {
+ str_len = strlen(str);
+ }
+ retval = strtol(str, NULL, 0);
+ if (str_len>0) {
+ switch (str[str_len-1]) {
+ case 'g':
+ case 'G':
+ retval *= 1024;
+ /* break intentionally missing */
+ case 'm':
+ case 'M':
+ retval *= 1024;
+ /* break intentionally missing */
+ case 'k':
+ case 'K':
+ retval *= 1024;
+ break;
+ }
+ }
+ return retval;
+}
+
ZEND_API double zend_string_to_double(const char *number, zend_uint length)
{
ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
ZEND_API int zend_atoi(const char *str, int str_len);
+ZEND_API int zend_atol(const char *str, int str_len);
ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
END_EXTERN_C()