com php-src: add argument for output_len: ext/mbstring/mb string.c

From: Date: Sat, 07 Mar 2015 17:03:47 +0000
Subject: com php-src: add argument for output_len: ext/mbstring/mb string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93700@lists.php.net to get a copy of this message
Commit: 905dfb9179a570b51469febda825a52a529d6793 Author: Masaki Kagaya <masakielastic@gmail.com> Sun, 1 Mar 2015 15:26:42 +0900 Parents: 70e241f1a32f8e30ca4aac47e7e9a781d9c42eb1 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=905dfb9179a570b51469febda825a52a529d6793 Log: add argument for output_len Changed paths: M ext/mbstring/mbstring.c Diff: diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index a6c2575..c17fc65 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -4789,7 +4789,7 @@ PHP_FUNCTION(mb_ord) } /* }}} */ -static inline char* php_mb_chr(long cp, const char* enc) +static inline char* php_mb_chr(long cp, const char* enc, size_t *output_len) { enum mbfl_no_encoding no_enc; char* buf; @@ -4849,6 +4849,10 @@ static inline char* php_mb_chr(long cp, const char* enc) ret = php_mb_convert_encoding(buf, buf_len, enc, "UCS-4BE", &ret_len); efree(buf); + if (output_len) { + *output_len = ret_len; + } + return ret; } else if (php_mb_is_unsupported_no_encoding(no_enc)) { php_error_docref(NULL, E_WARNING, "Unsupported encoding \"%s\"", enc); @@ -4894,6 +4898,10 @@ static inline char* php_mb_chr(long cp, const char* enc) ret = php_mb_convert_encoding(buf, buf_len, enc, enc, &ret_len); efree(buf); + if (output_len) { + *output_len = ret_len; + } + return ret; } /* {{{ proto bool mb_ord([int cp[, string encoding]]) */ @@ -4903,12 +4911,13 @@ PHP_FUNCTION(mb_chr) char* enc = NULL; long enc_len; char* ret; - + size_t ret_len; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &cp, &enc, &enc_len) == FAILURE) { return; } - ret = php_mb_chr(cp, enc); + ret = php_mb_chr(cp, enc, &ret_len); if (ret == NULL) { RETURN_FALSE;

« previous php.cvs (#93700) next »