diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-09-13 00:02:01 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-09-13 00:02:01 +0300 |
commit | c7de57e4744e7575f21f74bb45f2a417d356ea5e (patch) | |
tree | 135cd7d2cf1787441107d727bd501c3d836e0478 | |
parent | 87c7569ea3c8aa5d371e9e3d15a8668c5cfcc4fc (diff) | |
download | ydb-c7de57e4744e7575f21f74bb45f2a417d356ea5e.tar.gz |
Update contrib/restricted/boost/iostreams to 1.80.0
39 files changed, 752 insertions, 101 deletions
diff --git a/contrib/restricted/boost/iostreams/CMakeLists.txt b/contrib/restricted/boost/iostreams/CMakeLists.txt index 51a3db13d5..56da4b0c4e 100644 --- a/contrib/restricted/boost/iostreams/CMakeLists.txt +++ b/contrib/restricted/boost/iostreams/CMakeLists.txt @@ -18,12 +18,14 @@ target_include_directories(restricted-boost-iostreams PUBLIC ) target_include_directories(restricted-boost-iostreams PRIVATE ${CMAKE_SOURCE_DIR}/contrib/libs/libbz2 + ${CMAKE_SOURCE_DIR}/contrib/libs/zstd/include ) target_link_libraries(restricted-boost-iostreams PUBLIC contrib-libs-cxxsupp contrib-libs-libbz2 contrib-libs-lzma ZLIB::ZLIB + contrib-libs-zstd restricted-boost-assert restricted-boost-bind restricted-boost-config @@ -50,4 +52,5 @@ target_sources(restricted-boost-iostreams PRIVATE ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/iostreams/src/lzma.cpp ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/iostreams/src/mapped_file.cpp ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/iostreams/src/zlib.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/iostreams/src/zstd.cpp ) diff --git a/contrib/restricted/boost/iostreams/LICENSE b/contrib/restricted/boost/iostreams/LICENSE new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/contrib/restricted/boost/iostreams/LICENSE @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/iostreams/README.md b/contrib/restricted/boost/iostreams/README.md new file mode 100644 index 0000000000..5bdc70d40a --- /dev/null +++ b/contrib/restricted/boost/iostreams/README.md @@ -0,0 +1,39 @@ +Iostreams, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides: + +* Tools to make it easy to create standard C++ streams and stream buffers for accessing new Sources and Sinks. +* A framework for defining filters and attaching them to standard streams and stream buffers. +* A collection of ready-to-use Filters, Sources and Sinks. +* Utilities to save and restore stream state. + +### License + +Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + +### Properties + +* C++03 +* Requires a Link Library + +### Build Status + +Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | +:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | +[`master`](https://github.com/boostorg/iostreams/tree/master) | [![Build Status](https://travis-ci.org/boostorg/iostreams.svg?branch=master)](https://travis-ci.org/boostorg/iostreams) | [![Build status](https://ci.appveyor.com/api/projects/status/github/boostorg/iostreams?branch=master&svg=true)](https://ci.appveyor.com/project/eldiener/iostreams/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16463/badge.svg)](https://scan.coverity.com/projects/boostorg-iostreams) | [![codecov](https://codecov.io/gh/boostorg/iostreams/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/iostreams/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/iostreams.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/iostreams.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/iostreams.html) +[`develop`](https://github.com/boostorg/iostreams/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/iostreams.svg?branch=develop)](https://travis-ci.org/boostorg/iostreams) | [![Build status](https://ci.appveyor.com/api/projects/status/github/boostorg/iostreams?branch=develop&svg=true)](https://ci.appveyor.com/project/eldiener/iostreams/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16463/badge.svg)](https://scan.coverity.com/projects/boostorg-iostreams) | [![codecov](https://codecov.io/gh/boostorg/iostreams/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/iostreams/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/iostreams.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/iostreams.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/iostreams.html) + +### Directories + +| Name | Purpose | +| ----------- | ------------------------------ | +| `doc` | documentation | +| `example` | examples | +| `include` | headers | +| `test` | unit tests | + +### More information + +* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-iostreams) +* [Report bugs](https://github.com/boostorg/iostreams/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. +* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). +* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[iostreams]` tag at the beginning of the subject line. + diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/chain.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/chain.hpp index 4e108c8b09..a7d7dd710f 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/chain.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/chain.hpp @@ -17,11 +17,11 @@ #include <iterator> // advance. #include <list> #include <memory> // allocator, auto_ptr or unique_ptr. -#include <typeinfo> #include <stdexcept> // logic_error, out_of_range. #include <boost/checked_delete.hpp> #include <boost/config.hpp> // BOOST_MSVC, template friends, #include <boost/detail/workaround.hpp> // BOOST_NESTED_TEMPLATE +#include <boost/core/typeinfo.hpp> #include <boost/iostreams/constants.hpp> #include <boost/iostreams/detail/access_control.hpp> #include <boost/iostreams/detail/char_traits.hpp> @@ -164,7 +164,7 @@ public: //----------Direct component access---------------------------------------// - const std::type_info& component_type(int n) const + const boost::core::typeinfo& component_type(int n) const { if (static_cast<size_type>(n) >= size()) boost::throw_exception(std::out_of_range("bad chain offset")); @@ -173,7 +173,7 @@ public: // Deprecated. template<int N> - const std::type_info& component_type() const { return component_type(N); } + const boost::core::typeinfo& component_type() const { return component_type(N); } template<typename T> T* component(int n) const { return component(n, boost::type<T>()); } @@ -191,7 +191,7 @@ public: if (static_cast<size_type>(n) >= size()) boost::throw_exception(std::out_of_range("bad chain offset")); streambuf_type* link = *boost::next(list().begin(), n); - if (BOOST_IOSTREAMS_COMPARE_TYPE_ID(link->component_type(), typeid(T))) + if (BOOST_IOSTREAMS_COMPARE_TYPE_ID(link->component_type(), BOOST_CORE_TYPEID(T))) return static_cast<T*>(link->component_impl()); else return 0; @@ -455,12 +455,12 @@ public: chain_client(chain_client* client) : chain_(client->chain_) { } virtual ~chain_client() { } - const std::type_info& component_type(int n) const + const boost::core::typeinfo& component_type(int n) const { return chain_->component_type(n); } // Deprecated. template<int N> - const std::type_info& component_type() const + const boost::core::typeinfo& component_type() const { return chain_->BOOST_NESTED_TEMPLATE component_type<N>(); } template<typename T> @@ -498,7 +498,7 @@ protected: void set_chain(chain_type* c) { chain_ = c; chain_->register_client(this); } #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) && \ - (!BOOST_WORKAROUND(__BORLANDC__, < 0x600)) + (!BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600)) template<typename S, typename C, typename T, typename A, typename M> friend class chain_base; #else diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/concept_adapter.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/concept_adapter.hpp index 5ca878b55a..f04f964c50 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/concept_adapter.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/concept_adapter.hpp @@ -120,7 +120,7 @@ public: std::streamsize optimal_buffer_size() const { return iostreams::optimal_buffer_size(t_); } private: - BOOST_DELETED_FUNCTION(concept_adapter& operator=(const concept_adapter&)); + BOOST_DELETED_FUNCTION(concept_adapter& operator=(const concept_adapter&)) value_type t_; }; diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp index 623cf769d2..85794d0daa 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp @@ -28,7 +28,7 @@ public: { std::streamsize result = 0; while (result < n) { - std::streamsize amt = iostreams::read(device_, s, n); + std::streamsize amt = iostreams::read(device_, s + result, n - result); if (amt == -1) break; result += amt; diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/range_adapter.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/range_adapter.hpp index b7fe56f7ed..fa152f65c0 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/range_adapter.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/adapter/range_adapter.hpp @@ -10,20 +10,20 @@ #if defined(_MSC_VER) # pragma once -#endif +#endif #include <algorithm> // min. #include <boost/assert.hpp> #include <cstddef> // ptrdiff_t. #include <iosfwd> // streamsize, streamoff. -#include <boost/detail/iterator.hpp> // boost::iterator_traits. +#include <iterator> // iterator_traits. #include <boost/iostreams/categories.hpp> #include <boost/iostreams/detail/error.hpp> #include <boost/iostreams/positioning.hpp> #include <boost/mpl/if.hpp> #include <boost/throw_exception.hpp> #include <boost/type_traits/is_convertible.hpp> -#include <boost/utility/enable_if.hpp> +#include <boost/core/enable_if.hpp> // Must come last. #include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC. @@ -44,7 +44,7 @@ template<typename Mode, typename Range> class range_adapter { private: typedef typename Range::iterator iterator; - typedef boost::detail::iterator_traits<iterator> iter_traits; + typedef std::iterator_traits<iterator> iter_traits; typedef typename iter_traits::iterator_category iter_cat; public: typedef typename Range::value_type char_type; diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/bool_trait_def.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/bool_trait_def.hpp index c3fb9d587b..758e1cc41c 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/bool_trait_def.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/bool_trait_def.hpp @@ -21,7 +21,7 @@ // Description: Used to generate the traits classes is_istream, is_ostream, // etc. // -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582)) # define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) #else # define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) BOOST_PP_CAT(trait, _impl_):: diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/buffer.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/buffer.hpp index 35cb33c700..59617f4eb3 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/buffer.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/buffer.hpp @@ -205,7 +205,7 @@ void basic_buffer<Ch, Alloc>::swap(basic_buffer& rhs) template<typename Ch, typename Alloc> buffer<Ch, Alloc>::buffer(std::streamsize buffer_size) - : basic_buffer<Ch, Alloc>(buffer_size) { } + : basic_buffer<Ch, Alloc>(buffer_size), ptr_(data()), eptr_(data() + buffer_size) { } template<typename Ch, typename Alloc> inline void buffer<Ch, Alloc>::set(std::streamsize ptr, std::streamsize end) diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/auto_link.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/auto_link.hpp index 07ab23c3c1..be7dc63d1f 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/auto_link.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/auto_link.hpp @@ -17,7 +17,7 @@ #if defined(BOOST_EXTERNAL_LIB_NAME) # if defined(BOOST_MSVC) \ - || defined(__BORLANDC__) \ + || defined(__BORLANDC__) && !defined(__clang__) \ || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ || (defined(__ICL) && defined(_MSC_EXTENSIONS)) \ /**/ diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/bzip2.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/bzip2.hpp index bfcda40560..4c8bc91dd8 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/bzip2.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/bzip2.hpp @@ -15,9 +15,11 @@ # pragma once #endif +#include <boost/config.hpp> // BOOST_STRINGIZE. + #if defined(BOOST_BZIP2_BINARY) # if defined(BOOST_MSVC) || \ - defined(__BORLANDC__) || \ + defined(BOOST_BORLANDC) || \ (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) || \ (defined(__ICL) && defined(_MSC_EXTENSIONS)) \ /**/ diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/codecvt.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/codecvt.hpp index 6519ddcd44..13eb394d08 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/codecvt.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/codecvt.hpp @@ -42,7 +42,7 @@ //------------------Normalize codecvt::length---------------------------------// -#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) && \ +#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) && !defined(__clang__) && \ (!defined(BOOST_RWSTD_VER) || BOOST_RWSTD_VER < 0x04010300) && \ (!defined(__MACH__) || !defined(__INTEL_COMPILER)) /**/ @@ -68,7 +68,7 @@ namespace std { #if defined(__LIBCOMO__) using ::mbstate_t; -#elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__) +#elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(BOOST_BORLANDC) using ::mbstate_t; #elif defined(__SGI_STL_PORT) #elif defined(BOOST_NO_STDC_NAMESPACE) diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/disable_warnings.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/disable_warnings.hpp index ef25cdb907..344c6c1cb6 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/disable_warnings.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/disable_warnings.hpp @@ -20,7 +20,7 @@ # pragma warning(disable:6334) // sizeof applied to an expression with an operator. # endif #else -# if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) # pragma warn -8008 // Condition always true/false. # pragma warn -8066 // Unreachable code. # pragma warn -8071 // Conversion may lose significant digits. diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/enable_warnings.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/enable_warnings.hpp index 5712f36442..f04f525a73 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/enable_warnings.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/enable_warnings.hpp @@ -8,7 +8,7 @@ #if defined(BOOST_MSVC) # pragma warning(pop) #else -# if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) # pragma warn .8008 // Condition always true/false. # pragma warn .8066 // Unreachable code. # pragma warn .8071 // Conversion may lose significant digits. diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/overload_resolution.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/overload_resolution.hpp index 63d9e2830d..5b98221eca 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/overload_resolution.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/overload_resolution.hpp @@ -21,7 +21,7 @@ #if !defined(BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION) # if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) || \ - BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) \ /**/ # define BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION # endif diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/rtl.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/rtl.hpp index d9fbe5080d..b1a046f2a7 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/rtl.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/rtl.hpp @@ -23,7 +23,7 @@ #include <boost/iostreams/detail/config/windows_posix.hpp> // Handle open, close, read, and write -#ifdef __BORLANDC__ +#ifdef BOOST_BORLANDC # define BOOST_IOSTREAMS_RTL(x) BOOST_JOIN(_rtl_, x) #elif defined BOOST_IOSTREAMS_WINDOWS # define BOOST_IOSTREAMS_RTL(x) BOOST_JOIN(_, x) diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/wide_streams.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/wide_streams.hpp index af3d716d49..ca8dff38f5 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/wide_streams.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/wide_streams.hpp @@ -44,8 +44,7 @@ //------------------Locale support--------------------------------------------// #ifndef BOOST_IOSTREAMS_NO_LOCALE -# if defined(BOOST_NO_STD_LOCALE) || \ - defined(__CYGWIN__) && \ +# if defined(BOOST_NO_STD_LOCALE) && \ ( !defined(__MSL_CPP__) || defined(_MSL_NO_WCHART_CPP_SUPPORT) ) \ /**/ # define BOOST_IOSTREAMS_NO_LOCALE diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/zlib.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/zlib.hpp index 017dd0c182..576f5acaef 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/zlib.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/config/zlib.hpp @@ -19,7 +19,7 @@ #if defined(BOOST_ZLIB_BINARY) # if defined(BOOST_MSVC) || \ - defined(__BORLANDC__) || \ + defined(BOOST_BORLANDC) || \ (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) || \ (defined(__ICL) && defined(_MSC_EXTENSIONS)) \ /**/ diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/enable_if_stream.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/enable_if_stream.hpp index 826e44d2a5..2ead3d9ec3 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/enable_if_stream.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/enable_if_stream.hpp @@ -13,11 +13,12 @@ #endif #include <boost/config.hpp> // BOOST_NO_SFINAE. +#include <boost/config/workaround.hpp> #include <boost/utility/enable_if.hpp> #include <boost/iostreams/traits_fwd.hpp> // is_std_io. #if !defined(BOOST_NO_SFINAE) && \ - !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592)) # define BOOST_IOSTREAMS_ENABLE_IF_STREAM(T) \ , typename boost::enable_if< boost::iostreams::is_std_io<T> >::type* = 0 \ /**/ diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/execute.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/execute.hpp index 28e4217234..e5a9f7424a 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/execute.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/execute.hpp @@ -67,7 +67,7 @@ struct execute_traits_impl<void> { template< typename Op, typename Result = // VC6.5 workaround. #if !defined(BOOST_NO_RESULT_OF) && \ - !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592)) typename boost::result_of<Op()>::type #else BOOST_DEDUCED_TYPENAME Op::result_type diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/forward.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/forward.hpp index f5ed4f85dc..4e78f1e364 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/forward.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/forward.hpp @@ -102,7 +102,7 @@ // Disable forwarding constructors if first parameter type is the same // as the device type #if !defined(BOOST_NO_SFINAE) && \ - !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592)) # define BOOST_IOSTREAMS_DISABLE_IF_SAME(device, param) \ , typename boost::disable_if< boost::is_same<device, param> >::type* = 0 \ /**/ diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/functional.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/functional.hpp index dc8554c00f..e923e0dea0 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/functional.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/functional.hpp @@ -39,7 +39,7 @@ public: device_close_operation(const device_close_operation&) = default; void operator()() const { boost::iostreams::close(t_, which_); } private: - BOOST_DELETED_FUNCTION(device_close_operation& operator=(const device_close_operation&)); + BOOST_DELETED_FUNCTION(device_close_operation& operator=(const device_close_operation&)) T& t_; BOOST_IOS::openmode which_; }; @@ -54,7 +54,7 @@ public: filter_close_operation(const filter_close_operation&) = default; void operator()() const { boost::iostreams::close(t_, snk_, which_); } private: - BOOST_DELETED_FUNCTION(filter_close_operation& operator=(const filter_close_operation&)); + BOOST_DELETED_FUNCTION(filter_close_operation& operator=(const filter_close_operation&)) T& t_; Sink& snk_; BOOST_IOS::openmode which_; @@ -81,7 +81,7 @@ public: device_close_all_operation(const device_close_all_operation& ohter) = default; void operator()() const { detail::close_all(t_); } private: - BOOST_DELETED_FUNCTION(device_close_all_operation& operator=(const device_close_all_operation&)); + BOOST_DELETED_FUNCTION(device_close_all_operation& operator=(const device_close_all_operation&)) T& t_; }; @@ -92,7 +92,7 @@ public: filter_close_all_operation(T& t, Sink& snk) : t_(t), snk_(snk) { } void operator()() const { detail::close_all(t_, snk_); } private: - BOOST_DELETED_FUNCTION(filter_close_all_operation& operator=(const filter_close_all_operation&)); + BOOST_DELETED_FUNCTION(filter_close_all_operation& operator=(const filter_close_all_operation&)) T& t_; Sink& snk_; }; @@ -119,7 +119,7 @@ public: void operator()() const { t_.close(which_); } member_close_operation(member_close_operation const& other) = default; private: - BOOST_DELETED_FUNCTION(member_close_operation& operator=(const member_close_operation&)); + BOOST_DELETED_FUNCTION(member_close_operation& operator=(const member_close_operation&)) T& t_; BOOST_IOS::openmode which_; }; @@ -138,7 +138,7 @@ public: reset_operation(reset_operation const& other) = default; void operator()() const { t_.reset(); } private: - BOOST_DELETED_FUNCTION(reset_operation& operator=(const reset_operation&)); + BOOST_DELETED_FUNCTION(reset_operation& operator=(const reset_operation&)) T& t_; }; @@ -154,7 +154,7 @@ public: clear_flags_operation(T& t) : t_(t) { } void operator()() const { t_ = 0; } private: - BOOST_DELETED_FUNCTION(clear_flags_operation& operator=(const clear_flags_operation&)); + BOOST_DELETED_FUNCTION(clear_flags_operation& operator=(const clear_flags_operation&)) T& t_; }; @@ -178,7 +178,7 @@ public: buf_.flush(dev_); } private: - BOOST_DELETED_FUNCTION(flush_buffer_operation& operator=(const flush_buffer_operation&)); + BOOST_DELETED_FUNCTION(flush_buffer_operation& operator=(const flush_buffer_operation&)) Buffer& buf_; Device& dev_; bool flush_; diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/ios.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/ios.hpp index b123ddeb58..d09a2d6138 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/ios.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/ios.hpp @@ -32,7 +32,7 @@ namespace boost { namespace iostreams { namespace detail { #ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------------------// # define BOOST_IOSTREAMS_BASIC_IOS(ch, tr) std::basic_ios< ch, tr > # if !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) && \ - !BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) \ /**/ #define BOOST_IOS std::ios diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/optional.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/optional.hpp index 867dfbda69..7146e4c199 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/optional.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/optional.hpp @@ -83,7 +83,7 @@ public: void reset() { if (initialized_) { - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || \ + #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) || \ BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ /**/ T* t = static_cast<T*>(address()); diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/push.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/push.hpp index 1a9393cb02..d66740edf4 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/push.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/push.hpp @@ -53,7 +53,7 @@ BOOST_IOSTREAMS_PUSH_ARGS() ); \ /**/ -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ +#if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) \ /**/ # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES # define BOOST_IOSTREAMS_DEFINE_PUSH_IMPL(name, mode, ch, helper, has_return, result) \ diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/resolve.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/resolve.hpp index 2d480950e1..00d2442c7e 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/resolve.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/resolve.hpp @@ -167,7 +167,7 @@ struct resolve_traits { is_array<T>, array_adapter<Mode, T>, else_, - #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) + #if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) const T& #else T @@ -196,7 +196,7 @@ typename resolve_traits<Mode, Ch, T>::type resolve(const T& t BOOST_IOSTREAMS_DISABLE_IF_STREAM(T)) { return resolve<Mode, Ch>(t, is_std_io<T>()); } -# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \ +# if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) && \ !defined(__GNUC__) // ---------------------------------------------------// template<typename Mode, typename Ch, typename T> diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp index 69efe2b128..a55c4621ef 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp @@ -14,9 +14,9 @@ #include <boost/assert.hpp> #include <cstddef> -#include <typeinfo> #include <utility> // pair. #include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME, +#include <boost/core/typeinfo.hpp> #include <boost/iostreams/detail/char_traits.hpp> // member template friends. #include <boost/iostreams/detail/config/wide_streams.hpp> #include <boost/iostreams/detail/error.hpp> @@ -74,7 +74,7 @@ protected: // Declared in linked_streambuf. void close_impl(BOOST_IOS::openmode m); - const std::type_info& component_type() const { return typeid(T); } + const boost::core::typeinfo& component_type() const { return BOOST_CORE_TYPEID(T); } void* component_impl() { return component(); } #ifdef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES public: diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp index 90e1e11531..9f159a3697 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp @@ -16,9 +16,9 @@ #include <algorithm> // min, max. #include <cassert> #include <exception> -#include <typeinfo> #include <boost/config.hpp> // Member template friends. #include <boost/detail/workaround.hpp> +#include <boost/core/typeinfo.hpp> #include <boost/iostreams/constants.hpp> #include <boost/iostreams/detail/adapter/concept_adapter.hpp> #include <boost/iostreams/detail/buffer.hpp> @@ -94,7 +94,7 @@ protected: // Declared in linked_streambuf. void set_next(streambuf_type* next); void close_impl(BOOST_IOS::openmode m); - const std::type_info& component_type() const { return typeid(T); } + const boost::core::typeinfo& component_type() const { return BOOST_CORE_TYPEID(T); } void* component_impl() { return component(); } private: @@ -390,11 +390,18 @@ inline void indirect_streambuf<T, Tr, Alloc, Mode>::close_impl sync(); setp(0, 0); } + #if defined(BOOST_MSVC) + #pragma warning(push) + #pragma warning(disable: 4127) // conditional expression is constant + #endif if ( !is_convertible<category, dual_use>::value || is_convertible<Mode, input>::value == (which == BOOST_IOS::in) ) { obj().close(which, next_); } + #if defined(BOOST_MSVC) + #pragma warning(pop) + #endif } //----------State changing functions------------------------------------------// diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/linked_streambuf.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/linked_streambuf.hpp index 9999ded62f..708c2c42ab 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/linked_streambuf.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/detail/streambuf/linked_streambuf.hpp @@ -12,8 +12,8 @@ # pragma once #endif -#include <typeinfo> #include <boost/config.hpp> // member template friends. +#include <boost/core/typeinfo.hpp> #include <boost/iostreams/detail/char_traits.hpp> #include <boost/iostreams/detail/ios.hpp> // openmode. #include <boost/iostreams/detail/streambuf.hpp> @@ -91,7 +91,7 @@ protected: virtual bool auto_close() const = 0; virtual void set_auto_close(bool) = 0; virtual bool strict_sync() = 0; - virtual const std::type_info& component_type() const = 0; + virtual const boost::core::typeinfo& component_type() const = 0; virtual void* component_impl() = 0; #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS private: diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/bzip2.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/bzip2.hpp index b9c04a7ce1..435a9d3bde 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/bzip2.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/bzip2.hpp @@ -175,6 +175,7 @@ protected: int check_end(const char* src_begin, const char* dest_begin); int compress(int action); int decompress(); + int end(bool compress, std::nothrow_t); void end(bool compress); private: void do_init( bool compress, @@ -194,13 +195,14 @@ private: template<typename Alloc = std::allocator<char> > class bzip2_compressor_impl : public bzip2_base, - #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) + #if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) public #endif bzip2_allocator<Alloc> { public: bzip2_compressor_impl(const bzip2_params&); + ~bzip2_compressor_impl(); bool filter( const char*& src_begin, const char* src_end, char*& dest_begin, char* dest_end, bool flush ); void close(); @@ -217,13 +219,14 @@ private: template<typename Alloc = std::allocator<char> > class bzip2_decompressor_impl : public bzip2_base, - #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) + #if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) public #endif bzip2_allocator<Alloc> { public: bzip2_decompressor_impl(bool small = bzip2::default_small); + ~bzip2_decompressor_impl(); bool filter( const char*& begin_in, const char* end_in, char*& begin_out, char* end_out, bool flush ); void close(); @@ -314,6 +317,10 @@ bzip2_compressor_impl<Alloc>::bzip2_compressor_impl(const bzip2_params& p) : bzip2_base(p), eof_(false) { } template<typename Alloc> +bzip2_compressor_impl<Alloc>::~bzip2_compressor_impl() +{ (void) bzip2_base::end(true, std::nothrow); } + +template<typename Alloc> bool bzip2_compressor_impl<Alloc>::filter ( const char*& src_begin, const char* src_end, char*& dest_begin, char* dest_end, bool flush ) @@ -350,26 +357,32 @@ bzip2_decompressor_impl<Alloc>::bzip2_decompressor_impl(bool small) : bzip2_base(bzip2_params(small)), eof_(false) { } template<typename Alloc> +bzip2_decompressor_impl<Alloc>::~bzip2_decompressor_impl() +{ (void) bzip2_base::end(false, std::nothrow); } + +template<typename Alloc> bool bzip2_decompressor_impl<Alloc>::filter ( const char*& src_begin, const char* src_end, char*& dest_begin, char* dest_end, bool flush ) { - if (eof_) { - // reset the stream if there are more characters - if(src_begin == src_end) - return false; - else - close(); - } - if (!ready()) - init(); - before(src_begin, src_end, dest_begin, dest_end); - int result = decompress(); - if(result == bzip2::ok && flush) - result = check_end(src_begin, dest_begin); - after(src_begin, dest_begin); - bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); - eof_ = result == bzip2::stream_end; + do { + if (eof_) { + // reset the stream if there are more characters + if(src_begin == src_end) + return false; + else + close(); + } + if (!ready()) + init(); + before(src_begin, src_end, dest_begin, dest_end); + int result = decompress(); + if(result == bzip2::ok && flush) + result = check_end(src_begin, dest_begin); + after(src_begin, dest_begin); + bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); + eof_ = result == bzip2::stream_end; + } while (eof_ && src_begin != src_end && dest_begin != dest_end); return true; } diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/lzma.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/lzma.hpp index 94cd2b3b54..858474c011 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/lzma.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/lzma.hpp @@ -87,10 +87,12 @@ const int null = 0; struct lzma_params { // Non-explicit constructor. - lzma_params( uint32_t level = lzma::default_compression ) + lzma_params( uint32_t level = lzma::default_compression, uint32_t threads = 1 ) : level(level) + , threads(threads) { } uint32_t level; + uint32_t threads; }; // @@ -170,8 +172,10 @@ private: lzma::alloc_func, lzma::free_func, void* derived ); - void* stream_; // Actual type: lzmadec_stream*. - uint32_t level; + void init_stream(bool compress); + void* stream_; // Actual type: lzma_stream*. + uint32_t level_; + uint32_t threads_; }; // @@ -182,7 +186,7 @@ private: template<typename Alloc = std::allocator<char> > class lzma_compressor_impl : public lzma_base, public lzma_allocator<Alloc> { public: - lzma_compressor_impl(const lzma_params& = lzma::default_compression); + lzma_compressor_impl(const lzma_params& = lzma_params()); ~lzma_compressor_impl(); bool filter( const char*& src_begin, const char* src_end, char*& dest_begin, char* dest_end, bool flush ); @@ -222,7 +226,7 @@ private: public: typedef typename base_type::char_type char_type; typedef typename base_type::category category; - basic_lzma_compressor( const lzma_params& = lzma::default_compression, + basic_lzma_compressor( const lzma_params& = lzma_params(), std::streamsize buffer_size = default_device_buffer_size ); }; BOOST_IOSTREAMS_PIPABLE(basic_lzma_compressor, 1) diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/zstd.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/zstd.hpp new file mode 100644 index 0000000000..176799d937 --- /dev/null +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/filter/zstd.hpp @@ -0,0 +1,363 @@ +// (C) Copyright Reimar Döffinger 2018. +// Based on zstd.hpp by: +// (C) Copyright Milan Svoboda 2008. +// 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.) + +// See http://www.boost.org/libs/iostreams for documentation. + +#ifndef BOOST_IOSTREAMS_ZSTD_HPP_INCLUDED +#define BOOST_IOSTREAMS_ZSTD_HPP_INCLUDED + +#if defined(_MSC_VER) +# pragma once +#endif + +#include <cassert> +#include <iosfwd> // streamsize. +#include <memory> // allocator, bad_alloc. +#include <new> +#include <boost/config.hpp> // MSVC, STATIC_CONSTANT, DEDUCED_TYPENAME, DINKUM. +#include <boost/detail/workaround.hpp> +#include <boost/iostreams/constants.hpp> // buffer size. +#include <boost/iostreams/detail/config/auto_link.hpp> +#include <boost/iostreams/detail/config/dyn_link.hpp> +#include <boost/iostreams/detail/config/wide_streams.hpp> +#include <boost/iostreams/detail/ios.hpp> // failure, streamsize. +#include <boost/iostreams/filter/symmetric.hpp> +#include <boost/iostreams/pipeline.hpp> +#include <boost/type_traits/is_same.hpp> + +// Must come last. +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4251 4231 4660) // Dependencies not exported. +#endif +#include <boost/config/abi_prefix.hpp> + +namespace boost { namespace iostreams { + +namespace zstd { + +typedef void* (*alloc_func)(void*, size_t, size_t); +typedef void (*free_func)(void*, void*); + + // Compression levels + +BOOST_IOSTREAMS_DECL extern const uint32_t best_speed; +BOOST_IOSTREAMS_DECL extern const uint32_t best_compression; +BOOST_IOSTREAMS_DECL extern const uint32_t default_compression; + + // Status codes + +BOOST_IOSTREAMS_DECL extern const int okay; +BOOST_IOSTREAMS_DECL extern const int stream_end; + + // Flush codes + +BOOST_IOSTREAMS_DECL extern const int finish; +BOOST_IOSTREAMS_DECL extern const int flush; +BOOST_IOSTREAMS_DECL extern const int run; + + // Code for current OS + + // Null pointer constant. + +const int null = 0; + + // Default values + +} // End namespace zstd. + +// +// Class name: zstd_params. +// Description: Encapsulates the parameters passed to zstddec_init +// to customize compression and decompression. +// +struct zstd_params { + + // Non-explicit constructor. + zstd_params( uint32_t level = zstd::default_compression ) + : level(level) + { } + uint32_t level; +}; + +// +// Class name: zstd_error. +// Description: Subclass of std::ios::failure thrown to indicate +// zstd errors other than out-of-memory conditions. +// +class BOOST_IOSTREAMS_DECL zstd_error : public BOOST_IOSTREAMS_FAILURE { +public: + explicit zstd_error(size_t error); + int error() const { return error_; } + static void check BOOST_PREVENT_MACRO_SUBSTITUTION(size_t error); +private: + size_t error_; +}; + +namespace detail { + +template<typename Alloc> +struct zstd_allocator_traits { +#ifndef BOOST_NO_STD_ALLOCATOR +#if defined(BOOST_NO_CXX11_ALLOCATOR) + typedef typename Alloc::template rebind<char>::other type; +#else + typedef typename std::allocator_traits<Alloc>::template rebind_alloc<char> type; +#endif +#else + typedef std::allocator<char> type; +#endif +}; + +template< typename Alloc, + typename Base = // VC6 workaround (C2516) + BOOST_DEDUCED_TYPENAME zstd_allocator_traits<Alloc>::type > +struct zstd_allocator : private Base { +private: +#if defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_NO_STD_ALLOCATOR) + typedef typename Base::size_type size_type; +#else + typedef typename std::allocator_traits<Base>::size_type size_type; +#endif +public: + BOOST_STATIC_CONSTANT(bool, custom = + (!is_same<std::allocator<char>, Base>::value)); + typedef typename zstd_allocator_traits<Alloc>::type allocator_type; + static void* allocate(void* self, size_t items, size_t size); + static void deallocate(void* self, void* address); +}; + +class BOOST_IOSTREAMS_DECL zstd_base { +public: + typedef char char_type; +protected: + zstd_base(); + ~zstd_base(); + template<typename Alloc> + void init( const zstd_params& p, + bool compress, + zstd_allocator<Alloc>& zalloc ) + { + bool custom = zstd_allocator<Alloc>::custom; + do_init( p, compress, + custom ? zstd_allocator<Alloc>::allocate : 0, + custom ? zstd_allocator<Alloc>::deallocate : 0, + &zalloc ); + } + void before( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end ); + void after( const char*& src_begin, char*& dest_begin, + bool compress ); + int deflate(int action); + int inflate(int action); + void reset(bool compress, bool realloc); +private: + void do_init( const zstd_params& p, bool compress, + zstd::alloc_func, + zstd::free_func, + void* derived ); + void* cstream_; // Actual type: ZSTD_CStream * + void* dstream_; // Actual type: ZSTD_DStream * + void* in_; // Actual type: ZSTD_inBuffer * + void* out_; // Actual type: ZSTD_outBuffer * + int eof_; + uint32_t level; +}; + +// +// Template name: zstd_compressor_impl +// Description: Model of C-Style Filter implementing compression by +// delegating to the zstd function deflate. +// +template<typename Alloc = std::allocator<char> > +class zstd_compressor_impl : public zstd_base, public zstd_allocator<Alloc> { +public: + zstd_compressor_impl(const zstd_params& = zstd::default_compression); + ~zstd_compressor_impl(); + bool filter( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ); + void close(); +}; + +// +// Template name: zstd_compressor_impl +// Description: Model of C-Style Filte implementing decompression by +// delegating to the zstd function inflate. +// +template<typename Alloc = std::allocator<char> > +class zstd_decompressor_impl : public zstd_base, public zstd_allocator<Alloc> { +public: + zstd_decompressor_impl(const zstd_params&); + zstd_decompressor_impl(); + ~zstd_decompressor_impl(); + bool filter( const char*& begin_in, const char* end_in, + char*& begin_out, char* end_out, bool flush ); + void close(); +}; + +} // End namespace detail. + +// +// Template name: zstd_compressor +// Description: Model of InputFilter and OutputFilter implementing +// compression using zstd. +// +template<typename Alloc = std::allocator<char> > +struct basic_zstd_compressor + : symmetric_filter<detail::zstd_compressor_impl<Alloc>, Alloc> +{ +private: + typedef detail::zstd_compressor_impl<Alloc> impl_type; + typedef symmetric_filter<impl_type, Alloc> base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + basic_zstd_compressor( const zstd_params& = zstd::default_compression, + std::streamsize buffer_size = default_device_buffer_size ); +}; +BOOST_IOSTREAMS_PIPABLE(basic_zstd_compressor, 1) + +typedef basic_zstd_compressor<> zstd_compressor; + +// +// Template name: zstd_decompressor +// Description: Model of InputFilter and OutputFilter implementing +// decompression using zstd. +// +template<typename Alloc = std::allocator<char> > +struct basic_zstd_decompressor + : symmetric_filter<detail::zstd_decompressor_impl<Alloc>, Alloc> +{ +private: + typedef detail::zstd_decompressor_impl<Alloc> impl_type; + typedef symmetric_filter<impl_type, Alloc> base_type; +public: + typedef typename base_type::char_type char_type; + typedef typename base_type::category category; + basic_zstd_decompressor( std::streamsize buffer_size = default_device_buffer_size ); + basic_zstd_decompressor( const zstd_params& p, + std::streamsize buffer_size = default_device_buffer_size ); +}; +BOOST_IOSTREAMS_PIPABLE(basic_zstd_decompressor, 1) + +typedef basic_zstd_decompressor<> zstd_decompressor; + +//----------------------------------------------------------------------------// + +//------------------Implementation of zstd_allocator--------------------------// + +namespace detail { + +template<typename Alloc, typename Base> +void* zstd_allocator<Alloc, Base>::allocate + (void* self, size_t items, size_t size) +{ + size_type len = items * size; + char* ptr = + static_cast<allocator_type*>(self)->allocate + (len + sizeof(size_type) + #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) + , (char*)0 + #endif + ); + *reinterpret_cast<size_type*>(ptr) = len; + return ptr + sizeof(size_type); +} + +template<typename Alloc, typename Base> +void zstd_allocator<Alloc, Base>::deallocate(void* self, void* address) +{ + char* ptr = reinterpret_cast<char*>(address) - sizeof(size_type); + size_type len = *reinterpret_cast<size_type*>(ptr) + sizeof(size_type); + static_cast<allocator_type*>(self)->deallocate(ptr, len); +} + +//------------------Implementation of zstd_compressor_impl--------------------// + +template<typename Alloc> +zstd_compressor_impl<Alloc>::zstd_compressor_impl(const zstd_params& p) +{ init(p, true, static_cast<zstd_allocator<Alloc>&>(*this)); } + +template<typename Alloc> +zstd_compressor_impl<Alloc>::~zstd_compressor_impl() +{ reset(true, false); } + +template<typename Alloc> +bool zstd_compressor_impl<Alloc>::filter + ( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ) +{ + before(src_begin, src_end, dest_begin, dest_end); + int result = deflate(flush ? zstd::finish : zstd::run); + after(src_begin, dest_begin, true); + return result != zstd::stream_end; +} + +template<typename Alloc> +void zstd_compressor_impl<Alloc>::close() { reset(true, true); } + +//------------------Implementation of zstd_decompressor_impl------------------// + +template<typename Alloc> +zstd_decompressor_impl<Alloc>::zstd_decompressor_impl(const zstd_params& p) +{ init(p, false, static_cast<zstd_allocator<Alloc>&>(*this)); } + +template<typename Alloc> +zstd_decompressor_impl<Alloc>::~zstd_decompressor_impl() +{ reset(false, false); } + +template<typename Alloc> +zstd_decompressor_impl<Alloc>::zstd_decompressor_impl() +{ + zstd_params p; + init(p, false, static_cast<zstd_allocator<Alloc>&>(*this)); +} + +template<typename Alloc> +bool zstd_decompressor_impl<Alloc>::filter + ( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end, bool flush ) +{ + before(src_begin, src_end, dest_begin, dest_end); + int result = inflate(flush ? zstd::finish : zstd::run); + after(src_begin, dest_begin, false); + return result != zstd::stream_end; +} + +template<typename Alloc> +void zstd_decompressor_impl<Alloc>::close() { reset(false, true); } + +} // End namespace detail. + +//------------------Implementation of zstd_compressor-----------------------// + +template<typename Alloc> +basic_zstd_compressor<Alloc>::basic_zstd_compressor + (const zstd_params& p, std::streamsize buffer_size) + : base_type(buffer_size, p) { } + +//------------------Implementation of zstd_decompressor-----------------------// + +template<typename Alloc> +basic_zstd_decompressor<Alloc>::basic_zstd_decompressor + (std::streamsize buffer_size) + : base_type(buffer_size) { } + +template<typename Alloc> +basic_zstd_decompressor<Alloc>::basic_zstd_decompressor + (const zstd_params& p, std::streamsize buffer_size) + : base_type(buffer_size, p) { } + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. + +#include <boost/config/abi_suffix.hpp> // Pops abi_suffix.hpp pragmas. +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_IOSTREAMS_ZSTD_HPP_INCLUDED diff --git a/contrib/restricted/boost/iostreams/include/boost/iostreams/pipeline.hpp b/contrib/restricted/boost/iostreams/include/boost/iostreams/pipeline.hpp index d29c2da3f7..ad792abb95 100644 --- a/contrib/restricted/boost/iostreams/include/boost/iostreams/pipeline.hpp +++ b/contrib/restricted/boost/iostreams/include/boost/iostreams/pipeline.hpp @@ -47,7 +47,7 @@ struct pipeline; namespace detail { -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600) template<typename T> struct is_pipeline : mpl::false_ { }; diff --git a/contrib/restricted/boost/iostreams/src/bzip2.cpp b/contrib/restricted/boost/iostreams/src/bzip2.cpp index af80cd2f94..195b57d8a9 100644 --- a/contrib/restricted/boost/iostreams/src/bzip2.cpp +++ b/contrib/restricted/boost/iostreams/src/bzip2.cpp @@ -111,16 +111,19 @@ int bzip2_base::check_end(const char* src_begin, const char* dest_begin) } } -void bzip2_base::end(bool compress) +int bzip2_base::end(bool compress, std::nothrow_t) { - if(!ready_) return; + if (!ready_) return bzip2::ok; ready_ = false; bz_stream* s = static_cast<bz_stream*>(stream_); + return compress ? BZ2_bzCompressEnd(s) : BZ2_bzDecompressEnd(s); +} + +void bzip2_base::end(bool compress) +{ bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION( - compress ? - BZ2_bzCompressEnd(s) : - BZ2_bzDecompressEnd(s) - ); + end(compress, std::nothrow) + ); } int bzip2_base::compress(int action) diff --git a/contrib/restricted/boost/iostreams/src/file_descriptor.cpp b/contrib/restricted/boost/iostreams/src/file_descriptor.cpp index 288e2c6401..19ed52ef9c 100644 --- a/contrib/restricted/boost/iostreams/src/file_descriptor.cpp +++ b/contrib/restricted/boost/iostreams/src/file_descriptor.cpp @@ -259,18 +259,20 @@ void file_descriptor_impl::close() void file_descriptor_impl::close_impl(bool close_flag, bool throw_) { if (handle_ != invalid_handle()) { + bool success = true; + if (close_flag) { - bool success = - #ifdef BOOST_IOSTREAMS_WINDOWS - ::CloseHandle(handle_) == 1; - #else - BOOST_IOSTREAMS_FD_CLOSE(handle_) != -1; - #endif - if (!success && throw_) - throw_system_failure("failed closing file"); +#ifdef BOOST_IOSTREAMS_WINDOWS + success = ::CloseHandle(handle_) == 1; +#else + success = BOOST_IOSTREAMS_FD_CLOSE(handle_) != -1; +#endif } + // Even if the close fails, we want nothing more to do with the handle handle_ = invalid_handle(); flags_ = 0; + if (!success && throw_) + throw_system_failure("failed closing file"); } } diff --git a/contrib/restricted/boost/iostreams/src/lzma.cpp b/contrib/restricted/boost/iostreams/src/lzma.cpp index 5d7bb3cfbd..9376c23d60 100644 --- a/contrib/restricted/boost/iostreams/src/lzma.cpp +++ b/contrib/restricted/boost/iostreams/src/lzma.cpp @@ -18,6 +18,13 @@ #include <boost/iostreams/detail/config/dyn_link.hpp> #include <boost/iostreams/filter/lzma.hpp> + +#ifndef BOOST_IOSTREAMS_LZMA_NO_MULTITHREADED + #if LZMA_VERSION < 50020002 + #define BOOST_IOSTREAMS_LZMA_NO_MULTITHREADED + #endif +#endif + namespace boost { namespace iostreams { namespace lzma { @@ -75,7 +82,7 @@ void lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error) namespace detail { lzma_base::lzma_base() - : stream_(new lzma_stream) + : stream_(new lzma_stream), level_(lzma::default_compression), threads_(1) { } lzma_base::~lzma_base() { delete static_cast<lzma_stream*>(stream_); } @@ -113,13 +120,7 @@ void lzma_base::reset(bool compress, bool realloc) lzma_end(s); if (realloc) { - memset(s, 0, sizeof(*s)); - - lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION( - compress ? - lzma_easy_encoder(s, level, LZMA_CHECK_CRC32) : - lzma_stream_decoder(s, 100 * 1024 * 1024, LZMA_CONCATENATED) - ); + init_stream(compress); } } @@ -128,18 +129,41 @@ void lzma_base::do_init lzma::alloc_func, lzma::free_func, void* ) { + + level_ = p.level; + threads_ = p.threads; + +#ifndef BOOST_IOSTREAMS_LZMA_NO_MULTITHREADED + if (threads_ == 0) { + threads_ = lzma_cputhreads(); + } +#endif + + init_stream(compress); +} + +void lzma_base::init_stream(bool compress) +{ lzma_stream* s = static_cast<lzma_stream*>(stream_); memset(s, 0, sizeof(*s)); - level = p.level; +#ifndef BOOST_IOSTREAMS_LZMA_NO_MULTITHREADED + const lzma_mt opt = { 0, threads_, 0, 1000, level_, NULL, LZMA_CHECK_CRC32 }; +#endif + lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION( compress ? - lzma_easy_encoder(s, p.level, LZMA_CHECK_CRC32) : +#ifdef BOOST_IOSTREAMS_LZMA_NO_MULTITHREADED + lzma_easy_encoder(s, level_, LZMA_CHECK_CRC32) : +#else + lzma_stream_encoder_mt(s, &opt) : +#endif lzma_stream_decoder(s, 100 * 1024 * 1024, LZMA_CONCATENATED) ); } + } // End namespace detail. //----------------------------------------------------------------------------// diff --git a/contrib/restricted/boost/iostreams/src/mapped_file.cpp b/contrib/restricted/boost/iostreams/src/mapped_file.cpp index e345086a2d..918a5d4c62 100644 --- a/contrib/restricted/boost/iostreams/src/mapped_file.cpp +++ b/contrib/restricted/boost/iostreams/src/mapped_file.cpp @@ -11,17 +11,17 @@ #define BOOST_IOSTREAMS_SOURCE #include <cassert> +#include <stdexcept> #include <boost/iostreams/detail/config/rtl.hpp> #include <boost/iostreams/detail/config/windows_posix.hpp> #include <boost/iostreams/detail/file_handle.hpp> #include <boost/iostreams/detail/system_failure.hpp> #include <boost/iostreams/device/mapped_file.hpp> #include <boost/throw_exception.hpp> +#include <boost/numeric/conversion/cast.hpp> #ifdef BOOST_IOSTREAMS_WINDOWS -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -# endif +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers # include <windows.h> #else # include <errno.h> @@ -263,6 +263,7 @@ void mapped_file_impl::open_file(param_type p) flags |= O_LARGEFILE; #endif errno = 0; + if (p.path.is_wide()) { errno = EINVAL; cleanup_and_throw("wide path not supported here"); } // happens on CYGWIN handle_ = ::open(p.path.c_str(), flags, S_IRWXU); if (errno != 0) cleanup_and_throw("failed opening file"); @@ -323,7 +324,7 @@ void mapped_file_impl::try_map_file(param_type p) access, (DWORD) (p.offset >> 32), (DWORD) (p.offset & 0xffffffff), - (SIZE_T) (size_ != max_length ? size_ : 0), + (SIZE_T) (numeric_cast<size_type>(size_) != max_length ? size_ : 0), (LPVOID) p.hint ); if (!data) cleanup_and_throw("failed mapping view"); diff --git a/contrib/restricted/boost/iostreams/src/zlib.cpp b/contrib/restricted/boost/iostreams/src/zlib.cpp index 3dd7b1a89c..66380689bc 100644 --- a/contrib/restricted/boost/iostreams/src/zlib.cpp +++ b/contrib/restricted/boost/iostreams/src/zlib.cpp @@ -91,7 +91,8 @@ void zlib_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error) namespace detail { zlib_base::zlib_base() - : stream_(new z_stream), calculate_crc_(false), crc_(0), crc_imp_(0) + : stream_(new z_stream), calculate_crc_(false), crc_(0), crc_imp_(0), + total_in_(0), total_out_(0) { } zlib_base::~zlib_base() { delete static_cast<z_stream*>(stream_); } diff --git a/contrib/restricted/boost/iostreams/src/zstd.cpp b/contrib/restricted/boost/iostreams/src/zstd.cpp new file mode 100644 index 0000000000..20cc009804 --- /dev/null +++ b/contrib/restricted/boost/iostreams/src/zstd.cpp @@ -0,0 +1,166 @@ +// (C) Copyright Reimar Döffinger 2018. +// Based on zstd.cpp by: +// (C) Copyright Milan Svoboda 2008. +// (C) Copyright Jonathan Turkanis 2003. +// 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.) + +// See http://www.boost.org/libs/iostreams for documentation. + +// Define BOOST_IOSTREAMS_SOURCE so that <boost/iostreams/detail/config.hpp> +// knows that we are building the library (possibly exporting code), rather +// than using it (possibly importing code). +#define BOOST_IOSTREAMS_SOURCE + +#include <zstd.h> + +#include <boost/throw_exception.hpp> +#include <boost/iostreams/detail/config/dyn_link.hpp> +#include <boost/iostreams/filter/zstd.hpp> + +namespace boost { namespace iostreams { + +namespace zstd { + // Compression levels + +const uint32_t best_speed = 1; +const uint32_t best_compression = 19; +const uint32_t default_compression = 3; + + // Status codes + +const int okay = 0; +const int stream_end = 1; + + // Flush codes + +const int finish = 0; +const int flush = 1; +const int run = 2; +} // End namespace zstd. + +//------------------Implementation of zstd_error------------------------------// + +zstd_error::zstd_error(size_t error) + : BOOST_IOSTREAMS_FAILURE(ZSTD_getErrorName(error)), error_(error) + { } + +void zstd_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(size_t error) +{ + if (ZSTD_isError(error)) + boost::throw_exception(zstd_error(error)); +} + +//------------------Implementation of zstd_base-------------------------------// + +namespace detail { + +zstd_base::zstd_base() + : cstream_(ZSTD_createCStream()), dstream_(ZSTD_createDStream()), in_(new ZSTD_inBuffer), out_(new ZSTD_outBuffer), eof_(0) + { } + +zstd_base::~zstd_base() +{ + ZSTD_freeCStream(static_cast<ZSTD_CStream *>(cstream_)); + ZSTD_freeDStream(static_cast<ZSTD_DStream *>(dstream_)); + delete static_cast<ZSTD_inBuffer*>(in_); + delete static_cast<ZSTD_outBuffer*>(out_); +} + +void zstd_base::before( const char*& src_begin, const char* src_end, + char*& dest_begin, char* dest_end ) +{ + ZSTD_inBuffer *in = static_cast<ZSTD_inBuffer *>(in_); + ZSTD_outBuffer *out = static_cast<ZSTD_outBuffer *>(out_); + in->src = src_begin; + in->size = static_cast<size_t>(src_end - src_begin); + in->pos = 0; + out->dst = dest_begin; + out->size = static_cast<size_t>(dest_end - dest_begin); + out->pos = 0; +} + +void zstd_base::after(const char*& src_begin, char*& dest_begin, bool) +{ + ZSTD_inBuffer *in = static_cast<ZSTD_inBuffer *>(in_); + ZSTD_outBuffer *out = static_cast<ZSTD_outBuffer *>(out_); + src_begin = reinterpret_cast<const char*>(in->src) + in->pos; + dest_begin = reinterpret_cast<char*>(out->dst) + out->pos; +} + +int zstd_base::deflate(int action) +{ + ZSTD_CStream *s = static_cast<ZSTD_CStream *>(cstream_); + ZSTD_inBuffer *in = static_cast<ZSTD_inBuffer *>(in_); + ZSTD_outBuffer *out = static_cast<ZSTD_outBuffer *>(out_); + // Ignore spurious extra calls. + // Note size > 0 will trigger an error in this case. + if (eof_ && in->size == 0) return zstd::stream_end; + size_t result = ZSTD_compressStream(s, out, in); + zstd_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); + if (action != zstd::run) + { + result = action == zstd::finish ? ZSTD_endStream(s, out) : ZSTD_flushStream(s, out); + zstd_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); + eof_ = action == zstd::finish && result == 0; + return result == 0 ? zstd::stream_end : zstd::okay; + } + return zstd::okay; +} + +int zstd_base::inflate(int action) +{ + ZSTD_DStream *s = static_cast<ZSTD_DStream *>(dstream_); + ZSTD_inBuffer *in = static_cast<ZSTD_inBuffer *>(in_); + ZSTD_outBuffer *out = static_cast<ZSTD_outBuffer *>(out_); + // need loop since iostream code cannot handle short reads + do { + size_t result = ZSTD_decompressStream(s, out, in); + zstd_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(result); + } while (in->pos < in->size && out->pos < out->size); + return action == zstd::finish && in->size == 0 && out->pos == 0 ? zstd::stream_end : zstd::okay; +} + +void zstd_base::reset(bool compress, bool realloc) +{ + ZSTD_inBuffer *in = static_cast<ZSTD_inBuffer *>(in_); + ZSTD_outBuffer *out = static_cast<ZSTD_outBuffer *>(out_); + if (realloc) + { + memset(in, 0, sizeof(*in)); + memset(out, 0, sizeof(*out)); + eof_ = 0; + + zstd_error::check BOOST_PREVENT_MACRO_SUBSTITUTION( + compress ? + ZSTD_initCStream(static_cast<ZSTD_CStream *>(cstream_), level) : + ZSTD_initDStream(static_cast<ZSTD_DStream *>(dstream_)) + ); + } +} + +void zstd_base::do_init + ( const zstd_params& p, bool compress, + zstd::alloc_func, zstd::free_func, + void* ) +{ + ZSTD_inBuffer *in = static_cast<ZSTD_inBuffer *>(in_); + ZSTD_outBuffer *out = static_cast<ZSTD_outBuffer *>(out_); + + memset(in, 0, sizeof(*in)); + memset(out, 0, sizeof(*out)); + eof_ = 0; + + level = p.level; + zstd_error::check BOOST_PREVENT_MACRO_SUBSTITUTION( + compress ? + ZSTD_initCStream(static_cast<ZSTD_CStream *>(cstream_), level) : + ZSTD_initDStream(static_cast<ZSTD_DStream *>(dstream_)) + ); +} + +} // End namespace detail. + +//----------------------------------------------------------------------------// + +} } // End namespaces iostreams, boost. |