[vlc-devel] [PATCH] contrib: sidplay2: fix signed char stored as int8_t

Martin Storsjö martin at martin.st
Thu Jan 9 12:56:00 CET 2020


On Thu, 9 Jan 2020, Steve Lhomme wrote:

> This is the error I get:
>
> /bin/bash ../../libtool  --tag=CXX   --mode=compile 
> arm-linux-gnueabihf-g++ -DHAVE_CONFIG_H 
> -I/mnt/c/Users/robux/Documents/Programs/Videolabs/build/rasp/contrib/arm-linux-gnueabihf/include 
> 
> -I/mnt/c/Users/robux/Documents/Programs/Videolabs/build/rasp/contrib/arm-linux-gnueabihf/include
>  -g -O2 -DHAVE_UNIX -I../../include -I../../include/sidplay -c -o 
> xsid.lo xsid.cpp
> libtool: compile:  arm-linux-gnueabihf-g++ -DHAVE_CONFIG_H 
> -I/mnt/c/Users/robux/Documents/Programs/Videolabs/build/rasp/contrib/arm-linux-gnueabihf/include 
> -I/mnt/c/Users/robux/Documents/Programs/Videolabs/build/rasp/contrib/arm-linux-gnueabihf/include 
> -g -O2 -DHAVE_UNIX -I../../include -I../../include/sidplay -c xsid.cpp 
> -fPIC -DPIC -o xsid.o
> xsid.cpp:101:1: error: narrowing conversion of ‘'\200'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
>   101 | };
>       | ^
> xsid.cpp:101:1: error: narrowing conversion of ‘'\224'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
> xsid.cpp:101:1: error: narrowing conversion of ‘'\251'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
> xsid.cpp:101:1: error: narrowing conversion of ‘'\274'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
> xsid.cpp:101:1: error: narrowing conversion of ‘'\316'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
> xsid.cpp:101:1: error: narrowing conversion of ‘'\341'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
> xsid.cpp:101:1: error: narrowing conversion of ‘'\362'’ from ‘char’ to 
> ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]
> make[4]: *** [Makefile:409: xsid.lo] Error 1

Ok, right, well as the current data type is int8_t, I would expect that it 
actually will behave totally differently if you suddenly make it an 
unsigned data type. (On ARM linux, unqualified char is unsigned.)

The best bet here would simply be to rewrite the table to use proper 
negative values (or an (int8_t) cast on each of them); as it's only 16 
values, it should be pretty doable.

// Martin


More information about the vlc-devel mailing list