From 2734e8288d3ed7d42387f4de9c754d5f8520b07f Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Tue, 25 Apr 2006 04:48:06 +0000 Subject: [PATCH] Remove unneeded bzip2 support Bo Peng (ben.bob@gmail.com) * boost/libs/iostreams/src/bzip2.cpp remove since it requires bzip2.h * boost/libs/iostreams/src/Makefile.am remove bzip2.cpp git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13735 a592a061-630c-0410-9148-cb99ea01b6c8 --- boost/libs/iostreams/src/Makefile.am | 1 - boost/libs/iostreams/src/bzip2.cpp | 158 --------------------------- 2 files changed, 159 deletions(-) delete mode 100644 boost/libs/iostreams/src/bzip2.cpp diff --git a/boost/libs/iostreams/src/Makefile.am b/boost/libs/iostreams/src/Makefile.am index 3166156368..347fe3e729 100644 --- a/boost/libs/iostreams/src/Makefile.am +++ b/boost/libs/iostreams/src/Makefile.am @@ -12,7 +12,6 @@ AM_CPPFLAGS += \ $(BOOST_INCLUDES) libboost_iostreams_la_SOURCES = \ - bzip2.cpp \ file_descriptor.cpp \ mapped_file.cpp \ zlib.cpp diff --git a/boost/libs/iostreams/src/bzip2.cpp b/boost/libs/iostreams/src/bzip2.cpp deleted file mode 100644 index c20f9107fc..0000000000 --- a/boost/libs/iostreams/src/bzip2.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// (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. - -// To configure Boost to work with libbz2, see the -// installation instructions here: -// http://boost.org/libs/iostreams/doc/index.html?path=7 - -// Define BOOST_IOSTREAMS_SOURCE so that -// knows that we are building the library (possibly exporting code), rather -// than using it (possibly importing code). -#define BOOST_IOSTREAMS_SOURCE - -#include -#include -#include "bzlib.h" // Julian Seward's "bzip.h" header. - // To configure Boost to work with libbz2, see the - // installation instructions here: - // http://boost.org/libs/iostreams/doc/index.html?path=7 - -namespace boost { namespace iostreams { - -namespace bzip2 { - - // Status codes - -const int ok = BZ_OK; -const int run_ok = BZ_RUN_OK; -const int flush_ok = BZ_FLUSH_OK; -const int finish_ok = BZ_FINISH_OK; -const int stream_end = BZ_STREAM_END; -const int sequence_error = BZ_SEQUENCE_ERROR; -const int param_error = BZ_PARAM_ERROR; -const int mem_error = BZ_MEM_ERROR; -const int data_error = BZ_DATA_ERROR; -const int data_error_magic = BZ_DATA_ERROR_MAGIC; -const int io_error = BZ_IO_ERROR; -const int unexpected_eof = BZ_UNEXPECTED_EOF; -const int outbuff_full = BZ_OUTBUFF_FULL; -const int config_error = BZ_CONFIG_ERROR; - - // Action codes - -const int finish = BZ_FINISH; -const int run = BZ_RUN; - -} // End namespace bzip2. - -//------------------Implementation of bzip2_error-----------------------------// - -bzip2_error::bzip2_error(int error) - : BOOST_IOSTREAMS_FAILURE("bzip2 error"), error_(error) - { } - -void bzip2_error::check(int error) -{ - switch (error) { - case BZ_OK: - case BZ_RUN_OK: - case BZ_FLUSH_OK: - case BZ_FINISH_OK: - case BZ_STREAM_END: - return; - case BZ_MEM_ERROR: - throw std::bad_alloc(); - default: - throw bzip2_error(error); - } -} - -//------------------Implementation of bzip2_base------------------------------// - -namespace detail { - -bzip2_base::bzip2_base(const bzip2_params& params) - : params_(params), stream_(new bz_stream), ready_(false) - { } - -bzip2_base::~bzip2_base() { delete static_cast(stream_); } - -void bzip2_base::before( const char*& src_begin, const char* src_end, - char*& dest_begin, char* dest_end ) -{ - bz_stream* s = static_cast(stream_); - s->next_in = const_cast(src_begin); - s->avail_in = static_cast(src_end - src_begin); - s->next_out = reinterpret_cast(dest_begin); - s->avail_out= static_cast(dest_end - dest_begin); -} - -void bzip2_base::after(const char*& src_begin, char*& dest_begin) -{ - bz_stream* s = static_cast(stream_); - src_begin = const_cast(s->next_in); - dest_begin = s->next_out; -} - -void bzip2_base::end(bool compress) -{ - ready_ = false; - bz_stream* s = static_cast(stream_); - bzip2_error::check( - compress ? - BZ2_bzCompressEnd(s) : - BZ2_bzDecompressEnd(s) - ); -} - -int bzip2_base::compress(int action) -{ - return BZ2_bzCompress(static_cast(stream_), action); -} - -int bzip2_base::decompress() -{ - return BZ2_bzDecompress(static_cast(stream_)); -} - -void bzip2_base::do_init - ( bool compress, - #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - bzip2::alloc_func alloc, - bzip2::free_func free, - #endif - void* derived ) -{ - bz_stream* s = static_cast(stream_); - - // Current interface for customizing memory management - // is non-conforming and has been disabled: - //#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - // s->bzalloc = alloc; - // s->bzfree = free; - //#else - s->bzalloc = 0; - s->bzfree = 0; - //#endif - s->opaque = derived; - bzip2_error::check( - compress ? - BZ2_bzCompressInit( s, - params_.block_size, - 0, - params_.work_factor ) : - BZ2_bzDecompressInit( s, - 0, - params_.small ) - ); - ready_ = true; -} - -} // End namespace detail. - -//----------------------------------------------------------------------------// - -} } // End namespaces iostreams, boost.