mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 07:05:40 +00:00
dep/stb: Warning fix
This commit is contained in:
parent
aeba8b5e12
commit
0da756b0fd
|
@ -5,21 +5,21 @@
|
||||||
// https://github.com/nothings/stb/issues/113
|
// https://github.com/nothings/stb/issues/113
|
||||||
static unsigned char* compress_for_stbiw(unsigned char* data, int data_len, int* out_len, int quality)
|
static unsigned char* compress_for_stbiw(unsigned char* data, int data_len, int* out_len, int quality)
|
||||||
{
|
{
|
||||||
const uLongf bufSize = compressBound(data_len);
|
uLongf buf_size = compressBound(data_len);
|
||||||
|
|
||||||
// note that buf will be free'd by stb_image_write.h
|
// note that buf will be free'd by stb_image_write.h
|
||||||
// with STBIW_FREE() (plain free() by default)
|
// with STBIW_FREE() (plain free() by default)
|
||||||
unsigned char* buf = malloc(bufSize);
|
unsigned char* buf = malloc(buf_size);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (compress2(buf, &bufSize, data, data_len, quality) != Z_OK)
|
if (compress2(buf, &buf_size, data, data_len, quality) != Z_OK)
|
||||||
{
|
{
|
||||||
free(buf);
|
free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_len = bufSize;
|
*out_len = buf_size;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue