Errors don't display correctly
sunwire opened this issue · 3 comments
sunwire commented
When an error appears, version 1.0.8 displays:
Sense Code: Illegal Request (0x05)
ASC: 0x26
ASCQ: 0x00
Additional data: 0x00000000000000000000000000000000
but version 1.0.9 and 1.1.0 displays:
Sense Code: Illegal Request (0x)
ASC: 0x&
ASCQ: 0x
Additional data: 0x
The reason for this are changes made in aa22443
The old code uses HEX() macro
Lines 39 to 40 in 844306d
old:
cerr<<" (0x"<<HEX(sd->senseKey)<<")"<<endl;
new:
std::cerr<<" (0x"<<std::hex << (sd->senseKey);
it should be
std::cerr<<" (0x"<<std::hex << int(sd->senseKey);
or std::cerr<<" (0x"<<std::hex << static_cast<int>(sd->senseKey);
At least 7 lines of code are affected.
PS.
The macro also formats in the right way e.g. displays 0x01 not 0x1
jonasstein commented
I think we should drop that macro and write a proper function with test.
jonasstein commented
@sunwire ok then lets try to get the tests working. It would make sense to make a new release soon and drop 1.1.0
jonasstein commented
fixed by revert in f1a36eb