|
|
|
@ -429,9 +429,9 @@ ZEND_END_ARG_INFO(); |
|
|
|
static void php_converter_do_set_encoding(UConverter *cnv, INTERNAL_FUNCTION_PARAMETERS) { |
|
|
|
php_converter_object *objval = CONV_GET(getThis()); |
|
|
|
char *enc; |
|
|
|
int enc_len; |
|
|
|
zend_str_size_int enc_len; |
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &enc, &enc_len) == FAILURE) { |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &enc, &enc_len) == FAILURE) { |
|
|
|
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Bad arguments, " |
|
|
|
"expected one string argument", 0 TSRMLS_CC); |
|
|
|
RETURN_FALSE; |
|
|
|
@ -569,13 +569,13 @@ ZEND_END_ARG_INFO(); |
|
|
|
static PHP_METHOD(UConverter, __construct) { |
|
|
|
php_converter_object *objval = CONV_GET(getThis()); |
|
|
|
char *src = "utf-8"; |
|
|
|
int src_len = sizeof("utf-8") - 1; |
|
|
|
zend_str_size_int src_len = sizeof("utf-8") - 1; |
|
|
|
char *dest = src; |
|
|
|
int dest_len = src_len; |
|
|
|
zend_str_size_int dest_len = src_len; |
|
|
|
|
|
|
|
intl_error_reset(NULL TSRMLS_CC); |
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!", |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S!S!", |
|
|
|
&dest, &dest_len, &src, &src_len) == FAILURE) { |
|
|
|
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, |
|
|
|
"UConverter::__construct(): bad arguments", 0 TSRMLS_CC); |
|
|
|
@ -597,9 +597,10 @@ ZEND_END_ARG_INFO(); |
|
|
|
static PHP_METHOD(UConverter, setSubstChars) { |
|
|
|
php_converter_object *objval = CONV_GET(getThis()); |
|
|
|
char *chars; |
|
|
|
int chars_len, ret = 1; |
|
|
|
zend_str_size_int chars_len; |
|
|
|
int ret = 1; |
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &chars, &chars_len) == FAILURE) { |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &chars, &chars_len) == FAILURE) { |
|
|
|
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, |
|
|
|
"UConverter::setSubstChars(): bad arguments", 0 TSRMLS_CC); |
|
|
|
RETURN_FALSE; |
|
|
|
@ -769,10 +770,10 @@ ZEND_END_ARG_INFO(); |
|
|
|
static PHP_METHOD(UConverter, convert) { |
|
|
|
php_converter_object *objval = CONV_GET(getThis()); |
|
|
|
char *str, *dest; |
|
|
|
int str_len, dest_len; |
|
|
|
zend_str_size_int str_len, dest_len; |
|
|
|
zend_bool reverse = 0; |
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|b", |
|
|
|
&str, &str_len, &reverse) == FAILURE) { |
|
|
|
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, |
|
|
|
"UConverter::convert(): bad arguments", 0 TSRMLS_CC); |
|
|
|
@ -802,11 +803,11 @@ ZEND_END_ARG_INFO(); |
|
|
|
|
|
|
|
static PHP_METHOD(UConverter, transcode) { |
|
|
|
char *str, *src, *dest; |
|
|
|
int str_len, src_len, dest_len; |
|
|
|
zend_str_size_int str_len, src_len, dest_len; |
|
|
|
zval *options = NULL; |
|
|
|
UConverter *src_cnv = NULL, *dest_cnv = NULL; |
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|a!", |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSS|a!", |
|
|
|
&str, &str_len, &dest, &dest_len, &src, &src_len, &options) == FAILURE) { |
|
|
|
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, |
|
|
|
"UConverter::transcode(): bad arguments", 0 TSRMLS_CC); |
|
|
|
@ -817,7 +818,7 @@ static PHP_METHOD(UConverter, transcode) { |
|
|
|
if (php_converter_set_encoding(NULL, &src_cnv, src, src_len TSRMLS_CC) && |
|
|
|
php_converter_set_encoding(NULL, &dest_cnv, dest, dest_len TSRMLS_CC)) { |
|
|
|
char *out = NULL; |
|
|
|
int out_len = 0; |
|
|
|
zend_str_size_int out_len = 0; |
|
|
|
UErrorCode error = U_ZERO_ERROR; |
|
|
|
|
|
|
|
if (options && zend_hash_num_elements(Z_ARRVAL_P(options))) { |
|
|
|
@ -924,11 +925,11 @@ ZEND_BEGIN_ARG_INFO_EX(php_converter_getaliases_arginfo, 0, ZEND_RETURN_VALUE, 0 |
|
|
|
ZEND_END_ARG_INFO(); |
|
|
|
static PHP_METHOD(UConverter, getAliases) { |
|
|
|
char *name; |
|
|
|
int name_len; |
|
|
|
zend_str_size_int name_len; |
|
|
|
UErrorCode error = U_ZERO_ERROR; |
|
|
|
uint16_t i, count; |
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name, &name_len) == FAILURE) { |
|
|
|
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, |
|
|
|
"UConverter::getAliases(): bad arguments", 0 TSRMLS_CC); |
|
|
|
RETURN_FALSE; |
|
|
|
|