ladybird/Ports/cmake/patches/0004-snprintf.patch
AnotherTest 80d6f46d4e Ports: Add a cmake port
Yes, you build this *inside* serenity.
2021-02-15 17:32:56 +01:00

113 lines
4.2 KiB
Diff

From a624e066281d23fe8d5e36768e15ddf847693179 Mon Sep 17 00:00:00 2001
From: AnotherTest <ali.mpfard@gmail.com>
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<std::string> 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 <std::size_t N, typename T>
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<int>(N)) {
view = cm::string_view(digits, static_cast<std::size_t>(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<double (*)(double)>(&std::sin));
+ printf("%p\n", static_cast<double (*)(double)>(&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