csdk: Fixed compiler warnings in ocstack.c
authorGeorge Nash <george.nash@intel.com>
Thu, 9 Mar 2017 22:37:55 +0000 (14:37 -0800)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Wed, 22 Mar 2017 19:33:19 +0000 (19:33 +0000)
-Wformat= warning fixed by changing the ssanf %lld flag to SCNd64
-Wunused-function fixed by removing the OCSetNetworkMonitorHandler
 function. Since the function is not used it is also not maintained
 it is best to remove the code.

Change-Id: Ib82e6e77a561ac8713cc77bdecc44a5ce42cefff
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17813
Reviewed-by: Mike Fenelon <mike.fenelon@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/csdk/stack/src/ocstack.c

index 20bfbe6..85e1c1d 100755 (executable)
@@ -187,6 +187,10 @@ bool g_multicastServerStopped = false;
 
 #define MILLISECONDS_PER_SECOND   (1000)
 
+// handle case that SCNd64 is not defined in arduino's inttypes.h
+#if defined(WITH_ARDUINO) && !defined(SCNd64)
+#define SCNd64 "lld"
+#endif
 //-----------------------------------------------------------------------------
 // Private internal function prototypes
 //-----------------------------------------------------------------------------
@@ -434,14 +438,6 @@ static void OCDefaultAdapterStateChangedHandler(CATransportAdapter_t adapter, bo
 static void OCDefaultConnectionStateChangedHandler(const CAEndpoint_t *info, bool isConnected);
 
 /**
- * Register network monitoring callback.
- * Network status changes are delivered these callback.
- * @param adapterHandler        Adapter state monitoring callback.
- * @param connectionHandler     Connection state monitoring callback.
- */
-static void OCSetNetworkMonitorHandler(CAAdapterStateChangedCB adapterHandler,
-                                       CAConnectionStateChangedCB connectionHandler);
-/**
  * Map zoneId to endpoint address which scope is ipv6 link-local.
  * @param payload Discovery payload which has Endpoint information.
  * @param ifindex index which indicate network interface.
@@ -5611,7 +5607,7 @@ OCStackResult OCUpdateResourceInsWithResponse(const char *requestUri,
                  {
                      // Arduino's AVR-GCC doesn't support strtoll().
                      int64_t queryIns;
-                     int matchedItems = sscanf(query + 4, "%lld", &queryIns);
+                     int matchedItems = sscanf(query + 4, "%" SCNd64, &queryIns);
 
                      if (0 == matchedItems)
                      {
@@ -5796,14 +5792,6 @@ void OCDefaultConnectionStateChangedHandler(const CAEndpoint_t *info, bool isCon
     }
 }
 
-void OCSetNetworkMonitorHandler(CAAdapterStateChangedCB adapterHandler,
-                                CAConnectionStateChangedCB connectionHandler)
-{
-    OIC_LOG(DEBUG, TAG, "OCSetNetworkMonitorHandler");
-    g_adapterHandler = adapterHandler;
-    g_connectionHandler = connectionHandler;
-}
-
 OCStackResult OCGetDeviceId(OCUUIdentity *deviceId)
 {
     OicUuid_t oicUuid;