Exemplo n.º 1
0
/*
 * Setup inflation for auto inflation of data streams.
 */
static bool setup_auto_inflation(DCR *dcr)
{
   JCR *jcr = dcr->jcr;
   uint32_t decompress_buf_size;

   if (jcr->buf_size == 0) {
      jcr->buf_size = DEFAULT_NETWORK_BUFFER_SIZE;
   }

   setup_decompression_buffers(jcr, &decompress_buf_size);
   if (decompress_buf_size > 0) {
      /*
       * See if we need to create a new compression buffer or make sure the existing is big enough.
       */
      if (!jcr->compress.inflate_buffer) {
         jcr->compress.inflate_buffer = get_memory(decompress_buf_size);
         jcr->compress.inflate_buffer_size = decompress_buf_size;
      } else {
         if (decompress_buf_size > jcr->compress.inflate_buffer_size) {
            jcr->compress.inflate_buffer = realloc_pool_memory(jcr->compress.inflate_buffer, decompress_buf_size);
            jcr->compress.inflate_buffer_size = decompress_buf_size;
         }
      }
   } else {
      return false;
   }

   return true;
}
Exemplo n.º 2
0
/*
 * For decompression we use the same decompression buffer for each algorithm.
 */
bool adjust_decompression_buffers(JCR *jcr)
{
   uint32_t decompress_buf_size;

   setup_decompression_buffers(jcr, &decompress_buf_size);

   jcr->compress.inflate_buffer = get_memory(decompress_buf_size);
   jcr->compress.inflate_buffer_size = decompress_buf_size;

   return true;
}