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
Provenance
- Commit
e2b8524- Tree
d841052- Author
Brad Weinberger <1484541+BradleyMarie@users.noreply.github.com>- Committer
Brad Weinberger <1484541+BradleyMarie@users.noreply.github.com>- Parent
2f870b3
1 file changed+41 added−2 removed
modified:stb_image.h+41 added-2 removed
103 unmodified lines104 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 */110 111 #ifndef STBI_INCLUDE_STB_IMAGE_H112 #define STBI_INCLUDE_STB_IMAGE_H810 unmodified lines923 // portable way to check for no overflows in a*b924 return a <= INT_MAX/b;925 }926 927+#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 overflow929 static 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+#endif934 935 // returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow936 static int stbi__mad3sizes_valid(int a, int b, int c, int add)937 {9 unmodified lines947 stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);948 }949 #endif950 951+#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR)952 // mallocs with size overflow checking953 static 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+#endif959 960 static 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 lines1480 }1481 return 0;1482 }1483 1484+#if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM)1485+// nothing1486+#else1487 stbi_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 lines1494 }1495 1496 return s->img_buffer >= s->img_buffer_end;1497 }1498+#endif1499 1500+#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+#else1503 static void stbi__skip(stbi__context *s, int n)1504 {1505 if (n < 0) {1506 s->img_buffer = s->img_buffer_end;8 unmodified lines1515 }1516 }1517 s->img_buffer += n;1518 }1519+#endif1520 1521+#if defined(STBI_NO_PNG) && defined(STBI_NO_TGA) && defined(STBI_NO_HDR) && defined(STBI_NO_PNM)1522+// nothing1523+#else1524 static 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 lines1543 return 1;1544 } else1545 return 0;1546 }1547+#endif1548 1549+#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)1550+// nothing1551+#else1552 static int stbi__get16be(stbi__context *s)1553 {1554 int z = stbi__get8(s);1555 return (z << 8) + stbi__get8(s);1556 }1557+#endif1558 1559+#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)1560+// nothing1561+#else1562 static stbi__uint32 stbi__get32be(stbi__context *s)1563 {1564 stbi__uint32 z = stbi__get16be(s);1565 return (z << 16) + stbi__get16be(s);1566 }1567+#endif1568 1569 #if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF)1570 // nothing1571 #else13 unmodified lines1585 #endif1586 1587 #define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings1588 1565-1589+#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. jpeg7 unmodified lines1603 static 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+#endif1608 1609+#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+#else1612 static 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 lines1651 1652 STBI_FREE(data);1653 return good;1654 }1655+#endif1656 1657+#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)1658+// nothing1659+#else1660 static 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+#endif1665 1666+#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)1667+// nothing1668+#else1669 static 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 lines1708 1709 STBI_FREE(data);1710 return good;1711 }1712+#endif1713 1714 #ifndef STBI_NO_LINEAR1715 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)1716 {5882 unmodified lines