Kill compiler warnings

This commit is contained in:
Kalle Sommer Nielsen 2009-08-01 14:45:42 +00:00
parent bf79f08084
commit fef66b3c2d
14 changed files with 31 additions and 32 deletions

View 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 */

View 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;
}

View 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] = '$';

View 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 ||

View 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;

View 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;

View 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':

View File

@ -116,7 +116,7 @@ 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) {
@ -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) {

View 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;

View 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

View 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) {

View 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;

View File

@ -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);

View File

@ -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);
}