cvs: php-src /ext/bz2 bz2.c bz2_filter.c
| From: | Kalle Sommer Nielsen | Date: | Fri, 15 May 2009 17:27:56 +0000 |
| Subject: | cvs: php-src /ext/bz2 bz2.c bz2_filter.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-57864@lists.php.net to get a copy of this message | ||
kalle Fri May 15 17:27:56 2009 UTC
Modified files:
/php-src/ext/bz2 bz2.c bz2_filter.c
Log:
Fix compiler warnings
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2.c?r1=1.42&r2=1.43&diff_format=u
Index: php-src/ext/bz2/bz2.c
diff -u php-src/ext/bz2/bz2.c:1.42 php-src/ext/bz2/bz2.c:1.43
--- php-src/ext/bz2/bz2.c:1.42 Tue Mar 10 23:39:11 2009
+++ php-src/ext/bz2/bz2.c Fri May 15 17:27:56 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bz2.c,v 1.42 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: bz2.c,v 1.43 2009/05/15 17:27:56 kalle Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -475,14 +475,14 @@
Compresses a string into BZip2 encoded data */
static PHP_FUNCTION(bzcompress)
{
- zstr source; /* String to compress */
- int source_len;
- zend_uchar source_type;
- long block_size = 4, /* Block size for compression algorithm */
- work_factor = 0; /* Work factor for compression algorithm */
- char *dest = NULL; /* Destination to place the compressed data into */
- int dest_len = 0;
- int error; /* Error Container */
+ zstr source; /* String to compress */
+ int source_len;
+ zend_uchar source_type;
+ long block_size = 4, /* Block size for compression algorithm */
+ work_factor = 0; /* Work factor for compression algorithm */
+ char *dest = NULL; /* Destination to place the compressed data into */
+ int dest_len = 0;
+ int error; /* Error Container */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|ll", &source,
&source_len, &source_type, &block_size, &work_factor) == FAILURE) {
return;
@@ -492,7 +492,9 @@
* This is the largest size the results of the compression could possibly be,
* at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net for pointing this
out).
*/
- dest_len = source_len + (0.01 * source_len) + 600;
+ dest_len = (int) (source_len + (0.01 * source_len) + 600);
+
+ /* Allocate the destination buffer */
dest = emalloc(dest_len + 1);
if (source_type == IS_UNICODE) {
@@ -559,15 +561,15 @@
/* compression is better then 2:1, need to allocate more memory */
bzs.avail_out = source_len;
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
- dest = erealloc(dest, size + bzs.avail_out + 1);
+ dest = erealloc(dest, (size_t) (size + bzs.avail_out + 1));
bzs.next_out = dest + size;
}
if (error == BZ_STREAM_END || error == BZ_OK) {
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
- dest = erealloc(dest, size + 1);
+ dest = erealloc(dest, (size_t) (size + 1));
dest[size] = '\0';
- RETVAL_STRINGL(dest, size, 0);
+ RETVAL_STRINGL(dest, (int) size, 0);
} else { /* real error */
efree(dest);
RETVAL_LONG(error);
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.22&r2=1.23&diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.22 php-src/ext/bz2/bz2_filter.c:1.23
--- php-src/ext/bz2/bz2_filter.c:1.22 Tue Mar 10 23:39:11 2009
+++ php-src/ext/bz2/bz2_filter.c Fri May 15 17:27:56 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bz2_filter.c,v 1.22 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: bz2_filter.c,v 1.23 2009/05/15 17:27:56 kalle Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -89,7 +89,8 @@
streamp = &(data->strm);
while (buckets_in->head) {
- size_t bin = 0, desired;
+ int bin = 0;
+ size_t desired;
bucket = buckets_in->head;
@@ -234,7 +235,8 @@
streamp = &(data->strm);
while (buckets_in->head) {
- size_t bin = 0, desired;
+ int bin = 0;
+ size_t desired;
bucket = buckets_in->head;