[PATCH BlueZ 9/9] tools: parser: fix printf format errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



struct timeval members can be 32 or 64 bits which results in "long long
int" on some platforms. As there are no printf conversion specifiers for
time types, cast them to the longest possible types.
---
 tools/parser/parser.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/parser/parser.h b/tools/parser/parser.h
index 5f65f1689447..cd6268acb893 100644
--- a/tools/parser/parser.h
+++ b/tools/parser/parser.h
@@ -120,11 +120,14 @@ static inline void p_indent(int level, struct frame *f)
 				struct tm tm;
 				time_t t = f->ts.tv_sec;
 				localtime_r(&t, &tm);
-				printf("%04d-%02d-%02d %02d:%02d:%02d.%06lu ",
+				printf("%04d-%02d-%02d %02d:%02d:%02d.%06lld ",
 					tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
-					tm.tm_hour, tm.tm_min, tm.tm_sec, f->ts.tv_usec);
+					tm.tm_hour, tm.tm_min, tm.tm_sec,
+					(long long int)f->ts.tv_usec);
 			} else
-				printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec);
+				printf("%8lld.%06lld ",
+						(long long int)f->ts.tv_sec,
+						(long long int)f->ts.tv_usec);
 		}
 		printf("%c ", (f->in ? '>' : '<'));
 		parser.state = 1;
-- 
2.43.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux