Lines Matching refs:buff

1205  * @buff:  Compressed memory buffer
1212 append_reverse_ulong( xmlZMemBuff * buff, unsigned long data ) {
1216 if ( buff == NULL )
1227 *buff->zctrl.next_out = ( data & 0xff );
1229 buff->zctrl.next_out++;
1238 * @buff: The memory buffer context to clear
1243 xmlFreeZMemBuff( xmlZMemBuffPtr buff ) {
1249 if ( buff == NULL )
1252 xmlFree( buff->zbuff );
1254 z_err = deflateEnd( &buff->zctrl );
1260 deflateEnd( &buff->zctrl );
1263 xmlFree( buff );
1282 xmlZMemBuffPtr buff = NULL;
1289 buff = xmlMalloc( sizeof( xmlZMemBuff ) );
1290 if ( buff == NULL ) {
1295 (void)memset( buff, 0, sizeof( xmlZMemBuff ) );
1296 buff->size = INIT_HTTP_BUFF_SIZE;
1297 buff->zbuff = xmlMalloc( buff->size );
1298 if ( buff->zbuff == NULL ) {
1299 xmlFreeZMemBuff( buff );
1304 z_err = deflateInit2( &buff->zctrl, compression, Z_DEFLATED,
1308 xmlFreeZMemBuff( buff );
1309 buff = NULL;
1319 buff->crc = crc32( 0L, NULL, 0 );
1320 hdr_lgth = snprintf( (char *)buff->zbuff, buff->size,
1324 buff->zctrl.next_out = buff->zbuff + hdr_lgth;
1325 buff->zctrl.avail_out = buff->size - hdr_lgth;
1327 return ( buff );
1332 * @buff: Buffer used to compress and consolidate data.
1342 xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) {
1350 if ( buff == NULL )
1356 cur_used = buff->zctrl.next_out - buff->zbuff;
1357 new_size = buff->size + ext_amt;
1368 tmp_ptr = xmlRealloc( buff->zbuff, new_size );
1371 buff->size = new_size;
1372 buff->zbuff = tmp_ptr;
1373 buff->zctrl.next_out = tmp_ptr + cur_used;
1374 buff->zctrl.avail_out = new_size - cur_used;
1390 * @buff: Buffer used to compress and consolidate data
1400 xmlZMemBuffAppend( xmlZMemBuffPtr buff, const char * src, int len ) {
1405 if ( ( buff == NULL ) || ( src == NULL ) )
1408 buff->zctrl.avail_in = len;
1409 buff->zctrl.next_in = (unsigned char *)src;
1410 while ( buff->zctrl.avail_in > 0 ) {
1415 min_accept = buff->zctrl.avail_in / DFLT_ZLIB_RATIO;
1416 if ( buff->zctrl.avail_out <= min_accept ) {
1417 if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
1421 z_err = deflate( &buff->zctrl, Z_NO_FLUSH );
1433 buff->crc = crc32( buff->crc, (unsigned char *)src, len );
1440 * @buff: Compressed memory content buffer
1450 xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
1455 if ( ( buff == NULL ) || ( data_ref == NULL ) )
1462 z_err = deflate( &buff->zctrl, Z_FINISH );
1466 if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
1478 if ( buff->zctrl.avail_out < ( 2 * sizeof( unsigned long ) ) ) {
1479 if ( xmlZMemBuffExtend(buff, (2 * sizeof(unsigned long))) == -1 )
1488 append_reverse_ulong( buff, buff->crc );
1489 append_reverse_ulong( buff, buff->zctrl.total_in );
1491 zlgth = buff->zctrl.next_out - buff->zbuff;
1492 *data_ref = (char *)buff->zbuff;