From 5f0580ccf126a4834a406423e15da5b8a8bdf993 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Wed, 30 Sep 2015 10:36:21 +0200 Subject: [PATCH] Harmonize pointer printing and size_t-fy casts. Reviewed-by: Richard Levitte --- crypto/bio/b_print.c | 2 +- crypto/mem_dbg.c | 8 ++++---- crypto/thr_id.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index 06cadc8a63..f49ebee436 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -370,7 +370,7 @@ _dopr(char **sbuffer, flags, min, max); break; case 'p': - value = (long)va_arg(args, void *); + value = (size_t)va_arg(args, void *); fmtint(sbuffer, buffer, &currlen, maxlen, value, 16, min, max, flags | DP_F_NUM); break; diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 10cc8931e7..2cd1169918 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -321,9 +321,9 @@ static IMPLEMENT_LHASH_COMP_FN(mem, MEM) static unsigned long mem_hash(const MEM *a) { - unsigned long ret; + size_t ret; - ret = (unsigned long)a->addr; + ret = (size_t)a->addr; ret = ret * 17851 + (ret >> 14) * 7 + (ret >> 4) * 251; return (ret); @@ -661,8 +661,8 @@ static void print_leak_doall_arg(const MEM *m, MEM_LEAK *l) bufp += strlen(bufp); } - BIO_snprintf(bufp, BUF_REMAIN, "number=%d, address=%08lX\n", - m->num, (unsigned long)m->addr); + BIO_snprintf(bufp, BUF_REMAIN, "number=%d, address=%p\n", + m->num, m->addr); bufp += strlen(bufp); BIO_puts(l->bio, buf); diff --git a/crypto/thr_id.c b/crypto/thr_id.c index c391fc4ac3..51088e4fb5 100644 --- a/crypto/thr_id.c +++ b/crypto/thr_id.c @@ -146,7 +146,7 @@ void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr) /* * 'ptr' can be embedded in 'val' without loss of uniqueness */ - id->val = (unsigned long)id->ptr; + id->val = (size_t)id->ptr; return; } /* -- 2.40.0