Merge branch 'unused-function-warnings' of https://github.com/BradleyMarie/stb into work2
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parents d256911, e2b8524 · Browse files · 3 files·+48 added−5 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+48 added−5 removed
- other:+48 added−5 removed
Provenance
- Commit
1ced9fa- Tree
6aa20a1- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent 1
d256911- Parent 2
e2b8524
3 files changed+48 added−5 removed
modified:.github/CONTRIBUTING.md+3 added
3 unmodified lines45678910111213143 unmodified lines1819202122232425265 unmodified lines3 unmodified lines
General priority order is:
* Crashes* Security issues in stb_image* Bugs* Security concerns in other libs* Warnings* Enhancements (new features, performance improvement, etc)
Pull requests get priority over Issues. Some pull requests I take3 unmodified linesaddress things. Many issues have been around for a long time.
# Pull requests
* Make sure you're using a special branch just for this pull request. (Sometimes people unknowingly use a default branch, then later update that branch, which updates the pull request with the other changes if it hasn't been merged yet.)* Do NOT update the version number in the file. (This just causes conflicts.)* Do add your name to the list of contributors. (Don't worry about the formatting.) I'll try to remember to add it if you don't, but I sometimes forget as it's an extra step.
# Specific libraries5 unmodified linesmodified:stb_image.h+43 added-3 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:Michaelangel007109- Matvey Cherevko108+ Brad Weinberger Matvey Cherevko github:Michaelangel007109+ Blazej Dariusz Roszkowski110+ 111 */112 113 #ifndef STBI_INCLUDE_STB_IMAGE_H114 #define STBI_INCLUDE_STB_IMAGE_H829 unmodified lines944 // portable way to check for no overflows in a*b945 return a <= INT_MAX/b;946 }947 948+#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR)949 // returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow950 static int stbi__mad2sizes_valid(int a, int b, int add)951 {952 return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add);953 }954+#endif955 956 // returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow957 static int stbi__mad3sizes_valid(int a, int b, int c, int add)958 {9 unmodified lines968 stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);969 }970 #endif971 972+#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR)973 // mallocs with size overflow checking974 static void *stbi__malloc_mad2(int a, int b, int add)975 {976 if (!stbi__mad2sizes_valid(a, b, add)) return NULL;977 return stbi__malloc(a*b + add);978 }979+#endif980 981 static void *stbi__malloc_mad3(int a, int b, int c, int add)982 {983 if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL;535 unmodified lines1519 }1520 return 0;1521 }1522 1523+#if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM)1524+// nothing1525+#else1526 stbi_inline static int stbi__at_eof(stbi__context *s)1527 {1528 if (s->io.read) {1529 if (!(s->io.eof)(s->io_user_data)) return 0;3 unmodified lines1533 }1534 1535 return s->img_buffer >= s->img_buffer_end;1536 }1537+#endif1538 1539+#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)1540+// nothing1541+#else1542 static void stbi__skip(stbi__context *s, int n)1543 {1544 if (n < 0) {1545 s->img_buffer = s->img_buffer_end;8 unmodified lines1554 }1555 }1556 s->img_buffer += n;1557 }1558+#endif1559 1560+#if defined(STBI_NO_PNG) && defined(STBI_NO_TGA) && defined(STBI_NO_HDR) && defined(STBI_NO_PNM)1561+// nothing1562+#else1563 static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)1564 {1565 if (s->io.read) {1566 int blen = (int) (s->img_buffer_end - s->img_buffer);15 unmodified lines1582 return 1;1583 } else1584 return 0;1585 }1586+#endif1587 1588+#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)1589+// nothing1590+#else1591 static int stbi__get16be(stbi__context *s)1592 {1593 int z = stbi__get8(s);1594 return (z << 8) + stbi__get8(s);1595 }1596+#endif1597 1598+#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC)1599+// nothing1600+#else1601 static stbi__uint32 stbi__get32be(stbi__context *s)1602 {1603 stbi__uint32 z = stbi__get16be(s);1604 return (z << 16) + stbi__get16be(s);1605 }1606+#endif1607 1608 #if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF)1609 // nothing1610 #else13 unmodified lines1624 #endif1625 1626 #define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings1627 1603-1628+#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)1629+// nothing1630+#else1631 //////////////////////////////////////////////////////////////////////////////1632 //1633 // generic converter from built-in img_n to req_comp1634 // individual types do this automatically as much as possible (e.g. jpeg7 unmodified lines1642 static stbi_uc stbi__compute_y(int r, int g, int b)1643 {1644 return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8);1645 }1646+#endif1647 1648+#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)1649+// nothing1650+#else1651 static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)1652 {1653 int i,j;1654 unsigned char *good;35 unmodified lines1690 1691 STBI_FREE(data);1692 return good;1693 }1694+#endif1695 1696+#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)1697+// nothing1698+#else1699 static stbi__uint16 stbi__compute_y_16(int r, int g, int b)1700 {1701 return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8);1702 }1703+#endif1704 1705+#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD)1706+// nothing1707+#else1708 static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y)1709 {1710 int i,j;1711 stbi__uint16 *good;35 unmodified lines1747 1748 STBI_FREE(data);1749 return good;1750 }1751+#endif1752 1753 #ifndef STBI_NO_LINEAR1754 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)1755 {5898 unmodified linesmodified:stb.h+2 added-2 removed
2452 unmodified lines2453 buffer = (char *) malloc(y-x + len + 1);2454 if (!buffer) return NULL;2455 }2456 2457- if (len) { stb_p_strcpy_s(buffer, sizeof(buffer), "./"); return buffer; }2458- stb_strncpy(buffer, path+int(x), int(y-x));2457+ if (len) { stb_p_strcpy_s(buffer, 3, "./"); return buffer; }2458+ stb_strncpy(buffer, path+(int)x, (int)(y-x));2459 return buffer;2460 }2461 2462 char *stb_splitpath(char *output, char *src, int flag)11992 unmodified lines