IOT-2539 Fix warnings in routing code 35/22935/2
authorGeorge Nash <george.nash@intel.com>
Fri, 20 Oct 2017 20:04:01 +0000 (13:04 -0700)
committerAshok Babu Channa <ashok.channa@samsung.com>
Fri, 20 Oct 2017 21:34:16 +0000 (21:34 +0000)
Fixed -Werror=unused-const-variable= found in
routingtablemanager.c the USECS_PER_SEC was not
used anywhere and was removed.

Fixed -Werror=format= found in routingmanager.c
current time is a uint64 from inttypes.h
%llu is long long unsigned.

C99 spec suggests the type long long int should
be at least 64 bits but may be more.  On some
platfroms it might be 128-bits. In printf %lld
could be interpreted as 64-bits or 128-bits which
could result in undefined behavior.

The PRIu64 macro from inttypes will always be interpreted
as 64-bits by printf.

Change-Id: Iaf45d5a8382c4af8f3db973700db1d90b4472cc1
Signed-off-by: George Nash <george.nash@intel.com>
resource/csdk/routing/src/routingmanager.c
resource/csdk/routing/src/routingtablemanager.c

index bf16189..3dc87b8 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <inttypes.h>
 #include "routingmanager.h"
 #include "routingmanagerinterface.h"
 #include "routingtablemanager.h"
@@ -788,7 +789,7 @@ void RMProcess()
 
     if (!g_isValidated && ROUTINGTABLE_REFRESH_TIMEOUT <= (currentTime - g_refreshTableTime))
     {
-        OIC_LOG_V(DEBUG, TAG, "Refreshing the routing table: %llu", currentTime);
+        OIC_LOG_V(DEBUG, TAG, "Refreshing the routing table: %" PRIu64, currentTime);
         u_linklist_t* invalidInterfaces = NULL;
         RTMUpdateDestAddrValidity(&invalidInterfaces, &g_routingGatewayTable);
         if (0 < u_linklist_length(invalidInterfaces))
index 86d119a..88838c3 100644 (file)
@@ -36,8 +36,6 @@
  */
 #define RM_TAG "OIC_RM_RAP"
 
-static const uint64_t USECS_PER_SEC = 1000000;
-
 OCStackResult RTMInitialize(u_linklist_t **gatewayTable, u_linklist_t **endpointTable)
 {
     OIC_LOG(DEBUG, TAG, "RTMInitialize IN");