diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-21 21:57:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-21 21:57:47 +0000 |
commit | 69300eb606732a35eff5c2e150cf71667df59d3f (patch) | |
tree | 9f8f1f062957ed8812fa023ab72724d004459f6b /src/common/mempool.c | |
parent | b375472d14cb9165e3acab899e4388a36c03bf25 (diff) | |
download | tor-69300eb606732a35eff5c2e150cf71667df59d3f.tar.gz tor-69300eb606732a35eff5c2e150cf71667df59d3f.zip |
r14374@tombo: nickm | 2008-02-21 16:57:39 -0500
Fix all remaining shorten-64-to-32 errors in src/common. Some were genuine problems. Many were compatibility errors with libraries (openssl, zlib) that like predate size_t. Partial backport candidate.
svn:r13665
Diffstat (limited to 'src/common/mempool.c')
-rw-r--r-- | src/common/mempool.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/mempool.c b/src/common/mempool.c index 7c8092de71..6a41d220fe 100644 --- a/src/common/mempool.c +++ b/src/common/mempool.c @@ -358,7 +358,7 @@ mp_pool_t * mp_pool_new(size_t item_size, size_t chunk_capacity) { mp_pool_t *pool; - size_t alloc_size; + size_t alloc_size, new_chunk_cap; pool = ALLOC(sizeof(mp_pool_t)); CHECK_ALLOC(pool); @@ -393,7 +393,10 @@ mp_pool_new(size_t item_size, size_t chunk_capacity) if (chunk_capacity < MIN_CHUNK) chunk_capacity = MIN_CHUNK; - pool->new_chunk_capacity = (chunk_capacity-CHUNK_OVERHEAD) / alloc_size; + new_chunk_cap = (chunk_capacity-CHUNK_OVERHEAD) / alloc_size; + tor_assert(new_chunk_cap < INT_MAX); + pool->new_chunk_capacity = (int)new_chunk_cap; + pool->item_alloc_size = alloc_size; log_debug(LD_MM, "Capacity is %lu, item size is %lu, alloc size is %lu", |