示例#1
0
 Utils::ByteBuffer
 Decompressor::decompress(char* src, unsigned long src_len)
 {
   Utils::ByteBuffer dst;
   unsigned dst_len = 128 * 1024;
   dst.setSize(dst_len);
   decompress(dst.getBufferSigned(), dst.getSize(), src, src_len);
   dst.setSize(decompressed());
   return dst;
 }
示例#2
0
    void
    Compressor::compress(Utils::ByteBuffer& dst, char* src, unsigned long src_len)
    {
      unsigned bfr_size = compressBound(src_len);

      bool done = false;
      while (!done)
      {
        dst.setSize(bfr_size);

        try
        {
          compress(dst.getBufferSigned(), dst.getSize(), src, src_len);
          done = true;
        }
        catch (BufferTooShort& e)
        {
          (void)e;
          bfr_size <<= 1;
        }
      }

      dst.setSize(m_compressed);
    }
示例#3
0
 void
 Decompressor::decompress(Utils::ByteBuffer& dst, Utils::ByteBuffer& src)
 {
   decompress(dst.getBufferSigned(), dst.getSize(), src.getBufferSigned(), src.getSize());
   dst.setSize(decompressed());
 }
示例#4
0
 void
 Compressor::compress(Utils::ByteBuffer& dst, Utils::ByteBuffer& src)
 {
   return compress(dst, src.getBufferSigned(), src.getSize());
 }