Frameworks/base: Wall Werror in common_time
Turn on warnings and errors in common_time.
Fix a code path in CommonTimeServer::handleSyncResponse in which
and uninitialized variable is returned.
Change-Id: I2f80f063c625f032266647d0507f573370202707
diff --git a/libs/common_time/common_time_server.cpp b/libs/common_time/common_time_server.cpp
index 3e11987..01372e0 100644
--- a/libs/common_time/common_time_server.cpp
+++ b/libs/common_time/common_time_server.cpp
@@ -25,6 +25,7 @@
#include <arpa/inet.h>
#include <assert.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <linux/if_ether.h>
#include <net/if.h>
#include <net/if_arp.h>
@@ -969,13 +970,14 @@
// if the RTT of the packet is significantly larger than the panic
// threshold, we should simply discard it. Its better to do nothing
// than to take cues from a packet like that.
- int rttCommon = mCommonClock.localDurationToCommonDuration(rtt);
+ int64_t rttCommon = mCommonClock.localDurationToCommonDuration(rtt);
if (rttCommon > (static_cast<int64_t>(mPanicThresholdUsec) *
kRTTDiscardPanicThreshMultiplier)) {
- ALOGV("Dropping sync response with RTT of %lld uSec", rttCommon);
+ ALOGV("Dropping sync response with RTT of %" PRId64 " uSec", rttCommon);
mClient_ExpiredSyncRespsRXedFromCurMaster++;
if (shouldPanicNotGettingGoodData())
return becomeInitial("RX panic, no good data");
+ return true;
} else {
result = mClockRecovery.pushDisciplineEvent(avgLocal, avgCommon, rttCommon);
mClient_LastGoodSyncRX = clientRxLocalTime;