diff options
author | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-04-03 16:40:17 +0200 |
---|---|---|
committer | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-04-13 14:14:10 +0200 |
commit | a8d90a776ead891b8eedf25979c6ef4cccb6fe49 (patch) | |
tree | 17ddd317e1b2deeaa88ec4e32592bcd14ea22a4d | |
parent | b41f852e16f78c093805bd17f410ea483e6e7939 (diff) | |
download | qt3d-a8d90a776ead891b8eedf25979c6ef4cccb6fe49.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.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: I8e24267a1ebfc0c3ff4f2f8afdcb7c6aed62db80
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-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)); |