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 06cadc8..f49ebee 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 10cc893..2cd1169 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 c391fc4..51088e4 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;
     }
     /*