In tdefl_record_literal, the following expression may read an uninitialized
value in the m_pLZ_flags field:
*d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> 1);
By explicitly initializing it, we avoid possible undefined behaviors.
Issue found with Frama-C.
Function implemenations are already guarded by #ifndef MZ_NO_MALLOC, so
let's put prototypes under the same #ifndef. Also, while we are at it,
make those prototypes standard-compliant by adding void argument.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Fixed array index where to store image height.
PNG files made using `tdefl_write_image_to_png_file_in_memory_ex()` were very tall, with a huge empty area at the end.
Since `pnghdr[22]` was assigned twice, I changed indices to store height exactly in the way width is stored (two consecutive swapped bytes). Now PNG file height is correct.