Exemplo n.º 1
0
	void flush_or_clean()
	{
	    switch(get_mode())
	    {
	    case gf_read_only:
		clean_read();
		break;
	    case gf_write_only:
	    case gf_read_write:
		flush_write();
		break;
	    default:
		throw SRC_BUG;
	    }
	};
Exemplo n.º 2
0
	void inherited_flush_read() { flush_write(); clean_read(); };
Exemplo n.º 3
0
    void compressor::local_terminate()
    {
        if(compr != NULL)
        {
            S_I ret;

                // flushing the pending data
	    flush_write();
            clean_write();

            ret = compr->wrap.compressEnd();
            delete compr;
	    compr = NULL;

            switch(ret)
            {
            case WR_OK:
                break;
            case WR_DATA_ERROR: // some data remains in the compression pipe (data loss)
                throw SRC_BUG;
            case WR_STREAM_ERROR:
                throw Erange("compressor::~compressor", gettext("compressed data is corrupted"));
            default :
                throw SRC_BUG;
            }
        }

        if(decompr != NULL)
        {
                // flushing data
            flush_read();
            clean_read();

            S_I ret = decompr->wrap.decompressEnd();
            delete decompr;
	    decompr = NULL;

            switch(ret)
            {
            case WR_OK:
                break;
            default:
                throw SRC_BUG;
            }
        }

	if(lzo_read_buffer != NULL)
	{
	    flush_read();
	    clean_read();
	    delete [] lzo_read_buffer;
	    lzo_read_buffer = NULL;
	}

	if(lzo_write_buffer != NULL)
	{
	    flush_write();
	    clean_write();
	    delete [] lzo_write_buffer;
	    lzo_write_buffer = NULL;
	}

	if(lzo_compressed != NULL)
	{
	    delete [] lzo_compressed;
	    lzo_compressed = NULL;
	}

	if(lzo_wrkmem != NULL)
	{
	    delete [] lzo_wrkmem;
	    lzo_wrkmem = NULL;
	}
    }