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@openssl.org>
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);
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)));
}
# 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