Skip to content

Commit 77425c1

Browse files
committed
Fix warnings
1 parent 59429fe commit 77425c1

File tree

9 files changed

+75
-56
lines changed

9 files changed

+75
-56
lines changed

platforms/desktop-shared/application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ static void run_emulator(void)
753753
i = 0;
754754

755755
char title[256];
756-
sprintf(title, "%s %s - %s", GEARCOLECO_TITLE, GEARCOLECO_VERSION, emu_get_core()->GetCartridge()->GetFileName());
756+
snprintf(title, sizeof(title), "%s %s - %s", GEARCOLECO_TITLE, GEARCOLECO_VERSION, emu_get_core()->GetCartridge()->GetFileName());
757757
SDL_SetWindowTitle(sdl_window, title);
758758
}
759759
}

platforms/desktop-shared/config.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ void config_read(void)
215215
char pal_label_r[32];
216216
char pal_label_g[32];
217217
char pal_label_b[32];
218-
sprintf(pal_label_r, "CustomPalette%dR", i);
219-
sprintf(pal_label_g, "CustomPalette%dG", i);
220-
sprintf(pal_label_b, "CustomPalette%dB", i);
218+
snprintf(pal_label_r, sizeof(pal_label_r), "CustomPalette%dR", i);
219+
snprintf(pal_label_g, sizeof(pal_label_g), "CustomPalette%dG", i);
220+
snprintf(pal_label_b, sizeof(pal_label_b), "CustomPalette%dB", i);
221221
config_video.color[i].red = read_int("Video", pal_label_r, config_video.color[i].red);
222222
config_video.color[i].green = read_int("Video", pal_label_g, config_video.color[i].green);
223223
config_video.color[i].blue = read_int("Video", pal_label_b, config_video.color[i].blue);
@@ -374,9 +374,9 @@ void config_write(void)
374374
char pal_label_r[32];
375375
char pal_label_g[32];
376376
char pal_label_b[32];
377-
sprintf(pal_label_r, "CustomPalette%dR", i);
378-
sprintf(pal_label_g, "CustomPalette%dG", i);
379-
sprintf(pal_label_b, "CustomPalette%dB", i);
377+
snprintf(pal_label_r, sizeof(pal_label_r), "CustomPalette%dR", i);
378+
snprintf(pal_label_g, sizeof(pal_label_g), "CustomPalette%dG", i);
379+
snprintf(pal_label_b, sizeof(pal_label_b), "CustomPalette%dB", i);
380380
write_int("Video", pal_label_r, config_video.color[i].red);
381381
write_int("Video", pal_label_g, config_video.color[i].green);
382382
write_int("Video", pal_label_b, config_video.color[i].blue);

platforms/desktop-shared/emu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ void emu_get_info(char* info)
292292
int rom_banks = cart->GetROMBankCount();
293293
const char* mapper = get_mapper(cart->GetType());
294294

295-
sprintf(info, "File Name: %s\nMapper: %s\nRefresh Rate: %s\nCartridge Header: %s\nROM Banks: %d\nScreen Resolution: %dx%d", filename, mapper, pal, checksum, rom_banks, runtime.screen_width, runtime.screen_height);
295+
snprintf(info, 512, "File Name: %s\nMapper: %s\nRefresh Rate: %s\nCartridge Header: %s\nROM Banks: %d\nScreen Resolution: %dx%d", filename, mapper, pal, checksum, rom_banks, runtime.screen_width, runtime.screen_height);
296296
}
297297
else
298298
{
299-
sprintf(info, "There is no ROM loaded!");
299+
snprintf(info, 512, "There is no ROM loaded!");
300300
}
301301
}
302302

platforms/desktop-shared/gui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ static void main_menu(void)
608608
for (int i = 0; i < 16; i++)
609609
{
610610
char text[10] = {0};
611-
sprintf(text,"Color #%d", i + 1);
611+
snprintf(text, sizeof(text),"Color #%d", i + 1);
612612
if (ImGui::ColorEdit3(text, (float*)&custom_palette[i], ImGuiColorEditFlags_NoInputs))
613613
{
614614
update_palette();
@@ -1275,7 +1275,7 @@ static void keyboard_configuration_item(const char* text, SDL_Scancode* key, int
12751275
ImGui::SameLine(100);
12761276

12771277
char button_label[256];
1278-
sprintf(button_label, "%s##%s%d", SDL_GetScancodeName(*key), text, player);
1278+
snprintf(button_label, sizeof(button_label), "%s##%s%d", SDL_GetScancodeName(*key), text, player);
12791279

12801280
if (ImGui::Button(button_label, ImVec2(90,0)))
12811281
{
@@ -1292,7 +1292,7 @@ static void gamepad_configuration_item(const char* text, int* button, int player
12921292
static const char* gamepad_names[16] = {"A", "B", "X" ,"Y", "BACK", "GUID", "START", "L3", "R3", "L1", "R1", "UP", "DOWN", "LEFT", "RIGHT", "15"};
12931293

12941294
char button_label[256];
1295-
sprintf(button_label, "%s##%s%d", gamepad_names[*button], text, player);
1295+
snprintf(button_label, sizeof(button_label), "%s##%s%d", gamepad_names[*button], text, player);
12961296

12971297
if (ImGui::Button(button_label, ImVec2(70,0)))
12981298
{

platforms/desktop-shared/gui_debug.cpp

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static void memory_editor_menu(void)
314314
MemEditor::Bookmark* bookmark = &(*bookmarks)[i];
315315

316316
char label[80];
317-
snprintf(label, 80, "$%04X: %s", bookmark->address, bookmark->name);
317+
snprintf(label, sizeof(label), "$%04X: %s", bookmark->address, bookmark->name);
318318

319319
if (ImGui::MenuItem(label))
320320
{
@@ -508,7 +508,7 @@ static void debug_window_disassembler(void)
508508
ImGui::Separator();
509509

510510
if (IsValidPointer(selected_record))
511-
sprintf(brk_address_cpu, "%04X", selected_record->address);
511+
snprintf(brk_address_cpu, sizeof(brk_address_cpu), "%04X", selected_record->address);
512512

513513
ImGui::PushItemWidth(70);
514514
if (ImGui::InputTextWithHint("##add_breakpoint_cpu", "XXXX", brk_address_cpu, IM_ARRAYSIZE(brk_address_cpu), ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_EnterReturnsTrue))
@@ -835,128 +835,152 @@ static void debug_window_processor(void)
835835
ImGui::Separator();
836836
ImGui::TextColored(cyan, " A"); ImGui::SameLine();
837837
ImGui::Text(" $%02X", proc_state->AF->GetHigh());
838-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF->GetHigh()));
838+
char buffer[20];
839+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF->GetHigh()));
840+
ImGui::Text("%s", buffer);
839841

840842
ImGui::NextColumn();
841843
ImGui::TextColored(cyan, " F"); ImGui::SameLine();
842844
ImGui::Text(" $%02X", proc_state->AF->GetLow());
843-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF->GetLow()));
845+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF->GetLow()));
846+
ImGui::Text("%s", buffer);
844847

845848
ImGui::NextColumn();
846849
ImGui::Separator();
847850
ImGui::TextColored(cyan, " A'"); ImGui::SameLine();
848851
ImGui::Text("$%02X", proc_state->AF2->GetHigh());
849-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF2->GetHigh()));
852+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF2->GetHigh()));
853+
ImGui::Text("%s", buffer);
850854

851855
ImGui::NextColumn();
852856
ImGui::TextColored(cyan, " F'"); ImGui::SameLine();
853857
ImGui::Text("$%02X", proc_state->AF2->GetLow());
854-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF2->GetLow()));
858+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->AF2->GetLow()));
859+
ImGui::Text("%s", buffer);
855860

856861
ImGui::NextColumn();
857862
ImGui::Separator();
858863
ImGui::TextColored(cyan, " B"); ImGui::SameLine();
859864
ImGui::Text(" $%02X", proc_state->BC->GetHigh());
860-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC->GetHigh()));
865+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC->GetHigh()));
866+
ImGui::Text("%s", buffer);
861867

862868
ImGui::NextColumn();
863869
ImGui::TextColored(cyan, " C"); ImGui::SameLine();
864870
ImGui::Text(" $%02X", proc_state->BC->GetLow());
865-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC->GetLow()));
871+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC->GetLow()));
872+
ImGui::Text("%s", buffer);
866873

867874
ImGui::NextColumn();
868875
ImGui::Separator();
869876
ImGui::TextColored(cyan, " B'"); ImGui::SameLine();
870877
ImGui::Text("$%02X", proc_state->BC2->GetHigh());
871-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC2->GetHigh()));
878+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC2->GetHigh()));
879+
ImGui::Text("%s", buffer);
872880

873881
ImGui::NextColumn();
874882
ImGui::TextColored(cyan, " C'"); ImGui::SameLine();
875883
ImGui::Text("$%02X", proc_state->BC2->GetLow());
876-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC2->GetLow()));
884+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->BC2->GetLow()));
885+
ImGui::Text("%s", buffer);
877886

878887
ImGui::NextColumn();
879888
ImGui::Separator();
880889
ImGui::TextColored(cyan, " D"); ImGui::SameLine();
881890
ImGui::Text(" $%02X", proc_state->DE->GetHigh());
882-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE->GetHigh()));
891+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE->GetHigh()));
892+
ImGui::Text("%s", buffer);
883893

884894
ImGui::NextColumn();
885895
ImGui::TextColored(cyan, " E"); ImGui::SameLine();
886896
ImGui::Text(" $%02X", proc_state->DE->GetLow());
887-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE->GetLow()));
897+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE->GetLow()));
898+
ImGui::Text("%s", buffer);
888899

889900
ImGui::NextColumn();
890901
ImGui::Separator();
891902
ImGui::TextColored(cyan, " D'"); ImGui::SameLine();
892903
ImGui::Text("$%02X", proc_state->DE2->GetHigh());
893-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE2->GetHigh()));
904+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE2->GetHigh()));
905+
ImGui::Text("%s", buffer);
894906

895907
ImGui::NextColumn();
896908
ImGui::TextColored(cyan, " E'"); ImGui::SameLine();
897909
ImGui::Text("$%02X", proc_state->DE2->GetLow());
898-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE2->GetLow()));
910+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->DE2->GetLow()));
911+
ImGui::Text("%s", buffer);
899912

900913
ImGui::NextColumn();
901914
ImGui::Separator();
902915
ImGui::TextColored(cyan, " H"); ImGui::SameLine();
903916
ImGui::Text(" $%02X", proc_state->HL->GetHigh());
904-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL->GetHigh()));
917+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL->GetHigh()));
918+
ImGui::Text("%s", buffer);
905919

906920
ImGui::NextColumn();
907921
ImGui::TextColored(cyan, " L"); ImGui::SameLine();
908922
ImGui::Text(" $%02X", proc_state->HL->GetLow());
909-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL->GetLow()));
923+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL->GetLow()));
924+
ImGui::Text("%s", buffer);
910925

911926
ImGui::NextColumn();
912927
ImGui::Separator();
913928
ImGui::TextColored(cyan, " H'"); ImGui::SameLine();
914929
ImGui::Text("$%02X", proc_state->HL2->GetHigh());
915-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL2->GetHigh()));
930+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL2->GetHigh()));
931+
ImGui::Text("%s", buffer);
916932

917933
ImGui::NextColumn();
918934
ImGui::TextColored(cyan, " L'"); ImGui::SameLine();
919935
ImGui::Text("$%02X", proc_state->HL2->GetLow());
920-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL2->GetLow()));
936+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->HL2->GetLow()));
937+
ImGui::Text("%s", buffer);
921938

922939
ImGui::NextColumn();
923940
ImGui::Separator();
924941
ImGui::TextColored(cyan, " I"); ImGui::SameLine();
925942
ImGui::Text(" $%02X", *proc_state->I);
926-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(*proc_state->I));
943+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(*proc_state->I));
944+
ImGui::Text("%s", buffer);
927945

928946
ImGui::NextColumn();
929947
ImGui::TextColored(cyan, " R"); ImGui::SameLine();
930948
ImGui::Text(" $%02X", *proc_state->R);
931-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(*proc_state->R));
949+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(*proc_state->R));
950+
ImGui::Text("%s", buffer);
932951

933952
ImGui::NextColumn();
934953
ImGui::Columns(1);
935954

936955
ImGui::Separator();
937956
ImGui::TextColored(yellow, " IX"); ImGui::SameLine();
938957
ImGui::Text("= $%04X", proc_state->IX->GetValue());
939-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->IX->GetHigh()), BYTE_TO_BINARY(proc_state->IX->GetLow()));
958+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->IX->GetHigh()), BYTE_TO_BINARY(proc_state->IX->GetLow()));
959+
ImGui::Text("%s", buffer);
940960

941961
ImGui::Separator();
942962
ImGui::TextColored(yellow, " IY"); ImGui::SameLine();
943963
ImGui::Text("= $%04X", proc_state->IY->GetValue());
944-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->IY->GetHigh()), BYTE_TO_BINARY(proc_state->IY->GetLow()));
964+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->IY->GetHigh()), BYTE_TO_BINARY(proc_state->IY->GetLow()));
965+
ImGui::Text("%s", buffer);
945966

946967
ImGui::Separator();
947968
ImGui::TextColored(yellow, " WZ"); ImGui::SameLine();
948969
ImGui::Text("= $%04X", proc_state->WZ->GetValue());
949-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->WZ->GetHigh()), BYTE_TO_BINARY(proc_state->WZ->GetLow()));
970+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->WZ->GetHigh()), BYTE_TO_BINARY(proc_state->WZ->GetLow()));
971+
ImGui::Text("%s", buffer);
950972

951973
ImGui::Separator();
952974
ImGui::TextColored(yellow, " SP"); ImGui::SameLine();
953975
ImGui::Text("= $%04X", proc_state->SP->GetValue());
954-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->SP->GetHigh()), BYTE_TO_BINARY(proc_state->SP->GetLow()));
976+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->SP->GetHigh()), BYTE_TO_BINARY(proc_state->SP->GetLow()));
977+
ImGui::Text("%s", buffer);
955978

956979
ImGui::Separator();
957980
ImGui::TextColored(yellow, " PC"); ImGui::SameLine();
958981
ImGui::Text("= $%04X", proc_state->PC->GetValue());
959-
ImGui::Text(BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->PC->GetHigh()), BYTE_TO_BINARY(proc_state->PC->GetLow()));
982+
snprintf(buffer, sizeof(buffer), BYTE_TO_BINARY_PATTERN_SPACED " " BYTE_TO_BINARY_PATTERN_SPACED, BYTE_TO_BINARY(proc_state->PC->GetHigh()), BYTE_TO_BINARY(proc_state->PC->GetLow()));
983+
ImGui::Text("%s", buffer);
960984

961985
ImGui::Separator();
962986

@@ -1518,7 +1542,6 @@ static void add_breakpoint_cpu(void)
15181542
{
15191543
int input_len = (int)strlen(brk_address_cpu);
15201544
u16 target_address = 0;
1521-
int target_bank = 0;
15221545

15231546
try
15241547
{
@@ -1530,14 +1553,10 @@ static void add_breakpoint_cpu(void)
15301553
if (separator != std::string::npos)
15311554
{
15321555
target_address = (u16)std::stoul(str.substr(separator + 1 , std::string::npos), 0, 16);
1533-
1534-
target_bank = std::stoul(str.substr(0, separator), 0 , 16);
1535-
target_bank &= 0xFF;
15361556
}
15371557
}
15381558
else if (input_len == 4)
15391559
{
1540-
target_bank = 0;
15411560
target_address = (u16)std::stoul(brk_address_cpu, 0, 16);
15421561
}
15431562
else

platforms/desktop-shared/nfd/nfd_cocoa.mm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ nfdresult_t NFD_OpenDialogN(nfdnchar_t** outPath,
222222
const nfdnfilteritem_t* filterList,
223223
nfdfiltersize_t filterCount,
224224
const nfdnchar_t* defaultPath) {
225-
nfdopendialognargs_t args = {0};
225+
nfdopendialognargs_t args = { };
226226
args.filterList = filterList;
227227
args.filterCount = filterCount;
228228
args.defaultPath = defaultPath;
@@ -282,7 +282,7 @@ nfdresult_t NFD_OpenDialogMultipleN(const nfdpathset_t** outPaths,
282282
const nfdnfilteritem_t* filterList,
283283
nfdfiltersize_t filterCount,
284284
const nfdnchar_t* defaultPath) {
285-
nfdopendialognargs_t args = {0};
285+
nfdopendialognargs_t args = { };
286286
args.filterList = filterList;
287287
args.filterCount = filterCount;
288288
args.defaultPath = defaultPath;
@@ -348,7 +348,7 @@ nfdresult_t NFD_SaveDialogN(nfdnchar_t** outPath,
348348
nfdfiltersize_t filterCount,
349349
const nfdnchar_t* defaultPath,
350350
const nfdnchar_t* defaultName) {
351-
nfdsavedialognargs_t args = {0};
351+
nfdsavedialognargs_t args = { };
352352
args.filterList = filterList;
353353
args.filterCount = filterCount;
354354
args.defaultPath = defaultPath;
@@ -413,7 +413,7 @@ nfdresult_t NFD_SaveDialogU8_With_Impl(nfdversion_t version,
413413
}
414414

415415
nfdresult_t NFD_PickFolderN(nfdnchar_t** outPath, const nfdnchar_t* defaultPath) {
416-
nfdpickfoldernargs_t args = {0};
416+
nfdpickfoldernargs_t args = { };
417417
args.defaultPath = defaultPath;
418418
return NFD_PickFolderN_With_Impl(NFD_INTERFACE_VERSION, outPath, &args);
419419
}
@@ -465,7 +465,7 @@ nfdresult_t NFD_PickFolderU8_With_Impl(nfdversion_t version,
465465
}
466466

467467
nfdresult_t NFD_PickFolderMultipleN(const nfdpathset_t** outPaths, const nfdnchar_t* defaultPath) {
468-
nfdpickfoldernargs_t args = {0};
468+
nfdpickfoldernargs_t args = { };
469469
args.defaultPath = defaultPath;
470470
return NFD_PickFolderMultipleN_With_Impl(NFD_INTERFACE_VERSION, outPaths, &args);
471471
}

platforms/desktop-shared/stb/stb_image_write.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
773773
#ifdef __STDC_LIB_EXT1__
774774
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
775775
#else
776-
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
776+
len = snprintf(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
777777
#endif
778778
s->func(s->context, buffer, len);
779779

src/Processor.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ bool Processor::Disassemble(u16 address)
423423
if (i < record->size)
424424
{
425425
char value[8];
426-
sprintf(value, "%02X", bytes[i]);
426+
snprintf(value, sizeof(value), "%02X", bytes[i]);
427427
strcat(record->bytes, value);
428428
strcat(record->bytes, " ");
429429
}
@@ -444,26 +444,26 @@ bool Processor::Disassemble(u16 address)
444444
strcpy(record->name, info.name);
445445
break;
446446
case 1:
447-
sprintf(record->name, info.name, bytes[first]);
447+
snprintf(record->name, sizeof(record->name), info.name, bytes[first]);
448448
break;
449449
case 2:
450-
sprintf(record->name, info.name, bytes[first + 1]);
450+
snprintf(record->name, sizeof(record->name), info.name, bytes[first + 1]);
451451
break;
452452
case 3:
453453
record->jump = true;
454454
record->jump_address = (bytes[first + 2] << 8) | bytes[first + 1];
455-
sprintf(record->name, info.name, record->jump_address);
455+
snprintf(record->name, sizeof(record->name), info.name, record->jump_address);
456456
break;
457457
case 4:
458-
sprintf(record->name, info.name, (s8)bytes[first + 1]);
458+
snprintf(record->name, sizeof(record->name), info.name, (s8)bytes[first + 1]);
459459
break;
460460
case 5:
461461
record->jump = true;
462462
record->jump_address = address + info.size + (s8)bytes[first + 1];
463-
sprintf(record->name, info.name, record->jump_address, (s8)bytes[first + 1]);
463+
snprintf(record->name, sizeof(record->name), info.name, record->jump_address, (s8)bytes[first + 1]);
464464
break;
465465
case 6:
466-
sprintf(record->name, info.name, (s8)bytes[first + 1], bytes[first + 2]);
466+
snprintf(record->name, sizeof(record->name), info.name, (s8)bytes[first + 1], bytes[first + 2]);
467467
break;
468468
default:
469469
strcpy(record->name, "PARSE ERROR");

0 commit comments

Comments
 (0)