mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-04 16:06:49 +02:00
libwebp: Use ExUtilGet*() in anim_diff
Instead of strtod() or strtol(). Change-Id: I320373cd969c6969cf4b1491391a95668d1b0beb
This commit is contained in:
parent
0d92ff25f2
commit
14d020f6e6
@ -20,6 +20,7 @@
|
|||||||
#include <string.h> // for 'strcmp'.
|
#include <string.h> // for 'strcmp'.
|
||||||
|
|
||||||
#include "./anim_util.h"
|
#include "./anim_util.h"
|
||||||
|
#include "./example_util.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
@ -228,14 +229,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
}
|
}
|
||||||
} else if (!strcmp(argv[c], "-min_psnr")) {
|
} else if (!strcmp(argv[c], "-min_psnr")) {
|
||||||
if (c < argc - 1) {
|
if (c < argc - 1) {
|
||||||
const char* const v = argv[++c];
|
min_psnr = ExUtilGetFloat(argv[++c], &parse_error);
|
||||||
char* end = NULL;
|
|
||||||
const double d = strtod(v, &end);
|
|
||||||
if (end == v) {
|
|
||||||
parse_error = 1;
|
|
||||||
fprintf(stderr, "Error! '%s' is not a floating point number.\n", v);
|
|
||||||
}
|
|
||||||
min_psnr = d;
|
|
||||||
} else {
|
} else {
|
||||||
parse_error = 1;
|
parse_error = 1;
|
||||||
}
|
}
|
||||||
@ -243,14 +237,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
premultiply = 0;
|
premultiply = 0;
|
||||||
} else if (!strcmp(argv[c], "-max_diff")) {
|
} else if (!strcmp(argv[c], "-max_diff")) {
|
||||||
if (c < argc - 1) {
|
if (c < argc - 1) {
|
||||||
const char* const v = argv[++c];
|
max_diff = ExUtilGetInt(argv[++c], 0, &parse_error);
|
||||||
char* end = NULL;
|
|
||||||
const int n = (int)strtol(v, &end, 10);
|
|
||||||
if (end == v) {
|
|
||||||
parse_error = 1;
|
|
||||||
fprintf(stderr, "Error! '%s' is not an integer.\n", v);
|
|
||||||
}
|
|
||||||
max_diff = n;
|
|
||||||
} else {
|
} else {
|
||||||
parse_error = 1;
|
parse_error = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user