当前位置: 首页>>代码示例>>C++>>正文


C++ BZ2_bzDecompress函数代码示例

本文整理汇总了C++中BZ2_bzDecompress函数的典型用法代码示例。如果您正苦于以下问题:C++ BZ2_bzDecompress函数的具体用法?C++ BZ2_bzDecompress怎么用?C++ BZ2_bzDecompress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BZ2_bzDecompress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

size_t wxBZipInputStream::OnSysRead(void* buffer, size_t bufsize)
{
    bz_stream* hZip = (bz_stream*)m_hZip;

	hZip->next_out = (char*)buffer;
	hZip->avail_out = bufsize;

	while (hZip->avail_out != 0)
	{
		if (m_nBufferPos == 0 || m_nBufferPos == WXBZBS)
		{
			ReadRaw(m_pBuffer, WXBZBS);
			
            m_nBufferPos = 0;
			hZip->next_in = m_pBuffer;
			hZip->avail_in = WXBZBS;

            if (m_parent_i_stream->LastRead() != WXBZBS)
			{
                // Full amount not read, so do a last
                // minute tidy up and decompress what is left
				hZip->avail_in = m_parent_i_stream->LastRead();

				int nRet = BZ2_bzDecompress(hZip);

				if (nRet == BZ_OK || nRet == BZ_STREAM_END)
					return bufsize - hZip->avail_out;
				else
					return 0;
			}
		}

        // Buffer full, decompress some bytes
        hZip->next_in = &m_pBuffer[m_nBufferPos];
		hZip->avail_in = WXBZBS - m_nBufferPos;

		int nRet = BZ2_bzDecompress(hZip);

		if (nRet == BZ_OK)	
		{
			m_nBufferPos = WXBZBS - hZip->avail_in;
		}
		else if(nRet == BZ_STREAM_END)
			return bufsize - hZip->avail_out;
		else
			return 0;	
	}
 
	return bufsize - hZip->avail_out;	
}
开发者ID:BlitzMaxModules,项目名称:wx.mod,代码行数:50,代码来源:bzipstream.cpp

示例2: while

size_t wxBZipInputStream::OnSysRead(void* buffer, size_t bufsize)
{
	wxInt32 nRead = 0;

	((bz_stream*&)hZip)->next_out = &(((char*&)buffer)[nRead]);
	((bz_stream*&)hZip)->avail_out = bufsize - nRead;

	while (((bz_stream*&)hZip)->avail_out != 0)
	{
		//wxMessageBox(wxString::Format("%i %i", nRead, ((bz_stream*&)hZip)->avail_out));

		if (nBufferPos == 0 || nBufferPos == WXBZBS)
		{
			ReadRaw(pBuffer, WXBZBS);
			nBufferPos = 0;
			((bz_stream*&)hZip)->next_in = &pBuffer[nBufferPos];
			((bz_stream*&)hZip)->avail_in = WXBZBS - nBufferPos;
			if (m_parent_i_stream->LastRead() != WXBZBS)
			{
				((bz_stream*&)hZip)->avail_in = m_parent_i_stream->LastRead();

				int nRet = BZ2_bzDecompress((bz_stream*&)hZip);

				if (nRet == BZ_OK || nRet == BZ_STREAM_END)
					return bufsize - ((bz_stream*&)hZip)->avail_out;
				else
					return 0;
			}
		}
		((bz_stream*&)hZip)->next_in = &pBuffer[nBufferPos];
		((bz_stream*&)hZip)->avail_in = WXBZBS - nBufferPos;

		int nRet = BZ2_bzDecompress((bz_stream*&)hZip);

		if (nRet == BZ_OK)	
		{
			nBufferPos += -(nRead - (
			nRead += (WXBZBS - nBufferPos - ((bz_stream*&)hZip)->avail_in)
			));
		}
		else if(nRet == BZ_STREAM_END)
			return bufsize - ((bz_stream*&)hZip)->avail_out;
		else
			return 0;	
	}
 
	return bufsize - ((bz_stream*&)hZip)->avail_out;	
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:48,代码来源:bzipstream.cpp

示例3: bzf_read

static int 
bzf_read(struct open_file *f, void *buf, size_t size, size_t *resid)
{
    struct bz_file	*bzf = (struct bz_file *)f->f_fsdata;
    int			error;

    bzf->bzf_bzstream.next_out = buf;			/* where and how much */
    bzf->bzf_bzstream.avail_out = size;

    while (bzf->bzf_bzstream.avail_out && bzf->bzf_endseen == 0) {
	if ((bzf->bzf_bzstream.avail_in == 0) && (bzf_fill(bzf) == -1)) {
	    printf("bzf_read: fill error\n");
	    return(EIO);
	}
	if (bzf->bzf_bzstream.avail_in == 0) {		/* oops, unexpected EOF */
	    printf("bzf_read: unexpected EOF\n");
	    if (bzf->bzf_bzstream.avail_out == size)
		return(EIO);
	    break;
	}

	error = BZ2_bzDecompress(&bzf->bzf_bzstream);	/* decompression pass */
	if (error == BZ_STREAM_END) {			/* EOF, all done */
	    bzf->bzf_endseen = 1;
	    break;
	}
	if (error != BZ_OK) {				/* argh, decompression error */
	    printf("bzf_read: BZ2_bzDecompress returned %d\n", error);
	    return(EIO);
	}
    }
    if (resid != NULL)
	*resid = bzf->bzf_bzstream.avail_out;
    return(0);
}
开发者ID:Fneufneu,项目名称:zfs_read,代码行数:35,代码来源:bzipfs.c

示例4: FXASSERT

// Load from file
FXuval FXBZFileStream::readBuffer(FXuval){
  register FXival n; int bzerror;
  if(dir!=FXStreamLoad){fxerror("FXBZFileStream::readBuffer: wrong stream direction.\n");}
  FXASSERT(begptr<=rdptr);
  FXASSERT(rdptr<=wrptr);
  FXASSERT(wrptr<=endptr);
  if(rdptr<wrptr){memmove(begptr,rdptr,wrptr-rdptr);}
  wrptr=begptr+(wrptr-rdptr);
  rdptr=begptr;
  while(wrptr<endptr){
//    n=file.readBlock(bz->buffer,BUFFERSIZE);
//    if(n<=0) break;
//    bz->stream.next_in=bz->buffer;
//    bz->stream.avail_in=n;
    if(bz->stream.avail_in<=0){ // get more input if buffer is empty
      n=file.readBlock(bz->buffer,BUFFERSIZE);
      if(n<0) break;
      bz->stream.next_in=bz->buffer;
      bz->stream.avail_in=n;
      }
    bz->stream.next_out=(char*)wrptr;
    bz->stream.avail_out=endptr-wrptr;
    bzerror=BZ2_bzDecompress(&bz->stream);
//    if(bzerror!=BZ_OK) break;
    if(bzerror<0) break;  // break on error condition
    wrptr=(FXuchar*)bz->stream.next_out;
    if(bzerror==BZ_STREAM_END) break;
    }
  return wrptr-rdptr;
  }
开发者ID:gfphoenix,项目名称:tsiu,代码行数:31,代码来源:FXBZFileStream.cpp

示例5: BZ2_bzDecompress

long FileReaderBZ2::Read (void *buffer, long len)
{
	int err;

	Stream.next_out = (char *)buffer;
	Stream.avail_out = len;

	do
	{
		err = BZ2_bzDecompress(&Stream);
		if (Stream.avail_in == 0 && !SawEOF)
		{
			FillBuffer ();
		}
	} while (err == BZ_OK && Stream.avail_out != 0);

	if (err != BZ_OK && err != BZ_STREAM_END)
	{
		I_Error ("Corrupt bzip2 stream");
	}

	if (Stream.avail_out != 0)
	{
		I_Error ("Ran out of data in bzip2 stream");
	}

	return len - Stream.avail_out;
}
开发者ID:loismustdie555,项目名称:GZDoom-GPL,代码行数:28,代码来源:files.cpp

示例6: read

    std::string read() final {
        std::string output;

        if (m_buffer) {
            const size_t buffer_size = 10240;
            output.resize(buffer_size);
            m_bzstream.next_out = const_cast<char*>(output.data());
            m_bzstream.avail_out = buffer_size;
            int result = BZ2_bzDecompress(&m_bzstream);

            if (result != BZ_OK) {
                m_buffer = nullptr;
                m_buffer_size = 0;
            }

            if (result != BZ_OK && result != BZ_STREAM_END) {
                std::string message("bzip2 error: decompress failed: ");
                throw bzip2_error(message, result);
            }

            output.resize(static_cast<unsigned long>(m_bzstream.next_out - output.data()));
        }

        return output;
    }
开发者ID:Project-OSRM,项目名称:osrm-backend,代码行数:25,代码来源:bzip2_compression.hpp

示例7: libmpq__decompress_bzip2

/* this function decompress a stream using bzip2 library. */
int32_t libmpq__decompress_bzip2(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) {
	/* some common variables. */
	int32_t result = 0;
	int32_t tb     = 0;
	bz_stream strm;

	/* initialize the bzlib decompression. */
	strm.bzalloc = NULL;
	strm.bzfree  = NULL;

	/* initialize the structure. */
	if ((result = BZ2_bzDecompressInit(&strm, 0, 0)) != BZ_OK) {
		/* something on bzlib initialization failed. */
		return result;
	}

	/* fill the stream structure for bzlib. */
	strm.next_in   = (char *)in_buf;
	strm.avail_in  = in_size;
	strm.next_out  = (char *)out_buf;
	strm.avail_out = out_size;

	/* do the decompression. */
	while (BZ2_bzDecompress(&strm) != BZ_STREAM_END);

	/* save transferred bytes. */
	tb = strm.total_out_lo32;

	/* cleanup of bzip stream. */
	BZ2_bzDecompressEnd(&strm);

	/* return transferred bytes. */
	return tb;
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:35,代码来源:extract.c

示例8: camlzip_bzDecompress

value camlzip_bzDecompress(value vzs, value srcbuf, value srcpos, value srclen,
			   value dstbuf, value dstpos, value dstlen)
{
#ifdef USE_BZIP2
  bz_stream * zs = BZStream_val(vzs);
  int retcode;
  long used_in, used_out;
  value res;

  zs->next_in = &Byte(srcbuf, Long_val(srcpos));
  zs->avail_in = Long_val(srclen);
  zs->next_out = &Byte(dstbuf, Long_val(dstpos));
  zs->avail_out = Long_val(dstlen);
  retcode = BZ2_bzDecompress(zs);
  if (retcode < 0)
    camlzip_bzerror("Bzlib.decompress", retcode);
  used_in = Long_val(srclen) - zs->avail_in;
  used_out = Long_val(dstlen) - zs->avail_out;
  zs->next_in = NULL;           /* not required, but cleaner */
  zs->next_out = NULL;          /* (avoid dangling pointers into Caml heap) */
  res = alloc_small(3, 0);
  Field(res, 0) = Val_bool(retcode == BZ_STREAM_END);
  Field(res, 1) = Val_int(used_in);
  Field(res, 2) = Val_int(used_out);
  return res;
#else
  failwith("Bzip2 compression not supported");
#endif
}
开发者ID:ygrek,项目名称:mldonkey,代码行数:29,代码来源:zlibstubs.c

示例9: bz2_mem_read

// xmlInputReadCallback
static int bz2_mem_read(struct bz2_mem *bzmem, char *buffer, int len)
{
	if (len < 1) {
		// ensure that at least one byte of output space is available at each BZ2_bzDecompress call.
		return 0;
	}
	if (bzmem->eof) {
		// If we run BZ2_bzDecompress on processed buffer we will get -1 (SEQUENCE_ERROR)
		return 0;
	}
	// next_out should point to a buffer in which the uncompressed output is to be placed
	bzmem->stream->next_out = buffer;
	// with avail_out indicating how much output space is available.
	bzmem->stream->avail_out = len;
	int bzerror = BZ2_bzDecompress(bzmem->stream);
	if (bzerror == BZ_STREAM_END) {
		bzmem->eof = true;
	}
	if (bzerror == BZ_OK || bzerror == BZ_STREAM_END)
		return (len - bzmem->stream->avail_out);
	else {
		oscap_seterr(OSCAP_EFAMILY_OSCAP, "Could not read from bz_stream: BZ2_bzDecompress returns %d", bzerror);
		return -1;
	}
}
开发者ID:AxelNennker,项目名称:openscap,代码行数:26,代码来源:bz2.c

示例10: bz2_decompress_xml

bool bz2_decompress_xml(char *in_data, int in_data_length, BYTE **pDat, int *data_length) {
	const int BLOCKSIZE = 1024 * 100;

	bz_stream bzs = {0};

	switch(BZ2_bzDecompressInit(&bzs, 0, 0)) {
	case BZ_CONFIG_ERROR: 
		//MessageBox(0, "Configuration Error", "BZ2 Decompres Init", MB_OK | MB_ICONERROR); 
		ShowError(TranslateT("BZ2 Decompression, configuration error"));
		return false;
	case BZ_PARAM_ERROR: 
		//MessageBox(0, "Parameters Error", "BZ2 Decompres Init", MB_OK | MB_ICONERROR); 
		ShowError(TranslateT("BZ2 Decompression, parameter error"));
		return false;
	case BZ_MEM_ERROR: 
		//MessageBox(0, "Memory Error", "BZ2 Decompres Init", MB_OK | MB_ICONERROR); 
		ShowError(TranslateT("DB2 Decompression, memory error"));
		return false;
	}

	bzs.avail_in = in_data_length;
	bzs.next_in = in_data;

	bzs.avail_out = BLOCKSIZE;
	*pDat = (BYTE *)malloc(bzs.avail_out + 1); // allocate 100k (at present, xml data is about 87k)  (1 byte extra for a terminating 0 for safety)
	bzs.next_out = (char *)*pDat;

	int blocknum = 0;
	int ret;
	while((ret = BZ2_bzDecompress(&bzs)) == BZ_OK && bzs.avail_in > 0) {
		if(bzs.avail_out == 0) {
			blocknum++;
			*pDat = (BYTE *)realloc(*pDat, (blocknum + 1) * BLOCKSIZE + 1);
			bzs.next_out = (char *)(*pDat + (blocknum * BLOCKSIZE));
			bzs.avail_out = BLOCKSIZE;
		}
	}

	BZ2_bzDecompressEnd(&bzs);

	if(ret != BZ_STREAM_END) {
//		char msg[512];
//		sprintf(msg, "Error decompressing, code: %d", ret);
//		MessageBox(0, msg, "Error Decompressing BZ2 XML data", MB_OK);
		free(*pDat);
		*pDat = 0;
		*data_length = 0;
		return false;
	}

	*data_length = bzs.total_out_lo32;		// assume it's not too massive!
	(*pDat)[*data_length] = 0;				// for safety - last char shouldn't matter to us

	//char msg[256];
	//sprintf(msg, "Bytes decompressed: %d", data_length);
	//MessageBox(0, msg, "msg", MB_OK);

	return true;
}
开发者ID:darkscout,项目名称:sje-miranda-plugins,代码行数:59,代码来源:xmldata.cpp

示例11: BZ2_bzDecompressEnd

static char *_qdbm_bzdecode_impl(const char *ptr, int size, int *sp) {
    bz_stream zs;
    char *buf, *swap, obuf[BZIPBUFSIZ];
    int rv, asiz, bsiz, osiz;
    zs.bzalloc = NULL;
    zs.bzfree = NULL;
    zs.opaque = NULL;
    if(BZ2_bzDecompressInit(&zs, 0, 0) != BZ_OK) return NULL;
    asiz = size * 2 + 16;
    if(asiz < BZIPBUFSIZ) asiz = BZIPBUFSIZ;
    if(!(buf = malloc(asiz))) {
        BZ2_bzDecompressEnd(&zs);
        return NULL;
    }
    bsiz = 0;
    zs.next_in = (char *)ptr;
    zs.avail_in = size;
    zs.next_out = obuf;
    zs.avail_out = BZIPBUFSIZ;
    while((rv = BZ2_bzDecompress(&zs)) == BZ_OK) {
        osiz = BZIPBUFSIZ - zs.avail_out;
        if(bsiz + osiz >= asiz) {
            asiz = asiz * 2 + osiz;
            if(!(swap = realloc(buf, asiz))) {
                free(buf);
                BZ2_bzDecompressEnd(&zs);
                return NULL;
            }
            buf = swap;
        }
        memcpy(buf + bsiz, obuf, osiz);
        bsiz += osiz;
        zs.next_out = obuf;
        zs.avail_out = BZIPBUFSIZ;
    }
    if(rv != BZ_STREAM_END) {
        free(buf);
        BZ2_bzDecompressEnd(&zs);
        return NULL;
    }
    osiz = BZIPBUFSIZ - zs.avail_out;
    if(bsiz + osiz >= asiz) {
        asiz = asiz * 2 + osiz;
        if(!(swap = realloc(buf, asiz))) {
            free(buf);
            BZ2_bzDecompressEnd(&zs);
            return NULL;
        }
        buf = swap;
    }
    memcpy(buf + bsiz, obuf, osiz);
    bsiz += osiz;
    buf[bsiz] = '\0';
    if(sp) *sp = bsiz;
    BZ2_bzDecompressEnd(&zs);
    return buf;
}
开发者ID:naveen-raju,项目名称:key_value_stores,代码行数:57,代码来源:myconf.c

示例12: BZ_API

/*---------------------------------------------------*/
int BZ_API(BZ2_bzRead) 
           ( int*    bzerror, 
             BZFILE* b, 
             void*   buf, 
             int     len )
{
   Int32   n, ret;
   bzFile* bzf = (bzFile*)b;

   BZ_SETERR(BZ_OK);

   if (bzf == NULL || buf == NULL || len < 0)
      { BZ_SETERR(BZ_PARAM_ERROR); return 0; };

   if (bzf->writing)
      { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; };

   if (len == 0)
      { BZ_SETERR(BZ_OK); return 0; };

   bzf->strm.avail_out = len;
   bzf->strm.next_out = buf;

   while (True) {

      if (ferror(bzf->handle)) 
         { BZ_SETERR(BZ_IO_ERROR); return 0; };

      if (bzf->strm.avail_in == 0 && !bz_feof(bzf->handle)) {
         n = fread ( bzf->buf, sizeof(UChar), 
                     BZ_MAX_UNUSED, bzf->handle );
         if (ferror(bzf->handle))
            { BZ_SETERR(BZ_IO_ERROR); return 0; };
         bzf->bufN = n;
         bzf->strm.avail_in = bzf->bufN;
         bzf->strm.next_in = bzf->buf;
      }

      ret = BZ2_bzDecompress ( &(bzf->strm) );

      if (ret != BZ_OK && ret != BZ_STREAM_END)
         { BZ_SETERR(ret); return 0; };

      if (ret == BZ_OK && bz_feof(bzf->handle) && 
          bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
         { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };

      if (ret == BZ_STREAM_END)
         { BZ_SETERR(BZ_STREAM_END);
           return len - bzf->strm.avail_out; };
      if (bzf->strm.avail_out == 0)
         { BZ_SETERR(BZ_OK); return len; };
      
   }

}
开发者ID:Requaos,项目名称:harvey,代码行数:57,代码来源:bzread.c

示例13: bzip2_decompress

int
bzip2_decompress(void *src, uint64_t srclen, void *dst, uint64_t *dstlen,
		 int level, uchar_t chdr, void *data)
{
	bz_stream bzs;
	int ret;
	unsigned int slen, dlen;
	uint64_t _srclen = srclen;
	uint64_t _dstlen = *dstlen;
	uchar_t *dst1 = dst;
	uchar_t *src1 = src;

	bzs.bzalloc = slab_alloc_i;
	bzs.bzfree = slab_free;
	bzs.opaque = NULL;

	ret = BZ2_bzDecompressInit(&bzs, 0, 0);
	if (ret != BZ_OK) {
		bzerr(ret);
		return (-1);
	}

	while (_srclen > 0) {
		if (_srclen > SINGLE_CALL_MAX) {
			slen = SINGLE_CALL_MAX;
		} else {
			slen = _srclen;
		}
		if (_dstlen > SINGLE_CALL_MAX) {
			dlen = SINGLE_CALL_MAX;
		} else {
			dlen = _dstlen;
		}

		bzs.next_in = src1;
		bzs.avail_in = slen;
		bzs.next_out = dst1;
		bzs.avail_out = dlen;

		ret = BZ2_bzDecompress(&bzs);
		if (ret != BZ_OK && ret != BZ_STREAM_END) {
			BZ2_bzDecompressEnd(&bzs);
			bzerr(ret);
			return (-1);
		}
		dst1 += (dlen - bzs.avail_out);
		_dstlen -= (dlen - bzs.avail_out);
		src1 += (slen - bzs.avail_in);
		_srclen -= (slen - bzs.avail_in);
	}

	/* normal termination */
	*dstlen = *dstlen - _dstlen;
	BZ2_bzDecompressEnd(&bzs);
	return (0);
}
开发者ID:alepharchives,项目名称:pcompress,代码行数:56,代码来源:bzip2_compress.c

示例14: BZ2Decompress

void BZ2Decompress(Stream& out, Stream& in, Gate2<int, int> progress)
{
	enum { BUF_SIZE = 65536 };
	Buffer<char> input(BUF_SIZE), output(BUF_SIZE);
	int avail = in.Get(input, BUF_SIZE);
	if(avail == 0)
		return;
	bz_stream z;
	Zero(z);
	z.bzalloc = bzalloc_new;
	z.bzfree = bzfree_new;
	z.opaque = 0;
	if(BZ2_bzDecompressInit(&z, 0, 0) != BZ_OK)
	{
		out.SetError();
		return;
	}
	z.next_in = input;
	z.avail_in = avail;
	z.next_out = output;
	z.avail_out = BUF_SIZE;
	int code;
	bool running = true;
	int64 total = in.GetLeft();
	int done = 0;
	do
	{
		if(z.avail_in == 0 && running)
		{
			if((z.avail_in = in.Get(z.next_in = input, BUF_SIZE)) == 0)
				running = false;
			done += z.avail_in;
			if(progress(done, (int)total) || in.IsError())
			{
				BZ2_bzDecompressEnd(&z);
				out.SetError();
				return;
			}
		}
		code = BZ2_bzDecompress(&z);
		if(z.avail_out == 0)
		{
			out.Put(z.next_out = output, z.avail_out = BUF_SIZE);
			if(out.IsError())
			{
				BZ2_bzDecompressEnd(&z);
				return;
			}
		}
	}
	while(code == BZ_OK);
	if(z.avail_out < BUF_SIZE)
		out.Put(output, BUF_SIZE - z.avail_out);
	BZ2_bzDecompressEnd(&z);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:55,代码来源:bz2upp.cpp

示例15: do_uncompress

static int
do_uncompress( compress_filter_context_t *zfx, bz_stream *bzs,
	       IOBUF a, size_t *ret_len )
{
  int zrc;
  int rc=0;
  size_t n;
  int nread, count;
  int refill = !bzs->avail_in;

  if( DBG_FILTER )
    log_debug("begin bzDecompress: avail_in=%u, avail_out=%u, inbuf=%u\n",
	      (unsigned)bzs->avail_in, (unsigned)bzs->avail_out,
	      (unsigned)zfx->inbufsize );
  do
    {
      if( bzs->avail_in < zfx->inbufsize && refill )
	{
	  n = bzs->avail_in;
	  if( !n )
	    bzs->next_in = zfx->inbuf;
	  count = zfx->inbufsize - n;
	  nread = iobuf_read( a, zfx->inbuf + n, count );
	  if( nread == -1 ) nread = 0;
	  n += nread;
	  bzs->avail_in = n;
	}

      refill = 1;

      if( DBG_FILTER )
	log_debug("enter bzDecompress: avail_in=%u, avail_out=%u\n",
		  (unsigned)bzs->avail_in, (unsigned)bzs->avail_out);

      zrc=BZ2_bzDecompress(bzs);
      if( DBG_FILTER )
	log_debug("leave bzDecompress: avail_in=%u, avail_out=%u, zrc=%d\n",
		  (unsigned)bzs->avail_in, (unsigned)bzs->avail_out, zrc);
      if( zrc == BZ_STREAM_END )
	rc = -1; /* eof */
      else if( zrc != BZ_OK && zrc != BZ_PARAM_ERROR )
	log_fatal("bz2lib inflate problem: rc=%d\n", zrc );
    }
  while( bzs->avail_out && zrc != BZ_STREAM_END && zrc != BZ_PARAM_ERROR );

  /* I'm not completely happy with the two uses of BZ_PARAM_ERROR
     here.  The corresponding zlib function is Z_BUF_ERROR, which
     covers a narrower scope than BZ_PARAM_ERROR. -dshaw */

  *ret_len = zfx->outbufsize - bzs->avail_out;
  if( DBG_FILTER )
    log_debug("do_uncompress: returning %u bytes\n", (unsigned)*ret_len );
  return rc;
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-gnupg,代码行数:54,代码来源:compress-bz2.c


注:本文中的BZ2_bzDecompress函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。