Harmonize pointer printing and size_t-fy casts.
authorAndy Polyakov <appro@openssl.org>
Wed, 30 Sep 2015 08:36:21 +0000 (10:36 +0200)
committerAndy Polyakov <appro@openssl.org>
Mon, 5 Oct 2015 07:26:19 +0000 (09:26 +0200)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/bio/b_print.c
crypto/mem_dbg.c
crypto/thr_id.c

index 06cadc8a6372655275b5850d0e1855a912571d18..f49ebee436bec3ea2cf68e6b3fcf6c0f1a776047 100644 (file)
@@ -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;
index 10cc8931e770f0f17dc801d07e4658ede07e8d99..2cd116991822accf3c45b5dd679fbda132d954df 100644 (file)
@@ -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);
index c391fc4ac3c0018e7a93d460fef627eebdb1b14d..51088e4fb5e18e1e43fac29c163dd2f9a41642e7 100644 (file)
@@ -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;
     }
     /*