aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression/bzip2
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/compression/bzip2')
-rw-r--r--src/lib/compression/bzip2/bzip2.cpp12
-rw-r--r--src/lib/compression/bzip2/bzip2.h14
-rw-r--r--src/lib/compression/bzip2/info.txt2
3 files changed, 12 insertions, 16 deletions
diff --git a/src/lib/compression/bzip2/bzip2.cpp b/src/lib/compression/bzip2/bzip2.cpp
index d9ada84f6..565eb09fc 100644
--- a/src/lib/compression/bzip2/bzip2.cpp
+++ b/src/lib/compression/bzip2/bzip2.cpp
@@ -39,6 +39,14 @@ class Bzip2_Compression_Stream : public Bzip2_Stream
public:
explicit Bzip2_Compression_Stream(size_t block_size)
{
+ /*
+ * Defaults to 900k blocks as the computation cost of
+ * compression is not overly affected by the size, though
+ * more memory is required.
+ */
+ if(block_size == 0 || block_size >= 9)
+ block_size = 9;
+
int rc = BZ2_bzCompressInit(streamp(), block_size, 0, 0);
if(rc == BZ_MEM_ERROR)
@@ -98,9 +106,9 @@ class Bzip2_Decompression_Stream : public Bzip2_Stream
}
-Compression_Stream* Bzip2_Compression::make_stream() const
+Compression_Stream* Bzip2_Compression::make_stream(size_t comp_level) const
{
- return new Bzip2_Compression_Stream(m_block_size);
+ return new Bzip2_Compression_Stream(comp_level);
}
Compression_Stream* Bzip2_Decompression::make_stream() const
diff --git a/src/lib/compression/bzip2/bzip2.h b/src/lib/compression/bzip2/bzip2.h
index 06c80cb8e..18216f7eb 100644
--- a/src/lib/compression/bzip2/bzip2.h
+++ b/src/lib/compression/bzip2/bzip2.h
@@ -19,21 +19,9 @@ namespace Botan {
class BOTAN_DLL Bzip2_Compression final : public Stream_Compression
{
public:
- /**
- * @param block_size in 1024 KiB increments, in range from 1 to 9.
- *
- * Lowering this does not noticably modify the compression or
- * decompression speed, though less memory is required for both
- * compression and decompression.
- */
- Bzip2_Compression(size_t block_size = 9) : m_block_size(block_size) {}
-
std::string name() const override { return "Bzip2_Compression"; }
-
private:
- Compression_Stream* make_stream() const override;
-
- const size_t m_block_size;
+ Compression_Stream* make_stream(size_t comp_level) const override;
};
/**
diff --git a/src/lib/compression/bzip2/info.txt b/src/lib/compression/bzip2/info.txt
index ea2efa6f1..bc8d780be 100644
--- a/src/lib/compression/bzip2/info.txt
+++ b/src/lib/compression/bzip2/info.txt
@@ -1,4 +1,4 @@
-define BZIP2_TRANSFORM 20141118
+define BZIP2 20160412
load_on vendor