title: zlib inflate in memory
body: <p>I have a small buffer with some data (ca. 35'000 bytes).
  No i would like to inflate my buffer with zlib.
  The buffer is named "pos_in_mem" (void *) and the length of my buffer is len (int *).</p>
  
  <p>I always get a -3 (Z_DATA_ERROR) on that part of code:</p>
  
  <pre><code>int ret;
  z_stream strm;
  unsigned char in[CHUNK];
  unsigned char out[CHUNK];
  
  /* allocate deflate state */
  strm.zalloc = Z_NULL;
  strm.zfree = Z_NULL;
  strm.opaque = Z_NULL;
  strm.avail_in = 0;
  strm.next_in = Z_NULL;
  ret = inflateInit(&amp;strm);
  if (ret != Z_OK) {
      printf("zlib init failed");
  }
  strm.avail_in = *len; // this is my buffer length
  strm.next_in = pos_in_mem; // this is my buffer
  
  strm.avail_out = CHUNK;
  strm.next_out = out;
  
  //ret = deflate(&amp;strm, flush);
  ret = inflate(&amp;strm, Z_NO_FLUSH); // here i always get a -3 Z_DATA_ERROR
  printf("%d", strm.avail_out);
  (void)inflateEnd(&amp;strm);
  </code></pre>
  
  <p>any ideas?</p>
  
  <p>Thanks</p>