Skip to content
Myr

Fix clang unused function compile warnings

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Brad Weinberger · committed by Brad Weinberger · parent 2f870b3 · Browse files · 1 file+41 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+41 added−2 removed

  • other:+41 added−2 removed

1 file+41 added−2 removed

modified:stb_image.h+41 added-2 removed
103 unmodified lines
104 Aldo Culquicondor Philipp Wiesemann Dale Weiler github:sammyhw105 Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:phprus106 Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo107 Christian Floisand Kevin Schmidt JR Smith github:darealshinji108 Blazej Dariusz Roszkowski github:Michaelangel007108 Brad Weinberger Blazej Dariusz Roszkowski github:Michaelangel007109*/110111#ifndef STBI_INCLUDE_STB_IMAGE_H112#define STBI_INCLUDE_STB_IMAGE_H
810 unmodified lines
923 // portable way to check for no overflows in a*b924 return a <= INT_MAX/b;925}926927#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR)928// returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow929static int stbi__mad2sizes_valid(int a, int b, int add)930{931 return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add);932}933#endif934935// returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow936static int stbi__mad3sizes_valid(int a, int b, int c, int add)937{
9 unmodified lines
947 stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);948}949#endif950951#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR)952// mallocs with size overflow checking953static void *stbi__malloc_mad2(int a, int b, int add)954{955 if (!stbi__mad2sizes_valid(a, b, add)) return NULL;956 return stbi__malloc(a*b + add);957}958#endif959960static void *stbi__malloc_mad3(int a, int b, int c, int add)961{962 if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL;
517 unmodified lines
1480 }1481 return 0;1482}14831484#if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM)1485// nothing1486#else1487stbi_inline static int stbi__at_eof(stbi__context *s)1488{1489 if (s->io.read) {1490 if (!(s->io.eof)(s->io_user_data)) return 0;
3 unmodified lines
1494 }14951496 return s->img_buffer >= s->img_buffer_end;1497}1498#endif14991500#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC)1501// nothing1502#else1503static void stbi__skip(stbi__context *s, int n)1504{1505 if (n < 0) {1506 s->img_buffer = s->img_buffer_end;
8 unmodified lines
1515 }1516 }1517 s->img_buffer += n;1518}1519#endif15201521#if defined(STBI_NO_PNG) && defined(STBI_NO_TGA) && defined(STBI_NO_HDR) && defined(STBI_NO_PNM)1522// nothing1523#else1524static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)1525{1526 if (s->io.read) {1527 int blen = (int) (s->img_buffer_end - s->img_buffer);
15 unmodified lines
1543 return 1;1544 } else1545 return 0;1546}1547#endif15481549#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)1550// nothing1551#else1552static int stbi__get16be(stbi__context *s)1553{1554 int z = stbi__get8(s);1555 return (z << 8) + stbi__get8(s);1556}1557#endif15581559#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)1560// nothing1561#else1562static stbi__uint32 stbi__get32be(stbi__context *s)1563{1564 stbi__uint32 z = stbi__get16be(s);1565 return (z << 16) + stbi__get16be(s);1566}1567#endif15681569#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF)1570// nothing1571#else
13 unmodified lines
1585#endif15861587#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings158815651589#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM)1590// nothing1591#else1592//////////////////////////////////////////////////////////////////////////////1593//1594// generic converter from built-in img_n to req_comp1595// individual types do this automatically as much as possible (e.g. jpeg
7 unmodified lines
1603static stbi_uc stbi__compute_y(int r, int g, int b)1604{1605 return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8);1606}1607#endif16081609#if defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM)1610// nothing1611#else1612static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)1613{1614 int i,j;1615 unsigned char *good;
35 unmodified lines
16511652 STBI_FREE(data);1653 return good;1654}1655#endif16561657#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)1658// nothing1659#else1660static stbi__uint16 stbi__compute_y_16(int r, int g, int b)1661{1662 return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8);1663}1664#endif16651666#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)1667// nothing1668#else1669static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y)1670{1671 int i,j;1672 stbi__uint16 *good;
35 unmodified lines
17081709 STBI_FREE(data);1710 return good;1711}1712#endif17131714#ifndef STBI_NO_LINEAR1715static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)1716{
5882 unmodified lines