tpm2-software / tpm2-totp

Attest the trustworthiness of a device against a human using time-based one-time passwords
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
166 stars 37 forks source link

print uint64_t using inttypes.h `PRIu64` instead of `ld` #76

Closed PeterHuewe closed 3 years ago

PeterHuewe commented 3 years ago

The correct format specifier for uint64_t is PRIu64.

fixes these compilation issues on my rpi:

test/libtpm2-totp.c:49:39: error: format ‘%ld’ expects argument of type
‘long int’, but argument 5 has type ‘uint64_t’ {aka ‘long long unsigned
int’} [-Werror=format=]
     snprintf(&totp_string[0], 7, "%.*ld", 6, totp);
                                   ~~~~^      ~~~~
                                   %.*lld
test/libtpm2-totp.c:66:39: error: format ‘%ld’ expects argument of type
‘long int’, but argument 5 has type ‘uint64_t’ {aka ‘long long unsigned
int’} [-Werror=format=]
     snprintf(&totp_string[0], 7, "%.*ld", 6, totp);
                                   ~~~~^      ~~~~
                                   %.*lld

Signed-off-by: Peter Huewe Peter.Huewe@infineon.com