]> granicus.if.org Git - php/commitdiff
initialize optional vars
authorArnaud Le Blanc <lbarnaud@php.net>
Tue, 21 Oct 2008 23:36:17 +0000 (23:36 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Tue, 21 Oct 2008 23:36:17 +0000 (23:36 +0000)
ext/curl/interface.c
ext/date/php_date.c
ext/dom/domimplementation.c
ext/exif/exif.c
ext/gd/gd.c
ext/openssl/openssl.c
ext/simplexml/simplexml.c
ext/soap/soap.c
ext/sockets/sockets.c
ext/zip/php_zip.c

index 33a1d263657783ba49bd6c69a1a2cf89aed30cc0..f10376bcd7c971d5c3edc511d05ca6f2f790a045 100644 (file)
@@ -1092,8 +1092,8 @@ PHP_FUNCTION(curl_init)
        php_curl        *ch;
        CURL            *cp;
        zstr            src = NULL_ZSTR;
-       int             src_len;
-       zend_uchar      src_type;
+       int             src_len = 0;
+       zend_uchar      src_type = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|t", &src, &src_len, &src_type) == FAILURE) {
                RETURN_FALSE;
@@ -1783,7 +1783,7 @@ PHP_FUNCTION(curl_getinfo)
 {
        zval            *zid;
        php_curl        *ch;
-       long            option;
+       long            option = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &zid, &option) == FAILURE) {
                 RETURN_FALSE;
index c4848eecdbaf65941e4b42ea96076e6e31fd6866..61e9e808ec5d3cb042bac3949f8fdac4928b7ef9 100644 (file)
@@ -1511,7 +1511,7 @@ PHP_FUNCTION(idate)
 {
        char   *format;
        int     format_len;
-       long    ts;
+       long    ts = 0;
        int ret; 
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
@@ -1574,7 +1574,7 @@ PHP_FUNCTION(strtotime)
        char *times, *initial_ts;
        int   time_len, error1, error2;
        struct timelib_error_container *error;
-       long  preset_ts, ts;
+       long  preset_ts = 0, ts;
 
        timelib_time *t, *now;
        timelib_tzinfo *tzi;
@@ -1631,7 +1631,7 @@ PHP_FUNCTION(strtotime)
 /* {{{ php_mktime - (gm)mktime helper */
 PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
 {
-       long hou, min, sec, mon, day, yea, dst = -1;
+       long hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0, dst = -1;
        timelib_time *now;
        timelib_tzinfo *tzi = NULL;
        long ts, adjust_seconds = 0;
@@ -1760,7 +1760,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
 {
        char                *format, *buf;
        int                  format_len;
-       long                 timestamp;
+       long                 timestamp = 0;
        struct tm            ta;
        int                  max_reallocs = 5;
        size_t               buf_len = 64, real_len;
@@ -3962,7 +3962,7 @@ PHP_FUNCTION(timezone_identifiers_list)
        const timelib_tzdb_index_entry *table;
        int                             i, item_count;
        long                            what = PHP_DATE_TIMEZONE_GROUP_ALL;
-       char                           *option;
+       char                           *option = NULL;
        int                             option_len = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &what, &option, &option_len) == FAILURE) {
@@ -4068,10 +4068,10 @@ PHP_FUNCTION(date_default_timezone_get)
  */
 static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_sunset)
 {
-       double latitude, longitude, zenith, gmt_offset = 0, altitude;
+       double latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude;
        double h_rise, h_set, N;
        timelib_sll rise, set, transit;
-       long time, retformat;
+       long time, retformat = 0;
        int             rs;
        timelib_time   *t;
        timelib_tzinfo *tzi;
index a32f075c20901a0fad55e1e9b0047623e13fee41..d1d7642041dab1b12953fdf0f4da1d976671cb90 100644 (file)
@@ -98,7 +98,7 @@ PHP_METHOD(domimplementation, createDocumentType)
        zval *rv = NULL;
        xmlDtd *doctype;
        int ret, name_len = 0, publicid_len = 0, systemid_len = 0;
-       char *name, *publicid, *systemid;
+       char *name = NULL, *publicid = NULL, *systemid = NULL;
        xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL;
        xmlURIPtr uri;
 
@@ -161,7 +161,7 @@ PHP_METHOD(domimplementation, createDocument)
        xmlDtdPtr doctype = NULL;
        xmlNsPtr nsptr = NULL;
        int ret, uri_len = 0, name_len = 0, errorcode = 0;
-       char *uri, *name;
+       char *uri = NULL, *name = NULL;
        char *prefix = NULL, *localname = NULL;
        dom_object *doctobj;
 
index 89beb724ec6e8e11155c371983d6971f3dd48fb6..580ad5563c4189bb80b24ce03233c74c9c2a23f7 100644 (file)
@@ -3892,7 +3892,7 @@ PHP_FUNCTION(exif_read_data)
        image_info_type ImageInfo;
        char tmp[64], *sections_str=0, *s;
        char *filename;
-       int filename_len, sections_str_len;
+       int filename_len, sections_str_len = 0;
 
        memset(&ImageInfo, 0, sizeof(ImageInfo));
 
index 66fbdaac65311d7b76d6f9642cc1c5d99e7713d2..d1aeb009e59831ebb34ff78231f5e79eb767d42c 100644 (file)
@@ -4144,7 +4144,7 @@ PHP_FUNCTION(imagepstext)
 PHP_FUNCTION(imagepsbbox)
 {
        zval *fnt;
-       long sz = 0, sp, wd;
+       long sz = 0, sp = 0, wd = 0;
        char *str;
        int i, space = 0, add_width = 0, char_width, amount_kern;
        int cur_x, cur_y, dx, dy;
@@ -4152,7 +4152,7 @@ PHP_FUNCTION(imagepsbbox)
        int *f_ind;
        int str_len, per_char = 0;
        int argc = ZEND_NUM_ARGS();
-       double angle, sin_a = 0, cos_a = 0;
+       double angle = 0, sin_a = 0, cos_a = 0;
        BBox char_bbox, str_bbox = {0, 0, 0, 0};
 
        if (argc != 3 && argc != 6) {
index 114c413a2c57548db6b38200b0c2a1d6965cdf67..e461390f70c76e0d8ce25846d59944a58f6d0e91 100644 (file)
@@ -1550,7 +1550,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose)
        long purpose;
        zval **ppuntrusted=NULL;
        char * untrusted = NULL;
-       int untrusted_len;
+       int untrusted_len = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zl|a!Z", &zcert, &purpose, &zcainfo, &ppuntrusted) == FAILURE) {
                return;
@@ -3279,7 +3279,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
        zval **cert;
        EVP_PKEY *pkey;
        char *passphrase = "";
-       int passphrase_len;
+       int passphrase_len = sizeof("")-1;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|s&", &cert, &passphrase, &passphrase_len, UG(ascii_conv)) == FAILURE) {
                return;
@@ -3413,11 +3413,11 @@ PHP_FUNCTION(openssl_pkcs7_verify)
        zval **ppfilename;
        char * filename; int filename_len;
        zval **ppextracerts=NULL;
-       char * extracerts = NULL; int extracerts_len;
+       char * extracerts = NULL; int extracerts_len = 0;
        zval **ppsignersfilename;
-       char * signersfilename = NULL; int signersfilename_len;
+       char * signersfilename = NULL; int signersfilename_len = 0;
        zval **ppdatafilename=NULL;
-       char * datafilename = NULL; int datafilename_len;
+       char * datafilename = NULL; int datafilename_len = 0;
        
        RETVAL_LONG(-1);
 
@@ -4339,7 +4339,7 @@ PHP_FUNCTION(openssl_seal)
        unsigned char *buf = NULL, **eks;
        char *data; int data_len;
        char *method =NULL;
-       int method_len;
+       int method_len = 0;
        const EVP_CIPHER *cipher;
        EVP_CIPHER_CTX ctx;
 
@@ -4465,7 +4465,7 @@ PHP_FUNCTION(openssl_open)
        char * data;    int data_len;
        char * ekey;    int ekey_len;
        char *method =NULL;
-       int method_len;
+       int method_len = 0;
        const EVP_CIPHER *cipher;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SzSZ|s&", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len, UG(ascii_conv)) == FAILURE) {
index cd610f44768ae2c456cae0ecb95f266e91a244b5..3f71bbdb82c6d31b2a9d6a65d587f3d2c2948814 100644 (file)
@@ -1546,7 +1546,7 @@ SXE_METHOD(children)
 {
        php_sxe_object *sxe;
        char           *nsprefix = NULL;
-       int             nsprefix_len;
+       int             nsprefix_len = 0;
        xmlNodePtr      node;
        zend_bool       isprefix = 0;
 
@@ -1595,7 +1595,7 @@ SXE_METHOD(attributes)
 {
        php_sxe_object *sxe;
        char           *nsprefix = NULL;
-       int             nsprefix_len;
+       int             nsprefix_len = 0;
        xmlNodePtr      node;
        zend_bool       isprefix = 0;
 
index 3fe8f68495c95623261f804c4e9d6b3e5aee4174..40c40f305e1ae9f4cb581faf0ffd146225f64304 100644 (file)
@@ -1211,9 +1211,9 @@ PHP_METHOD(SoapFault, SoapFault)
        zstr fault_actor = NULL_ZSTR;
        zstr name = NULL_ZSTR;
        char *fault_code = NULL, *fault_code_ns = NULL;
-       int fault_string_len, fault_actor_len, name_len;
+       int fault_string_len = 0, fault_actor_len = 0, name_len = 0;
        zval *code = NULL, *details = NULL, *headerfault = NULL;
-       zend_uchar name_type, fault_string_type, fault_actor_type;
+       zend_uchar name_type = 0, fault_string_type = 0, fault_actor_type = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zt|t!z!t!z",
                &code,
@@ -1342,8 +1342,8 @@ PHP_METHOD(SoapVar, SoapVar)
 {
        zval *data, *type;
        zstr stype = NULL_ZSTR, ns = NULL_ZSTR, name = NULL_ZSTR, namens = NULL_ZSTR;
-       int stype_len, ns_len, name_len, namens_len;
-       zend_uchar stype_type, ns_type, name_type, namens_type;
+       int stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0;
+       zend_uchar stype_type = 0, ns_type = 0, name_type = 0, namens_type = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|tttt",
                        &data, &type,
@@ -1940,7 +1940,7 @@ PHP_METHOD(SoapServer, handle)
        soapHeader *soap_headers = NULL;
        sdlFunctionPtr function;
        zstr arg = NULL_ZSTR;
-       int arg_len;
+       int arg_len = 0;
        xmlCharEncodingHandlerPtr old_encoding;
        HashTable *old_class_map, *old_typemap;
        int old_features;
@@ -2478,8 +2478,8 @@ PHP_METHOD(SoapServer, fault)
        zstr code, string;
        zstr actor=NULL_ZSTR;
        zstr name=NULL_ZSTR;
-       int code_len, string_len, actor_len, name_len;
-       zend_uchar code_type, string_type, actor_type, name_type;
+       int code_len, string_len, actor_len = 0, name_len = 0;
+       zend_uchar code_type, string_type, actor_type = 0, name_type = 0;
        zval* details = NULL;
 
        SOAP_SERVER_BEGIN_CODE();
@@ -3695,8 +3695,8 @@ PHP_METHOD(SoapClient, __setCookie)
 {
        zstr name;
        zstr val = NULL_ZSTR;
-       int  name_len, val_len;
-       zend_uchar name_type, val_type;
+       int  name_len, val_len = 0;
+       zend_uchar name_type, val_type = 0;
        soap_client_object *client;
 
        client = (soap_client_object*)zend_object_store_get_object(this_ptr TSRMLS_CC);
@@ -3796,8 +3796,8 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
 PHP_METHOD(SoapClient, __setLocation)
 {
        void* location = NULL;
-       int  location_len;
-       zend_uchar location_type;
+       int  location_len = 0;
+       zend_uchar location_type = 0;
        soap_client_object *client;
 
        client = (soap_client_object*)zend_object_store_get_object(this_ptr TSRMLS_CC);
index 5e2b09c5489e7ff02c278c4ea06289de7bc2d06a..e05a40e257716a48520ebf3b30220d459cb587ed 100644 (file)
@@ -976,7 +976,7 @@ PHP_FUNCTION(socket_write)
        zval            *arg1;
        php_socket      *php_sock;
        int                     retval, str_len;
-       long            length;
+       long            length = 0;
        char            *str;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &str, &str_len, &length) == FAILURE) {
@@ -1270,7 +1270,7 @@ PHP_FUNCTION(socket_connect)
        struct sockaddr_un      s_un;
        char                            *addr;
        int                                     retval, addr_len;
-       long                            port;
+       long                            port = 0;
        int                                     argc = ZEND_NUM_ARGS();
 
        if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) {
index 220b6e8317d09c0bf4e4fe21c40b95ee34c7e8b1..ab7a9642ace20de9d7cbc6e4f535886458ca0b34 100644 (file)
@@ -1143,8 +1143,8 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open)
 {
        zval * zip;
        zval * zip_entry;
-       char *mode;
-       int mode_len;
+       char *mode = NULL;
+       int mode_len = 0;
        zip_read_rsrc * zr_rsrc;
        zip_rsrc *z_rsrc;
 
@@ -1486,10 +1486,10 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
        struct zip *intern;
        zval *this = getThis();
        char *pattern;
-       char *path;
+       char *path = NULL;
        char *remove_path = NULL;
        char *add_path = NULL;
-       int pattern_len, add_path_len, remove_path_len, path_len;
+       int pattern_len, add_path_len, remove_path_len, path_len = 0;
        long remove_all_path = 0;
        long flags = 0;
        zval *options = NULL;