mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
Merge "fix some warnings from static analysis"
This commit is contained in:
@ -929,7 +929,7 @@ int main(int argc, const char *argv[]) {
|
||||
|
||||
// Read the input
|
||||
if (verbose) {
|
||||
StopwatchReadAndReset(&stop_watch);
|
||||
StopwatchReset(&stop_watch);
|
||||
}
|
||||
if (!ReadPicture(in_file, &picture, keep_alpha,
|
||||
(keep_metadata == 0) ? NULL : &metadata)) {
|
||||
@ -983,7 +983,7 @@ int main(int argc, const char *argv[]) {
|
||||
|
||||
// Compress
|
||||
if (verbose) {
|
||||
StopwatchReadAndReset(&stop_watch);
|
||||
StopwatchReset(&stop_watch);
|
||||
}
|
||||
if (crop != 0) {
|
||||
// We use self-cropping using a view.
|
||||
|
@ -474,8 +474,9 @@ static int SaveOutput(const WebPDecBuffer* const buffer,
|
||||
int ok = 1;
|
||||
Stopwatch stop_watch;
|
||||
|
||||
if (verbose)
|
||||
StopwatchReadAndReset(&stop_watch);
|
||||
if (verbose) {
|
||||
StopwatchReset(&stop_watch);
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINCODEC_H
|
||||
needs_open_file = (format != PNG);
|
||||
@ -657,8 +658,9 @@ int main(int argc, const char *argv[]) {
|
||||
|
||||
if (!ExUtilReadFile(in_file, &data, &data_size)) return -1;
|
||||
|
||||
if (verbose)
|
||||
StopwatchReadAndReset(&stop_watch);
|
||||
if (verbose) {
|
||||
StopwatchReset(&stop_watch);
|
||||
}
|
||||
|
||||
status = WebPGetFeatures(data, data_size, bitstream);
|
||||
if (status != VP8_STATUS_OK) {
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
typedef LARGE_INTEGER Stopwatch;
|
||||
|
||||
static WEBP_INLINE void StopwatchReset(Stopwatch* watch) {
|
||||
QueryPerformanceCounter(watch);
|
||||
}
|
||||
|
||||
static WEBP_INLINE double StopwatchReadAndReset(Stopwatch* watch) {
|
||||
const LARGE_INTEGER old_value = *watch;
|
||||
LARGE_INTEGER freq;
|
||||
@ -37,6 +41,10 @@ static WEBP_INLINE double StopwatchReadAndReset(Stopwatch* watch) {
|
||||
|
||||
typedef struct timeval Stopwatch;
|
||||
|
||||
static WEBP_INLINE void StopwatchReset(Stopwatch* watch) {
|
||||
gettimeofday(watch, NULL);
|
||||
}
|
||||
|
||||
static WEBP_INLINE double StopwatchReadAndReset(Stopwatch* watch) {
|
||||
const struct timeval old_value = *watch;
|
||||
gettimeofday(watch, NULL);
|
||||
|
@ -57,7 +57,7 @@ static struct {
|
||||
|
||||
const char* file_name;
|
||||
WebPData data;
|
||||
WebPDecoderConfig* config;
|
||||
WebPDecoderConfig config;
|
||||
const WebPDecBuffer* pic;
|
||||
WebPDemuxer* dmux;
|
||||
WebPIterator curr_frame;
|
||||
@ -146,7 +146,7 @@ static int ApplyColorProfile(const WebPData* const profile,
|
||||
|
||||
static int Decode(void) { // Fills kParams.curr_frame
|
||||
const WebPIterator* const curr = &kParams.curr_frame;
|
||||
WebPDecoderConfig* const config = kParams.config;
|
||||
WebPDecoderConfig* const config = &kParams.config;
|
||||
WebPDecBuffer* const output_buffer = &config->output;
|
||||
int ok = 0;
|
||||
|
||||
@ -386,16 +386,15 @@ static void Help(void) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
WebPDecoderConfig config;
|
||||
int c;
|
||||
WebPDecoderConfig* const config = &kParams.config;
|
||||
WebPIterator* const curr = &kParams.curr_frame;
|
||||
WebPIterator* const prev = &kParams.prev_frame;
|
||||
|
||||
if (!WebPInitDecoderConfig(&config)) {
|
||||
if (!WebPInitDecoderConfig(config)) {
|
||||
fprintf(stderr, "Library version mismatch!\n");
|
||||
return -1;
|
||||
}
|
||||
kParams.config = &config;
|
||||
kParams.use_color_profile = 1;
|
||||
|
||||
for (c = 1; c < argc; ++c) {
|
||||
@ -405,9 +404,9 @@ int main(int argc, char *argv[]) {
|
||||
} else if (!strcmp(argv[c], "-noicc")) {
|
||||
kParams.use_color_profile = 0;
|
||||
} else if (!strcmp(argv[c], "-nofancy")) {
|
||||
config.options.no_fancy_upsampling = 1;
|
||||
config->options.no_fancy_upsampling = 1;
|
||||
} else if (!strcmp(argv[c], "-nofilter")) {
|
||||
config.options.bypass_filtering = 1;
|
||||
config->options.bypass_filtering = 1;
|
||||
} else if (!strcmp(argv[c], "-info")) {
|
||||
kParams.print_info = 1;
|
||||
} else if (!strcmp(argv[c], "-version")) {
|
||||
@ -419,7 +418,7 @@ int main(int argc, char *argv[]) {
|
||||
(dmux_version >> 8) & 0xff, dmux_version & 0xff);
|
||||
return 0;
|
||||
} else if (!strcmp(argv[c], "-mt")) {
|
||||
config.options.use_threads = 1;
|
||||
config->options.use_threads = 1;
|
||||
} else if (argv[c][0] == '-') {
|
||||
printf("Unknown option '%s'\n", argv[c]);
|
||||
Help();
|
||||
|
Reference in New Issue
Block a user