From a624e066281d23fe8d5e36768e15ddf847693179 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Thu, 11 Feb 2021 21:04:56 +0330 Subject: [PATCH 04/11] snprintf! --- Modules/FindCUDA/select_compute_arch.cmake | 2 +- Source/cmProjectCommand.cxx | 2 +- Source/cmStringAlgorithms.cxx | 2 +- Tests/RunCMake/Android/android.cxx | 2 +- Utilities/cmjsoncpp/src/lib_json/json_reader.cpp | 4 ++-- Utilities/cmjsoncpp/src/lib_json/json_writer.cpp | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake index 9351288..6b31fc2 100644 --- a/Modules/FindCUDA/select_compute_arch.cmake +++ b/Modules/FindCUDA/select_compute_arch.cmake @@ -132,7 +132,7 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) " {\n" " cudaDeviceProp prop;\n" " if (cudaSuccess == cudaGetDeviceProperties(&prop, device))\n" - " std::printf(\"%d.%d \", prop.major, prop.minor);\n" + " printf(\"%d.%d \", prop.major, prop.minor);\n" " }\n" " return 0;\n" "}\n") diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index f8678b9..05a76ad 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -237,7 +237,7 @@ bool cmProjectCommand(std::vector const& args, &v[2], &v[3]); for (auto i = 0u; i < MAX_VERSION_COMPONENTS; ++i) { if (int(i) < vc) { - std::sprintf(vb[i], "%u", v[i]); + sprintf(vb[i], "%u", v[i]); version_string += &"."[std::size_t(i == 0)]; version_string += vb[i]; version_components[i] = vb[i]; diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx index e0af281..f0a50cc 100644 --- a/Source/cmStringAlgorithms.cxx +++ b/Source/cmStringAlgorithms.cxx @@ -152,7 +152,7 @@ template inline void MakeDigits(cm::string_view& view, char (&digits)[N], const char* pattern, T value) { - int res = std::snprintf(digits, N, pattern, value); + int res = snprintf(digits, N, pattern, value); if (res > 0 && res < static_cast(N)) { view = cm::string_view(digits, static_cast(res)); } diff --git a/Tests/RunCMake/Android/android.cxx b/Tests/RunCMake/Android/android.cxx index a6d8c55..f47611e 100644 --- a/Tests/RunCMake/Android/android.cxx +++ b/Tests/RunCMake/Android/android.cxx @@ -20,7 +20,7 @@ int main() { #if !defined(STL_NONE) // Require -lm implied by linking as C++. - std::printf("%p\n", static_cast(&std::sin)); + printf("%p\n", static_cast(&std::sin)); #endif #if defined(STL_NONE) return 0; diff --git a/Utilities/cmjsoncpp/src/lib_json/json_reader.cpp b/Utilities/cmjsoncpp/src/lib_json/json_reader.cpp index 6eeba0e..80389e5 100644 --- a/Utilities/cmjsoncpp/src/lib_json/json_reader.cpp +++ b/Utilities/cmjsoncpp/src/lib_json/json_reader.cpp @@ -24,7 +24,7 @@ #if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above #define snprintf sprintf_s #elif _MSC_VER >= 1900 // VC++ 14.0 and above -#define snprintf std::snprintf +#define snprintf snprintf #else #define snprintf _snprintf #endif @@ -32,7 +32,7 @@ #define snprintf snprintf #elif __cplusplus >= 201103L #if !defined(__MINGW32__) && !defined(__CYGWIN__) -#define snprintf std::snprintf +#define snprintf snprintf #endif #endif diff --git a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp index fc86505..abaa661 100644 --- a/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp +++ b/Utilities/cmjsoncpp/src/lib_json/json_writer.cpp @@ -50,7 +50,7 @@ #if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above #define snprintf sprintf_s #elif _MSC_VER >= 1900 // VC++ 14.0 and above -#define snprintf std::snprintf +#define snprintf snprintf #else #define snprintf _snprintf #endif @@ -58,7 +58,7 @@ #define snprintf snprintf #elif __cplusplus >= 201103L #if !defined(__MINGW32__) && !defined(__CYGWIN__) -#define snprintf std::snprintf +#define snprintf snprintf #endif #endif -- 2.30.1