audiotest: Fix Wformat warnings reported by clang.

Fix a bunch of warnings reported by clang because of incorrect
format specifiers.

/mnt/host/source/src/platform/audiotest/src/alsa_conformance_helper.c:159:40: error: format specifies type
'int' but the argument has type 'snd_pcm_uframes_t' (aka 'unsigned long') [-Werror,-Wformat]
     printf("period size: %d frames\n", frames);
                         ~~            ^~~~~~
                         %lu
/mnt/host/source/src/platform/audiotest/src/alsa_conformance_helper.c:173:40: error: format specifies type
'unsigned int' but the argument has type 'snd_pcm_uframes_t' (aka 'unsigned long') [-Werror,-Wformat]
    printf("buffer size: %u frames\n", frames);
                         ~~            ^~~~~~
                         %lu
/mnt/host/source/src/platform/audiotest/src/alsa_conformance_helper.c:283:67: error: invalid conversion
specifier ':' [-Werror,-Wformat-invalid-specifier]
         fprintf(stderr, "snd_pcm_hw_params_set_period_size_near %l: %s\n",
                                                                ~~^
/mnt/host/source/src/platform/audiotest/src/alsa_conformance_helper.c:284:17: error: format specifies type
'char *' but the argument has type 'snd_pcm_uframes_t' (aka 'unsigned long') [-Werror,-Wformat]
                 *period_size, snd_strerror(rc));
                ^~~~~~~~~~~~
/mnt/host/source/src/platform/audiotest/src/alsa_conformance_helper.c:284:31: error: data argument not
used by format string [-Werror,-Wformat-extra-args]
                 *period_size, snd_strerror(rc));

And several more.

BUG=chromium:958583
TEST=emerge-amd64-generic audiotest works.

Change-Id: Id5bcb98877e83bf15a4c00d43c29b5963cd3c015
Reviewed-on: https://chromium-review.googlesource.com/1592641
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
diff --git a/include/alsa_conformance_debug.h b/include/alsa_conformance_debug.h
index 06ee3fc..f5dc31d 100644
--- a/include/alsa_conformance_debug.h
+++ b/include/alsa_conformance_debug.h
@@ -8,6 +8,7 @@
 #define INCLUDE_ALSA_CONFORMANCE_DEBUG_H_
 
 /* Print debug messages. Only available in debug mode. */
+__attribute__((__format__(__printf__, 1, 2)))
 void logger(const char *format, ...);
 
 #endif /* INCLUDE_ALSA_CONFORMANCE_DEBUG_H_ */
diff --git a/src/alsa_conformance_helper.c b/src/alsa_conformance_helper.c
index 578484d..07c7bb9 100644
--- a/src/alsa_conformance_helper.c
+++ b/src/alsa_conformance_helper.c
@@ -156,7 +156,7 @@
         fprintf(stderr, "hw_params_get_period_size: %s\n", snd_strerror(rc));
         return rc;
     }
-    printf("period size: %d frames\n", frames);
+    printf("period size: %lu frames\n", frames);
 
     rc = snd_pcm_hw_params_get_buffer_time(params, &val, &dir);
     if (rc < 0) {
@@ -170,7 +170,7 @@
         fprintf(stderr, "hw_params_get_buffer_time: %s\n", snd_strerror(rc));
         return rc;
     }
-    printf("buffer size: %u frames\n", frames);
+    printf("buffer size: %lu frames\n", frames);
     return 0;
 }
 
@@ -280,7 +280,7 @@
                                                 period_size,
                                                 &dir);
     if (rc < 0) {
-        fprintf(stderr, "snd_pcm_hw_params_set_period_size_near %l: %s\n",
+        fprintf(stderr, "snd_pcm_hw_params_set_period_size_near %lu: %s\n",
                 *period_size, snd_strerror(rc));
         return rc;
     }
diff --git a/src/alsa_conformance_recorder.c b/src/alsa_conformance_recorder.c
index f1819de..67825ef 100644
--- a/src/alsa_conformance_recorder.c
+++ b/src/alsa_conformance_recorder.c
@@ -240,19 +240,19 @@
             err_max = MAX(err_max, recorder->err);
         }
     }
-    printf("number of recorders: %u\n", list->count);
-    printf("number of points: %u\n", points);
+    printf("number of recorders: %lu\n", list->count);
+    printf("number of points: %lu\n", points);
     if (list->count == 1) {
         printf("step average: %lf\n", step);
-        printf("step min: %u\n", step_min);
-        printf("step max: %u\n", step_max);
+        printf("step min: %lu\n", step_min);
+        printf("step max: %lu\n", step_max);
         printf("step standard deviation: %lf\n", list->array[0]->step_standard);
         printf("rate: %lf\n", rate);
         printf("rate error: %lf\n", err);
     } else {
         printf("step average: %lf\n", step / list->count);
-        printf("step min: %u\n", step_min);
-        printf("step max: %u\n", step_max);
+        printf("step min: %lu\n", step_min);
+        printf("step max: %lu\n", step_max);
         printf("rate average: %lf\n", rate / list->count);
         printf("rate min: %lf\n", rate_min);
         printf("rate max: %lf\n", rate_max);
diff --git a/src/alsa_conformance_timer.c b/src/alsa_conformance_timer.c
index 5feec54..12385d1 100644
--- a/src/alsa_conformance_timer.c
+++ b/src/alsa_conformance_timer.c
@@ -7,6 +7,7 @@
 #include <assert.h>
 #include <ctype.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -59,7 +60,8 @@
 char* timespec_to_str(const struct timespec *time)
 {
     char buf[30];
-    snprintf(buf, 30, "%u.%09u", time->tv_sec, time->tv_nsec);
+    snprintf(buf, 30, "%" PRIu64 ".%09" PRIu64, (uint64_t) time->tv_sec,
+             (uint64_t) time->tv_nsec);
     return strdup(buf);
 }