From 0ff771b50a4eb1e1c8125f7ee1501e74ea116b9e Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 7 Oct 2012 17:06:15 +0400 Subject: [PATCH] Eliminate 64-bit compiler warnings in atomic_ops_malloc * src/atomic_ops_malloc.c (add_chunk_as): Cast shifted value to size_t (the type of assigned variable, at least to eliminate compiler warning for 64-bit targets). * src/atomic_ops_malloc.c (AO_free): Cast (*base) to int (the type of assigned variable) to eliminate MS VC compiler warning. --- src/atomic_ops_malloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/atomic_ops_malloc.c b/src/atomic_ops_malloc.c index 40d80f3..6933880 100644 --- a/src/atomic_ops_malloc.c +++ b/src/atomic_ops_malloc.c @@ -211,7 +211,7 @@ AO_stack_t AO_free_list[LOG_MAX_SIZE+1]; static void add_chunk_as(void * chunk, unsigned log_sz) { size_t ofs, limit; - size_t sz = 1 << log_sz; + size_t sz = (size_t)1 << log_sz; assert (CHUNK_SIZE >= sz); limit = (size_t)CHUNK_SIZE - sz; @@ -289,7 +289,7 @@ AO_free(void *p) int log_sz; if (0 == p) return; - log_sz = *(AO_t *)base; + log_sz = (int)(*(AO_t *)base); # ifdef AO_TRACE_MALLOC fprintf(stderr, "%x: AO_free(%p sz:%lu)\n", (int)pthread_self(), p, (unsigned long)(log_sz > LOG_MAX_SIZE? log_sz : (1 << log_sz))); -- 2.40.0