Closed nemequ closed 9 years ago
At least with the latest in master, this mostly works. I have done some work on the flushing system of LZNT1, so check it out.
After the first ms_deflate, I have: in_avail 0x00000000 in_total 0x00000aa5 out_avail 0x00002a94 out_total 0x00000000
After the second ms_deflate, I have: in_avail 0x00000000 in_total 0x00000aa5 out_avail 0x000024e3 out_total 0x000005b1
Shows that no data is written during the first ms_deflate (understandable since LZNT1 wiats for 4096 bytes to compress) and when calling with MSCOMP_FLUSH it outputs 0x05B1 bytes.
There are some problems with your code in the newest master:
I have gone through and documented mscomp.h much better now. It should explain a lot more. But in general, I have made several fixes to streaming stuff recently. Xpress still does not stream-compress, but I am holding off on finishing that until I get the speed of the general compression up.
ms_inflate actually returns MSCOMP_POSSIBLE_STREAM_END here and not MSCOMP_OK because it realizes that the stream is probably ended
Ah, don't know how I missed that >:(
Your last assert should probably be decomp and not comp
Yep. At that point I was just throwing stuff in with no way to test.
You probably meant to use MSCOMP_FINISH instead of MSCOMP_FLUSH - while for LZNT1 they are basically identical (although ms_inflate_end will return an error saying not finished), but more importantly other formats are likely not to support FLUSH as well as FINISH. Additionally, FINISH won't return MSCOMP_OK but instead MSCOMP_STREAM_END.
In this case I just wanted an example of flush working correctly, but yes, in real code I'll make the distinction between flushing and finishing.
I have gone through and documented mscomp.h much better now. It should explain a lot more. But in general, I have made several fixes to streaming stuff recently. Xpress still does not stream-compress, but I am holding off on finishing that until I get the speed of the general compression up.
Oh, wow, that's a lot better than last time I looked at it. Sorry, I really should have checked your recent changes before bothering you with this.
I'm trying to add support for flushing to the ms-compress squash plugin, but it isn't working as I would expect. Perhaps I'm missing something, but here is a quick test case for how I would expect it to work:
The really surprising part is that after calling ms_deflate with MSCOMP_FLUSH no data is written to the output.