]> granicus.if.org Git - php/commitdiff
Kill compiler warnings
authorKalle Sommer Nielsen <kalle@php.net>
Sat, 1 Aug 2009 14:45:42 +0000 (14:45 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Sat, 1 Aug 2009 14:45:42 +0000 (14:45 +0000)
14 files changed:
ext/gd/gd.c
ext/session/mod_files.c
ext/standard/crypt_blowfish.c
ext/standard/dir.c
ext/standard/html.c
ext/standard/iptc.c
ext/standard/pack.c
ext/standard/streamsfuncs.c
ext/standard/strnatcmp.c
main/rfc1867.c
main/snprintf.c
main/streams/filter.c
main/streams/glob_wrapper.c
main/streams/streams.c

index ee6a5ca71b0953e03b5001af44e108131ee61d2b..45267c4b6bffcb43bfd9e84d4b88c3c6d57abc48 100644 (file)
@@ -3956,10 +3956,10 @@ PHP_FUNCTION(imagepstext)
        bg_al = gdImageAlpha(bg_img, _bg);
 
        for (i = 0; i < aa_steps; i++) {
-               rd = bg_rd + (double) (fg_rd - bg_rd) / aa_steps * (i + 1);
-               gr = bg_gr + (double) (fg_gr - bg_gr) / aa_steps * (i + 1);
-               bl = bg_bl + (double) (fg_bl - bg_bl) / aa_steps * (i + 1);
-               al = bg_al + (double) (fg_al - bg_al) / aa_steps * (i + 1);
+               rd = bg_rd + (int) (fg_rd - bg_rd) / aa_steps * (i + 1);
+               gr = bg_gr + (int) (fg_gr - bg_gr) / aa_steps * (i + 1);
+               bl = bg_bl + (int) (fg_bl - bg_bl) / aa_steps * (i + 1);
+               al = bg_al + (int) (fg_al - bg_al) / aa_steps * (i + 1);
                aa[i] = gdImageColorResolveAlpha(bg_img, rd, gr, bl, al);
        }
 
@@ -3997,7 +3997,7 @@ PHP_FUNCTION(imagepstext)
                for (i = 1; i < str_len; i++) {
                        amount_kern = (int) T1_GetKerning(*f_ind, str[i - 1], str[i]);
                        amount_kern += str[i - 1] == ' ' ? space : 0;
-                       add_width = (int) (amount_kern + width) / extend;
+                       add_width = (int) ((amount_kern + width) / extend);
 
                        char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, (float) size, transform);
                        str_path = T1_ConcatOutlines(str_path, char_path);
@@ -4699,7 +4699,7 @@ PHP_FUNCTION(imageconvolution)
                                        zval copyval = **var2;
                                        zval_copy_ctor(&copyval);
                                        convert_to_double(&copyval);
-                                       matrix[i][j] = Z_DVAL_PP(var2);
+                                       matrix[i][j] = (float) Z_DVAL_PP(var2);
                                } else {
                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have a 3x3 matrix");
                                        RETURN_FALSE;
@@ -4707,7 +4707,7 @@ PHP_FUNCTION(imageconvolution)
                        }
                }
        }
-       RETURN_BOOL(gdImageConvolution(im_src, matrix, div, offset));
+       RETURN_BOOL(gdImageConvolution(im_src, matrix, (float) div, (float) offset));
 }
 /* }}} */
 /* End section: Filters */
index 7e90147b40a30e2807964dc7a087e6037091f7ef..1459067850a7e3b0af99c7c715e1b03deb399472 100644 (file)
@@ -132,7 +132,7 @@ static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, cons
                if (status != U_ZERO_ERROR) {
                        php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failure converting savepath to local filesystem encoding, attempting to use utf8");
                } else {
-                       if (newlen >= buflen) {
+                       if ((unsigned int)newlen >= buflen) {
                                newlen = buflen - 1;
                                newbuf[newlen] = 0;
                        }
index b640a1081b6d84f5e4639b6c9021e781c3620e80..2ffd093700677c3d3ae16200bc66cab8169b2961 100644 (file)
@@ -744,7 +744,7 @@ char *php_crypt_gensalt_blowfish_rn(unsigned long count,
        output[1] = '2';
        output[2] = 'a';
        output[3] = '$';
-       output[4] = '0' + count / 10;
+       output[4] = (char) ('0' + count / 10);
        output[5] = '0' + count % 10;
        output[6] = '$';
 
index ce45ace899cb1c01d872d70c06c47b023dc541da..c760b21cde8084803079d7b701e0b36bc3f4ea5e 100644 (file)
@@ -449,8 +449,7 @@ PHP_FUNCTION(glob)
        int pattern_len;
        long flags = 0;
        glob_t globbuf;
-       unsigned int n;
-       int ret;
+       int ret, n;
        zend_bool basedir_limit = 0;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &pppattern, &flags) == FAILURE ||
index eeaf296599e839030587430c3136c71b6353190f..8b56ac848a260addb79166498d854e0d10b424a8 100644 (file)
@@ -1397,7 +1397,7 @@ PHP_FUNCTION(htmlspecialchars_decode)
                        if (!memcmp(p, basic_entities_dec[j].entity, basic_entities_dec[j].entitylen)) {
                                int e_len = basic_entities_dec[j].entitylen - 1;
                
-                               *p++ = basic_entities_dec[j].charcode;
+                               *p++ = (char)basic_entities_dec[j].charcode;
                                memmove(p, p + e_len, (e - p - e_len));
                                e -= e_len;
                                goto done;
index d174aad4c1acc42628a0f6409125c06207a6ff9e..fcd98189d58e2b81383d8c3a2a724f90f59f22e7 100644 (file)
@@ -183,7 +183,8 @@ PHP_FUNCTION(iptcembed)
        int jpeg_file_len, iptcdata_len;
     FILE *fp;
        unsigned int marker;
-       unsigned int done = 0, inx;     
+       unsigned int done = 0;
+       int inx;        
        long spool = 0;
        unsigned char *spoolbuf=0, *poi=0;
        struct stat sb;
index 605aede826d8a85e2d20018b0ca4514a44e0eca1..349977f5adbafc55e4a11c642b82cdf5c9780d06 100644 (file)
@@ -255,7 +255,7 @@ PHP_FUNCTION(pack)
 
                        case 'i': 
                        case 'I':
-                               INC_OUTPUTPOS(arg,sizeof(int))
+                               INC_OUTPUTPOS((unsigned int) arg, sizeof(int))
                                break;
 
                        case 'l': 
@@ -266,11 +266,11 @@ PHP_FUNCTION(pack)
                                break;
 
                        case 'f':
-                               INC_OUTPUTPOS(arg,sizeof(float))
+                               INC_OUTPUTPOS((unsigned int) arg, sizeof(float))
                                break;
 
                        case 'd':
-                               INC_OUTPUTPOS(arg,sizeof(double))
+                               INC_OUTPUTPOS((unsigned int) arg, sizeof(double))
                                break;
 
                        case 'X':
index c2ef4f2beb362bebeb4c183a4203d28dafa45959..76b9800dd8d617c575e983d6962756c01dd0ca92 100644 (file)
@@ -116,10 +116,10 @@ PHP_FUNCTION(stream_socket_client)
        
        /* prepare the timeout value for use */
        conv = (php_timeout_ull) (timeout * 1000000.0);
-       tv.tv_sec = conv / 1000000;
+       tv.tv_sec = (long) (conv / 1000000);
        tv.tv_usec = conv % 1000000;
 
-       if (zerrno)     {
+       if (zerrno) {
                zval_dtor(zerrno);
                ZVAL_LONG(zerrno, 0);
        }
@@ -260,7 +260,7 @@ PHP_FUNCTION(stream_socket_accept)
        
        /* prepare the timeout value for use */
        conv = (php_timeout_ull) (timeout * 1000000.0);
-       tv.tv_sec = conv / 1000000;
+       tv.tv_sec = (long) (conv / 1000000);
        tv.tv_usec = conv % 1000000;
 
        if (zpeername) {
index 569e02ddf5f7ac8a90f8ee4930c8554875069cca..ecd14b03b425a1c2a904763c7780a916f4aed5a6 100644 (file)
@@ -104,7 +104,7 @@ compare_left(char const *a, char const *b)
 PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case)
 {
        unsigned char ca, cb;
-       int ai, bi;
+       unsigned int ai, bi;
        int fractional, result;
 
        ai = bi = 0;
@@ -239,7 +239,7 @@ PHPAPI int u_strnatcmp_ex(UChar const *a, size_t a_len, UChar const *b, size_t b
        UChar const *ap, *bp;
        int fractional, result;
        int a_off, b_off;
-       int a_curr, b_curr;
+       unsigned int a_curr, b_curr;
 
        if (a_len == 0 || b_len == 0)
                return a_len - b_len;
index 90e8f5ed41ace302e0fb50d9f81ba6d6433fd0cb..242125a066b2d1eebfc4eba9e788d96291a04a27 100644 (file)
@@ -842,12 +842,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
                                        }
                                }
 
-                               if (PG(upload_max_filesize) > 0 && (total_bytes+blen) > PG(upload_max_filesize)) {
+                               if (PG(upload_max_filesize) > 0 && (int)(total_bytes+blen) > PG(upload_max_filesize)) {
 #if DEBUG_FILE_UPLOAD
                                        sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of %ld bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
 #endif
                                        cancel_upload = UPLOAD_ERROR_A;
-                               } else if (max_file_size && ((total_bytes+blen) > max_file_size)) {
+                               } else if (max_file_size && ((int)(total_bytes+blen) > max_file_size)) {
 #if DEBUG_FILE_UPLOAD
                                        sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
 #endif
index b64abac3d22bfef4452deeefef24e2e7ab591c9c..7279c66d5b9a863ba0472975021e45d92ed69699 100644 (file)
@@ -1263,7 +1263,7 @@ static void strx_printv(int *ccp, char *buf, size_t len, const char *format, va_
 
 PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) /* {{{ */
 {
-       int cc;
+       unsigned int cc;
        va_list ap;
 
        va_start(ap, format);
@@ -1279,7 +1279,7 @@ PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) /* {{{
 
 PHPAPI int ap_php_vslprintf(char *buf, size_t len, const char *format, va_list ap) /* {{{ */
 {
-       int cc;
+       unsigned int cc;
 
        strx_printv(&cc, buf, len, format, ap);
        if (cc >= len) {
index b20ed7068c694c594b515774e9c193a0ebe42d2f..55fd28974a6b4475455341a36356b8eb55d304f6 100644 (file)
@@ -428,7 +428,7 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea
                        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 ((int) (stream->readpos + consumed) > stream->writepos || consumed < 0) {
                                /* No behaving filter should cause this. */
                                status = PSFS_ERR_FATAL;
                        }
@@ -484,9 +484,8 @@ PHPAPI int php_stream_filter_append_ex(php_stream_filter_chain *chain, php_strea
                                                php_stream_bucket_convert_notranscode(bucket, stream->readbuf_type);
                                        }
 
-                                       /* Grow buffer to hold this bucket if need be.
-                                          TODO: See warning in main/stream/streams.c::php_stream_fill_read_buffer */
-                                       if (stream->readbuflen - stream->writepos < bucket->buflen) {
+                                       /* Grow buffer to hold this bucket if need be */
+                                       if (stream->readbuflen - stream->writepos < (unsigned int)bucket->buflen) {
                                                stream->readbuflen += bucket->buflen;
                                                stream->readbuf.v = perealloc(stream->readbuf.v, PS_ULEN(stream->readbuf_type == IS_UNICODE, stream->readbuflen), stream->is_persistent);
                                        }
@@ -660,7 +659,7 @@ PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish TSRMLS
 
        if (chain == &(stream->readfilters)) {
                /* Dump any newly flushed data to the read buffer */
-               if (stream->readpos > stream->chunk_size) {
+               if ((unsigned int)stream->readpos > stream->chunk_size) {
                        /* Back the buffer up */
                        memcpy(stream->readbuf.s, stream->readbuf.s + PS_ULEN(stream->readbuf_type == IS_UNICODE, stream->readpos), PS_ULEN(stream->readbuf_type == IS_UNICODE, stream->writepos - stream->readpos));
                        stream->writepos -= stream->readpos;
index 9c7f994982b9a8359b547471eadac93d4d4c9a6d..da489ceb33e4b3dc7f5b4e4af35c2cf346d96aa2 100755 (executable)
@@ -144,7 +144,7 @@ static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count T
 
        /* avoid problems if someone mis-uses the stream */
        if (count == sizeof(php_stream_dirent) && pglob) {
-               if (pglob->index < pglob->glob.gl_pathc) {
+               if (pglob->index < (unsigned int) pglob->glob.gl_pathc) {
                        php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[pglob->index++], pglob->flags & GLOB_APPEND, &path TSRMLS_CC);
                        PHP_STRLCPY(ent->d_name, path, sizeof(ent->d_name), strlen(path));
                        return sizeof(php_stream_dirent);
index b3c834b28681ddb5d934cc717f6cae37d329686c..ca628a16f69ea611ca85018ea2e42585816bd962 100755 (executable)
@@ -514,7 +514,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
 
                                                /* grow buffer to hold this bucket
                                                 * TODO: this can fail for persistent streams */
-                                               if (stream->readbuflen - stream->writepos < bucket->buflen) {
+                                               if (stream->readbuflen - stream->writepos < (unsigned int)bucket->buflen) {
                                                        stream->readbuflen += bucket->buflen;
                                                        stream->readbuf.v = perealloc(stream->readbuf.v, PS_ULEN(stream->readbuf_type == IS_UNICODE, stream->readbuflen), stream->is_persistent);
                                                }