Fix warnings about "conversion to a greater size" that appear in VS2015 in x64 with /W4.

The warning concerns the return value of stbi_err, which is an int, being converted to a pointer. In VS2015 it seems casting directly from a 32-bit int to a 64-bit pointer triggers this warning. Worked around by first converting to a 64-bit int (here size_t) and then to a pointer.
This commit is contained in:
Nathan Reed 2015-09-10 01:20:35 -07:00
parent 6d613ed8ce
commit 26c98260b6

View File

@ -902,8 +902,8 @@ static void *stbi__malloc(size_t size)
#define stbi__err(x,y) stbi__err(x) #define stbi__err(x,y) stbi__err(x)
#endif #endif
#define stbi__errpf(x,y) ((float *) (stbi__err(x,y)?NULL:NULL)) #define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL))
#define stbi__errpuc(x,y) ((unsigned char *) (stbi__err(x,y)?NULL:NULL)) #define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL))
STBIDEF void stbi_image_free(void *retval_from_stbi_load) STBIDEF void stbi_image_free(void *retval_from_stbi_load)
{ {