]> granicus.if.org Git - php/commitdiff
signed/unsigned compiler warning fixes
authorHartmut Holzgraefe <hholzgra@php.net>
Fri, 26 Sep 2003 08:09:56 +0000 (08:09 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Fri, 26 Sep 2003 08:09:56 +0000 (08:09 +0000)
Zend/zend_alloc.c
ext/standard/array.c
ext/standard/dir.c
ext/standard/dns.c
ext/standard/exec.c
ext/standard/ftp_fopen_wrapper.c
ext/standard/pack.c
ext/xml/compat.c
ext/zlib/zlib.c
main/fopen_wrappers.c

index 13de5cf4727ec06f02ec5f0e4d7e9f3bd4b0ca0c..6e153cbedb664aeba993c25ae001bbf277397d79 100644 (file)
@@ -728,7 +728,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
                had_problems = 1;
                overflow_ptr = (char *) &end_magic;
 
-               for (i=0; i<sizeof(long); i++) {
+               for (i=0; i<(int)sizeof(long); i++) {
                        if (overflow_ptr[i]!=magic_ptr[i]) {
                                overflows++;
                        }
@@ -737,7 +737,7 @@ ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_
                zend_debug_alloc_output("%10s\t", "End:");
                zend_debug_alloc_output("Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n", end_magic, MEM_BLOCK_END_MAGIC);
                zend_debug_alloc_output("%10s\t","");
-               if (overflows>=sizeof(long)) {
+               if (overflows>=(int)sizeof(long)) {
                        zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
                } else {
                        zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
index 61716fbb8d6a7b31a2c3d5f2fc314a476292d29a..3a6d4c74d40e96f27b461ba4643599e917ff4b1a 100644 (file)
@@ -1890,7 +1890,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
        
        /* If we did a shift... re-index like it did before */
        if (!off_the_end) {
-               int k = 0;
+               unsigned int k = 0;
                int should_rehash = 0;
                Bucket *p = Z_ARRVAL_PP(stack)->pListHead;
                while (p != NULL) {
index 40738b3b8eef71fd0ccc8704b300a3a88238fbd0..25f96064e9c241fafd81676ae696d30efb7088de 100644 (file)
@@ -361,7 +361,8 @@ PHP_FUNCTION(glob)
        int pattern_len;
        long flags = 0;
        glob_t globbuf;
-       int n, ret;
+       unsigned int n;
+       int ret;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &pattern, &pattern_len, &flags) == FAILURE) 
                return;
index 73a1e3080371f530ab317e3960e1892aeaee5360..eddb67ed435f11eca710dd6b36f761a47edce075 100644 (file)
@@ -746,7 +746,7 @@ PHP_FUNCTION(dns_get_mx)
        if (i < 0) {
                RETURN_FALSE;
        }
-       if (i > sizeof(ans)) {
+       if (i > (int)sizeof(ans)) {
                i = sizeof(ans);
        }
        hp = (HEADER *)&ans;
index 2b3f3b3dd88bcd68a61e4985f73fd3eb74dea9f2..adc243f63cf84a4767075409b5941dc08dee7c0e 100644 (file)
@@ -61,10 +61,10 @@ int php_exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC)
 {
        FILE *fp;
        char *buf, *tmp=NULL;
-       int buflen, l, pclose_return;
+       int l, pclose_return;
        char *cmd_p, *b, *c, *d=NULL;
        php_stream *stream;
-       size_t bufl = 0;
+       size_t buflen, bufl = 0;
 #if PHP_SIGCHILD
        void (*sig_handler)();
 #endif
index 177bed26ab649bdad3aa1c2c9c1ef62da3b32737..8d20a1a3aed8f55fbf61296616791b24613a3ff1 100644 (file)
@@ -586,7 +586,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count
                return 0;
        }
 
-       memcpy(ent->d_name, basename, MIN(sizeof(ent->d_name), basename_len)-1);
+       memcpy(ent->d_name, basename, MIN((int)sizeof(ent->d_name), basename_len)-1);
        ent->d_name[sizeof(ent->d_name)-1] = '\0';
        efree(basename);
 
index 5678ecbbf82f6df61ec2ff0103971e8a41411abd..72c18ea53b581c62123cccd7534ead36182dfa35 100644 (file)
@@ -847,7 +847,7 @@ PHP_MINIT_FUNCTION(pack)
                /* Where to get lo to hi bytes from */
                byte_map[0] = 0;
 
-               for (i = 0; i < sizeof(int); i++) {
+               for (i = 0; i < (int)sizeof(int); i++) {
                        int_map[i] = i;
                }
 
@@ -879,7 +879,7 @@ PHP_MINIT_FUNCTION(pack)
                /* Where to get hi to lo bytes from */
                byte_map[0] = size - 1;
 
-               for (i = 0; i < sizeof(int); i++) {
+               for (i = 0; i < (int)sizeof(int); i++) {
                        int_map[i] = size - (sizeof(int) - i);
                }
 
index 04d33fdb744ad586df8253d18745374743cf330b..45c47d14d739c9760d1a96df28b62d194f565c72 100644 (file)
@@ -509,7 +509,7 @@ const XML_Char *error_mapping[] = {
 const XML_Char *
 XML_ErrorString(int code)
 {
-       if (code < 0 || code >= sizeof(error_mapping)) {
+       if (code < 0 || code >= (int)sizeof(error_mapping)) {
                return "Unknown";
        }
        return error_mapping[code];
index d3ca9dadcb7767e124bd175e520e2c644129c977..05e17ee620bb8c9fcafdb3e0e1068cb45e0ffb87 100644 (file)
@@ -410,7 +410,8 @@ PHP_FUNCTION(gzcompress)
    Unzip a gzip-compressed string */
 PHP_FUNCTION(gzuncompress)
 {
-       int data_len, status, factor=1, maxfactor=16;
+       int data_len, status;
+       unsigned int factor=1, maxfactor=16;
        long limit = 0;
        unsigned long plength=0, length;
        char *data, *s1=NULL, *s2=NULL;
@@ -433,7 +434,7 @@ PHP_FUNCTION(gzuncompress)
         that should be eneugh for all real life cases  
        */
        do {
-               length = plength ? plength : data_len * (1 << factor++);
+               length = plength ? plength : (unsigned long)data_len * (1 << factor++);
                s2 = (char *) erealloc(s1, length);
                status = uncompress(s2, &length, data, data_len);
                s1 = s2;
@@ -516,7 +517,8 @@ PHP_FUNCTION(gzdeflate)
    Unzip a gzip-compressed string */
 PHP_FUNCTION(gzinflate)
 {
-       int data_len, status, factor=1, maxfactor=16;
+       int data_len, status;
+       unsigned int factor=1, maxfactor=16;
        long limit = 0;
        unsigned long plength=0, length;
        char *data, *s1=NULL, *s2=NULL;
@@ -544,7 +546,7 @@ PHP_FUNCTION(gzinflate)
        stream.zfree = (free_func) Z_NULL;
 
        do {
-               length = plength ? plength : data_len * (1 << factor++);
+               length = plength ? plength : (unsigned long)data_len * (1 << factor++);
                s2 = (char *) erealloc(s1, length);
 
                if (!s2 && s1) {
index e7093276724b8121835f4791456233f24f72a454..5356350917847cb989ea7f740db4b4e0f2d95208 100644 (file)
@@ -299,7 +299,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
                if (s) {                        /* if there is no path name after the file, do not bother */
                                                        /* to try open the directory */
                        length = s - (path_info + 2);
-                       if (length > sizeof(user) - 1)
+                       if (length > (int)sizeof(user) - 1)
                                length = sizeof(user) - 1;
                        memcpy(user, path_info + 2, length);
                        user[length] = '\0';