version 1.1.1.1, 2012/02/21 23:48:05
|
version 1.1.1.2, 2012/05/29 12:34:37
|
Line 80 static php_stream_filter_status_t php_zlib_inflate_fil
|
Line 80 static php_stream_filter_status_t php_zlib_inflate_fil
|
while (buckets_in->head) { |
while (buckets_in->head) { |
size_t bin = 0, desired; |
size_t bin = 0, desired; |
|
|
|
bucket = buckets_in->head; |
|
|
bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); |
bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); |
while (bin < bucket->buflen) { |
|
|
|
|
while (bin < (unsigned int) bucket->buflen) { |
|
|
if (data->finished) { |
if (data->finished) { |
consumed += bucket->buflen; |
consumed += bucket->buflen; |
break; |
break; |
Line 110 static php_stream_filter_status_t php_zlib_inflate_fil
|
Line 113 static php_stream_filter_status_t php_zlib_inflate_fil
|
desired -= data->strm.avail_in; /* desired becomes what we consumed this round through */ |
desired -= data->strm.avail_in; /* desired becomes what we consumed this round through */ |
data->strm.next_in = data->inbuf; |
data->strm.next_in = data->inbuf; |
data->strm.avail_in = 0; |
data->strm.avail_in = 0; |
consumed += desired; |
|
bin += desired; |
bin += desired; |
|
|
if (data->strm.avail_out < data->outbuf_len) { |
if (data->strm.avail_out < data->outbuf_len) { |
Line 126 static php_stream_filter_status_t php_zlib_inflate_fil
|
Line 128 static php_stream_filter_status_t php_zlib_inflate_fil
|
php_stream_bucket_delref(bucket TSRMLS_CC); |
php_stream_bucket_delref(bucket TSRMLS_CC); |
return PSFS_PASS_ON; |
return PSFS_PASS_ON; |
} |
} |
|
|
} |
} |
|
consumed += bucket->buflen; |
php_stream_bucket_delref(bucket TSRMLS_CC); |
php_stream_bucket_delref(bucket TSRMLS_CC); |
} |
} |
|
|
Line 205 static php_stream_filter_status_t php_zlib_deflate_fil
|
Line 209 static php_stream_filter_status_t php_zlib_deflate_fil
|
while (buckets_in->head) { |
while (buckets_in->head) { |
size_t bin = 0, desired; |
size_t bin = 0, desired; |
|
|
bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC); | bucket = buckets_in->head; |
|
|
while (bin < bucket->buflen) { | bucket = php_stream_bucket_make_writeable(bucket TSRMLS_CC); |
| |
| while (bin < (unsigned int) bucket->buflen) { |
desired = bucket->buflen - bin; |
desired = bucket->buflen - bin; |
if (desired > data->inbuf_len) { |
if (desired > data->inbuf_len) { |
desired = data->inbuf_len; |
desired = data->inbuf_len; |
Line 224 static php_stream_filter_status_t php_zlib_deflate_fil
|
Line 230 static php_stream_filter_status_t php_zlib_deflate_fil
|
desired -= data->strm.avail_in; /* desired becomes what we consumed this round through */ |
desired -= data->strm.avail_in; /* desired becomes what we consumed this round through */ |
data->strm.next_in = data->inbuf; |
data->strm.next_in = data->inbuf; |
data->strm.avail_in = 0; |
data->strm.avail_in = 0; |
consumed += desired; |
|
bin += desired; |
bin += desired; |
|
|
if (data->strm.avail_out < data->outbuf_len) { |
if (data->strm.avail_out < data->outbuf_len) { |
Line 238 static php_stream_filter_status_t php_zlib_deflate_fil
|
Line 243 static php_stream_filter_status_t php_zlib_deflate_fil
|
exit_status = PSFS_PASS_ON; |
exit_status = PSFS_PASS_ON; |
} |
} |
} |
} |
|
consumed += bucket->buflen; |
php_stream_bucket_delref(bucket TSRMLS_CC); |
php_stream_bucket_delref(bucket TSRMLS_CC); |
} |
} |
|
|
Line 261 static php_stream_filter_status_t php_zlib_deflate_fil
|
Line 267 static php_stream_filter_status_t php_zlib_deflate_fil
|
if (bytes_consumed) { |
if (bytes_consumed) { |
*bytes_consumed = consumed; |
*bytes_consumed = consumed; |
} |
} |
|
|
return exit_status; |
return exit_status; |
} |
} |
|
|
Line 294 static php_stream_filter *php_zlib_filter_create(const
|
Line 301 static php_stream_filter *php_zlib_filter_create(const
|
/* Create this filter */ |
/* Create this filter */ |
data = pecalloc(1, sizeof(php_zlib_filter_data), persistent); |
data = pecalloc(1, sizeof(php_zlib_filter_data), persistent); |
if (!data) { |
if (!data) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", sizeof(php_zlib_filter_data)); | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", sizeof(php_zlib_filter_data)); |
return NULL; |
return NULL; |
} |
} |
|
|
Line 306 static php_stream_filter *php_zlib_filter_create(const
|
Line 313 static php_stream_filter *php_zlib_filter_create(const
|
data->strm.avail_out = data->outbuf_len = data->inbuf_len = 2048; |
data->strm.avail_out = data->outbuf_len = data->inbuf_len = 2048; |
data->strm.next_in = data->inbuf = (Bytef *) pemalloc(data->inbuf_len, persistent); |
data->strm.next_in = data->inbuf = (Bytef *) pemalloc(data->inbuf_len, persistent); |
if (!data->inbuf) { |
if (!data->inbuf) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", data->inbuf_len); | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", data->inbuf_len); |
pefree(data, persistent); |
pefree(data, persistent); |
return NULL; |
return NULL; |
} |
} |
data->strm.avail_in = 0; |
data->strm.avail_in = 0; |
data->strm.next_out = data->outbuf = (Bytef *) pemalloc(data->outbuf_len, persistent); |
data->strm.next_out = data->outbuf = (Bytef *) pemalloc(data->outbuf_len, persistent); |
if (!data->outbuf) { |
if (!data->outbuf) { |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes.", data->outbuf_len); | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", data->outbuf_len); |
pefree(data->inbuf, persistent); |
pefree(data->inbuf, persistent); |
pefree(data, persistent); |
pefree(data, persistent); |
return NULL; |
return NULL; |
Line 412 factory_setlevel:
|
Line 419 factory_setlevel:
|
} |
} |
break; |
break; |
default: |
default: |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filter parameter, ignored."); | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filter parameter, ignored"); |
} |
} |
} |
} |
status = deflateInit2(&(data->strm), level, Z_DEFLATED, windowBits, memLevel, 0); |
status = deflateInit2(&(data->strm), level, Z_DEFLATED, windowBits, memLevel, 0); |