Implementing a function to convert lzma_ret to string is tricky, because the same return values have slightly different meanings when returned by different functions. This is a design mistake in the API, but it cannot be fixed without breaking the API, which I don't want to do.
One possibility would be to provide a few strerror-like functions that could be used with return values of different functions. This doesn't sound nice though. Letting liblzma construct the error message when the error occurs allows more detailed error messages than what one could get by converting lzma_ret to a string. E.g. when LZMA_OPTIONS_ERROR is returned, the error message could include what compression option was the problem. Functions that work on lzma_stream could store the message in the lzma_stream structure. This is what zlib does. liblzma has many functions that don't use lzma_stream, so this isn't a solution for those functions. A thread-local variable to store an error message would work with all functions and also in threaded programs. Would this be OK? Does someone have alternative ideas? -- Lasse Collin | IRC: Larhzu @ IRCnet & Freenode