From 3cb54987857690fa5b73f0192cc052eb55b562f7 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Wed, 30 Apr 2014 09:21:54 -0700 Subject: [PATCH] logd: 64-bit compile issue - ULONG_MAX is used against an uint32 - Add tv_sec_max and tv_nsec_max constants to log_time Change-Id: Ic86cd7b0680868ad0536198b71a34cb19134fc22 --- include/log/log_read.h | 3 +++ logd/LogStatistics.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/log/log_read.h b/include/log/log_read.h index bd9de1250..54d71a482 100644 --- a/include/log/log_read.h +++ b/include/log/log_read.h @@ -33,6 +33,9 @@ public: uint32_t tv_sec; // good to Feb 5 2106 uint32_t tv_nsec; + static const uint32_t tv_sec_max = 0xFFFFFFFFUL; + static const uint32_t tv_nsec_max = 999999999UL; + log_time(const timespec &T) { tv_sec = T.tv_sec; diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp index f2b9a268c..81c9babb0 100644 --- a/logd/LogStatistics.cpp +++ b/logd/LogStatistics.cpp @@ -392,8 +392,8 @@ LogStatistics::LogStatistics() dgram_qlen_statistics = false; for(unsigned short bucket = 0; dgram_qlen(bucket); ++bucket) { - mMinimum[bucket].tv_sec = (uint32_t)-1; - mMinimum[bucket].tv_nsec = 999999999UL; + mMinimum[bucket].tv_sec = mMinimum[bucket].tv_sec_max; + mMinimum[bucket].tv_nsec = mMinimum[bucket].tv_nsec_max; } } @@ -439,7 +439,7 @@ unsigned short LogStatistics::dgram_qlen(unsigned short bucket) { } unsigned long long LogStatistics::minimum(unsigned short bucket) { - if (mMinimum[bucket].tv_sec == LONG_MAX) { + if (mMinimum[bucket].tv_sec == mMinimum[bucket].tv_sec_max) { return 0; } return mMinimum[bucket].nsec();