diff options
author | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-04-03 16:40:17 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-04-13 13:35:03 +0000 |
commit | ad7b5076070307c7684adf5bf81b4d8c79b388e1 (patch) | |
tree | 30b764c2e060d1391c34f17587a3c02702d50c8c | |
parent | 3b24faf00f229a21ebd77d3241b51f2fdeb65279 (diff) | |
download | qt3d-ad7b5076070307c7684adf5bf81b4d8c79b388e1.tar.gz |
Silence warning about unsafe sprintf, use snprintf instead
Apple Clang, and clang also complains about this, and warnings like this
tend to break the unity build in certain situation. So, if possible, I
rather address them.
Task-number: QTBUG-109394
Change-Id: I8e24267a1ebfc0c3ff4f2f8afdcb7c6aed62db80
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit a8d90a776ead891b8eedf25979c6ef4cccb6fe49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/renderers/opengl/debug/imguirenderer.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/plugins/renderers/opengl/debug/imguirenderer.cpp b/src/plugins/renderers/opengl/debug/imguirenderer.cpp index 4a53117a0..6d52b515d 100644 --- a/src/plugins/renderers/opengl/debug/imguirenderer.cpp +++ b/src/plugins/renderers/opengl/debug/imguirenderer.cpp @@ -29,10 +29,6 @@ #define GL_VERTEX_ARRAY_BINDING 0x85B5 #endif -#ifdef _MSC_VER -#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen -#endif - QT_BEGIN_NAMESPACE using namespace Qt3DRender; @@ -162,7 +158,7 @@ void ImGuiRenderer::renderDebugOverlay(const std::vector<RenderView *> &renderVi { ImGui::Begin("Qt3D Profiling"); char caption[50]; - sprintf(caption, "Avg %.3f ms/frame (%.1f FPS)", static_cast<double>(1000.0f / ImGui::GetIO().Framerate), static_cast<double>(ImGui::GetIO().Framerate)); + snprintf(caption, sizeof(caption), "Avg %.3f ms/frame (%.1f FPS)", static_cast<double>(1000.0f / ImGui::GetIO().Framerate), static_cast<double>(ImGui::GetIO().Framerate)); ImGui::PlotLines("FPS", m_fpsLog, logIndex + 1, 0, caption, m_fpsRange.first, m_fpsRange.second, ImVec2(0, 80)); ImGui::PlotHistogram("Jobs", m_jobsLog, logIndex + 1, 0, nullptr, m_jobsRange.first, m_jobsRange.second, ImVec2(0, 80)); |