]> granicus.if.org Git - php/commitdiff
- Warning fixes by Steph
authorMarcus Boerger <helly@php.net>
Sun, 26 Feb 2006 10:57:00 +0000 (10:57 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 26 Feb 2006 10:57:00 +0000 (10:57 +0000)
17 files changed:
Zend/zend_execute.c
Zend/zend_execute_API.c
Zend/zend_interfaces.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/ereg/ereg.c
ext/standard/array.c
ext/standard/dir.c
ext/standard/exec.c
ext/standard/pack.c
ext/standard/reg.c
ext/standard/string.c
ext/standard/user_filters.c
main/main.c
main/streams/filter.c
sapi/cgi/fastcgi.c
win32/select.c

index 046a9b1b0d21a681d98f322edebba068d9702da2..d87e46cbebd5b8ce94c43515e71b7843617be1c7 100644 (file)
@@ -177,8 +177,8 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_
                should_free->var = ptr;
 
                if (T->str_offset.str->type != IS_STRING
-                       || ((int)T->str_offset.offset<0)
-                       || (T->str_offset.str->value.str.len <= T->str_offset.offset)) {
+                       || ((int)T->str_offset.offset < 0)
+                       || (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) {
                        zend_error(E_NOTICE, "Uninitialized string offset:  %d", T->str_offset.offset);
                        ptr->value.str.val = STR_EMPTY_ALLOC();
                        ptr->value.str.len = 0;
@@ -658,7 +658,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
                                zend_error(E_WARNING, "Illegal string offset:  %d", T->str_offset.offset);
                                break;
                        }
-                       if (T->str_offset.offset >= T->str_offset.str->value.str.len) {
+                       if ((int)T->str_offset.offset >= T->str_offset.str->value.str.len) {
                                zend_uint i;
 
                                if (T->str_offset.str->value.str.len==0) {
index 40a7d9ba5bc5b96a8b25b692ce4f8c14f741a7cb..ea89f093d54cf7596867c69aa0188ab010b011fc 100644 (file)
@@ -482,7 +482,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
                                continue;
                        }
 
-                       if (const_value.type == IS_STRING && const_value.value.str.len == str_index_len-1 &&
+                       if (const_value.type == IS_STRING && const_value.value.str.len == (int)str_index_len-1 &&
                           !strncmp(const_value.value.str.val, str_index, str_index_len)) {
                                /* constant value is the same as its name */
                                zval_dtor(&const_value);
index 4d680077bac9fc4dda87629732fe2528d6253b9f..2a93e778437502eae7b383044996f05758476017 100755 (executable)
@@ -336,7 +336,7 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr
                } else if (class_type->get_iterator != zend_user_it_get_new_iterator) {
                        /* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */
                        if (class_type->num_interfaces) {
-                               for (i = 0; i < class_type->num_interfaces; i++) {
+                               for (i = 0; i < (int)class_type->num_interfaces; i++) {
                                        if (class_type->interfaces[i] == zend_ce_iterator) {
                                                return FAILURE;
                                        }
index f0ecd2b460c0e80b1bf9a4255fbcaed42aebc0cc..c63a337eb997003e3d76a894cc6a6d3f56b501bf 100644 (file)
@@ -3096,7 +3096,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
        HashTable *fe_ht;
        zend_object_iterator *iter = NULL;
        int key_type;
-       zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
+       zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);
 
        PZVAL_LOCK(array);
 
index 0cb9fb16a0721a8b79ae7b0d88e9b3710097f647..78c0c6bdaacd03bed34f86e3a4ac14eaef992d7b 100644 (file)
@@ -7561,7 +7561,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
        HashTable *fe_ht;
        zend_object_iterator *iter = NULL;
        int key_type;
-       zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
+       zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);
 
        PZVAL_LOCK(array);
 
index a9ebaaee88923b8f1b2b10a878521aead0678f6a..3e48d39ab3c17715b34ca262bc4bcd406c2cc9be 100644 (file)
@@ -355,7 +355,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
                        new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
                        walk = replace;
                        while (*walk) {
-                               if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
+                               if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= (int)re.re_nsub) {
                                        if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
                                                new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
                                        }    
index 2e9b025cf2bf9cb49c8238079f8171880c1517d2..dc2f4d88ab06f6165e7b1bed2dab7cd20caac1f0 100644 (file)
@@ -1810,14 +1810,14 @@ HashTable* php_splice(HashTable *in_hash, int offset, int length,
        /* Clamp the offset.. */
        if (offset > num_in)
                offset = num_in;
-       else if (offset < 0 && (offset=num_in+offset) < 0)
+       else if (offset < 0 && (offset = (num_in + offset)) < 0)
                offset = 0;
        
        /* ..and the length */
        if (length < 0) {
-               length = num_in-offset+length;
-       } else if (((unsigned) offset + (unsigned) length) > num_in) {
-               length = num_in-offset;
+               length = num_in - offset + length;
+       } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) {
+               length = num_in - offset;
        }
 
        /* Create and initialize output hash */
@@ -2204,14 +2204,14 @@ PHP_FUNCTION(array_slice)
        /* Clamp the offset.. */
        if (offset_val > num_in)
                return;
-       else if (offset_val < 0 && (offset_val=num_in+offset_val) < 0)
+       else if (offset_val < 0 && (offset_val = (num_in + offset_val)) < 0)
                offset_val = 0;
        
        /* ..and the length */
        if (length_val < 0) {
-               length_val = num_in-offset_val+length_val;
-       } else if (((unsigned) offset_val + (unsigned) length_val) > num_in) {
-               length_val = num_in-offset_val;
+               length_val = num_in - offset_val + length_val;
+       } else if (((unsigned)offset_val + (unsigned)length_val) > (unsigned)num_in) {
+               length_val = num_in - offset_val;
        }
        
        if (length_val == 0)
index c13102b89e232797f3080cdfdffabb310a16d2a7..baa9a79c327956c26640f498fa3071f4020b94c1 100644 (file)
@@ -370,7 +370,7 @@ PHP_FUNCTION(glob)
        int pattern_len;
        long flags = 0;
        glob_t globbuf;
-       unsigned int n;
+       int n;
        int ret;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE) 
index bf2e3dbe8d51ce82c6128fe40897c1b3363898c3..be07e3813d59ccc4c3bbfe5e00ec29e527fa3b67 100644 (file)
@@ -135,7 +135,7 @@ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
                                /* strip trailing whitespaces */        
                                l = bufl;
                                while (l-- && isspace(((unsigned char *)buf)[l]));
-                               if (l != (bufl - 1)) {
+                               if (l != (int)(bufl - 1)) {
                                        bufl = l + 1;
                                        buf[bufl] = '\0';
                                }
@@ -148,7 +148,7 @@ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC)
                        if (type != 2) {
                                l = bufl;
                                while (l-- && isspace(((unsigned char *)buf)[l]));
-                               if (l != (bufl - 1)) {
+                               if (l != (int)(bufl - 1)) {
                                        bufl = l + 1;
                                        buf[bufl] = '\0';
                                }
index f088890a59a8635ac388089de4a820ef723c7eed..85b2acda744371b45257f492e42f0133d1cbdba2 100644 (file)
@@ -55,7 +55,7 @@
 #endif
 
 #define INC_OUTPUTPOS(a,b) \
-       if ((a) < 0 || ((INT_MAX - outputpos)/(b)) < (a)) { \
+       if ((a) < 0 || ((INT_MAX - outputpos)/((int)b)) < (a)) { \
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow in format string", code); \
                RETURN_FALSE; \
        } \
index a9ebaaee88923b8f1b2b10a878521aead0678f6a..3e48d39ab3c17715b34ca262bc4bcd406c2cc9be 100644 (file)
@@ -355,7 +355,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
                        new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
                        walk = replace;
                        while (*walk) {
-                               if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
+                               if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= (int)re.re_nsub) {
                                        if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
                                                new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
                                        }    
index 545ceeebabbc6afabc7b0a5a1df7aefa9da1b725..5ae92eeec7bb5f11f3328018486027201af626b8 100644 (file)
@@ -237,7 +237,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior)
                }
        }
        
-       if (((unsigned) start + (unsigned) len) > len1) {
+       if ((start + len) > len1) {
                len = len1 - start;
        }
 
@@ -1166,7 +1166,7 @@ quit_loop:
        if (state == 1) {
                cend = c;
        }
-       if (suffix != NULL && sufflen < (cend - comp) &&
+       if (suffix != NULL && sufflen < (uint)(cend - comp) &&
                        memcmp(cend - sufflen, suffix, sufflen) == 0) {
                cend -= sufflen;
        }
@@ -1983,7 +1983,7 @@ PHP_FUNCTION(substr)
                RETURN_FALSE;
        }
 
-       if (((unsigned) f + (unsigned) l) > Z_STRLEN_PP(str)) {
+       if ((f + l) > Z_STRLEN_PP(str)) {
                l = Z_STRLEN_PP(str) - f;
        }
 
@@ -2080,7 +2080,7 @@ PHP_FUNCTION(substr_replace)
                                }
                        }
 
-                       if (((unsigned) f + (unsigned) l) > Z_STRLEN_PP(str)) {
+                       if ((f + l) > Z_STRLEN_PP(str)) {
                                l = Z_STRLEN_PP(str) - f;
                        }
                        if (Z_TYPE_PP(repl) == IS_ARRAY) {
@@ -2176,7 +2176,7 @@ PHP_FUNCTION(substr_replace)
                                }
                        }
 
-                       if (((unsigned) f + (unsigned) l) > Z_STRLEN_PP(tmp_str)) {
+                       if ((f + l) > Z_STRLEN_PP(tmp_str)) {
                                l = Z_STRLEN_PP(tmp_str) - f;
                        }
 
index ece984f7a634ebef84e6d8b9abb92a02552730f4..971a5b91abd6aa9e3f6cd57c7099190b10ca068f 100644 (file)
@@ -406,7 +406,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
                if (!bucket->own_buf) {
                        bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC);
                }
-               if (bucket->buflen != Z_STRLEN_PP(pzdata)) {
+               if ((int)bucket->buflen != Z_STRLEN_PP(pzdata)) {
                        bucket->buf = perealloc(bucket->buf, Z_STRLEN_PP(pzdata), bucket->is_persistent);
                        bucket->buflen = Z_STRLEN_PP(pzdata);
                }
index 3c6d4697427bd433da17e9ceefc450222f51fb0c..b6ee590a6776d0b47a158cf907d8340f0bdff2fd 100644 (file)
@@ -659,7 +659,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_
                 * be NULL if PG(last_error_message) is not NULL */
                if (strcmp(PG(last_error_message), buffer)
                        || (!PG(ignore_repeated_source)
-                               && ((PG(last_error_lineno) != error_lineno)
+                               && ((PG(last_error_lineno) != (int)error_lineno)
                                        || strcmp(PG(last_error_file), error_filename)))) {
                        display = 1;
                } else {
index baa6211226ac5acc679767c9735fa3ca12bbbf70..f8a85232457182aef28053c5b2d1e8f12a03078e 100644 (file)
@@ -351,7 +351,7 @@ PHPAPI void _php_stream_filter_append(php_stream_filter_chain *chain, php_stream
                php_stream_bucket_append(brig_inp, bucket TSRMLS_CC);
                status = filter->fops->filter(stream, filter, brig_inp, brig_outp, &consumed, PSFS_FLAG_NORMAL TSRMLS_CC);
 
-               if (stream->readpos + consumed > stream->writepos || consumed < 0) {
+               if (stream->readpos + consumed > (uint)stream->writepos || consumed < 0) {
                        /* No behaving filter should cause this. */
                        status = PSFS_ERR_FATAL;
                }
index 5051898c10ca11dfe212a18847b4f491c75c1f0e..baa93b0e8322a4b909299842911ef0986418ab62 100644 (file)
@@ -531,7 +531,7 @@ static int fcgi_read_request(fcgi_request *req)
                }
                len = p - buf - sizeof(fcgi_header);
                len += fcgi_make_header((fcgi_header*)buf, FCGI_GET_VALUES_RESULT, 0, len);
-               if (safe_write(req, buf, sizeof(fcgi_header)+len) != sizeof(fcgi_header)+len) {
+               if (safe_write(req, buf, sizeof(fcgi_header)+len) != (int)sizeof(fcgi_header)+len) {
                        return 0;
                }
                return 0;
index 4da95d852f6f105e102926ae162354edcf7cf301..de391fc12f9766012fd156f8b03f46686b4c55c9 100644 (file)
@@ -67,13 +67,13 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, stru
                        if ((DWORD)handles[n_handles] == 0xffffffff) {
                                /* socket */
                                if (SAFE_FD_ISSET(i, rfds)) {
-                                       FD_SET(i, &sock_read);
+                                       FD_SET((uint)i, &sock_read);
                                }
                                if (SAFE_FD_ISSET(i, wfds)) {
-                                       FD_SET(i, &sock_write);
+                                       FD_SET((uint)i, &sock_write);
                                }
                                if (SAFE_FD_ISSET(i, efds)) {
-                                       FD_SET(i, &sock_except);
+                                       FD_SET((uint)i, &sock_except);
                                }
                                if (i > sock_max_fd) {
                                        sock_max_fd = i;
@@ -136,13 +136,13 @@ PHPAPI int php_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, stru
                                for (i = 0; i < n_handles; i++) {
                                        if (WAIT_OBJECT_0 == WaitForSingleObject(handles[i], 0)) {
                                                if (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) {
-                                                       FD_SET(handle_slot_to_fd[i], &aread);
+                                                       FD_SET((uint)handle_slot_to_fd[i], &aread);
                                                }
                                                if (SAFE_FD_ISSET(handle_slot_to_fd[i], wfds)) {
-                                                       FD_SET(handle_slot_to_fd[i], &awrite);
+                                                       FD_SET((uint)handle_slot_to_fd[i], &awrite);
                                                }
                                                if (SAFE_FD_ISSET(handle_slot_to_fd[i], efds)) {
-                                                       FD_SET(handle_slot_to_fd[i], &aexcept);
+                                                       FD_SET((uint)handle_slot_to_fd[i], &aexcept);
                                                }
                                                retcode++;
                                        }