eglaysher / rlvm

RealLive clone for Linux and OSX
http://rlvm.net
GNU General Public License v3.0
150 stars 25 forks source link

Fails to compile with GCC 5.0: narrowing conversion in koepac_voice_archive.cc #65

Closed jbeich closed 9 years ago

jbeich commented 9 years ago

-Wno-narrowing doesn't help to avoid the following error found via DPorts. Maybe use int16_t instead.

src/systems/base/koepac_voice_archive.cc:142:27: error: narrowing conversion of '255
' from 'int' to 'int8_t {aka signed char}' inside { }
     0x7e, 0x81, 0x7f, 0x80};
                           ^
src/systems/base/koepac_voice_archive.cc:142:27: error: narrowing conversion of '25$
' from 'int' to 'int8_t {aka signed char}' inside { }
src/systems/base/koepac_voice_archive.cc:142:27: error: narrowing conversion of '25$
' from 'int' to 'int8_t {aka signed char}' inside { }
...
minirop commented 9 years ago

if it does not go over 255, uint8_t shouldn't be prefered?

eglaysher commented 9 years ago

uint8_t probably should be prefered; given some of the libraries that rlvm links in, I wouldn't expect rlvm to compile with signed characters. (Most of the code which assumes characters are always unsigned predates rlvm by years. Like most of the image and audio parsing code, the koepac decoding code originally comes from xclannad.)

I suspect a switch to uint8_t...might work here. But now I'm wondering exactly why the variable d (line 213) is signed. That might be significant... Every time I've touched some of these internals, I've made a hash of it...

minirop commented 9 years ago

I look at it, and I don't understand either since d is only used as an array index and cast to an unsigned char each time.