Ejemplo n.º 1
0
bool descriptor_data::compressEnd(  )
{
    unsigned char dummy[1];

    if( !mccp->out_compress || !is_compressing )
        return true;

    mccp->out_compress->avail_in = 0;
    mccp->out_compress->next_in = dummy;

    if( deflate( mccp->out_compress, Z_FINISH ) == Z_STREAM_END )
        process_compressed();   /* try to send any residual data */

    deflateEnd( mccp->out_compress );
    OLD_DISPOSE( mccp->out_compress_buf );
    OLD_DISPOSE( mccp->out_compress );
    is_compressing = false;
    return true;
}
Ejemplo n.º 2
0
bool compressEnd( DESCRIPTOR_DATA * d )
{
   unsigned char dummy[1];

   if( !d->mccp->out_compress )
      return TRUE;

   d->mccp->out_compress->avail_in = 0;
   d->mccp->out_compress->next_in = dummy;

   if( deflate( d->mccp->out_compress, Z_FINISH ) == Z_STREAM_END )
      process_compressed( d );   /* try to send any residual data */

   deflateEnd( d->mccp->out_compress );
   DISPOSE( d->mccp->out_compress_buf );
   DISPOSE( d->mccp->out_compress );

   return TRUE;
}
Ejemplo n.º 3
0
bool compressEnd(DESCRIPTOR_DATA *d,unsigned char type)
{
#if defined(USE_COMPRESSION)
    unsigned char dummy[1];
    unsigned char telopt;

    if (!d->out_compress)
        return TRUE;
    if (d->compressing != type)
        return FALSE;

    //    bug("Stopping compression for descriptor %d", d->descriptor);

    d->out_compress->avail_in = 0;
    d->out_compress->next_in = dummy;
    telopt = d->compressing;

    if (deflate(d->out_compress, Z_FINISH) != Z_STREAM_END)
        return FALSE;

    if ( !d )
        return FALSE;

    if (!process_compressed(d))
        return FALSE;

    deflateEnd(d->out_compress);
    free(d->out_compress_buf);
    free(d->out_compress);
    d->compressing = 0;
    d->out_compress_buf = NULL;
    d->out_compress = NULL;

    /*    if ( d->character )
        {
        if ( telopt == 85 && IS_SET(d->character->config,CONFIG_COMPRESS))
                REMOVE_BIT(d->character->config,CONFIG_COMPRESS);
        if ( telopt == 86 && IS_SET(d->character->config,CONFIG_COMPRESS2))
                REMOVE_BIT(d->character->config,CONFIG_COMPRESS2);
        }*/
#endif
    return TRUE;
}