Skip to content

Commit cf0881b

Browse files
joevtdingusdev
authored andcommitted
debugger: Fix compiler warnings.
1 parent 6b82e15 commit cf0881b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

debugger/debugger.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ using namespace std;
5353

5454
static uint32_t str2addr(string& addr_str) {
5555
try {
56-
return (uint32_t)stoul(addr_str, NULL, 0);
56+
return static_cast<uint32_t>(stoul(addr_str, NULL, 0));
5757
} catch (invalid_argument& exc) {
5858
throw invalid_argument(string("Cannot convert ") + addr_str);
5959
}
6060
}
6161

6262
static uint32_t str2num(string& num_str) {
6363
try {
64-
return (uint32_t)stol(num_str, NULL, 0);
64+
return static_cast<uint32_t>(stol(num_str, NULL, 0));
6565
} catch (invalid_argument& exc) {
6666
throw invalid_argument(string("Cannot convert ") + num_str);
6767
}
@@ -142,7 +142,7 @@ static uint32_t disasm_68k(uint32_t count, uint32_t address) {
142142
cout << uppercase << hex << insn->address << " ";
143143
cout << setfill(' ');
144144
cout << setw(10) << left << insn->mnemonic << insn->op_str << endl;
145-
address = dis_addr;
145+
address = static_cast<uint32_t>(dis_addr);
146146
} else {
147147
print_bin:
148148
cout << uppercase << hex << address << " ";
@@ -168,7 +168,7 @@ void exec_single_68k()
168168

169169
/* PPC r24 contains 68k PC advanced by two bytes
170170
as part of instruction prefetching */
171-
cur_68k_pc = get_reg(string("R24")) - 2;
171+
cur_68k_pc = static_cast<uint32_t>(get_reg(string("R24")) - 2);
172172

173173
/* PPC r29 contains base address of the emulator opcode table */
174174
emu_table_virt = get_reg(string("R29")) & 0xFFF80000;
@@ -178,7 +178,7 @@ void exec_single_68k()
178178
cur_instr_tab_entry = mmu_read_vmem<uint16_t>(NO_OPCODE, cur_68k_pc) * 8 + emu_table_virt;
179179

180180
/* grab the PPC PC too */
181-
ppc_pc = get_reg(string("PC"));
181+
ppc_pc = static_cast<uint32_t>(get_reg(string("PC")));
182182

183183
//printf("cur_instr_tab_entry = %X\n", cur_instr_tab_entry);
184184

@@ -187,7 +187,7 @@ void exec_single_68k()
187187
one by one until the execution goes outside the opcode table. */
188188
while (power_on && ppc_pc >= cur_instr_tab_entry && ppc_pc < cur_instr_tab_entry + 8) {
189189
ppc_exec_single();
190-
ppc_pc = get_reg(string("PC"));
190+
ppc_pc = static_cast<uint32_t>(get_reg(string("PC")));
191191
}
192192

193193
/* Getting here means we're outside the emualtor opcode table.
@@ -655,7 +655,7 @@ void DppcDebugger::enter_debugger() {
655655
}
656656
} else if (cmd == "next" || cmd == "ni") {
657657
addr_str = "PC";
658-
addr = (uint32_t)get_reg(addr_str) + 4;
658+
addr = static_cast<uint32_t>(get_reg(addr_str) + 4);
659659
ppc_exec_until(addr);
660660
} else if (cmd == "until") {
661661
if (cmd_repeat) {
@@ -738,7 +738,7 @@ void DppcDebugger::enter_debugger() {
738738
}
739739
else {
740740
addr_str = "R24";
741-
addr = get_reg(addr_str) - 2;
741+
addr = static_cast<uint32_t>(get_reg(addr_str) - 2);
742742
}
743743
next_addr_68k = disasm_68k(1, addr);
744744
#endif
@@ -749,7 +749,7 @@ void DppcDebugger::enter_debugger() {
749749
}
750750
else {
751751
addr_str = "PC";
752-
addr = (uint32_t)get_reg(addr_str);
752+
addr = static_cast<uint32_t>(get_reg(addr_str));
753753
}
754754
next_addr_ppc = disasm(1, addr);
755755
}

0 commit comments

Comments
 (0)