From ab8453c57221917cad0a268aa43e8c7d6826a67d Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 21 Jul 2022 20:51:26 -0700 Subject: [PATCH] tests: Use snprintf instead of sprintf sprintf now results in a deprecation warning in Xcode 14 beta. --- tests/test_document.cpp | 2 +- tests/test_dom_traverse.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 0e0bad4..6d016c3 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -736,7 +736,7 @@ struct temp_file temp_file() { static int index = 0; - sprintf(path, "%stempfile%d", test_runner::_temp_path, index++); + snprintf(path, sizeof(path), "%stempfile%d", test_runner::_temp_path, index++); } ~temp_file() diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 4a2403d..b83aa74 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -795,7 +795,7 @@ struct test_walker: xml_tree_walker std::basic_string depthstr() const { char buf[32]; - sprintf(buf, "%d", depth()); + snprintf(buf, sizeof(buf), "%d", depth()); #ifdef PUGIXML_WCHAR_MODE wchar_t wbuf[32];