[FFmpeg-devel] [PATCH] avfilter/vf_pseudocolor: Add missing braces

Mark Thompson sw at jkqxz.net
Tue Feb 2 23:50:37 EET 2021


The array inside a structure needs two levels of braces.
---
The previous format was unambiguous, but it provoked a lot of warning spam.  gcc 10:

CC      libavfilter/vf_pseudocolor.o
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around initializer [-Wmissing-braces]
   107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around initializer [-Wmissing-braces]
   107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {               }
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around initializer [-Wmissing-braces]
   107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {               }   {            }
src/libavfilter/vf_pseudocolor.c:107:35: warning: missing braces around initializer [-Wmissing-braces]
   107 | static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {               }   {            }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around initializer [-Wmissing-braces]
   108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around initializer [-Wmissing-braces]
   108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {            }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around initializer [-Wmissing-braces]
   108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {            }   {               }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around initializer [-Wmissing-braces]
   108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {            }   {               }   {            }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around initializer [-Wmissing-braces]
   108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {            }   {               }   {            }   {            }
src/libavfilter/vf_pseudocolor.c:108:35: warning: missing braces around initializer [-Wmissing-braces]
   108 | static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
       |                                   ^
       |                                     {             }   {            }   {               }   {            }   {            }

  libavfilter/vf_pseudocolor.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c
index 192839342b..3416ab19a9 100644
--- a/libavfilter/vf_pseudocolor.c
+++ b/libavfilter/vf_pseudocolor.c
@@ -104,8 +104,8 @@ static const Range full_range   = {0, 256};
  static const Range spec1_range[] = {{0, 16}, {16, 236}, {236, 256}};
  static const Range spec2_range[] = {{0, 16}, {16, 22}, {22, 226}, {226, 236}, {236, 256}};

-static const Fill spec1_fills[] = {{0.5f, 0.f, .5f}, {-1.f, -1.f, -1.f}, {1.f, 0.f, 0.f}};
-static const Fill spec2_fills[] = {{0.5f, 0.f, .5f}, {0.f, 1.f, 1.f}, {-1.f, -1.f, -1.f}, {1.f, 1.f, 0.f}, {1.f, 0.f, 0.f}};
+static const Fill spec1_fills[] = {{{0.5f, 0.f, .5f}}, {{-1.f, -1.f, -1.f}}, {{1.f, 0.f, 0.f}}};
+static const Fill spec2_fills[] = {{{0.5f, 0.f, .5f}}, {{0.f, 1.f, 1.f}}, {{-1.f, -1.f, -1.f}}, {{1.f, 1.f, 0.f}}, {{1.f, 0.f, 0.f}}};

  static const Curve curves[] =
  {
-- 
2.29.2


More information about the ffmpeg-devel mailing list