Remove build warnings
authorJaewook Jung <jw0213.jung@samsung.com>
Tue, 16 May 2017 11:10:51 +0000 (20:10 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Thu, 18 May 2017 05:31:08 +0000 (05:31 +0000)
Change-Id: Ib22fda47f5e843bc753966c085942014d70d4922
Signed-off-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19949
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Glen Youngjin Kim <glen.kim@samsung.com>
Reviewed-by: Hyuna Jo <hyuna0213.jo@samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Todd Malsbary <todd.malsbary@intel.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/c_common/platform_features.h
resource/csdk/connectivity/inc/ca_adapter_net_ssl.h
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
resource/csdk/resource-directory/src/rd_client.c
resource/csdk/stack/src/ocresource.c
resource/include/StringConstants.h
resource/src/CAManager.cpp
resource/src/OCException.cpp
resource/src/OCResource.cpp
resource/unittests/OCExceptionTest.cpp

index 5f03d39..a4a7f13 100644 (file)
  * UINT16_MAX does not appear to be defined on Arduino so we define it here.
  */
 #  define UINT16_MAX 65535
+
+/**
+ * Handle case that PRId64 is not defined in Arduino's inttypes.h
+ */
+#  if !defined(PRId64)
+#    define PRId64 "lld"
+#  endif
 #endif
 
 /**
index 464341e..ecec0ca 100644 (file)
@@ -123,7 +123,7 @@ void CAdeinitSslAdapter();
  *
  */
 
-CAResult_t CAencryptSsl(const CAEndpoint_t *endpoint, void *data, size_t dataLen);
+CAResult_t CAencryptSsl(const CAEndpoint_t *endpoint, const void *data, size_t dataLen);
 
 /**
  * Performs TLS decryption of the data.
index 5e1cd3d..17c9969 100644 (file)
@@ -1339,7 +1339,7 @@ static void SetupCipher(mbedtls_ssl_config * config, CATransportAdapter_t adapte
     // Add all certificate ciphersuites
     if (true == g_caSslContext->cipherFlag[1])
     {
-        for (int i = 0; i < SSL_CIPHER_MAX - 1; i++)
+        for (unsigned int i = 0; i < SSL_CIPHER_MAX - 1; i++)
         {
             if (MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 != tlsCipher[i][0] &&
                     i != g_caSslContext->cipher)
@@ -1758,7 +1758,7 @@ SslCacheMessage_t *  NewCacheMessage(uint8_t * data, size_t dataLen)
 /* Send data via TLS connection.
  */
 CAResult_t CAencryptSsl(const CAEndpoint_t *endpoint,
-                        void *data, size_t dataLen)
+                        const void *data, size_t dataLen)
 {
     int ret = 0;
 
@@ -2043,7 +2043,7 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, size_t dat
                     OIC_LOG_V(DEBUG, NET_SSL_TAG, "Out %s", __func__);
                     return CA_STATUS_FAILED;
                 }
-                else if (ret > sizeof(peer->sep.publicKey))
+                else if ((size_t)ret > sizeof(peer->sep.publicKey))
                 {
                     assert(!"publicKey field of CASecureEndpoint_t is too small for the public key!");
                     OIC_LOG(ERROR, NET_SSL_TAG, "Public key of remote peer was too large");
index bfc8da3..144272a 100644 (file)
@@ -22,6 +22,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>
 
 #include "oic_malloc.h"
 #include "oic_string.h"
@@ -448,7 +449,8 @@ OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host,
         OCResource *handle = (OCResource *) resourceHandles[j];
         int64_t ins = 0;
         OCGetResourceIns(handle, &ins);
-        int lenBufferRequired = snprintf((queryParam + queryLength), (MAX_URI_LENGTH - queryLength), "&ins=%lld", ins);
+        int lenBufferRequired = snprintf((queryParam + queryLength),
+                                         (MAX_URI_LENGTH - queryLength), "&ins=%" PRId64, ins);
         if (lenBufferRequired >= (MAX_URI_LENGTH - queryLength) || lenBufferRequired < 0)
         {
             return OC_STACK_INVALID_URI;
index 2e205ec..69ae755 100755 (executable)
@@ -1273,11 +1273,6 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr,
        }
     }
 
-    bool isVirtual = false;
-    if (GetTypeOfVirtualURI(resourcePtr->uri) != OC_UNKNOWN_URI)
-    {
-        isVirtual = true;
-    }
 #ifdef TCP_ADAPTER
     uint16_t tcpPort = 0;
     GetTCPPortInfo(devAddr, &tcpPort, (resourcePtr->resourceProperties & OC_SECURE));
index 2a406b8..861f69c 100644 (file)
@@ -134,6 +134,7 @@ namespace OC
         static const char FORBIDDEN_REQ[]              = "Forbidden request";
         static const char INTERNAL_SERVER_ERROR[]      = "Internal server error";
         static const char BAD_ENDPOINT[]               = "Bad Endpoint";
+        static const char GATEWAY_TIMEOUT[]            = "Gateway Timeout";
     }
 
     namespace Error
index 8687ce1..99397f9 100644 (file)
@@ -134,7 +134,7 @@ uint16_t CAManager::getAssignedPortNumber(OCTransportAdapter adapter, OCTranspor
 OCStackResult CAManager::setBTConfigure(const CAUtilConfig& config)
 {
     OIC_LOG(INFO, TAG, "setBTConfigure");
-    CAUtilConfig_t configs = {(CATransportBTFlags_t)config.bleFlag};
+    CAUtilConfig_t configs = {(CATransportBTFlags_t)config.bleFlag, CA_USER_PREF_CLOUD};
     CAResult_t ret = CAUtilSetBTConfigure(configs);
     return convertCAResultToOCResult(ret);
 }
index 34fe08f..b3a3508 100644 (file)
@@ -121,6 +121,8 @@ std::string OC::OCException::reason(const OCStackResult sr)
             return OC::Exception::INTERNAL_SERVER_ERROR;
         case OC_STACK_BAD_ENDPOINT:
             return OC::Exception::BAD_ENDPOINT;
+        case OC_STACK_GATEWAY_TIMEOUT:
+            return OC::Exception::GATEWAY_TIMEOUT;
     }
 
     return OC::Exception::UNKNOWN_ERROR;
index 8fd1ed0..67ac61d 100644 (file)
@@ -117,11 +117,7 @@ OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
     m_endpoints(endpoints),
     m_observeHandle(nullptr)
 {
-    m_devAddr = OCDevAddr{OC_DEFAULT_ADAPTER, OC_DEFAULT_FLAGS, 0, {0}, 0,
-#if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
-                          {0}
-#endif
-                        };
+    m_devAddr = OCDevAddr{OC_DEFAULT_ADAPTER, OC_DEFAULT_FLAGS, 0, {0}, 0, {0}, {0}};
     m_isCollection = std::find(m_interfaces.begin(), m_interfaces.end(), LINK_INTERFACE)
                         != m_interfaces.end();
 
index d2e5118..8241144 100644 (file)
@@ -79,7 +79,8 @@ namespace OC
                 OC_STACK_NOT_ACCEPTABLE,
                 OC_STACK_FORBIDDEN_REQ,
                 OC_STACK_INTERNAL_SERVER_ERROR,
-                OC_STACK_BAD_ENDPOINT
+                OC_STACK_BAD_ENDPOINT,
+                OC_STACK_GATEWAY_TIMEOUT
             };
 
             std::string resultMessages[]=
@@ -130,7 +131,8 @@ namespace OC
                 OC::Exception::NOT_ACCEPTABLE,
                 OC::Exception::FORBIDDEN_REQ,
                 OC::Exception::INTERNAL_SERVER_ERROR,
-                OC::Exception::BAD_ENDPOINT
+                OC::Exception::BAD_ENDPOINT,
+                OC::Exception::GATEWAY_TIMEOUT
             };
             TEST(OCExceptionTest, ReasonCodeMatches)
             {