[bTSstream-devel] [PATCH] desc_81: Fix compilation with older compilers

Georgi Chorbadzhiyski georgi at unixsol.net
Mon Oct 26 09:47:29 CET 2020


The attached fixes the following error when compiling 'dvblastctl'

  /usr/local/include/bitstream/atsc/si/desc_81.h: In function ‘desc81_bit_rate_code_from_octetrate’:
  /usr/local/include/bitstream/atsc/si/desc_81.h:83:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
  /usr/local/include/bitstream/atsc/si/desc_81.h:83:5: note: use option -std=c99 or -std=gnu99 to compile your code

Apply via 'git am 0001-desc_81-Fix-compilation-with-older-compilers.patch'

-- 
Georgi Chorbadzhiyski | https://georgi.unixsol.org/ | https://georgi.unixsol.org/git/
-------------- next part --------------
From 577483cf4711c1f325cf854311edcb37b0018127 Mon Sep 17 00:00:00 2001
From: Georgi Chorbadzhiyski <georgi at unixsol.org>
Date: Tue, 15 Sep 2020 09:20:34 +0300
Subject: [PATCH] desc_81: Fix compilation with older compilers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes the following error when compiling 'dvblastctl'

  /usr/local/include/bitstream/atsc/si/desc_81.h: In function ‘desc81_bit_rate_code_from_octetrate’:
  /usr/local/include/bitstream/atsc/si/desc_81.h:83:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
  /usr/local/include/bitstream/atsc/si/desc_81.h:83:5: note: use option -std=c99 or -std=gnu99 to compile your code
---
 atsc/si/desc_81.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/atsc/si/desc_81.h b/atsc/si/desc_81.h
index e55581b..2c7a20b 100644
--- a/atsc/si/desc_81.h
+++ b/atsc/si/desc_81.h
@@ -80,7 +80,8 @@ static inline uint8_t desc81_bit_rate_code_from_octetrate(uint64_t octetrate)
         256, 320, 384, 448, 512, 576,
         640,
     };
-    for (unsigned i = 0; i < 19; i++) {
+    unsigned i;
+    for (i = 0; i < 19; i++) {
         if (octetrate * 8 == table[i] * 1000)
             return i;
         else if (octetrate * 8 < table[i] * 1000)
-- 
2.24.3 (Apple Git-128)



More information about the biTStream-devel mailing list