From 3c477458fa7f1506e722ede38636eaced8810687 Mon Sep 17 00:00:00 2001 From: Joel Kitching Date: Fri, 4 Oct 2019 17:46:29 +0800 Subject: vboot: format hex numbers with %#x instead of 0x%x Also standardize on using hex for printing ASCII key values across vboot_ui.c and vboot_ui_menu.c. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ib10288d95e29c248ebe807d99108aea75775b155 Signed-off-by: Joel Kitching Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1840191 Reviewed-by: Joel Kitching Tested-by: Joel Kitching Commit-Queue: Joel Kitching --- tests/tpm_lite/lock.c | 2 +- tests/tpm_lite/startup.c | 6 +++--- tests/tpm_lite/tlcl_tests.h | 4 ++-- tests/tpm_lite/tpmtest_timing.c | 2 +- tests/tpm_lite/tpmtest_writelimit.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests/tpm_lite') diff --git a/tests/tpm_lite/lock.c b/tests/tpm_lite/lock.c index bfc10e2e..55d2dfe7 100644 --- a/tests/tpm_lite/lock.c +++ b/tests/tpm_lite/lock.c @@ -24,6 +24,6 @@ int main(int argc, char** argv) { TlclWriteLock(INDEX0); - printf("Locked 0x%x\n", INDEX0); + printf("Locked %#x\n", INDEX0); exit(0); } diff --git a/tests/tpm_lite/startup.c b/tests/tpm_lite/startup.c index 3d901f39..573373dc 100644 --- a/tests/tpm_lite/startup.c +++ b/tests/tpm_lite/startup.c @@ -15,17 +15,17 @@ int main(int argc, char** argv) { TlclLibInit(); result = TlclStartup(); if (result != 0) { - printf("tpm startup failed with 0x%x\n", result); + printf("tpm startup failed with %#x\n", result); } result = TlclGetFlags(NULL, NULL, NULL); if (result != 0) { - printf("tpm getflags failed with 0x%x\n", result); + printf("tpm getflags failed with %#x\n", result); } printf("executing SelfTestFull\n"); TlclSelfTestFull(); result = TlclGetFlags(NULL, NULL, NULL); if (result != 0) { - printf("tpm getflags failed with 0x%x\n", result); + printf("tpm getflags failed with %#x\n", result); } printf("TEST SUCCEEDED\n"); return 0; diff --git a/tests/tpm_lite/tlcl_tests.h b/tests/tpm_lite/tlcl_tests.h index 7b0d295c..db0999cd 100644 --- a/tests/tpm_lite/tlcl_tests.h +++ b/tests/tpm_lite/tlcl_tests.h @@ -19,8 +19,8 @@ uint32_t _result = (tpm_command); \ uint32_t _exp = (expected_result); \ if (_result != _exp) { \ - printf("TEST FAILED: line %d: " #tpm_command ": 0x%x" \ - " (expecting 0x%x)\n", __LINE__, _result, _exp); \ + printf("TEST FAILED: line %d: " #tpm_command ": %#x" \ + " (expecting %#x)\n", __LINE__, _result, _exp); \ return _result; \ } \ } while (0) diff --git a/tests/tpm_lite/tpmtest_timing.c b/tests/tpm_lite/tpmtest_timing.c index d86b4eee..1ec14a2e 100644 --- a/tests/tpm_lite/tpmtest_timing.c +++ b/tests/tpm_lite/tpmtest_timing.c @@ -28,7 +28,7 @@ gettimeofday(&before, NULL); \ __result = op; \ if (__result != TPM_SUCCESS) { \ - printf(#op ": error 0x%x\n", __result); \ + printf(#op ": error %#x\n", __result); \ errors++; \ } \ gettimeofday(&after, NULL); \ diff --git a/tests/tpm_lite/tpmtest_writelimit.c b/tests/tpm_lite/tpmtest_writelimit.c index 75bae9f1..05e4a178 100644 --- a/tests/tpm_lite/tpmtest_writelimit.c +++ b/tests/tpm_lite/tpmtest_writelimit.c @@ -43,7 +43,7 @@ int main(int argc, char** argv) { "MAX_NV_WRITES_NOOWNER reached"); break; default: - VB2_DEBUG("unexpected error code %d (0x%x)\n", + VB2_DEBUG("unexpected error code %d (%#x)\n", result, result); exit(1); } -- cgit v1.2.1