From 1af96481b2e9bea4ad48cacf2f093ffc36b39d33 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Fri, 27 Mar 2026 00:10:39 +0900 Subject: [PATCH] [Build/MacOS] Fix sprintf deprecation warnings Convert to snprintf in trace_viewer and suppress in 3pp stb header. --- src/xenia/gpu/trace_dump.cc | 7 +++++++ src/xenia/gpu/trace_viewer.cc | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/xenia/gpu/trace_dump.cc b/src/xenia/gpu/trace_dump.cc index 2aa519366..6a27325c7 100644 --- a/src/xenia/gpu/trace_dump.cc +++ b/src/xenia/gpu/trace_dump.cc @@ -26,7 +26,14 @@ #define STB_IMAGE_WRITE_IMPLEMENTATION #undef _CRT_SECURE_NO_WARNINGS #undef _CRT_NONSTDC_NO_DEPRECATE +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif #include "third_party/stb/stb_image_write.h" +#ifdef __clang__ +#pragma clang diagnostic pop +#endif DEFINE_path(target_trace_file, "", "Specifies the trace file to load.", "GPU"); DEFINE_path(trace_dump_path, "", "Output path for dumped files.", "GPU"); diff --git a/src/xenia/gpu/trace_viewer.cc b/src/xenia/gpu/trace_viewer.cc index 830ebcfcc..1af05462d 100644 --- a/src/xenia/gpu/trace_viewer.cc +++ b/src/xenia/gpu/trace_viewer.cc @@ -1763,8 +1763,8 @@ void TraceViewer::DrawStateUI() { regs.GetVertexFetch(vertex_binding.fetch_constant); assert_true(fetch.endian == xenos::Endian::k8in32); char tree_root_id[32]; - sprintf(tree_root_id, "#vertices_root_%d", - vertex_binding.fetch_constant); + snprintf(tree_root_id, sizeof(tree_root_id), "#vertices_root_%d", + vertex_binding.fetch_constant); if (ImGui::TreeNode(tree_root_id, "vf%d: 0x%.8X (%db), %s", vertex_binding.fetch_constant, fetch.address << 2, fetch.size * 4,