Fixed build warnings due to assert, unused function, time
authorErich Keane <erich.keane@intel.com>
Tue, 21 Jul 2015 23:05:54 +0000 (16:05 -0700)
committerErich Keane <erich.keane@intel.com>
Wed, 22 Jul 2015 15:32:08 +0000 (15:32 +0000)
This fixes a handful of the warnings present on master.

Change-Id: Idc39f9c8f8c73e0107831bc340738028a1294604
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1804
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript
resource/csdk/connectivity/lib/libcoap-4.1.1/bits.h
resource/csdk/connectivity/lib/libcoap-4.1.1/coap_time.h
resource/csdk/connectivity/lib/libcoap-4.1.1/uri.c
resource/csdk/connectivity/src/camessagehandler.c
resource/csdk/connectivity/src/caprotocolmessage.c
resource/csdk/connectivity/src/caretransmission.c
resource/csdk/stack/src/ocserverrequest.c

index c5f9425..8c1059a 100644 (file)
@@ -28,7 +28,7 @@ if target_os == 'arduino':
                ])
 
 if target_os not in ['arduino', 'windows', 'winrt']:
-       libcoap_env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '_BSD_SOURCE'])
+       libcoap_env.AppendUnique(CPPDEFINES = ['WITH_POSIX', '_DEFAULT_SOURCE'])
        libcoap_env.AppendUnique(CFLAGS = ['-std=gnu99','-fPIC'])
 
 if target_os not in ['windows', 'winrt']:
index 20281a0..9add64f 100644 (file)
@@ -33,7 +33,7 @@
  */
 inline static int bits_setb(uint8_t *vec, size_t size, uint8_t bit)
 {
-    if (size <= (bit >> 3))
+    if (size <= (size_t)(bit >> 3))
         return -1;
 
     *(vec + (bit >> 3)) |= (uint8_t)(1 << (bit & 0x07));
@@ -53,7 +53,7 @@ inline static int bits_setb(uint8_t *vec, size_t size, uint8_t bit)
  */
 inline static int bits_clrb(uint8_t *vec, size_t size, uint8_t bit)
 {
-    if (size <= (bit >> 3))
+    if (size <= (size_t)(bit >> 3))
         return -1;
 
     *(vec + (bit >> 3)) &= (uint8_t)(~(1 << (bit & 0x07)));
@@ -72,7 +72,7 @@ inline static int bits_clrb(uint8_t *vec, size_t size, uint8_t bit)
  */
 inline static int bits_getb(const uint8_t *vec, size_t size, uint8_t bit)
 {
-    if (size <= (bit >> 3))
+    if (size <= (size_t)(bit >> 3))
         return -1;
 
     return (*(vec + (bit >> 3)) & (1 << (bit & 0x07))) != 0;
index 76dcd9d..6eb924b 100644 (file)
@@ -31,6 +31,9 @@ extern "C"
      * @{
      */
 
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
 #ifdef WITH_LWIP
 
 #include <stdint.h>
index 1e8d000..42dab60 100644 (file)
@@ -556,7 +556,7 @@ coap_parse_next(coap_parse_iterator_t *pi)
 
     /* skip following separator (the first segment might not have one) */
 
-      if (strchr(s,*(pi->pos)))
+      if (strchr((const char*)s,*(pi->pos)))
       {
           ++pi->pos;
           --pi->n;
@@ -564,7 +564,7 @@ coap_parse_next(coap_parse_iterator_t *pi)
 
       p = pi->pos;
 
-      while ((pi->segment_length < pi->n) && (!strchr(s,*p))
+      while ((pi->segment_length < pi->n) && (!strchr((const char*)s,*p))
               && (!strnchr(pi->delim, pi->dlen, *p)))
       {
           ++p;
index d92d5b1..0b6e93e 100644 (file)
@@ -70,7 +70,9 @@ static void CAErrorHandler(const CAEndpoint_t *endpoint,
 static CAData_t* CAGenerateHandlerData(const CAEndpoint_t *endpoint, const void *data,
                                        CADataType_t dataType);
 
+#ifdef SINGLE_THREAD
 static void CAProcessReceivedData(CAData_t *data);
+#endif
 static void CADataDestroyer(void *data, uint32_t size);
 static void CALogPayloadInfo(CAInfo_t *info);
 static bool CADropSecondRequest(const CAEndpoint_t *endpoint, uint16_t messageId);
@@ -298,6 +300,7 @@ static void CADataDestroyer(void *data, uint32_t size)
     OIC_LOG(DEBUG, TAG, "CADataDestroyer OUT");
 }
 
+#ifdef SINGLE_THREAD
 static void CAProcessReceivedData(CAData_t *data)
 {
     OIC_LOG(DEBUG, TAG, "CAProcessReceivedData IN");
@@ -330,13 +333,11 @@ static void CAProcessReceivedData(CAData_t *data)
         g_errorHandler(rep, data->errorInfo);
     }
 
-
-#ifdef SINGLE_THREAD
     CADataDestroyer(data, sizeof(CAData_t));
-#endif
 
     OIC_LOG(DEBUG, TAG, "CAProcessReceivedData OUT");
 }
+#endif
 
 #ifndef SINGLE_THREAD
 
index b6e3b05..18ba048 100644 (file)
@@ -28,7 +28,6 @@
 // For details on compatibility and glibc support,
 // Refer http://www.gnu.org/software/libc/manual/html_node/BSD-Random.html
 #define _DEFAULT_SOURCE
-#define _BSD_SOURCE
 
 #include <stdio.h>
 #include <stdlib.h>
index 2b130c2..b19b0db 100644 (file)
@@ -28,7 +28,6 @@
 // For details on compatibility and glibc support,
 // Refer http://www.gnu.org/software/libc/manual/html_node/BSD-Random.html
 #define _DEFAULT_SOURCE
-#define _BSD_SOURCE
 
 // Defining _POSIX_C_SOURCE macro with 199309L (or greater) as value
 // causes header files to expose definitions
index eed3051..add91c7 100644 (file)
@@ -546,11 +546,7 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
                             , CA_ADAPTER_REMOTE_ACCESS
                             #endif
                         };
-    const char * connTypes[] = {"ip" , "ble",  "edr"
-                                #ifdef RA_ADAPTER
-                                , "ra"
-                                #endif
-                            };
+
     int size = sizeof(CAConnTypes)/ sizeof(CATransportAdapter_t);
 
     CATransportAdapter_t adapter = responseEndpoint.adapter;