Fix clang syntax checking error.

Added output info for LOG_IF, moved the position of the declaration
of an arry. Changed the input format of sprintf.

BUG=chromium:221218
TEST=CFLAGS="-clang -print-cmdline" CXXFLAGS="-clang -print-cmdline"
     emerge-x86-alex verity passes.

Change-Id: Ie969776a05dbf4627e6e235a3dc2d98ff7de27d4
Reviewed-on: https://gerrit.chromium.org/gerrit/47577
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
diff --git a/dm-bht.c b/dm-bht.c
index 2a2b49a..ccc7a17 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -59,7 +59,8 @@
 static void dm_bht_bin_to_hex(u8 *binary, u8 *hex, unsigned int binary_len)
 {
 	while (binary_len-- > 0) {
-		sprintf((char *__restrict__)hex, "%02hhx", (int)*binary);
+                sprintf((char *__restrict__)hex, "%02hhx",
+                        (unsigned char)*binary);
 		hex += 2;
 		binary++;
 	}
diff --git a/file_hasher_unittest.cc b/file_hasher_unittest.cc
index 83c7af4..84b2360 100644
--- a/file_hasher_unittest.cc
+++ b/file_hasher_unittest.cc
@@ -41,9 +41,8 @@
   verity::FileHasher *hasher_;
 };
 
-static char last_digest_match[256] = { 0 };
-
 MATCHER_P(DigestMatch, a, "given hexdigest matches binary digest arg") {
+  static char last_digest_match[256] = { 0 };
   char *hexdigest = new char[strlen(a) + 1];
   verity_utils::to_hex(hexdigest, arg, strlen(a)/2);
   bool ok = !strcmp(a, hexdigest);
diff --git a/verity_main.cc b/verity_main.cc
index 698940a..da96479 100644
--- a/verity_main.cc
+++ b/verity_main.cc
@@ -134,8 +134,10 @@
     << "Failed to initialize hasher";
   if (salt)
     hasher.set_salt(salt);
-  LOG_IF(FATAL, !hasher.Hash());
-  LOG_IF(FATAL, !hasher.Store());
+  LOG_IF(FATAL, !hasher.Hash())
+    << "Failed to hash hasher";
+  LOG_IF(FATAL, !hasher.Store())
+    << "Failed to store hasher";
   hasher.PrintTable(true);
   return 0;
 }