fix coding standard problem
authorjjack.lee <jjack.lee@samsung.com>
Thu, 13 Nov 2014 06:58:59 +0000 (15:58 +0900)
committerjjack.lee <jjack.lee@samsung.com>
Thu, 13 Nov 2014 07:09:05 +0000 (16:09 +0900)
fix all coding standard problem. This commit did NOT include logic changes .

Change-Id: I34f7a33374f137b8b641dff74e113b4941cb1391

resource/csdk/stack/include/ocstack.h
resource/csdk/stack/src/ocstack.c
resource/include/IServerWrapper.h
resource/include/InProcServerWrapper.h
resource/include/OCPlatform.h
resource/include/OCPlatform_impl.h
resource/include/OutOfProcServerWrapper.h
resource/src/InProcServerWrapper.cpp
resource/src/OCPlatform.cpp
resource/src/OCPlatform_impl.cpp

index b17ce8f..235660a 100644 (file)
@@ -479,16 +479,18 @@ OCStackResult OCCreateResource(OCResourceHandle *handle,
                                uint8_t resourceProperties);
 
 /**
- * Create a resource. with host ip address for rsrc_t
+ * Create a resource. with host ip address for remote resource
  *
- * @param handle - pointer to handle to newly created resource.  Set by ocstack.  Used to refer to resource
+ * @param handle - pointer to handle to newly created resource.  Set by ocstack.
+ *                 Used to refer to resource
  * @param resourceTypeName - name of resource type.  Example: "core.led"
  * @param resourceInterfaceName - name of resource interface.  Example: "core.rw"
- * @param host - HOST address of the resource.  Example:  "coap://xxx.xxx.xxx.xxx:xxxxx"
+ * @param host - HOST address of the remote resource.  Example:  "coap://xxx.xxx.xxx.xxx:xxxxx"
  * @param uri - URI of the resource.  Example:  "/a/led"
  * @param entityHandler - entity handler function that is called by ocstack to handle requests, etc
  *                        NULL for default entity handler
- * @param resourceProperties - properties supported by resource.  Example: OC_DISCOVERABLE|OC_OBSERVABLE
+ * @param resourceProperties - properties supported by resource.
+ *                             Example: OC_DISCOVERABLE|OC_OBSERVABLE
  *
  * @return
  *     OC_STACK_OK    - no errors
index c1dc1c4..3dae06b 100644 (file)
@@ -842,16 +842,18 @@ exit:
 
 
 /**
- * Create a resource. with host ip address for rsrc_t
+ * Create a resource. with host ip address for remote resource
  *
- * @param handle - pointer to handle to newly created resource.  Set by ocstack.  Used to refer to resource
+ * @param handle - pointer to handle to newly created resource.  Set by ocstack.
+ *                 Used to refer to resource
  * @param resourceTypeName - name of resource type.  Example: "core.led"
  * @param resourceInterfaceName - name of resource interface.  Example: "core.rw"
- * @param host - HOST address of the resource.  Example:  "coap://xxx.xxx.xxx.xxx:xxxxx"
+ * @param host - HOST address of the remote resource.  Example:  "coap://xxx.xxx.xxx.xxx:xxxxx"
  * @param uri - URI of the resource.  Example:  "/a/led"
  * @param entityHandler - entity handler function that is called by ocstack to handle requests, etc
  *                        NULL for default entity handler
- * @param resourceProperties - properties supported by resource.  Example: OC_DISCOVERABLE|OC_OBSERVABLE
+ * @param resourceProperties - properties supported by resource.
+ *                             Example: OC_DISCOVERABLE|OC_OBSERVABLE
  *
  * @return
  *     OC_STACK_OK    - no errors
@@ -864,28 +866,29 @@ OCStackResult OCCreateResourceWithHost(OCResourceHandle *handle,
         const char *host,
         const char *uri,
         OCEntityHandler entityHandler,
-        uint8_t resourceProperties) {
-
-
-       char *str = NULL;
-       size_t size;
-       OCStackResult result = OC_STACK_ERROR;
+        uint8_t resourceProperties)
+{
+    char *str = NULL;
+    size_t size;
+    OCStackResult result = OC_STACK_ERROR;
 
-       result = OCCreateResource(handle,resourceTypeName,resourceInterfaceName,uri,entityHandler,resourceProperties);
+    result = OCCreateResource(handle, resourceTypeName, resourceInterfaceName,
+                                uri, entityHandler, resourceProperties);
 
-       if( result != OC_STACK_ERROR)
-       {
-               // Set the uri
-           size = strlen(host) + 1;
-           str = (char *) OCMalloc(size);
-           if (!str) {
-               return OC_STACK_ERROR;
-           }
-           strncpy(str, host, size);
-               ((OCResource *)*handle)->host = str;
-       }
+    if (result != OC_STACK_ERROR)
+    {
+        // Set the uri
+        size = strlen(host) + 1;
+        str = (char *) OCMalloc(size);
+        if (!str)
+        {
+            return OC_STACK_ERROR;
+        }
+        strncpy(str, host, size);
+        ((OCResource *) *handle)->host = str;
+    }
 
-       return result;
+    return result;
 }
 
 /**
index e617302..1796b02 100644 (file)
@@ -53,8 +53,7 @@ namespace OC
                     EntityHandler& entityHandler,
                     uint8_t resourceProperty) = 0;
 
-
-               virtual OCStackResult registerResourceWithHost(
+        virtual OCStackResult registerResourceWithHost(
                     OCResourceHandle& resourceHandle,
                     std::string& resourceHOST,
                     std::string& resourceURI,
index ca6eeea..c74f838 100644 (file)
@@ -44,7 +44,7 @@ namespace OC
                     EntityHandler& entityHandler,
                     uint8_t resourceProperty);
 
-               virtual OCStackResult registerResourceWithHost(
+        virtual OCStackResult registerResourceWithHost(
                     OCResourceHandle& resourceHandle,
                     std::string& resourceHOST,
                     std::string& resourceURI,
index ac9495e..b736799 100644 (file)
@@ -154,17 +154,17 @@ namespace OC
                         uint8_t resourceProperty);
 
         /**
-        * This API registers a resource with the server
-        * NOTE: This API applies to server & client side.
+         * This API registers a resource with the server
+         * NOTE: This API applies to server & client side.
 
-               * @param resourceHandle - Upon successful registration, resourceHandle will be filled
-               * @param resource - The resource that all data filled.
-               *
-               * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        */
+         * @param resourceHandle - Upon successful registration, resourceHandle will be filled
+         * @param OCResource - The instance of OCResource that all data filled.
+         *
+         * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
+         */
 
-               OCStackResult registerResource(OCResourceHandle& resourceHandle,
-                                                                       const std::shared_ptr<OCResource> resource);
+        OCStackResult registerResource(OCResourceHandle& resourceHandle,
+                        const std::shared_ptr< OCResource > resource);
 
         /**
         * Set default device entity handler
index 823d4ff..1a0e05d 100644 (file)
@@ -179,18 +179,18 @@ namespace OC
                         EntityHandler entityHandler,
                         uint8_t resourceProperty);
 
-               /**
-        * This API registers a resource with the server
-        * NOTE: This API applies to server & client side.
+        /**
+         * This API registers a resource with the server
+         * NOTE: This API applies to server & client side.
 
-               * @param resourceHandle - Upon successful registration, resourceHandle will be filled
-               * @param resource - The resource that all data filled.
-               *
-               * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        */
+         * @param resourceHandle - Upon successful registration, resourceHandle will be filled
+         * @param OCResource - The instance of OCResource that all data filled.
+         *
+         * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
+         */
 
-               OCStackResult registerResource(OCResourceHandle& resourceHandle,
-                                                                       const std::shared_ptr<OCResource> resource);
+        OCStackResult registerResource(OCResourceHandle& resourceHandle,
+                        const std::shared_ptr<OCResource> resource);
 
         /**
         * Set default device entity handler
index 5fc209e..9f3b09c 100644 (file)
@@ -44,7 +44,7 @@ namespace OC
             // Not implemented
             return OC_STACK_NOTIMPL;
         }
-               virtual OCStackResult registerResourceWithHost(
+        virtual OCStackResult registerResourceWithHost(
                     OCResourceHandle& resourceHandle,
                     std::string& resourceHOST,
                     std::string& resourceURI,
@@ -52,9 +52,10 @@ namespace OC
                     const std::string& resourceInterface,
                     EntityHandler& entityHandler,
                     uint8_t resourceProperty)
-               {
-                       return OC_STACK_NOTIMPL;
-               }
+        {
+            // Not implemented
+            return OC_STACK_NOTIMPL;
+        }
 
         virtual OCStackResult unregisterResource(
                      const OCResourceHandle& resourceHandle)
index 90cdc7d..c057c7d 100644 (file)
@@ -388,64 +388,64 @@ namespace OC
         return result;
     }
 
-       OCStackResult InProcServerWrapper::registerResourceWithHost(
-                                               OCResourceHandle& resourceHandle,
-                                               std::string& resourceHOST,
-                                               std::string& resourceURI,
-                                               const std::string& resourceTypeName,
-                                               const std::string& resourceInterface,
-                                               EntityHandler& eHandler,
-                                               uint8_t resourceProperties)
-
-               {
-                       OCStackResult result = OC_STACK_ERROR;
-
-                       auto cLock = m_csdkLock.lock();
-
-                       if(cLock)
-                       {
-                               std::lock_guard<std::recursive_mutex> lock(*cLock);
-
-                               if(NULL != eHandler)
-                               {
-                                       result = OCCreateResourceWithHost(&resourceHandle, // OCResourceHandle *handle
-                                                               resourceTypeName.c_str(), // const char * resourceTypeName
-                                                               resourceInterface.c_str(), //const char * resourceInterfaceName //TODO fix this
-                                                               resourceHOST.c_str(), // const char * host
-                                                               resourceURI.c_str(), // const char * uri
-                                                               EntityHandlerWrapper, // OCEntityHandler entityHandler
-                                                               resourceProperties // uint8_t resourceProperties
-                                                               );
-                               }
-                               else
-                               {
-                                       result = OCCreateResourceWithHost(&resourceHandle, // OCResourceHandle *handle
-                                                               resourceTypeName.c_str(), // const char * resourceTypeName
-                                                               resourceInterface.c_str(), //const char * resourceInterfaceName //TODO fix this
-                                                               resourceHOST.c_str(), // const char * host
-                                                               resourceURI.c_str(), // const char * uri
-                                                               NULL, // OCEntityHandler entityHandler
-                                                               resourceProperties // uint8_t resourceProperties
-                                                               );
-                               }
-
-                               if(result != OC_STACK_OK)
-                               {
-                                       resourceHandle = (OCResourceHandle) 0;
-                               }
-                               else
-                               {
-                                       entityHandlerMap[resourceHandle] = eHandler;
-                                       resourceUriMap[resourceHandle] = resourceURI;
-                               }
-                       }
-                       else
-                       {
-                               result = OC_STACK_ERROR;
-                       }
-
-                       return result;
-               }
+    OCStackResult InProcServerWrapper::registerResourceWithHost(
+                    OCResourceHandle& resourceHandle,
+                    std::string& resourceHOST,
+                    std::string& resourceURI,
+                    const std::string& resourceTypeName,
+                    const std::string& resourceInterface,
+                    EntityHandler& eHandler,
+                    uint8_t resourceProperties)
+
+    {
+        OCStackResult result = OC_STACK_ERROR;
+
+        auto cLock = m_csdkLock.lock();
+
+        if (cLock)
+        {
+            std::lock_guard < std::recursive_mutex > lock(*cLock);
+
+            if (NULL != eHandler)
+            {
+                result = OCCreateResourceWithHost(&resourceHandle, // OCResourceHandle *handle
+                        resourceTypeName.c_str(), // const char * resourceTypeName
+                        resourceInterface.c_str(), //const char * resourceInterfaceName //TODO fix
+                        resourceHOST.c_str(), // const char * host
+                        resourceURI.c_str(), // const char * uri
+                        EntityHandlerWrapper, // OCEntityHandler entityHandler
+                        resourceProperties // uint8_t resourceProperties
+                        );
+            }
+            else
+            {
+                result = OCCreateResourceWithHost(&resourceHandle, // OCResourceHandle *handle
+                        resourceTypeName.c_str(), // const char * resourceTypeName
+                        resourceInterface.c_str(), //const char * resourceInterfaceName //TODO fix
+                        resourceHOST.c_str(), // const char * host
+                        resourceURI.c_str(), // const char * uri
+                        nullptr, // OCEntityHandler entityHandler
+                        resourceProperties // uint8_t resourceProperties
+                        );
+            }
+
+            if (result != OC_STACK_OK)
+            {
+                resourceHandle = nullptr;
+            }
+            else
+            {
+                entityHandlerMap[resourceHandle] = eHandler;
+                resourceUriMap[resourceHandle] = resourceURI;
+            }
+        }
+        else
+        {
+            result = OC_STACK_ERROR;
+        }
+
+        return result;
+    }
     OCStackResult InProcServerWrapper::setDefaultDeviceEntityHandler
                                         (EntityHandler entityHandler)
     {
index 441a413..73488d6 100644 (file)
@@ -108,8 +108,8 @@ namespace OC
                                                 entityHandler, resourceProperty);
         }
 
-               OCStackResult registerResource(OCResourceHandle& resourceHandle,
-                                                                       const std::shared_ptr<OCResource> resource)
+        OCStackResult registerResource(OCResourceHandle& resourceHandle,
+                                                const std::shared_ptr< OCResource > resource)
         {
             return OCPlatform_impl::Instance().registerResource(resourceHandle, resource);
         }
index 36f909c..34fc47b 100644 (file)
@@ -187,16 +187,15 @@ namespace OC
 
 
        OCStackResult OCPlatform_impl::registerResource(OCResourceHandle& resourceHandle,
-                                                                                                               const std::shared_ptr<OCResource> resource)
-       {
-               uint8_t resourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
-
-               return checked_guard(m_server, &IServerWrapper::registerResourceWithHost,
-                                                  ref(resourceHandle), resource->host(), resource->uri(), "core.remote",
-                                                  "oc.mi.def", (EntityHandler) NULL, resourceProperty);
+                                            const std::shared_ptr< OCResource > resource)
+    {
+        uint8_t resourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
 
+        return checked_guard(m_server, &IServerWrapper::registerResourceWithHost,
+                ref(resourceHandle), resource->host(), resource->uri(), "core.remote", "oc.mi.def",
+                (EntityHandler) nullptr, resourceProperty);
 
-       }
+    }
     OCStackResult OCPlatform_impl::unregisterResource(const OCResourceHandle& resourceHandle) const
     {
         return checked_guard(m_server, &IServerWrapper::unregisterResource,