case IS_STRING: \
Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10); \
break; \
- case IS_UNICODE: \
+ case IS_UNICODE: \
Z_LVAL(holder) = zend_u_strtol(Z_USTRVAL_P(op), NULL, 10); \
- break; \
+ break; \
case IS_ARRAY: \
Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
break; \
Z_LVAL(holder) = 1; \
} \
break; \
- case IS_UNICODE: \
+ case IS_UNICODE: \
if (Z_USTRLEN_P(op) == 0 \
|| (Z_USTRLEN_P(op)==1 && \
(Z_USTRVAL_P(op)[0]=='0'))) { \
- Z_LVAL(holder) = 0; \
- } else { \
- Z_LVAL(holder) = 1; \
- } \
- break; \
+ Z_LVAL(holder) = 0; \
+ } else { \
+ Z_LVAL(holder) = 1; \
+ } \
+ break; \
case IS_ARRAY: \
Z_LVAL(holder) = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \
break; \
ZEND_API int _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC) /* {{{ */
{
- return _convert_to_unicode_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC);
+ return _convert_to_unicode_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC);
}
/* }}} */
Z_USTRVAL_P(op) = eustrndup(result, result_len);
Z_USTRLEN_P(op) = result_len;
break;
- }
+ }
case IS_DOUBLE: {
UChar num_buf[NUM_BUF_SIZE], *result;
double dval = Z_DVAL_P(op);
ZEND_API int _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
{
- TSRMLS_FETCH();
- return _convert_to_string_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC);
+ TSRMLS_FETCH();
+ return _convert_to_string_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC);
}
/* }}} */
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */
{
- int ret;
+ int ret;
int converted = 0;
zval op1_copy, op2_copy;
zval *op_free;
zend_free_obj_get_result(op_free TSRMLS_CC);
return ret;
} else if (Z_TYPE_P(op2) != IS_OBJECT &&
- Z_OBJ_HT_P(op1)->cast_object) {
+ Z_OBJ_HT_P(op1)->cast_object) {
ALLOC_INIT_ZVAL(op_free);
if (Z_OBJ_HT_P(op1)->cast_object(op1, op_free, Z_TYPE_P(op2), NULL TSRMLS_CC) == FAILURE) {
ZVAL_LONG(result, 1);
zend_free_obj_get_result(op_free TSRMLS_CC);
return ret;
} else if (Z_TYPE_P(op1) != IS_OBJECT &&
- Z_OBJ_HT_P(op2)->cast_object) {
+ Z_OBJ_HT_P(op2)->cast_object) {
ALLOC_INIT_ZVAL(op_free);
if (Z_OBJ_HT_P(op2)->cast_object(op2, op_free, Z_TYPE_P(op1), NULL TSRMLS_CC) == FAILURE) {
ZVAL_LONG(result, -1);
static void increment_string(zval *str) /* {{{ */
{
- int carry=0;
- int pos=Z_STRLEN_P(str)-1;
- char *s=Z_STRVAL_P(str);
- char *t;
- int last=0; /* Shut up the compiler warning */
- int ch;
+ int carry=0;
+ int pos=Z_STRLEN_P(str)-1;
+ char *s=Z_STRVAL_P(str);
+ char *t;
+ int last=0; /* Shut up the compiler warning */
+ int ch;
if (Z_STRLEN_P(str) == 0) {
STR_FREE(Z_STRVAL_P(str));
}
while (pos >= 0) {
- ch = s[pos];
- if (ch >= 'a' && ch <= 'z') {
- if (ch == 'z') {
- s[pos] = 'a';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=LOWER_CASE;
- } else if (ch >= 'A' && ch <= 'Z') {
- if (ch == 'Z') {
- s[pos] = 'A';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=UPPER_CASE;
- } else if (ch >= '0' && ch <= '9') {
- if (ch == '9') {
- s[pos] = '0';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last = NUMERIC;
- } else {
- carry=0;
- break;
- }
- if (carry == 0) {
- break;
- }
- pos--;
- }
-
- if (carry) {
- t = (char *) emalloc(Z_STRLEN_P(str)+1+1);
- memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str));
- Z_STRLEN_P(str)++;
- t[Z_STRLEN_P(str)] = '\0';
- switch (last) {
- case NUMERIC:
- t[0] = '1';
- break;
- case UPPER_CASE:
- t[0] = 'A';
- break;
- case LOWER_CASE:
- t[0] = 'a';
- break;
- }
- STR_FREE(Z_STRVAL_P(str));
- Z_STRVAL_P(str) = t;
- }
+ ch = s[pos];
+ if (ch >= 'a' && ch <= 'z') {
+ if (ch == 'z') {
+ s[pos] = 'a';
+ carry=1;
+ } else {
+ s[pos]++;
+ carry=0;
+ }
+ last=LOWER_CASE;
+ } else if (ch >= 'A' && ch <= 'Z') {
+ if (ch == 'Z') {
+ s[pos] = 'A';
+ carry=1;
+ } else {
+ s[pos]++;
+ carry=0;
+ }
+ last=UPPER_CASE;
+ } else if (ch >= '0' && ch <= '9') {
+ if (ch == '9') {
+ s[pos] = '0';
+ carry=1;
+ } else {
+ s[pos]++;
+ carry=0;
+ }
+ last = NUMERIC;
+ } else {
+ carry=0;
+ break;
+ }
+ if (carry == 0) {
+ break;
+ }
+ pos--;
+ }
+
+ if (carry) {
+ t = (char *) emalloc(Z_STRLEN_P(str)+1+1);
+ memcpy(t+1, Z_STRVAL_P(str), Z_STRLEN_P(str));
+ Z_STRLEN_P(str)++;
+ t[Z_STRLEN_P(str)] = '\0';
+ switch (last) {
+ case NUMERIC:
+ t[0] = '1';
+ break;
+ case UPPER_CASE:
+ t[0] = 'A';
+ break;
+ case LOWER_CASE:
+ t[0] = 'a';
+ break;
+ }
+ STR_FREE(Z_STRVAL_P(str));
+ Z_STRVAL_P(str) = t;
+ }
}
/* }}} */
static void increment_unicode(zval *str) /* {{{ */
{
- int carry=0;
- int pos=Z_USTRLEN_P(str)-1;
- UChar *s=Z_USTRVAL_P(str);
- UChar *t;
- int last=0; /* Shut up the compiler warning */
- int ch;
+ int carry=0;
+ int pos=Z_USTRLEN_P(str)-1;
+ UChar *s=Z_USTRVAL_P(str);
+ UChar *t;
+ int last=0; /* Shut up the compiler warning */
+ int ch;
if (Z_USTRLEN_P(str) == 0) {
USTR_FREE(Z_USTRVAL_P(str));
}
while (pos >= 0) {
- ch = s[pos];
- if (ch >= 'a' && ch <= 'z') {
- if (ch == 'z') {
- s[pos] = 'a';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=LOWER_CASE;
- } else if (ch >= 'A' && ch <= 'Z') {
- if (ch == 'Z') {
- s[pos] = 'A';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=UPPER_CASE;
- } else if (ch >= '0' && ch <= '9') {
- if (ch == '9') {
- s[pos] = '0';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last = NUMERIC;
- } else {
- carry=0;
- break;
- }
- if (carry == 0) {
- break;
- }
- pos--;
- }
-
- if (carry) {
- t = (UChar *) eumalloc(Z_USTRLEN_P(str)+1+1);
- memcpy(t+1, Z_USTRVAL_P(str), UBYTES(Z_USTRLEN_P(str)));
- Z_USTRLEN_P(str)++;
- t[Z_USTRLEN_P(str)] = 0;
- switch (last) {
- case NUMERIC:
- t[0] = '1';
- break;
- case UPPER_CASE:
- t[0] = 'A';
- break;
- case LOWER_CASE:
- t[0] = 'a';
- break;
- }
- USTR_FREE(Z_USTRVAL_P(str));
- Z_USTRVAL_P(str) = t;
- }
+ ch = s[pos];
+ if (ch >= 'a' && ch <= 'z') {
+ if (ch == 'z') {
+ s[pos] = 'a';
+ carry=1;
+ } else {
+ s[pos]++;
+ carry=0;
+ }
+ last=LOWER_CASE;
+ } else if (ch >= 'A' && ch <= 'Z') {
+ if (ch == 'Z') {
+ s[pos] = 'A';
+ carry=1;
+ } else {
+ s[pos]++;
+ carry=0;
+ }
+ last=UPPER_CASE;
+ } else if (ch >= '0' && ch <= '9') {
+ if (ch == '9') {
+ s[pos] = '0';
+ carry=1;
+ } else {
+ s[pos]++;
+ carry=0;
+ }
+ last = NUMERIC;
+ } else {
+ carry=0;
+ break;
+ }
+ if (carry == 0) {
+ break;
+ }
+ pos--;
+ }
+
+ if (carry) {
+ t = (UChar *) eumalloc(Z_USTRLEN_P(str)+1+1);
+ memcpy(t+1, Z_USTRVAL_P(str), UBYTES(Z_USTRLEN_P(str)));
+ Z_USTRLEN_P(str)++;
+ t[Z_USTRLEN_P(str)] = 0;
+ switch (last) {
+ case NUMERIC:
+ t[0] = '1';
+ break;
+ case UPPER_CASE:
+ t[0] = 'A';
+ break;
+ case LOWER_CASE:
+ t[0] = 'a';
+ break;
+ }
+ USTR_FREE(Z_USTRVAL_P(str));
+ Z_USTRVAL_P(str) = t;
+ }
}
/* }}} */
#ifdef ZEND_USE_TOLOWER_L
ZEND_API void zend_update_current_locale(void) /* {{{ */
{
- current_locale = _get_current_locale();
+ current_locale = _get_current_locale();
}
/* }}} */
#endif