Fix Z80Debug.cpp compile with C++20

String literals should not be used to initialize char* but C++17 and earlier were letting it slide
This commit is contained in:
gm-matthew 2023-09-01 13:52:13 +01:00 committed by Bart Trzynadlowski
parent ebff9a8b2d
commit c9b718e89a

View file

@ -33,7 +33,7 @@
namespace Debugger namespace Debugger
{ {
// Instruction templates // Instruction templates
static char *templates[5][256] = { static const char *templates[5][256] = {
{ {
// Table 0: single byte instructions // Table 0: single byte instructions
"NOP","LD BC,@a","LD (BC),A","INC BC","INC B","DEC B","LD B,@d","RLCA", "NOP","LD BC,@a","LD (BC),A","INC BC","INC B","DEC B","LD B,@d","RLCA",
@ -393,10 +393,10 @@ namespace Debugger
switch (opcode) switch (opcode)
{ {
case 0xCB: case 0xCB:
templ = templates[1][m_bus->Read8(dAddr++)]; templ = (char*)templates[1][m_bus->Read8(dAddr++)];
break; break;
case 0xED: case 0xED:
templ = templates[2][m_bus->Read8(dAddr++)]; templ = (char*)templates[2][m_bus->Read8(dAddr++)];
break; break;
case 0xDD: case 0xDD:
xyChr = 'X'; xyChr = 'X';
@ -405,10 +405,10 @@ namespace Debugger
{ {
offs = m_bus->Read8(dAddr++); offs = m_bus->Read8(dAddr++);
notJump = true; notJump = true;
templ = templates[4][m_bus->Read8(dAddr++)]; templ = (char*)templates[4][m_bus->Read8(dAddr++)];
} }
else else
templ = templates[3][nextCode]; templ = (char*)templates[3][nextCode];
break; break;
case 0xFD: case 0xFD:
xyChr = 'Y'; xyChr = 'Y';
@ -417,13 +417,13 @@ namespace Debugger
{ {
offs = m_bus->Read8(dAddr++); offs = m_bus->Read8(dAddr++);
notJump = true; notJump = true;
templ = templates[4][m_bus->Read8(dAddr++)]; templ = (char*)templates[4][m_bus->Read8(dAddr++)];
} }
else else
templ = templates[3][nextCode]; templ = (char*)templates[3][nextCode];
break; break;
default: default:
templ = templates[0][opcode]; templ = (char*)templates[0][opcode];
break; break;
} }