mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-01 13:40:39 +00:00
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
This commit is contained in:
parent
4fd1ce3af6
commit
2734e8288d
@ -12,7 +12,6 @@ AM_CPPFLAGS += \
|
|||||||
$(BOOST_INCLUDES)
|
$(BOOST_INCLUDES)
|
||||||
|
|
||||||
libboost_iostreams_la_SOURCES = \
|
libboost_iostreams_la_SOURCES = \
|
||||||
bzip2.cpp \
|
|
||||||
file_descriptor.cpp \
|
file_descriptor.cpp \
|
||||||
mapped_file.cpp \
|
mapped_file.cpp \
|
||||||
zlib.cpp
|
zlib.cpp
|
||||||
|
@ -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 <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 <boost/iostreams/detail/config/dyn_link.hpp>
|
|
||||||
#include <boost/iostreams/filter/bzip2.hpp>
|
|
||||||
#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<bz_stream*>(stream_); }
|
|
||||||
|
|
||||||
void bzip2_base::before( const char*& src_begin, const char* src_end,
|
|
||||||
char*& dest_begin, char* dest_end )
|
|
||||||
{
|
|
||||||
bz_stream* s = static_cast<bz_stream*>(stream_);
|
|
||||||
s->next_in = const_cast<char*>(src_begin);
|
|
||||||
s->avail_in = static_cast<unsigned>(src_end - src_begin);
|
|
||||||
s->next_out = reinterpret_cast<char*>(dest_begin);
|
|
||||||
s->avail_out= static_cast<unsigned>(dest_end - dest_begin);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bzip2_base::after(const char*& src_begin, char*& dest_begin)
|
|
||||||
{
|
|
||||||
bz_stream* s = static_cast<bz_stream*>(stream_);
|
|
||||||
src_begin = const_cast<char*>(s->next_in);
|
|
||||||
dest_begin = s->next_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
void bzip2_base::end(bool compress)
|
|
||||||
{
|
|
||||||
ready_ = false;
|
|
||||||
bz_stream* s = static_cast<bz_stream*>(stream_);
|
|
||||||
bzip2_error::check(
|
|
||||||
compress ?
|
|
||||||
BZ2_bzCompressEnd(s) :
|
|
||||||
BZ2_bzDecompressEnd(s)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
int bzip2_base::compress(int action)
|
|
||||||
{
|
|
||||||
return BZ2_bzCompress(static_cast<bz_stream*>(stream_), action);
|
|
||||||
}
|
|
||||||
|
|
||||||
int bzip2_base::decompress()
|
|
||||||
{
|
|
||||||
return BZ2_bzDecompress(static_cast<bz_stream*>(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<bz_stream*>(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.
|
|
Loading…
Reference in New Issue
Block a user