Reintroduce HEX macro as fix

Co-authored-by: Paweł Marciniak <sunwire+git@gmail.com>
This commit is contained in:
Paweł Marciniak
2022-04-24 15:35:52 +01:00
committed by GitHub
parent 844306dbe4
commit f1a36eba42
2 changed files with 8 additions and 8 deletions

View File

@@ -371,13 +371,13 @@ bool SCSIExecute(std::string tapedrive, unsigned char *cmd_p, int cmd_len,
#ifdef DEBUGSCSI
std::cout << "SCSI Command: ";
for (int i = 0; i < cmd_len; i++) {
std::cout << std::hex << cmd_p[i];
std::cout << HEX(cmd_p[i]);
}
std::cout << "\n";
std::cout << "SCSI Data: ";
for (int i = 0; i < dxfer_len; i++) {
std::cout << std::hex << (dxfer_p[i]);
std::cout << HEX(dxfer_p[i]));
}
std::cout << std::endl;
#endif
@@ -569,20 +569,20 @@ void outputSense(SCSI_PAGE_SENSE *sd) {
break;
}
std::cerr << " (0x" << std::hex << (sd->senseKey) << ")\n";
std::cerr << " (0x" << HEX(sd->senseKey) << ")\n";
std::cerr << std::left << std::setw(25) << " ASC:"
<< "0x" << std::hex << (sd->addSenseCode) << "\n";
<< "0x" << HEX(sd->addSenseCode) << "\n";
std::cerr << std::left << std::setw(25) << " ASCQ:"
<< "0x" << std::hex << (sd->addSenseCodeQual) << "\n";
<< "0x" << HEX(sd->addSenseCodeQual) << "\n";
if (sd->addSenseLen > 0) {
std::cerr << std::left << std::setw(25) << " Additional data:"
<< "0x";
for (int i = 0; i < sd->addSenseLen; i++) {
std::cerr << std::hex << (sd->addSenseData[i]);
std::cerr << HEX(sd->addSenseData[i]);
}
std::cerr << "\n";
}
@@ -592,7 +592,7 @@ void outputSense(SCSI_PAGE_SENSE *sd) {
char *rawsense = (char *)sd;
for (int i = 0; i < sizeof(SCSI_PAGE_SENSE); i++) {
std::cerr << std::hex << (rawsense[i]);
std::cerr << HEX(rawsense[i]);
}
std::cerr << "\n";
#endif

View File

@@ -37,7 +37,7 @@ GNU General Public License for more details.
// outputs hex in a 2 digit pair
#define HEX(x) \
right << setw(2) << setfill('0') << hex << (int)(x) << setfill(' ')
std::right << std::setw(2) << std::setfill('0') << std::hex << (int)(x) << std::setfill(' ')
// macro for a byte swapped short
#define BSSHORT(x) ((unsigned short)((x[0] << 8) + x[1]))
// macro for a byte swapped int