summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--args.c9
-rw-r--r--examples/vp9cx_set_ref.c10
2 files changed, 12 insertions, 7 deletions
diff --git a/args.c b/args.c
index bd1ede038..5483f395c 100644
--- a/args.c
+++ b/args.c
@@ -13,6 +13,7 @@
#include <limits.h>
#include "args.h"
+#include "vpx/vpx_integer.h"
#include "vpx_ports/msvc.h"
#if defined(__GNUC__) && __GNUC__
@@ -118,13 +119,13 @@ void arg_show_usage(FILE *fp, const struct arg_def *const *defs) {
}
unsigned int arg_parse_uint(const struct arg *arg) {
- long int rawval;
+ uint32_t rawval;
char *endptr;
- rawval = strtol(arg->val, &endptr, 10);
+ rawval = strtoul(arg->val, &endptr, 10);
if (arg->val[0] != '\0' && endptr[0] == '\0') {
- if (rawval >= 0 && rawval <= UINT_MAX) return (unsigned int)rawval;
+ if (rawval <= UINT_MAX) return rawval;
die("Option %s: Value %ld out of range for unsigned int\n", arg->name,
rawval);
@@ -135,7 +136,7 @@ unsigned int arg_parse_uint(const struct arg *arg) {
}
int arg_parse_int(const struct arg *arg) {
- long int rawval;
+ int32_t rawval;
char *endptr;
rawval = strtol(arg->val, &endptr, 10);
diff --git a/examples/vp9cx_set_ref.c b/examples/vp9cx_set_ref.c
index 798d7e3f2..3472689db 100644
--- a/examples/vp9cx_set_ref.c
+++ b/examples/vp9cx_set_ref.c
@@ -304,6 +304,7 @@ int main(int argc, char **argv) {
const char *height_arg = NULL;
const char *infile_arg = NULL;
const char *outfile_arg = NULL;
+ const char *update_frame_num_arg = NULL;
unsigned int limit = 0;
vp9_zero(ecodec);
@@ -318,18 +319,21 @@ int main(int argc, char **argv) {
height_arg = argv[2];
infile_arg = argv[3];
outfile_arg = argv[4];
+ update_frame_num_arg = argv[5];
encoder = get_vpx_encoder_by_name("vp9");
if (!encoder) die("Unsupported codec.");
- update_frame_num = atoi(argv[5]);
+ update_frame_num = (unsigned int)strtoul(update_frame_num_arg, NULL, 0);
// In VP9, the reference buffers (cm->buffer_pool->frame_bufs[i].buf) are
// allocated while calling vpx_codec_encode(), thus, setting reference for
// 1st frame isn't supported.
- if (update_frame_num <= 1) die("Couldn't parse frame number '%s'\n", argv[5]);
+ if (update_frame_num <= 1) {
+ die("Couldn't parse frame number '%s'\n", update_frame_num_arg);
+ }
if (argc > 6) {
- limit = atoi(argv[6]);
+ limit = (unsigned int)strtoul(argv[6], NULL, 0);
if (update_frame_num > limit)
die("Update frame number couldn't larger than limit\n");
}