webpng.c (libgd-2.2.4) | : | webpng.c (libgd-2.2.5) | ||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
#endif | #endif | |||
#ifdef __clang__ | #ifdef __clang__ | |||
/* Workaround broken clang behavior: https://llvm.org/bugs/show_bug.cgi?id=20144 */ | /* Workaround broken clang behavior: https://llvm.org/bugs/show_bug.cgi?id=20144 */ | |||
#undef strcmp | #undef strcmp | |||
#endif | #endif | |||
/* Bring in the gd library functions */ | /* Bring in the gd library functions */ | |||
#include "gd.h" | #include "gd.h" | |||
#define KEEP_TRANS (-100) | ||||
static const char argv0[] = "webpng"; | static const char argv0[] = "webpng"; | |||
static void usage(const char *msg) | static void usage(const char *msg) | |||
{ | { | |||
/* If the command failed, output an explanation. */ | /* If the command failed, output an explanation. */ | |||
fprintf(msg == NULL ? stdout : stderr, | fprintf(msg == NULL ? stdout : stderr, | |||
"Usage: %s [-i y|n] [-l] [-t index|none] [-d] [-a] pngname.png\n" | "Usage: %s [-i y|n] [-l] [-t index|none] [-d] [-a] pngname.png\n" | |||
" -i <y|n> Turns on/off interlace\n" | " -i <y|n> Turns on/off interlace\n" | |||
" -l Prints the table of color indexes\n" | " -l Prints the table of color indexes\n" | |||
" -t <index> Set the transparent color to the specified index (0 -255 or \"none\")\n" | " -t <index> Set the transparent color to the specified index (0 -255 or \"none\")\n" | |||
skipping to change at line 77 | skipping to change at line 79 | |||
{ | { | |||
FILE *in; | FILE *in; | |||
FILE *out; | FILE *out; | |||
const char *infile; | const char *infile; | |||
char *tmpfile; | char *tmpfile; | |||
int i; | int i; | |||
int use_stdin_stdout = 0; | int use_stdin_stdout = 0; | |||
int interlace = -100; | int interlace = -100; | |||
int list_color_table = 0; | int list_color_table = 0; | |||
int trans_col = -1; | int trans_col = KEEP_TRANS; | |||
int report_details = 0; | int report_details = 0; | |||
int print_alpha = 0; | int print_alpha = 0; | |||
/* Declare our image pointer */ | /* Declare our image pointer */ | |||
gdImagePtr im = 0; | gdImagePtr im = 0; | |||
/* We'll set 'write' once we know the user's request | /* We'll set 'write' once we know the user's request | |||
requires that the image be written back to disk. */ | requires that the image be written back to disk. */ | |||
int write = 0; | int write = 0; | |||
int got_a_flag = 0; | int got_a_flag = 0; | |||
skipping to change at line 254 | skipping to change at line 256 | |||
if (write == 0) { | if (write == 0) { | |||
gdImageDestroy(im); | gdImageDestroy(im); | |||
return 0; | return 0; | |||
} | } | |||
if (interlace == 1) | if (interlace == 1) | |||
gdImageInterlace(im, 1); | gdImageInterlace(im, 1); | |||
else if (interlace == 0) | else if (interlace == 0) | |||
gdImageInterlace(im, 0); | gdImageInterlace(im, 0); | |||
if (trans_col != -100) | if (trans_col != KEEP_TRANS) | |||
gdImageColorTransparent(im, trans_col); | gdImageColorTransparent(im, trans_col); | |||
if (use_stdin_stdout) { | if (use_stdin_stdout) { | |||
out = stdout; | out = stdout; | |||
} else { | } else { | |||
/* Open a temporary file. */ | /* Open a temporary file. */ | |||
size_t filelen = strlen(infile); | size_t filelen = strlen(infile); | |||
size_t len = filelen + 8; | size_t len = filelen + 8; | |||
int outfd; | int outfd; | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added |