[openssl-commits] [openssl] master update

Emilia Kasper emilia at openssl.org
Tue Sep 1 18:19:56 UTC 2015


The branch master has been updated
       via  fb029cebaeb6b0dbdb05a26a515e38a52a3c0fa1 (commit)
      from  08a721ac613d69217b474a61882971ae9d4586d1 (commit)


- Log -----------------------------------------------------------------
commit fb029cebaeb6b0dbdb05a26a515e38a52a3c0fa1
Author: Adam Eijdenberg <adam.eijdenberg at gmail.com>
Date:   Tue Aug 4 19:08:22 2015 -0700

    RT3984: Fix clang compiler warning on Mac OS X where %ld is used for uint64_t.
    
    clang suggests %llu instead, but it isn't clear that is portable on
    all platforms.
    
    C99 and above define a handy macro for us, so we try to use that
    definition and fall back to current definition if needed (though we
    switch to 'u' for unsigned).
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/enc.c              |  4 ++--
 apps/s_client.c         |  2 +-
 include/openssl/e_os2.h | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/apps/enc.c b/apps/enc.c
index 628142a..18fcb95 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -567,8 +567,8 @@ int enc_main(int argc, char **argv)
 
     ret = 0;
     if (verbose) {
-        BIO_printf(bio_err, "bytes read   :%8ld\n", BIO_number_read(in));
-        BIO_printf(bio_err, "bytes written:%8ld\n", BIO_number_written(out));
+        BIO_printf(bio_err, "bytes read   :%8"PRIu64"\n", BIO_number_read(in));
+        BIO_printf(bio_err, "bytes written:%8"PRIu64"\n", BIO_number_written(out));
     }
  end:
     ERR_print_errors(bio_err);
diff --git a/apps/s_client.c b/apps/s_client.c
index 2b69355..819cff3 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -2092,7 +2092,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
         ssl_print_tmp_key(bio, s);
 
         BIO_printf(bio,
-                   "---\nSSL handshake has read %ld bytes and written %ld bytes\n",
+                   "---\nSSL handshake has read %"PRIu64" bytes and written %"PRIu64" bytes\n",
                    BIO_number_read(SSL_get_rbio(s)),
                    BIO_number_written(SSL_get_wbio(s)));
     }
diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h
index 177b098..9f7dcf1 100644
--- a/include/openssl/e_os2.h
+++ b/include/openssl/e_os2.h
@@ -294,6 +294,22 @@ typedef unsigned __int64 uint64_t;
 #  include <stdint.h>
 # endif
 
+/*
+ * We need a format operator for some client tools for uint64_t.
+ * This is an attempt at doing so in a portable manner.
+ * If we can't use a built-in definition, we'll revert to the previous
+ * behavior that was hard-coded but now causing compiler warnings on
+ * some systems (e.g. Mac OS X).
+ */
+# ifndef PRIu64
+#  if (__STDC_VERSION__ >= 199901L)
+#   include <inttypes.h>
+#  endif
+#  ifndef PRIu64
+#   define PRIu64 "lu"
+#  endif
+# endif
+
 #ifdef  __cplusplus
 }
 #endif


More information about the openssl-commits mailing list