Commit b96cbc44 authored by Urvang Joshi's avatar Urvang Joshi

Fix warnings reported by -Wshadow: Part6: main directory

Now that all warnings are taken care of, add warning flag -Wshadow to
configure.

Note: Enabling this flag for C++ generates some useless warnings about
some function parameters shadowing class member function names. So, only
enabling this warning for C code.

Change-Id: I53ffb763483fec675a3358c5e64a737a03b93eb1
parent 23dcada9
......@@ -839,7 +839,7 @@ static int main_loop(int argc, const char **argv_) {
if (single_file) {
if (use_y4m) {
char buf[Y4M_BUFFER_SIZE] = { 0 };
char y4m_buf[Y4M_BUFFER_SIZE] = { 0 };
size_t len = 0;
if (img->fmt == AOM_IMG_FMT_I440 || img->fmt == AOM_IMG_FMT_I44016) {
fprintf(stderr, "Cannot produce y4m output for 440 sampling.\n");
......@@ -848,21 +848,22 @@ static int main_loop(int argc, const char **argv_) {
if (frame_out == 1) {
// Y4M file header
len = y4m_write_file_header(
buf, sizeof(buf), aom_input_ctx.width, aom_input_ctx.height,
&aom_input_ctx.framerate, img->fmt, img->bit_depth);
y4m_buf, sizeof(y4m_buf), aom_input_ctx.width,
aom_input_ctx.height, &aom_input_ctx.framerate, img->fmt,
img->bit_depth);
if (do_md5) {
MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
MD5Update(&md5_ctx, (md5byte *)y4m_buf, (unsigned int)len);
} else {
fputs(buf, outfile);
fputs(y4m_buf, outfile);
}
}
// Y4M frame header
len = y4m_write_frame_header(buf, sizeof(buf));
len = y4m_write_frame_header(y4m_buf, sizeof(y4m_buf));
if (do_md5) {
MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
MD5Update(&md5_ctx, (md5byte *)y4m_buf, (unsigned int)len);
} else {
fputs(buf, outfile);
fputs(y4m_buf, outfile);
}
} else {
if (frame_out == 1) {
......
......@@ -1286,9 +1286,10 @@ static void set_default_kf_interval(struct stream_state *stream,
* specified on the command line.
*/
if (!stream->config.have_kf_max_dist) {
double framerate = (double)global->framerate.num / global->framerate.den;
if (framerate > 0.0)
stream->config.cfg.kf_max_dist = (unsigned int)(5.0 * framerate);
double global_framerate =
(double)global->framerate.num / global->framerate.den;
if (global_framerate > 0.0)
stream->config.cfg.kf_max_dist = (unsigned int)(5.0 * global_framerate);
}
}
......@@ -2115,10 +2116,10 @@ int main(int argc, const char **argv_) {
} else {
const int64_t input_pos = ftello(input.file);
const int64_t input_pos_lagged = input_pos - lagged_count;
const int64_t limit = input.length;
const int64_t input_limit = input.length;
rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
remaining = limit - input_pos + lagged_count;
remaining = input_limit - input_pos + lagged_count;
}
average_rate =
......
......@@ -576,6 +576,10 @@ process_toolchain() {
check_add_cflags -Wuninitialized
check_add_cflags -Wunused-variable
check_add_cflags -Wsign-compare
# Enabling the following warning for C++ generates some useless warnings
# about some function parameters shadowing class member function names.
# So, only enable this warning for C code.
check_cflags "-Wshadow" && add_cflags_only "-Wshadow"
case ${CC} in
*clang*)
# libaom and/or clang have issues with aliasing:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment