]> granicus.if.org Git - taglib/commit
taglib: fix test build failure on powerpc/c++11 (#834)
authorSergei Trofimovich <slyfox@inbox.ru>
Tue, 19 Sep 2017 01:06:55 +0000 (02:06 +0100)
committerStephen F. Booth <me@sbooth.org>
Tue, 19 Sep 2017 01:06:55 +0000 (20:06 -0500)
commit0b583bafd09c29695af9e84f7e7182280411a78e
treec2cb9b06fed7a25c2e01cb9a0bea90607b3926d5
parent46483948413c1330c036240ed89429a1c6905843
taglib: fix test build failure on powerpc/c++11 (#834)

powerpc is a platform with 'char' == 'unsigned char'.
As a result '-1' is not expressible in char and build fails as:

```
    # '-funsigned-char' to force test build failure on other platforms
    $ cmake .. -DBUILD_TESTS=YES -DCMAKE_CXX_FLAGS="-O2 -funsigned-char" -DCMAKE_C_FLAGS="-O2 -funsigned-char"
    ...
    $ make check
    tests/test_synchdata.cpp: In member function 'void TestID3v2SynchData::testToUIntBroken()':
    tests/test_synchdata.cpp:78:33: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
     char data[] = { 0, 0, 0, -1 };
                                 ^
```

The fix is to expliticly cast -1 to 'char'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
tests/test_synchdata.cpp