examples: quiet -Wshorten-64-to-32 warnings
all around usage of strtol/strtoul
ported from libvpx:
08b8b6bb8 examples: quiet -Wshorten-64-to-32 warnings
Change-Id: If907c89f107a068987aa71ddd93cee9a7389e4cd
diff --git a/examples/aom_cx_set_ref.c b/examples/aom_cx_set_ref.c
index 6beb4fb..d1aec99 100644
--- a/examples/aom_cx_set_ref.c
+++ b/examples/aom_cx_set_ref.c
@@ -342,8 +342,8 @@
}
info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(width_arg, NULL, 0);
- info.frame_height = strtol(height_arg, NULL, 0);
+ info.frame_width = (int)strtol(width_arg, NULL, 0);
+ info.frame_height = (int)strtol(height_arg, NULL, 0);
info.time_base.numerator = 1;
info.time_base.denominator = fps;
diff --git a/examples/decode_with_drops.c b/examples/decode_with_drops.c
index 6dd654b..45e0fb0 100644
--- a/examples/decode_with_drops.c
+++ b/examples/decode_with_drops.c
@@ -93,8 +93,8 @@
if (!(outfile = fopen(argv[2], "wb")))
die("Failed to open %s for writing.", argv[2]);
- n = strtol(argv[3], &nptr, 0);
- m = strtol(nptr + 1, NULL, 0);
+ n = (int)strtol(argv[3], &nptr, 0);
+ m = (int)strtol(nptr + 1, NULL, 0);
is_range = (*nptr == '-');
if (!n || !m || (*nptr != '-' && *nptr != '/'))
die("Couldn't parse pattern %s.\n", argv[3]);
diff --git a/examples/lossless_encoder.c b/examples/lossless_encoder.c
index 1abeb27..32ab18a 100644
--- a/examples/lossless_encoder.c
+++ b/examples/lossless_encoder.c
@@ -80,8 +80,8 @@
if (!encoder) die("Unsupported codec.");
info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(argv[1], NULL, 0);
- info.frame_height = strtol(argv[2], NULL, 0);
+ info.frame_width = (int)strtol(argv[1], NULL, 0);
+ info.frame_height = (int)strtol(argv[2], NULL, 0);
info.time_base.numerator = 1;
info.time_base.denominator = fps;
diff --git a/examples/set_maps.c b/examples/set_maps.c
index b4916cf..e88cd42 100644
--- a/examples/set_maps.c
+++ b/examples/set_maps.c
@@ -143,8 +143,8 @@
}
assert(encoder != NULL);
info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(argv[2], NULL, 0);
- info.frame_height = strtol(argv[3], NULL, 0);
+ info.frame_width = (int)strtol(argv[2], NULL, 0);
+ info.frame_height = (int)strtol(argv[3], NULL, 0);
info.time_base.numerator = 1;
info.time_base.denominator = fps;
diff --git a/examples/simple_encoder.c b/examples/simple_encoder.c
index 1d2b51e..033068f 100644
--- a/examples/simple_encoder.c
+++ b/examples/simple_encoder.c
@@ -180,14 +180,14 @@
infile_arg = argv[4];
outfile_arg = argv[5];
keyframe_interval_arg = argv[6];
- max_frames = strtol(argv[8], NULL, 0);
+ max_frames = (int)strtol(argv[8], NULL, 0);
encoder = get_aom_encoder_by_name(codec_arg);
if (!encoder) die("Unsupported codec.");
info.codec_fourcc = encoder->fourcc;
- info.frame_width = strtol(width_arg, NULL, 0);
- info.frame_height = strtol(height_arg, NULL, 0);
+ info.frame_width = (int)strtol(width_arg, NULL, 0);
+ info.frame_height = (int)strtol(height_arg, NULL, 0);
info.time_base.numerator = 1;
info.time_base.denominator = fps;
@@ -201,7 +201,7 @@
die("Failed to allocate image.");
}
- keyframe_interval = strtol(keyframe_interval_arg, NULL, 0);
+ keyframe_interval = (int)strtol(keyframe_interval_arg, NULL, 0);
if (keyframe_interval < 0) die("Invalid keyframe interval value.");
printf("Using %s\n", aom_codec_iface_name(encoder->codec_interface()));
@@ -214,7 +214,7 @@
cfg.g_timebase.num = info.time_base.numerator;
cfg.g_timebase.den = info.time_base.denominator;
cfg.rc_target_bitrate = bitrate;
- cfg.g_error_resilient = strtol(argv[7], NULL, 0);
+ cfg.g_error_resilient = (aom_codec_er_flags_t)strtoul(argv[7], NULL, 0);
writer = aom_video_writer_open(outfile_arg, kContainerIVF, &info);
if (!writer) die("Failed to open %s for writing.", outfile_arg);
diff --git a/examples/twopass_encoder.c b/examples/twopass_encoder.c
index 7e97d13..e767bb5 100644
--- a/examples/twopass_encoder.c
+++ b/examples/twopass_encoder.c
@@ -206,15 +206,15 @@
if (argc < 6) die("Invalid number of arguments");
- if (argc > 6) limit = strtol(argv[6], NULL, 0);
+ if (argc > 6) limit = (int)strtol(argv[6], NULL, 0);
if (limit == 0) limit = 100;
encoder = get_aom_encoder_by_name(codec_arg);
if (!encoder) die("Unsupported codec.");
- w = strtol(width_arg, NULL, 0);
- h = strtol(height_arg, NULL, 0);
+ w = (int)strtol(width_arg, NULL, 0);
+ h = (int)strtol(height_arg, NULL, 0);
if (w <= 0 || h <= 0 || (w % 2) != 0 || (h % 2) != 0)
die("Invalid frame size: %dx%d", w, h);