8#ifndef BOTAN_COMPRESSION_UTILS_H_
9#define BOTAN_COMPRESSION_UTILS_H_
11#include <botan/compression.h>
13#include <botan/mem_ops.h>
15#include <unordered_map>
32 void* do_malloc(
size_t n,
size_t size);
33 void do_free(
void* ptr);
35 std::unordered_map<void*, size_t> m_current_allocs;
41template <
typename Stream,
typename ByteType,
typename StreamLenType =
size_t>
44 void next_in(uint8_t*
b,
size_t len)
override {
45 m_stream.next_in =
reinterpret_cast<ByteType*
>(
b);
46 m_stream.avail_in =
static_cast<StreamLenType
>(len);
50 m_stream.next_out =
reinterpret_cast<ByteType*
>(
b);
51 m_stream.avail_out =
static_cast<StreamLenType
>(len);
54 size_t avail_in()
const override {
return m_stream.avail_in; }
56 size_t avail_out()
const override {
return m_stream.avail_out; }
76 std::unique_ptr<Compression_Alloc_Info> m_allocs;
static void free(void *self, void *ptr)
static void * malloc(void *self, T n, T size)
~Zlib_Style_Stream() override
size_t avail_out() const override
Compression_Alloc_Info * alloc()
Zlib_Style_Stream(Zlib_Style_Stream &&other)=delete
size_t avail_in() const override
void next_out(uint8_t *b, size_t len) override
Zlib_Style_Stream & operator=(Zlib_Style_Stream &&other)=delete
Zlib_Style_Stream & operator=(const Zlib_Style_Stream &other)=delete
void next_in(uint8_t *b, size_t len) override
Zlib_Style_Stream(const Zlib_Style_Stream &other)=delete
int(* final)(unsigned char *, CTX *)
constexpr void clear_mem(T *ptr, size_t n)