aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-04-30 01:39:48 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-04-30 01:39:48 +0300
commit0f68ff449b17745a4fab8f8336b4e94aaa453a57 (patch)
treee8a57af9fd361ab5d92551e561ae3b6ccdef4729
parent50a9e01725b3801e4f6ea11f91e45af5d6b1ccdc (diff)
downloadydb-0f68ff449b17745a4fab8f8336b4e94aaa453a57.tar.gz
Update contrib/restricted/boost/lexical_cast to 1.82.0
-rw-r--r--contrib/restricted/boost/core/include/boost/core/snprintf.hpp173
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp21
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp2
-rw-r--r--contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp2
12 files changed, 188 insertions, 26 deletions
diff --git a/contrib/restricted/boost/core/include/boost/core/snprintf.hpp b/contrib/restricted/boost/core/include/boost/core/snprintf.hpp
new file mode 100644
index 0000000000..91e252b4c4
--- /dev/null
+++ b/contrib/restricted/boost/core/include/boost/core/snprintf.hpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright Andrey Semashev 2022.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file snprintf.hpp
+ * \author Andrey Semashev
+ * \date 06.12.2022
+ *
+ * \brief The header provides more portable definition of snprintf and vsnprintf,
+ * as well as \c wchar_t counterparts.
+ */
+
+#ifndef BOOST_CORE_SNPRINTF_HPP_INCLUDED_
+#define BOOST_CORE_SNPRINTF_HPP_INCLUDED_
+
+#include <stdio.h>
+#include <wchar.h>
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+#if defined(__MINGW32__)
+
+#include <cstddef>
+#include <cstdarg>
+#if !defined(__MINGW64_VERSION_MAJOR)
+#include <climits>
+#endif
+
+// MinGW32 and MinGW-w64 provide their own snprintf implementations that are compliant with the C standard.
+#define BOOST_CORE_DETAIL_MINGW_SNPRINTF
+
+#elif (defined(BOOST_MSSTL_VERSION) && BOOST_MSSTL_VERSION < 140)
+
+#include <cstddef>
+#include <cstdarg>
+#include <climits>
+
+// MSVC snprintfs are not conforming but they are good enough for typical use cases.
+#define BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF
+
+#endif
+
+namespace boost {
+
+namespace core {
+
+#if defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
+
+#if defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF)
+
+inline int vsnprintf(char* buf, std::size_t size, const char* format, std::va_list args)
+{
+ return __mingw_vsnprintf(buf, size, format, args);
+}
+
+inline int vswprintf(wchar_t* buf, std::size_t size, const wchar_t* format, std::va_list args)
+{
+#if defined(__MINGW64_VERSION_MAJOR)
+ int res = __mingw_vsnwprintf(buf, size, format, args);
+ // __mingw_vsnwprintf returns the number of characters to be printed, but (v)swprintf is expected to return -1 on truncation
+ if (static_cast< unsigned int >(res) >= size)
+ res = -1;
+ return res;
+#else
+ // Legacy MinGW32 does not provide __mingw_vsnwprintf, so use _vsnwprintf from MSVC CRT
+ if (BOOST_UNLIKELY(size == 0u || size > static_cast< std::size_t >(INT_MAX)))
+ return -1;
+
+ int res = _vsnwprintf(buf, size, format, args);
+ // (v)swprintf is expected to return -1 on truncation, so we only need to ensure the output is null-terminated
+ if (static_cast< unsigned int >(res) >= size)
+ {
+ buf[size - 1u] = L'\0';
+ res = -1;
+ }
+
+ return res;
+#endif
+}
+
+#elif defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+// '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead.
+#pragma warning(disable: 4996)
+#endif
+
+inline int vsnprintf(char* buf, std::size_t size, const char* format, std::va_list args)
+{
+ if (BOOST_UNLIKELY(size == 0u))
+ return 0;
+ if (BOOST_UNLIKELY(size > static_cast< std::size_t >(INT_MAX)))
+ return -1;
+
+ buf[size - 1u] = '\0';
+ int res = _vsnprintf(buf, size, format, args);
+ if (static_cast< unsigned int >(res) >= size)
+ {
+ // _vsnprintf returns -1 if the output was truncated and in case of other errors.
+ // Detect truncation by checking whether the output buffer was written over entirely.
+ if (buf[size - 1u] != '\0')
+ {
+ buf[size - 1u] = '\0';
+ res = static_cast< int >(size);
+ }
+ }
+
+ return res;
+}
+
+inline int vswprintf(wchar_t* buf, std::size_t size, const wchar_t* format, std::va_list args)
+{
+ if (BOOST_UNLIKELY(size == 0u || size > static_cast< std::size_t >(INT_MAX)))
+ return -1;
+
+ int res = _vsnwprintf(buf, size, format, args);
+ // (v)swprintf is expected to return -1 on truncation, so we only need to ensure the output is null-terminated
+ if (static_cast< unsigned int >(res) >= size)
+ {
+ buf[size - 1u] = L'\0';
+ res = -1;
+ }
+
+ return res;
+}
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+#endif
+
+inline int snprintf(char* buf, std::size_t size, const char* format, ...)
+{
+ std::va_list args;
+ va_start(args, format);
+ int res = vsnprintf(buf, size, format, args);
+ va_end(args);
+ return res;
+}
+
+inline int swprintf(wchar_t* buf, std::size_t size, const wchar_t* format, ...)
+{
+ std::va_list args;
+ va_start(args, format);
+ int res = vswprintf(buf, size, format, args);
+ va_end(args);
+ return res;
+}
+
+#else // defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
+
+// Standard-conforming compilers already have the correct snprintfs
+using ::snprintf;
+using ::vsnprintf;
+
+using ::swprintf;
+using ::vswprintf;
+
+#endif // defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
+
+} // namespace core
+
+} // namespace boost
+
+#endif // BOOST_CORE_SNPRINTF_HPP_INCLUDED_
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp
index b9304f7684..d2838be986 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp
index 3a2c704998..2dfc77abcf 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp
index 23a2f57f54..39b2bbf2bd 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp
index 17c6cf9b70..04383bf3af 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -38,6 +38,7 @@
#include <boost/static_assert.hpp>
#include <boost/detail/lcast_precision.hpp>
#include <boost/detail/workaround.hpp>
+#include <boost/core/snprintf.hpp>
#ifndef BOOST_NO_STD_LOCALE
# include <locale>
@@ -279,11 +280,7 @@ namespace boost {
using namespace std;
const double val_as_double = val;
finish = start +
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
- sprintf_s(begin, CharacterBufferSize,
-#else
- sprintf(begin,
-#endif
+ boost::core::snprintf(begin, CharacterBufferSize,
"%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val_as_double);
return finish > start;
}
@@ -291,11 +288,7 @@ namespace boost {
bool shl_real_type(double val, char* begin) {
using namespace std;
finish = start +
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
- sprintf_s(begin, CharacterBufferSize,
-#else
- sprintf(begin,
-#endif
+ boost::core::snprintf(begin, CharacterBufferSize,
"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val);
return finish > start;
}
@@ -304,11 +297,7 @@ namespace boost {
bool shl_real_type(long double val, char* begin) {
using namespace std;
finish = start +
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
- sprintf_s(begin, CharacterBufferSize,
-#else
- sprintf(begin,
-#endif
+ boost::core::snprintf(begin, CharacterBufferSize,
"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double>()), val );
return finish > start;
}
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp
index 86c278f7c9..853e254f8d 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp
index dd68b173e5..ef53e524eb 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp
index dd6ff06adc..176dd3dc0d 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp
index 6be846c74b..e2069a56b3 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
index 3aa6d57400..e4a581eaee 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp
index a5427bb158..ca1e39d699 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp
index b1a52be429..d326f12110 100644
--- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp
+++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp
@@ -1,6 +1,6 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
-// Copyright Antony Polukhin, 2011-2022.
+// Copyright Antony Polukhin, 2011-2023.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at