Fix libpng bug introduced by my previous pull request + misc fixes

Fixed the bug introduced by myself when fixing deprecated access to png_info of libpng, fixed miscellaneous compilation errors/warnings given by clang++