Update stb (#885)

This commit and, by extension, PR attempts to update `stb` in the most
straightforward way possible as well as include fixes from main repo's
unmerged PRs for cases rearing their ugly heads during everyday usage:

 - stb#1299: stb_rect_pack: Make rect_height_compare a stable sort
 - stb#1402: stb_image: Fix "unused invalid_chunk" with STBI_FAILURE_USERMSG
 - stb#1404: stb_image: Fix gif two_back memory address
 - stb#1420: stb_image: Improve error reporting if file operations fail
   within *_from_file functions
 - stb#1445: stb_vorbis: Few static analyzers fixes
 - stb#1487: stb_vorbis: Fix residue classdata bounding for
   f->temp_memory_required
 - stb#1490: stb_vorbis: Fix broken clamp in codebook_decode_deinterleave_repeat
 - stb#1496: stb_image: Fix pnm only build
 - stb#1497: stb_image: Fix memory leaks if stbi__convert failed
 - stb#1498: stb_vorbis: Fix memory leaks in stb_vorbis
 - stb#1499: stb_vorbis: Minor change to prevent the undefined behavior -
   left shift of a negative value
 - stb#1500: stb_vorbis: Fix signed integer overflow

Includes additional small fixes that I felt didn't warrant a separate PR.
This commit is contained in:
mataha 2023-12-23 06:39:27 +01:00 committed by GitHub
parent 7faffde303
commit 1bc48bc8e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 1560 additions and 1282 deletions

View file

@ -71,8 +71,8 @@ static struct Flags {
enum TtyQuantizationAlgorithm quant;
} g_flags;
static wontreturn void PrintUsage(int rc, FILE *f) {
fprintf(f, "Usage: %s%s", program_invocation_name, "\
static wontreturn void PrintUsage(int rc, int fd) {
tinyprint(fd, "Usage: ", program_invocation_name, "\
[FLAGS] [PATH]\n\
\n\
FLAGS\n\
@ -86,7 +86,7 @@ EXAMPLES\n\
\n\
printansi.com -w80 -h40 logo.png\n\
\n\
\n");
\n", NULL);
exit(rc);
}
@ -107,7 +107,7 @@ static void GetOpts(int *argc, char *argv[]) {
g_flags.blocks = IsWindows() ? kTtyBlocksCp437 : kTtyBlocksUnicode;
if (*argc == 2 &&
(strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-help") == 0)) {
PrintUsage(EXIT_SUCCESS, stdout);
PrintUsage(EXIT_SUCCESS, STDOUT_FILENO);
}
while ((opt = getopt(*argc, argv, "?ivpfrtxads234o:w:h:")) != -1) {
switch (opt) {
@ -162,9 +162,12 @@ static void GetOpts(int *argc, char *argv[]) {
++__log_level;
break;
case '?':
PrintUsage(EXIT_SUCCESS, stdout);
default:
PrintUsage(EX_USAGE, stderr);
if (opt == optopt) {
PrintUsage(EXIT_SUCCESS, STDOUT_FILENO);
} else {
PrintUsage(EX_USAGE, STDERR_FILENO);
}
}
}
if (optind == *argc) {