pass: hal: Fix build warning caused by a wrong scanf format specifier 43/141043/8
authorWook Song <wook16.song@samsung.com>
Fri, 28 Jul 2017 02:05:52 +0000 (11:05 +0900)
committerWook Song <wook16.song@samsung.com>
Fri, 4 Aug 2017 00:21:33 +0000 (09:21 +0900)
The original type of int64_t depends on whether 32-bit or 64-bit
environment. In detail, on the 32-bit environment, int64_t is long long
int while, on the 64-bit environment, it is long int. Therefore, using
%lld for the scanf format specifier of int64_t on the 64-bit environment
causes a build warning. This patch fixes the following build warning [1]
using the special purpose format specifier, SCNd64, for int64_t.

[1] "warning: format '%lld' expects
argument of type 'long long int *', but argument 3 has type 'int64_t *
{aka long int *}' [-Wformat=]"

Change-Id: I6a4cb301858635b2cef91fdee8d04540413f7bec
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-hal.c

index 7fa470f617367bd636362c819fcbc80c85ff7894..3c1a5fae4c9e77711cc547e0387a3261b63bf4a0 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -863,7 +864,7 @@ int pass_get_cpu_stats(struct pass_policy *policy)
        }
 
        for (i = 0; i < policy->num_pass_cpu_stats; i++) {
-               ret = fscanf(fp_stats, "%lld %d %d %d",
+               ret = fscanf(fp_stats, "%" SCNd64 "%d %d %d",
                        &stats[i].time,
                        &stats[i].freq,
                        &stats[i].freq_new,