Implement convert_to_unicode_with_converter() and adjust zval_* APIs.

This commit is contained in:
Andrei Zmievski 2006-07-12 17:35:06 +00:00
parent 938f6d4141
commit 2c8398fe81
3 changed files with 19 additions and 5 deletions

View File

@ -580,6 +580,12 @@ ZEND_API void convert_to_boolean(zval *op)
}
ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC)
{
TSRMLS_FETCH();
_convert_to_unicode_with_converter(op, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC ZEND_FILE_LINE_CC);
}
ZEND_API void _convert_to_unicode_with_converter(zval *op, UConverter *conv TSRMLS_DC ZEND_FILE_LINE_DC)
{
switch (Z_TYPE_P(op)) {
case IS_NULL:
@ -589,7 +595,7 @@ ZEND_API void _convert_to_unicode(zval *op TSRMLS_DC ZEND_FILE_LINE_DC)
case IS_UNICODE:
break;
case IS_STRING:
zval_string_to_unicode(op TSRMLS_CC);
zval_string_to_unicode_ex(op, conv TSRMLS_CC);
return;
case IS_BOOL:
if (Z_LVAL_P(op)) {
@ -669,7 +675,7 @@ ZEND_API void _convert_to_string_with_converter(zval *op, UConverter *conv TSRML
case IS_STRING:
return;
case IS_UNICODE:
zval_unicode_to_string(op, conv TSRMLS_CC);
zval_unicode_to_string_ex(op, conv TSRMLS_CC);
break;
case IS_BOOL:
if (Z_LVAL_P(op)) {

View File

@ -537,8 +537,8 @@ ZEND_API void zend_raise_conversion_error_ex(char *message, UConverter *conv, ze
}
/* }}} */
/* {{{ zval_unicode_to_string */
ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC)
/* {{{ zval_unicode_to_string_ex */
ZEND_API int zval_unicode_to_string_ex(zval *string, UConverter *conv TSRMLS_DC)
{
UErrorCode status = U_ZERO_ERROR;
char *s = NULL;
@ -568,6 +568,13 @@ ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC)
}
/* }}} */
/* {{{ zval_unicode_to_string */
ZEND_API int zval_unicode_to_string(zval *string TSRMLS_DC)
{
return zval_unicode_to_string_ex(string, ZEND_U_CONVERTER(UG(runtime_encoding_conv)) TSRMLS_CC);
}
/* }}} */
/* {{{ zval_string_to_unicode_ex */
ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv TSRMLS_DC)
{

View File

@ -78,7 +78,8 @@ ZEND_API char* zend_unicode_to_ascii(const UChar *us, int us_len TSRMLS_DC);
ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv TSRMLS_DC);
ZEND_API int zval_string_to_unicode(zval *string TSRMLS_DC);
ZEND_API int zval_unicode_to_string(zval *string, UConverter *conv TSRMLS_DC);
ZEND_API int zval_unicode_to_string_ex(zval *string, UConverter *conv TSRMLS_DC);
ZEND_API int zval_unicode_to_string(zval *string TSRMLS_DC);
ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len);
ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int ulen, char* str, int slen);