aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-31 12:43:24 -0500
committerJack Lloyd <[email protected]>2016-12-31 12:43:24 -0500
commitfe1902074d75a9632cb55862c8614893711f2571 (patch)
treecce2763a7de9bb795e2b17e13fe72707991df593 /src/lib
parentab3b2d298c34f7e8d06b53102741995853ce4a1f (diff)
Improve filter tests
Fix a bug in Pipe::check_available that must date back 15 years... Add destructors to compression filter so unique_ptr destructor runs without user having to include an extra header for the owned type.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/filters/comp_filter.cpp4
-rw-r--r--src/lib/filters/comp_filter.h4
-rw-r--r--src/lib/filters/pipe_rw.cpp4
3 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/filters/comp_filter.cpp b/src/lib/filters/comp_filter.cpp
index 4fdc8ffc8..2563a4907 100644
--- a/src/lib/filters/comp_filter.cpp
+++ b/src/lib/filters/comp_filter.cpp
@@ -28,6 +28,8 @@ Compression_Filter::Compression_Filter(const std::string& type, size_t level, si
}
}
+Compression_Filter::~Compression_Filter() { /* for unique_ptr */ }
+
std::string Compression_Filter::name() const
{
return m_comp->name();
@@ -79,6 +81,8 @@ Decompression_Filter::Decompression_Filter(const std::string& type, size_t bs) :
}
}
+Decompression_Filter::~Decompression_Filter() { /* for unique_ptr */ }
+
std::string Decompression_Filter::name() const
{
return m_comp->name();
diff --git a/src/lib/filters/comp_filter.h b/src/lib/filters/comp_filter.h
index 552dc8588..64887e161 100644
--- a/src/lib/filters/comp_filter.h
+++ b/src/lib/filters/comp_filter.h
@@ -34,6 +34,8 @@ class BOTAN_DLL Compression_Filter : public Filter
Compression_Filter(const std::string& type,
size_t compression_level,
size_t buffer_size = 4096);
+
+ ~Compression_Filter();
private:
std::unique_ptr<Compression_Algorithm> m_comp;
size_t m_buffersize, m_level;
@@ -54,6 +56,8 @@ class BOTAN_DLL Decompression_Filter : public Filter
Decompression_Filter(const std::string& type,
size_t buffer_size = 4096);
+
+ ~Decompression_Filter();
private:
std::unique_ptr<Decompression_Algorithm> m_comp;
std::size_t m_buffersize;
diff --git a/src/lib/filters/pipe_rw.cpp b/src/lib/filters/pipe_rw.cpp
index 6979bd4ce..dacc91008 100644
--- a/src/lib/filters/pipe_rw.cpp
+++ b/src/lib/filters/pipe_rw.cpp
@@ -159,7 +159,7 @@ size_t Pipe::peek(uint8_t& out, size_t offset, message_id msg) const
size_t Pipe::get_bytes_read() const
{
- return m_outputs->get_bytes_read(DEFAULT_MESSAGE);
+ return m_outputs->get_bytes_read(default_msg());
}
size_t Pipe::get_bytes_read(message_id msg) const
@@ -169,7 +169,7 @@ size_t Pipe::get_bytes_read(message_id msg) const
bool Pipe::check_available(size_t n)
{
- return (n <= remaining(DEFAULT_MESSAGE));
+ return (n <= remaining(default_msg()));
}
bool Pipe::check_available_msg(size_t n, message_id msg)