lbarnaud Tue Oct 21 22:05:09 2008 UTC
Modified files:
/php-src/ext/iconv iconv.c
Log:
initialize optional vars
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.166&r2=1.167&diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.166 php-src/ext/iconv/iconv.c:1.167
--- php-src/ext/iconv/iconv.c:1.166 Tue Sep 23 15:22:05 2008
+++ php-src/ext/iconv/iconv.c Tue Oct 21 22:05:09 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.166 2008/09/23 15:22:05 nlopess Exp $ */
+/* $Id: iconv.c,v 1.167 2008/10/21 22:05:09 lbarnaud Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1935,7 +1935,7 @@
Returns the character count of str */
PHP_FUNCTION(iconv_strlen)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zstr str;
int str_len, argc = ZEND_NUM_ARGS();
@@ -1945,8 +1945,6 @@
unsigned int retval;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(argc TSRMLS_CC, "t|s",
&str, &str_len, &str_type, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
@@ -1975,19 +1973,17 @@
Returns specified part of a string */
PHP_FUNCTION(iconv_substr)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zstr str;
int str_len;
zend_uchar str_type;
- long offset, length;
+ long offset, length = 0;
php_iconv_err_t err;
smart_str retval = {0};
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "tl|ls",
&str, &str_len, &str_type, &offset, &length,
&charset, &charset_len) == FAILURE) {
@@ -2051,7 +2047,7 @@
Finds position of first occurrence of needle within part of haystack
beginning with offset */
PHP_FUNCTION(iconv_strpos)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
zstr haystk;
int haystk_len;
@@ -2059,15 +2055,12 @@
zstr ndl;
int ndl_len;
zend_uchar ndl_type;
- long offset;
+ long offset = 0;
php_iconv_err_t err;
unsigned int retval;
- offset = 0;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT|ls",
&haystk, &haystk_len, &haystk_type, &ndl, &ndl_len, &ndl_type,
&offset, &charset, &charset_len) == FAILURE) {
@@ -2118,7 +2111,7 @@
Finds position of last occurrence of needle within part of haystack
beginning with offset */
PHP_FUNCTION(iconv_strrpos)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
char *haystk;
int haystk_len;
@@ -2129,8 +2122,6 @@
unsigned int retval;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
&haystk, &haystk_len, &ndl, &ndl_len,
&charset, &charset_len) == FAILURE) {
@@ -2284,7 +2275,7 @@
{
char *encoded_str;
int encoded_str_len;
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
long mode = 0;
@@ -2292,8 +2283,6 @@
php_iconv_err_t err;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
&encoded_str, &encoded_str_len, &mode, &charset, &charset_len)
== FAILURE) {
@@ -2327,14 +2316,12 @@
{
const char *encoded_str;
int encoded_str_len;
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
long mode = 0;
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
&encoded_str, &encoded_str_len, &mode, &charset, &charset_len)
== FAILURE) {
@@ -2510,7 +2497,7 @@
PHP_FUNCTION(iconv_get_encoding)
{
char *type = "all";
- int type_len;
+ int type_len = sizeof("all")-1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type,
&type_len) == FAILURE)
return;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php