]> granicus.if.org Git - libvpx/commitdiff
Fix warnings reported by -Wshadow: Part4: main directory
authorUrvang Joshi <urvang@google.com>
Mon, 17 Oct 2016 21:53:33 +0000 (14:53 -0700)
committerYaowu Xu <yaowu@google.com>
Wed, 19 Oct 2016 14:56:53 +0000 (07:56 -0700)
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.

Cherry-picked from aomedia/master: b96cbc4

Change-Id: I3922dea2e6976b16519c4aa4d1bd395c198134f1

aomdec.c
aomenc.c
av1/encoder/rdopt.c
configure

index d9f229da0322788f5ac2c60a9fd0ff13e20d367c..e88c81ffb9201d0b532cca5bff85b9a274429eb9 100644 (file)
--- a/aomdec.c
+++ b/aomdec.c
@@ -893,7 +893,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");
@@ -902,21 +902,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) {
index 63ef753ad6c61bb71e6f6edf005e94c6fbb1eed5..3f9a87d0ed9c7bbf6fa1b7a0573a79e7d2ffdd28 100644 (file)
--- a/aomenc.c
+++ b/aomenc.c
@@ -1753,13 +1753,11 @@ static void test_decode(struct stream_state *stream,
   /* Get the internal reference frame */
   if (strcmp(codec->name, "vp8") == 0) {
     struct aom_ref_frame ref_enc, ref_dec;
-    int width, height;
-
-    width = (stream->config.cfg.g_w + 15) & ~15;
-    height = (stream->config.cfg.g_h + 15) & ~15;
-    aom_img_alloc(&ref_enc.img, AOM_IMG_FMT_I420, width, height, 1);
+    const unsigned int frame_width = (stream->config.cfg.g_w + 15) & ~15;
+    const unsigned int frame_height = (stream->config.cfg.g_h + 15) & ~15;
+    aom_img_alloc(&ref_enc.img, AOM_IMG_FMT_I420, frame_width, frame_height, 1);
     enc_img = ref_enc.img;
-    aom_img_alloc(&ref_dec.img, AOM_IMG_FMT_I420, width, height, 1);
+    aom_img_alloc(&ref_dec.img, AOM_IMG_FMT_I420, frame_width, frame_height, 1);
     dec_img = ref_dec.img;
 
     ref_enc.frame_type = AOM_LAST_FRAME;
@@ -2131,10 +2129,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 =
index 2f9c42aa7d6ecee7bb7988469a5167b4341486ca..8399a850a009cd2d0b583b07a7f64e75b9d9a528 100644 (file)
@@ -9381,7 +9381,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
     int best_rate_nocoef;
 #endif
     int64_t distortion2 = 0, distortion_y = 0, dummy_rd = best_rd, this_rd;
-    int skippable = 0, rate_overhead = 0;
+    int skippable = 0;
     TX_SIZE best_tx_size, uv_tx;
     TX_TYPE best_tx_type;
     PALETTE_MODE_INFO palette_mode_info;
@@ -9389,6 +9389,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
         x->palette_buffer->best_palette_color_map;
     uint8_t *const color_map = xd->plane[0].color_index_map;
 
+    rate_overhead = 0;
     mbmi->mode = DC_PRED;
     mbmi->uv_mode = DC_PRED;
     mbmi->ref_frame[0] = INTRA_FRAME;
@@ -9551,7 +9552,6 @@ PALETTE_EXIT:
         nearmv[1] = frame_mv[NEARMV][refs[1]];
       }
 #else
-      int i;
       int ref_set = (mbmi_ext->ref_mv_count[rf_type] >= 2)
                         ? AOMMIN(2, mbmi_ext->ref_mv_count[rf_type] - 2)
                         : INT_MAX;
index d911d9a9ad1be9d31b65e1d4cacede497550c502..53ba10e370053573c8d792900a84dae42bb50eaf 100755 (executable)
--- a/configure
+++ b/configure
@@ -611,6 +611,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*) ;;
           *) check_add_cflags -Wunused-but-set-variable ;;