From 3b5c1fb022dc286b0480ccafa9b79f832deb24ce Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 21 Jul 2022 21:17:17 -0700 Subject: [PATCH] tests: Fix MSVC 2005 build ... I forgot we still support platforms without C99, 23 years later. --- tests/test_document.cpp | 5 +++++ tests/test_dom_traverse.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 6d016c3..fca6bd9 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -736,7 +736,12 @@ struct temp_file temp_file() { static int index = 0; + + #if __cplusplus >= 201103 snprintf(path, sizeof(path), "%stempfile%d", test_runner::_temp_path, index++); + #else + sprintf(path, "%stempfile%d", test_runner::_temp_path, index++); + #endif } ~temp_file() diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index b83aa74..29b4dfd 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -795,7 +795,12 @@ struct test_walker: xml_tree_walker std::basic_string depthstr() const { char buf[32]; + + #if __cplusplus >= 201103 snprintf(buf, sizeof(buf), "%d", depth()); + #else + sprintf(buf, "%d", depth()); + #endif #ifdef PUGIXML_WCHAR_MODE wchar_t wbuf[32];