diff options
Diffstat (limited to 'src/lib/compression')
-rw-r--r-- | src/lib/compression/bzip2/bzip2.cpp | 2 | ||||
-rw-r--r-- | src/lib/compression/comp_util.cpp | 38 | ||||
-rw-r--r-- | src/lib/compression/compress_utils.h (renamed from src/lib/compression/comp_util.h) | 4 | ||||
-rw-r--r-- | src/lib/compression/compression.cpp | 28 | ||||
-rw-r--r-- | src/lib/compression/info.txt | 2 | ||||
-rw-r--r-- | src/lib/compression/lzma/lzma.cpp | 2 | ||||
-rw-r--r-- | src/lib/compression/zlib/zlib.cpp | 2 |
7 files changed, 33 insertions, 45 deletions
diff --git a/src/lib/compression/bzip2/bzip2.cpp b/src/lib/compression/bzip2/bzip2.cpp index 2d1617bce..857af10b1 100644 --- a/src/lib/compression/bzip2/bzip2.cpp +++ b/src/lib/compression/bzip2/bzip2.cpp @@ -8,7 +8,7 @@ */ #include <botan/bzip2.h> -#include <botan/internal/comp_util.h> +#include <botan/internal/compress_utils.h> #define BZ_NO_STDIO #include <bzlib.h> diff --git a/src/lib/compression/comp_util.cpp b/src/lib/compression/comp_util.cpp deleted file mode 100644 index 05c9ddb3b..000000000 --- a/src/lib/compression/comp_util.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Allocation Tracker -* (C) 2014 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include <botan/internal/comp_util.h> -#include <botan/mem_ops.h> -#include <cstdlib> - -namespace Botan { - -void* Compression_Alloc_Info::do_malloc(size_t n, size_t size) - { - const size_t total_sz = n * size; - - void* ptr = std::malloc(total_sz); - m_current_allocs[ptr] = total_sz; - return ptr; - } - -void Compression_Alloc_Info::do_free(void* ptr) - { - if(ptr) - { - auto i = m_current_allocs.find(ptr); - - if(i == m_current_allocs.end()) - throw std::runtime_error("Compression_Alloc_Info::free got pointer not allocated by us"); - - zero_mem(ptr, i->second); - std::free(ptr); - m_current_allocs.erase(i); - } - } - -} diff --git a/src/lib/compression/comp_util.h b/src/lib/compression/compress_utils.h index 963eae642..d06971751 100644 --- a/src/lib/compression/comp_util.h +++ b/src/lib/compression/compress_utils.h @@ -1,5 +1,5 @@ /* -* Shared code for compression libraries +* Compression utility header * (C) 2014 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) @@ -9,7 +9,7 @@ #define BOTAN_COMPRESSION_UTILS_H__ #include <botan/compression.h> -#include <botan/algo_registry.h> +#include <botan/internal/algo_registry.h> #include <memory> #include <unordered_map> diff --git a/src/lib/compression/compression.cpp b/src/lib/compression/compression.cpp index e5221aba6..600f2c3ae 100644 --- a/src/lib/compression/compression.cpp +++ b/src/lib/compression/compression.cpp @@ -6,10 +6,36 @@ */ #include <botan/compression.h> -#include <botan/algo_registry.h> +#include <botan/internal/compress_utils.h> +#include <botan/mem_ops.h> +#include <cstdlib> namespace Botan { +void* Compression_Alloc_Info::do_malloc(size_t n, size_t size) + { + const size_t total_sz = n * size; + + void* ptr = std::malloc(total_sz); + m_current_allocs[ptr] = total_sz; + return ptr; + } + +void Compression_Alloc_Info::do_free(void* ptr) + { + if(ptr) + { + auto i = m_current_allocs.find(ptr); + + if(i == m_current_allocs.end()) + throw std::runtime_error("Compression_Alloc_Info::free got pointer not allocated by us"); + + zero_mem(ptr, i->second); + std::free(ptr); + m_current_allocs.erase(i); + } + } + Transform* make_compressor(const std::string& type, size_t level) { const std::string comp_suffix = "_Compression(" + std::to_string(level) + ")"; diff --git a/src/lib/compression/info.txt b/src/lib/compression/info.txt index f1a3fa696..bfbc806c8 100644 --- a/src/lib/compression/info.txt +++ b/src/lib/compression/info.txt @@ -1,7 +1,7 @@ define COMPRESSION 20141117 <header:internal> -comp_util.h +compress_utils.h </header:internal> <header:public> diff --git a/src/lib/compression/lzma/lzma.cpp b/src/lib/compression/lzma/lzma.cpp index 69d73a3a1..c7e6ab815 100644 --- a/src/lib/compression/lzma/lzma.cpp +++ b/src/lib/compression/lzma/lzma.cpp @@ -9,7 +9,7 @@ */ #include <botan/lzma.h> -#include <botan/internal/comp_util.h> +#include <botan/internal/compress_utils.h> #include <lzma.h> namespace Botan { diff --git a/src/lib/compression/zlib/zlib.cpp b/src/lib/compression/zlib/zlib.cpp index 24e8721e3..a709526ce 100644 --- a/src/lib/compression/zlib/zlib.cpp +++ b/src/lib/compression/zlib/zlib.cpp @@ -8,7 +8,7 @@ */ #include <botan/zlib.h> -#include <botan/internal/comp_util.h> +#include <botan/internal/compress_utils.h> #include <ctime> #include <zlib.h> |