* for paletted images, .._info()'s comp should be based on the palette's
bits per pixel, not the images bits per pixel (which describes the
size of an index into the palette and is also checked now)
* make sure the color (map) type and the image type fields of the header
are consistent (=> if TGA color type is 1 for paletted, the TGA image
type must be 1 or 9)
* .._test() does some more checks and uses stbi__get16le() instead of
stbi__get16be() - TGA is little endian.
* .._test() now always rewinds (sometimes it used to do only return 0;
without rewinding)
* remove "error check" at the beginning of stbi__tga_load(), because
all that is already tested in stbi__tga_test()
stbi__tga_* assumed that 16bit TGAs were Grayscale + Alpha.
However, if the TGA imagetype is not one of the gray ones, it's 16Bit
RGB data, with 5 Bits per channel. If the TGA image descriptor field
has alpha bits (the 3 least significant ones) set, the pixel's most
significant bit is for alpha: 1 for opaque and 0 for translucent.
Furthermore people claim that TGAs can also pretend to have 15bpp,
which is the same as 16bpp but definitely without alpha.
So 15/16bpp TGAs are now decoded to STBI_rgb(_alpha).
- Add stb_vsnprintf, stb_snprintf functions.
- stb snprintf routines should return -1 on buffer truncation on all platforms.
- Add stb_strscpy string copy function which should behave the same as Linux kernel strscpy.
- Bump readdir_raw buffer sizes up to 4k, add checks for path truncations.
- Use d_type to check for directory instead of opendir/closedir. This
should be faster and fix recursive symlnk death.
When compiling with more restrictive compiler options
such casting from double to float will cause a warning.
Ex. GCC -Wdouble-promotion
Signed-off-by: Filip Wasil <filip.wasil@gmail.com>