external: libpng: fix numerous compiler warnings

Clean up the code for unused variables to handle them
a bit more elegantly.

Change-Id: I8b01c27673128719dad74276599d5a286c4dd412