Skip to content

Commit 7b52d0c

Browse files
committed
fix things
1 parent 079b0ba commit 7b52d0c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

shared/chip8.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int chip8_init(
7878
/* init registers and memory once */
7979
memset(chip8.V, 0 , NUM_REGISTERS);
8080
memset(chip8.memory, 0, MEM_SIZE);
81-
memset(chip8.stack, 0, STACK_DEPTH);
81+
memset(chip8.stack, 0, sizeof(chip8.stack));
8282
chip8.I = 0;
8383
chip8.PC = ENTRY_POINT;
8484
chip8.sp = 0;
@@ -213,7 +213,7 @@ void chip8_soft_reset() {
213213

214214
/* clear registers and the stack */
215215
memset(chip8.V, 0 , NUM_REGISTERS);
216-
memset(chip8.stack, 0, STACK_DEPTH);
216+
memset(chip8.stack, 0, sizeof(chip8.stack));
217217
memset(chip8.memory, 0, MEM_SIZE);
218218

219219
/* load fontset */

shared/open_file_dialog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int openFileDialog(char *rom_name) {
2525
const char* defaultDir = ""; // unify behavior: let OS choose last-used/home
2626
std::vector<std::string> files = openFileDialog("Chip8", defaultDir, fileTypes);
2727
if (files.empty()) return 1;
28-
strcpy(rom_name, files[0].c_str());
28+
snprintf(rom_name, 256, "%s", files[0].c_str());
2929
return 0;
3030

3131
#elif defined(_WIN32)

0 commit comments

Comments
 (0)