lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.07k stars 422 forks source link

encode() returns error code if save_file() cannot open output file. #14

Closed cosinekitty closed 9 years ago

cosinekitty commented 9 years ago

Before this change, encode() would return 0 whether or not the output file was created. There was no way for a caller to know when the file could not be created (e.g. due to a non-existent parent directory).

Changed save_file() to return error 79 if it cannot open output file. encode() checks return code from save_file() and passes any error value back to the caller.

cosinekitty commented 9 years ago

By the way, I should say this is a wonderful piece of code. It is refreshing how easy it is to use and how it just WORKED the first time I used it, without having to fight to get it to compile. Thank you!

lvandeve commented 9 years ago

Thanks for this fix, good find

lvandeve commented 9 years ago

sorry for late merge I thought it already was long ago but apparently it wasn't :)

cosinekitty commented 9 years ago

I'm glad I could make this small contribution. And I would have reminded you in another year or two! :)

On Sat, Sep 12, 2015 at 5:15 PM, Lode Vandevenne notifications@github.com wrote:

sorry for late merge I thought it already was long ago but apparently it wasn't :)

— Reply to this email directly or view it on GitHub https://github.com/lvandeve/lodepng/pull/14#issuecomment-139820395.