libpng icon indicating copy to clipboard operation
libpng copied to clipboard

Use PNG_ABORT instead of abort in png_safe_error

Open flsobral opened this issue 1 year ago • 1 comments

https://github.com/pnggroup/libpng/blob/f1848a3b560ddcad065242268433af475948461e/pngerror.c#L916

Just use the macro instead of the platform dependent function for cross platform support.

flsobral avatar May 03 '24 12:05 flsobral

It's the only direct use of 'abort' in the code so it's inconsistent. Curiously it has been there since I wrote the code in 2011; 'abort' is a required function of an ANSI-C compiler and an ANSI-C compiler is now required (it wasn't originally) so PNG_ABORT should go after 1.6. For the 1.6 the change should be harmless, if @ctruta wants to do it.

jbowler avatar May 05 '24 22:05 jbowler

PNG_ABORT was from forever ago, specifically from version 1.0.6 (published in the spring of Y2K). It used to have a purpose back then, but it no longer does, because all platforms, old and new, on which libpng 1.6.x is compilable and runnable, do have abort().

Going beyond 1.6.x, PNG_ABORT is one of the several legacy hacks that are to be deleted.

ctruta avatar Sep 13 '24 19:09 ctruta

Ah, but then it is planned. I suggest changing this to [libpng18]

There are a number of tasks for libpng18 that are merge-conflict-minefields, PNG_ABORT is minor but removing deprecated functions and removing scripts/makefiles.unsupported are two. Bigger ones are the pending STDIO crashes on Windows problem, for which I have a fix in mind that will fix the simplified API too, defaulting to now issuing png_warning, png_benign_chunk_error and so on unless the app turns it on. Both of these are behavior changes but not API changes. The first (STDIO) is pretty easy the second needs some policy discussion; e.g. if the app does take the time to install a warning handler then the warnings should be on!

jbowler avatar Sep 13 '24 21:09 jbowler