예제 #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());
 }