Fixed compilar warning in ocserver
authorGeorge Nash <george.nash@intel.com>
Thu, 2 Mar 2017 18:59:22 +0000 (10:59 -0800)
committerRick Bell <richard.s.bell@intel.com>
Sat, 4 Mar 2017 20:16:35 +0000 (20:16 +0000)
The -Wformat= warning was fixed by replacing
the %lld flag with the PRId64 or SCNd64 macro
from the inttypes.

Change-Id: I79b289d79ee2b918ec0947815f2dc6e6d3c07f3c
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17629
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp

index 656168e..2d857b7 100644 (file)
@@ -35,6 +35,7 @@
 #include <pthread.h>
 #endif
 #include <array>
+#include <cinttypes>
 #include "oic_malloc.h"
 #include <getopt.h>
 #include "ocstack.h"
@@ -187,7 +188,7 @@ bool checkIfQueryForPowerPassed(char * query)
         if (pointerToOperator)
         {
             int64_t powerRequested;
-            int matchedItems = sscanf((pointerToOperator + 1), "%lld", &powerRequested);
+            int matchedItems = sscanf((pointerToOperator + 1), "%" SCNd64, &powerRequested);
 
             if (1 != matchedItems)
             {
@@ -196,7 +197,7 @@ bool checkIfQueryForPowerPassed(char * query)
 
             if (Light.power > powerRequested)
             {
-                OIC_LOG_V(INFO, TAG, "Current power: %lld. Requested: <%lld", Light.power,
+                OIC_LOG_V(INFO, TAG, "Current power: %" PRId64 ". Requested: <%" PRId64, Light.power,
                           powerRequested);
                 return false;
             }
@@ -737,7 +738,7 @@ void *ChangeLightRepresentation (void *param)
         Light.power += 5;
         if (gLightUnderObservation)
         {
-            OIC_LOG_V(INFO, TAG, " =====> Notifying stack of new power level %lld\n", Light.power);
+            OIC_LOG_V(INFO, TAG, " =====> Notifying stack of new power level %" PRId64 "\n", Light.power);
             if (gObserveNotifyType == 1)
             {
                 // Notify list of observers. Alternate observers on the list will be notified.