Is there any tool that can inflate a zlib compressed stream that has been recorded and split up into multiples? The tool, should be able to decompress any file, not just the first one with the header. Of course, this would require syncing up to the next flush point (00 00 ff ff) and some of the initial data would be dropped.
I used Mark Adler’s zpipe.c excample and added inflatesync() call to the code and got it working. I would however prefer a tool that has been used and tested by the community for years. I assume my search skills are just not that good as such a tool seems like it would have been created by now.
In the off chance, I am the first, here is my code changes to zpipe:
114 do {
115 strm.avail_out = CHUNK;
116 strm.next_out = out;
117 //ret = inflate(&strm, Z_NO_FLUSH);
118 ret = inflate(&strm, Z_SYNC_FLUSH);
119 if(ret == Z_DATA_ERROR)
120 {
121 ret = inflateSync(&strm);
122 if(ret != Z_OK)
123 {
124 fputs("syncing failedn", stderr);
125 }
126 else
127 ret = inflate(&strm, Z_SYNC_FLUSH);
128 }
129 assert(ret != Z_STREAM_ERROR); /* state not clobbered */