[libdvbpsi-devel] Fix compilation with --enable-debug with GCC 5.1

Daniel Kamil Kozar git at videolan.org
Mon Aug 24 12:54:41 CEST 2015


libdvbpsi | branch: master | Daniel Kamil Kozar <dkk089 at gmail.com> | Fri Jun 12 20:22:09 2015 +0200| [9866f5871f97b2f24135050fbc3e6078790cbe82] | committer: Daniel Kamil Kozar

Fix compilation with --enable-debug with GCC 5.1

GCC 5.1.0 features stricter warnings about comparing boolean variables
with integer values, and thus compilation with --enable-debug failed
with "comparison of constant 12 with boolean expression is always true".
The leftover pieces of old code which treated integers as booleans are
now fixed, and the test suite is now compilable and runs correctly.

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=9866f5871f97b2f24135050fbc3e6078790cbe82
---

 misc/dr.xml    |    4 ++--
 misc/test_dr.c |   14 +++++++-------
 misc/test_dr.h |    6 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/misc/dr.xml b/misc/dr.xml
index 4bd9874..2c297c0 100644
--- a/misc/dr.xml
+++ b/misc/dr.xml
@@ -7,7 +7,7 @@
     <integer name="i_frame_rate_code" bitcount="4" default="0" />
     <insert>
       <begin>
-  s_decoded.b_mpeg2 = 0;</begin>
+  s_decoded.b_mpeg2 = false;</begin>
     </insert>
     <boolean name="b_constrained_parameter" default="0" />
     <boolean name="b_still_picture" default="0" />
@@ -18,7 +18,7 @@
     <integer name="i_frame_rate_code" bitcount="4" default="0" />
     <insert>
       <begin>
-  s_decoded.b_mpeg2 = 12;</begin>
+  s_decoded.b_mpeg2 = true;</begin>
     </insert>
     <boolean name="b_constrained_parameter" default="0" />
     <boolean name="b_still_picture" default="0" />
diff --git a/misc/test_dr.c b/misc/test_dr.c
index 2a38f05..f2ff185 100644
--- a/misc/test_dr.c
+++ b/misc/test_dr.c
@@ -100,7 +100,7 @@ static int main_vstream_2(void)
   /* check b_multiple_frame_rate */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
@@ -115,7 +115,7 @@ static int main_vstream_2(void)
   /* check i_frame_rate_code */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
@@ -130,7 +130,7 @@ static int main_vstream_2(void)
   /* check b_constrained_parameter */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
@@ -145,7 +145,7 @@ static int main_vstream_2(void)
   /* check b_still_picture */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
@@ -160,7 +160,7 @@ static int main_vstream_2(void)
   /* check i_profile_level_indication */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
@@ -175,7 +175,7 @@ static int main_vstream_2(void)
   /* check i_chroma_format */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
@@ -190,7 +190,7 @@ static int main_vstream_2(void)
   /* check b_frame_rate_extension */
   BOZO_init_boolean(b_multiple_frame_rate, 0);
   BOZO_init_integer(i_frame_rate_code, 0);
-  s_decoded.b_mpeg2 = 12;
+  s_decoded.b_mpeg2 = true;
   BOZO_init_boolean(b_constrained_parameter, 0);
   BOZO_init_boolean(b_still_picture, 0);
   BOZO_init_integer(i_profile_level_indication, 0);
diff --git a/misc/test_dr.h b/misc/test_dr.h
index 52418b4..4db3bc7 100644
--- a/misc/test_dr.h
+++ b/misc/test_dr.h
@@ -97,13 +97,13 @@
   {                                                                     \
     fprintf(stdout, "  \"%s\" boolean check\n", #name);                 \
     i_loop_count = 0;                                                   \
-    s_decoded.name = 0;                                                 \
+    s_decoded.name = false;                                             \
     do                                                                  \
     {
 
 #define BOZO_end_boolean(name)                                          \
-      s_decoded.name += 12;                                             \
-    } while(!i_err && (s_decoded.name <= 12));                          \
+      s_decoded.name ^= true;                                           \
+    } while(!i_err && s_decoded.name);                                  \
     fprintf(stdout, "\r  iteration count: %22"PRI64d, i_loop_count);       \
     if(i_err)                                                           \
       fprintf(stdout, "    FAILED !!!\n");                              \



More information about the libdvbpsi-devel mailing list