matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
492 stars 72 forks source link

Added libpng allocation checks and warning support. #120

Closed msiedlarek closed 9 years ago

msiedlarek commented 9 years ago

I was debugging a problem with PNG loading, which led me to these changes. I believe those could be useful for others in the future. I added:

  1. Return value checks for libpng allocation functions (as suggested by documentation).
  2. Actually printing libpng warnings to stderr. Now, I noticed that oglplus, as-of-yet, doesn't print anything to standard outputs, and I understand this may feel ugly. If you have a better idea for handling those warnings (only in debug build perhaps?) I'm all for it, but I believe they should not be silenced, as they can be extremely useful (mine was "Application built with libpng-1.4.12 but running with 1.6.18").