mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
more C89-fixes
going down to strict -ansi c89 is quite overkill (no 'inline', and /* */-style comments). But with these fixes, the code compiles with the stringent flags: -Wextra -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations and -Wdeclaration-after-statement Change-Id: I36222f8f505bcba3d9d1309ad98b5ccb04ec17e3
This commit is contained in:
@ -276,6 +276,7 @@ static int ReadJPEG(FILE* in_file, WebPPicture* const pic) {
|
||||
|
||||
#ifdef WEBP_HAVE_PNG
|
||||
static void PNGAPI error_function(png_structp png, png_const_charp dummy) {
|
||||
(void)dummy; // remove variable-unused warning
|
||||
longjmp(png_jmpbuf(png), 1);
|
||||
}
|
||||
|
||||
@ -284,9 +285,9 @@ static int ReadPNG(FILE* in_file, WebPPicture* const pic) {
|
||||
png_infop info;
|
||||
int color_type, bit_depth, interlaced;
|
||||
int num_passes;
|
||||
int p, y;
|
||||
int p;
|
||||
int ok = 0;
|
||||
png_uint_32 width, height;
|
||||
png_uint_32 width, height, y;
|
||||
int stride;
|
||||
uint8_t* rgb = NULL;
|
||||
|
||||
@ -446,7 +447,7 @@ static void PrintValues(const int values[4]) {
|
||||
fprintf(stderr,"|\n");
|
||||
}
|
||||
|
||||
void PrintExtraInfo(const WebPPicture* const pic, int short_output) {
|
||||
static void PrintExtraInfo(const WebPPicture* const pic, int short_output) {
|
||||
const WebPAuxStats* const stats = pic->stats;
|
||||
if (short_output) {
|
||||
fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]);
|
||||
@ -553,7 +554,7 @@ static int DumpPicture(const WebPPicture* const picture, const char* PGM_name) {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void HelpShort() {
|
||||
static void HelpShort(void) {
|
||||
printf("Usage:\n\n");
|
||||
printf(" cwebp [options] -q quality input.png -o output.webp\n\n");
|
||||
printf("where quality is between 0 (poor) to 100 (very good).\n");
|
||||
@ -561,7 +562,7 @@ static void HelpShort() {
|
||||
printf("Try -longhelp for an exhaustive list of advanced options.\n");
|
||||
}
|
||||
|
||||
static void HelpLong() {
|
||||
static void HelpLong(void) {
|
||||
printf("Usage:\n");
|
||||
printf(" cwebp [-preset <...>] [options] in_file [-o out_file]\n\n");
|
||||
printf("If input size (-s) for an image is not specified, "
|
||||
|
@ -117,6 +117,7 @@ static int WritePNG(const char* out_file_name, unsigned char* rgb, int stride,
|
||||
|
||||
#elif defined(WEBP_HAVE_PNG) // !WIN32
|
||||
static void PNGAPI error_function(png_structp png, png_const_charp dummy) {
|
||||
(void)dummy; // remove variable-unused warning
|
||||
longjmp(png_jmpbuf(png), 1);
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ static int WritePNG(FILE* out_file, unsigned char* rgb, int stride,
|
||||
png_uint_32 width, png_uint_32 height) {
|
||||
png_structp png;
|
||||
png_infop info;
|
||||
int y;
|
||||
png_uint_32 y;
|
||||
|
||||
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL, error_function, NULL);
|
||||
@ -203,7 +204,7 @@ typedef enum {
|
||||
PGM,
|
||||
} OutputFileFormat;
|
||||
|
||||
static void help(const char *s) {
|
||||
static void Help(void) {
|
||||
printf("Usage: dwebp "
|
||||
"[in_file] [-h] [-v] [-ppm] [-pgm] [-version] [-o out_file]\n\n"
|
||||
"Decodes the WebP image file to PNG format [Default]\n"
|
||||
@ -227,7 +228,7 @@ int main(int argc, const char *argv[]) {
|
||||
int c;
|
||||
for (c = 1; c < argc; ++c) {
|
||||
if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) {
|
||||
help(argv[0]);
|
||||
Help();
|
||||
return 0;
|
||||
} else if (!strcmp(argv[c], "-o") && c < argc - 1) {
|
||||
out_file = argv[++c];
|
||||
@ -244,7 +245,7 @@ int main(int argc, const char *argv[]) {
|
||||
verbose = 1;
|
||||
} else if (argv[c][0] == '-') {
|
||||
printf("Unknown option '%s'\n", argv[c]);
|
||||
help(argv[0]);
|
||||
Help();
|
||||
return -1;
|
||||
} else {
|
||||
in_file = argv[c];
|
||||
@ -253,7 +254,7 @@ int main(int argc, const char *argv[]) {
|
||||
|
||||
if (in_file == NULL) {
|
||||
printf("missing input file!!\n");
|
||||
help(argv[0]);
|
||||
Help();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user