Bug#789248: bs1770gain: Fail to build on archs with unsigned char

Petter Reinholdtsen pere at hungry.com
Fri Jun 19 06:35:17 UTC 2015


Package: bs1770gain
Version: 0.4.3-1
Severity: wishlist
Tags: patch

The first build of bs1770gain on the autobuilders showed a common error
on several architectures:

ffsox_csv2avdict.c:261:10: error: comparison is always false due to limited range of data type [-Werror=type-limits]
   if (EOF==(*wp=getc(b->f)))
          ^
cc1: all warnings being treated as errors

This is caused by 'char *wp' being unable to store the value of EOF
(often defined to -1) when char is unsigned.  The underlying cause is
that the return type of getc() is 'int', not 'char', and should not be
stored directly in a char before comparing it to EOF.

I believe this untested patch solve the issue:

diff --git a/libffsox-2/ffsox_csv2avdict.c b/libffsox-2/ffsox_csv2avdict.c
index e0a9474..ce3f781 100755
--- a/libffsox-2/ffsox_csv2avdict.c
+++ b/libffsox-2/ffsox_csv2avdict.c
@@ -255,11 +255,14 @@ static int priv_get_utf8(priv_t *b)
   static unsigned short mask[] = {192, 224, 240}; 
 
   char *wp=b->ch;
+  int firstbyte;
   size_t n; 
 
   // read first byte into buffer
-  if (EOF==(*wp=getc(b->f)))
+  firstbyte = getc(b->f);
+  if (EOF==firstbyte)
     goto error;
+  *wp = (char)firstbyte;
 
   // check how many more bytes need to be read for character
   n = 0;

-- 
Happy hacking
Petter Reinholdtsen



More information about the pkg-multimedia-maintainers mailing list