Home | History | Annotate | Download | only in libxml2

Lines Matching defs:buff

1410  * @buff:  Compressed memory buffer
1417 append_reverse_ulong( xmlZMemBuff * buff, unsigned long data ) {
1421 if ( buff == NULL )
1432 *buff->zctrl.next_out = ( data & 0xff );
1434 buff->zctrl.next_out++;
1443 * @buff: The memory buffer context to clear
1448 xmlFreeZMemBuff( xmlZMemBuffPtr buff ) {
1454 if ( buff == NULL )
1457 xmlFree( buff->zbuff );
1459 z_err = deflateEnd( &buff->zctrl );
1465 deflateEnd( &buff->zctrl );
1468 xmlFree( buff );
1487 xmlZMemBuffPtr buff = NULL;
1494 buff = xmlMalloc( sizeof( xmlZMemBuff ) );
1495 if ( buff == NULL ) {
1500 (void)memset( buff, 0, sizeof( xmlZMemBuff ) );
1501 buff->size = INIT_HTTP_BUFF_SIZE;
1502 buff->zbuff = xmlMalloc( buff->size );
1503 if ( buff->zbuff == NULL ) {
1504 xmlFreeZMemBuff( buff );
1509 z_err = deflateInit2( &buff->zctrl, compression, Z_DEFLATED,
1513 xmlFreeZMemBuff( buff );
1514 buff = NULL;
1524 buff->crc = crc32( 0L, NULL, 0 );
1525 hdr_lgth = snprintf( (char *)buff->zbuff, buff->size,
1529 buff->zctrl.next_out = buff->zbuff + hdr_lgth;
1530 buff->zctrl.avail_out = buff->size - hdr_lgth;
1532 return ( buff );
1537 * @buff: Buffer used to compress and consolidate data.
1547 xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) {
1555 if ( buff == NULL )
1561 cur_used = buff->zctrl.next_out - buff->zbuff;
1562 new_size = buff->size + ext_amt;
1573 tmp_ptr = xmlRealloc( buff->zbuff, new_size );
1576 buff->size = new_size;
1577 buff->zbuff = tmp_ptr;
1578 buff->zctrl.next_out = tmp_ptr + cur_used;
1579 buff->zctrl.avail_out = new_size - cur_used;
1595 * @buff: Buffer used to compress and consolidate data
1605 xmlZMemBuffAppend( xmlZMemBuffPtr buff, const char * src, int len ) {
1610 if ( ( buff == NULL ) || ( src == NULL ) )
1613 buff->zctrl.avail_in = len;
1614 buff->zctrl.next_in = (unsigned char *)src;
1615 while ( buff->zctrl.avail_in > 0 ) {
1620 min_accept = buff->zctrl.avail_in / DFLT_ZLIB_RATIO;
1621 if ( buff->zctrl.avail_out <= min_accept ) {
1622 if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
1626 z_err = deflate( &buff->zctrl, Z_NO_FLUSH );
1638 buff->crc = crc32( buff->crc, (unsigned char *)src, len );
1645 * @buff: Compressed memory content buffer
1655 xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
1660 if ( ( buff == NULL ) || ( data_ref == NULL ) )
1667 z_err = deflate( &buff->zctrl, Z_FINISH );
1671 if ( xmlZMemBuffExtend( buff, buff->size ) == -1 )
1683 if ( buff->zctrl.avail_out < ( 2 * sizeof( unsigned long ) ) ) {
1684 if ( xmlZMemBuffExtend(buff, (2 * sizeof(unsigned long))) == -1 )
1693 append_reverse_ulong( buff, buff->crc );
1694 append_reverse_ulong( buff, buff->zctrl.total_in );
1696 zlgth = buff->zctrl.next_out - buff->zbuff;
1697 *data_ref = (char *)buff->zbuff;