From 18a58396b7bb2925a33c57b17f1820b386b54c2d Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 12 Oct 2010 15:40:31 +0000 Subject: s/u32bit/size_t/ in alloc Also handle partial writes in alloc_mmap --- src/alloc/mem_pool/mem_pool.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/alloc/mem_pool/mem_pool.h') diff --git a/src/alloc/mem_pool/mem_pool.h b/src/alloc/mem_pool/mem_pool.h index a67e641e2..28d4dd903 100644 --- a/src/alloc/mem_pool/mem_pool.h +++ b/src/alloc/mem_pool/mem_pool.h @@ -22,8 +22,8 @@ namespace Botan { class Pooling_Allocator : public Allocator { public: - void* allocate(u32bit); - void deallocate(void*, u32bit); + void* allocate(size_t); + void deallocate(void*, size_t); void destroy(); @@ -33,23 +33,23 @@ class Pooling_Allocator : public Allocator Pooling_Allocator(Mutex* mutex); ~Pooling_Allocator(); private: - void get_more_core(u32bit); - byte* allocate_blocks(u32bit); + void get_more_core(size_t); + byte* allocate_blocks(size_t); - virtual void* alloc_block(u32bit) = 0; - virtual void dealloc_block(void*, u32bit) = 0; + virtual void* alloc_block(size_t) = 0; + virtual void dealloc_block(void*, size_t) = 0; class Memory_Block { public: Memory_Block(void*); - static u32bit bitmap_size() { return BITMAP_SIZE; } - static u32bit block_size() { return BLOCK_SIZE; } + static size_t bitmap_size() { return BITMAP_SIZE; } + static size_t block_size() { return BLOCK_SIZE; } - bool contains(void*, u32bit) const; - byte* alloc(u32bit); - void free(void*, u32bit); + bool contains(void*, size_t) const; + byte* alloc(size_t); + void free(void*, size_t); bool operator<(const Memory_Block& other) const { @@ -59,8 +59,8 @@ class Pooling_Allocator : public Allocator } private: typedef u64bit bitmap_type; - static const u32bit BITMAP_SIZE = 8 * sizeof(bitmap_type); - static const u32bit BLOCK_SIZE = 64; + static const size_t BITMAP_SIZE = 8 * sizeof(bitmap_type); + static const size_t BLOCK_SIZE = 64; bitmap_type bitmap; byte* buffer, *buffer_end; @@ -68,7 +68,7 @@ class Pooling_Allocator : public Allocator std::vector blocks; std::vector::iterator last_used; - std::vector > allocated; + std::vector > allocated; Mutex* mutex; }; -- cgit v1.2.3