diff options
author | 2012-02-27 18:50:55 -0800 | |
---|---|---|
committer | 2012-02-27 18:50:55 -0800 | |
commit | d9df224570325c41f9aa9f3a25bf4baf828065f2 (patch) | |
tree | d4604285742530f34dd3895ee3f83450a3d8519a /libs/utils/StopWatch.cpp | |
parent | 4709a11b5dcb0abb5f8518e0404b67a0912c0167 (diff) |
Fixed several 64-bit porting issues
1. Use "%zu" instead of "%d" for size_t in printf
2. Variable precision specifier (eg. "%.*s") in printf should be of type int.
(iov_len is size_t which is 64-bit when compiled with -m64)
3. Use PRId64 instead of "%lld" to print variables of type int64_t
Change-Id: I2be40a6514b5dffa0038d62b9bccc3401b8756e6
Diffstat (limited to 'libs/utils/StopWatch.cpp')
-rw-r--r-- | libs/utils/StopWatch.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/utils/StopWatch.cpp b/libs/utils/StopWatch.cpp index 595aec359e36..b1708d62b811 100644 --- a/libs/utils/StopWatch.cpp +++ b/libs/utils/StopWatch.cpp @@ -20,6 +20,10 @@ #include <stdlib.h> #include <stdio.h> +/* for PRId64 */ +#define __STDC_FORMAT_MACROS 1 +#include <inttypes.h> + #include <utils/Log.h> #include <utils/Errors.h> #include <utils/StopWatch.h> @@ -39,11 +43,11 @@ StopWatch::~StopWatch() { nsecs_t elapsed = elapsedTime(); const int n = mNumLaps; - ALOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed)); + ALOGD("StopWatch %s (us): %" PRId64 " ", mName, ns2us(elapsed)); for (int i=0 ; i<n ; i++) { const nsecs_t soFar = mLaps[i].soFar; const nsecs_t thisLap = mLaps[i].thisLap; - ALOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap)); + ALOGD(" [%d: %" PRId64 ", %" PRId64, i, ns2us(soFar), ns2us(thisLap)); } } |