richgel999 / lzham_codec

Lossless data compression codec with LZMA-like ratios but 1.5x-8x faster decompression speed, C/C++
Other
693 stars 71 forks source link

Provide better failure codes #18

Open AndrewSav opened 8 years ago

AndrewSav commented 8 years ago

When compression returns LZHAM_COMP_STATUS_FAILED there is no way to tell what went wrong. And if you look at the code, there are around 10 different decision points that can result in LZHAM_COMP_STATUS_FAILED be returned. You have to actually debug through the library code, to find out where exactly it's failed.

Some better feedback on the library part here, will be most appreciated.

richgel999 commented 8 years ago

This has been addressed in lzham_codec_devel: https://github.com/richgel999/lzham_codec_devel

(Once GDC is over lzham_codec_devel will replace lzham_codec.)

AndrewSav commented 8 years ago

Thank you for this. Could you please clarify how this is addressed? I cannot spot the difference; For example lzham_compress_memory signature looks the same and lzham_compress_status_t enum also looks the same.

Also, could you please clarify what GDC stands for?

richgel999 commented 8 years ago

So the devel version now supports LZHAM_ERROR_LOGGING. Right now it only outputs to stderr (optionally), but this could be changed to call a callback (for example). I went through the entire codec and marked up every place an error can occur, to make it easier to track down what went wrong internally. I know this isn't perfect but it's a start.

GDC is the Games Developers Conference, next months.