Commit 7b48db67 authored by Harry's avatar Harry Committed by Uze Choi

[IOT-2810][ES]Static analysis coding style issues

Changes are mostly related to indentation, catching
exception by reference-to-const.

Change-Id: I3aa27b58f507551ed2ed677c4b2c89b151b87bf3
Signed-off-by: default avatarHarry <h.marappa@samsung.com>
parent 4a76e62a
......@@ -106,7 +106,7 @@ void GetInterfaceNameFromQuery(const char *query, char **iface)
bool CompareResourceInterface(const char *from, const char *iface)
{
char *if_ptr;
char *if_ptr = NULL;
GetInterfaceNameFromQuery(from, &if_ptr);
if (!if_ptr)
{
......@@ -261,6 +261,13 @@ OCStackResult initWiFiConfResource(bool isSecured)
NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
}
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Failed to create WiFiConf resource with result: %s",
getResult(res));
return res;
}
res = OCBindResourceInterfaceToResource(g_ESWiFiConfResource.handle,
OC_RSRVD_INTERFACE_READ_WRITE);
if (res != OC_STACK_OK)
......@@ -303,6 +310,13 @@ OCStackResult initCoapCloudConfResource(bool isSecured)
NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
}
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Failed to create CoapCloudConf resource with result: %s",
getResult(res));
return res;
}
res = OCBindResourceInterfaceToResource(g_ESCoapCloudConfResource.handle,
OC_RSRVD_INTERFACE_READ_WRITE);
if (res != OC_STACK_OK)
......@@ -336,6 +350,13 @@ OCStackResult initDevConfResource(bool isSecured)
NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
}
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Failed to create DevConf resource with result: %s",
getResult(res));
return res;
}
res = OCBindResourceInterfaceToResource(g_ESDevConfResource.handle, OC_RSRVD_INTERFACE_READ);
if (res != OC_STACK_OK)
{
......@@ -417,12 +438,12 @@ OCEntityHandlerResult updateEasySetupResource(OCEntityHandlerRequest* ehRequest,
children = children->next;
OCRepPayloadDestroy(repPayload);
}
}
if (hasError)
{
ehResult = OC_EH_BAD_REQ;
}
if (hasError)
{
ehResult = OC_EH_BAD_REQ;
}
}
else if (CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))
{
......@@ -430,6 +451,7 @@ OCEntityHandlerResult updateEasySetupResource(OCEntityHandlerRequest* ehRequest,
updateEasySetupConnectProperty(input);
}
}
OIC_LOG(DEBUG, ES_RH_TAG, "updateEasySetupResource exit");
return ehResult;
}
......@@ -1756,7 +1778,7 @@ OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty)
{
g_ESWiFiConfResource.supportedEncType[i] = (deviceProperty->WiFi).supportedEncType[i];
OIC_LOG_V(INFO_PRIVATE, ES_RH_TAG, "WiFi Enc Type : %d",
g_ESWiFiConfResource.supportedAuthType[i]);
g_ESWiFiConfResource.supportedEncType[i]);
}
OICStrcpy(g_ESDevConfResource.devName, OIC_STRING_MAX_VALUE,
......
......@@ -349,7 +349,9 @@ namespace OIC
OCRepresentation cloudDataRep;
if(authCode.length() > 0)
{
cloudDataRep.setValue(OC_RSRVD_ES_AUTHCODE, authCode);
}
if(accessToken.length() > 0)
{
......@@ -1076,13 +1078,19 @@ namespace OIC
}
if(b_2_4G && b_5G)
{
return WIFI_BOTH;
}
if(b_2_4G)
{
return WIFI_24G;
}
if(b_5G)
{
return WIFI_5G;
}
return WIFI_FREQ_NONE;
}
......
......@@ -288,7 +288,7 @@ namespace OIC
}
}
}
catch(std::exception& e)
catch(const std::exception& e)
{
OIC_LOG_V(INFO, ES_REMOTE_ENROLLEE_TAG,
"Exception in foundResource: %s", e.what());
......
......@@ -148,7 +148,7 @@ void provisionSecurity()
{
remoteEnrollee->provisionSecurity((SecurityProvStatusCbWithOption)provisionSecurityStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionSecurity call" << e.reason();
return;
......@@ -182,7 +182,7 @@ void getStatus()
{
remoteEnrollee->getStatus(getStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during getConfiguration call" << e.reason();
return;
......@@ -215,7 +215,7 @@ void getConfiguration()
{
remoteEnrollee->getConfiguration(getConfigurationCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during getConfiguration call" << e.reason();
return;
......@@ -250,7 +250,7 @@ void provisionDeviceProperty()
{
remoteEnrollee->provisionDeviceProperties(devProp, deviceProvisioningStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionDeviceProperties call" << e.reason();
return;
......@@ -285,7 +285,7 @@ void requestToConnect()
types.push_back(ES_CONNECT_COAPCLOUD);
remoteEnrollee->requestToConnect(types, connectRequestStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionDeviceProperties call" << e.reason();
return;
......@@ -332,7 +332,7 @@ void provisionCloudProperty()
{
remoteEnrollee->provisionCloudProperties(cloudProp, cloudProvisioningStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionCloudProperties call" << e.reason();
return;
......@@ -389,7 +389,7 @@ void foundUnsecuredResource(std::shared_ptr<OC::OCResource> resource)
}
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
std::cerr << "Exception in foundResource: " << e.what() << std::endl;
}
......@@ -468,7 +468,7 @@ void foundSecuredResource(std::shared_ptr<OC::OCResource> resource)
}
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
std::cerr << "Exception in foundResource: " << e.what() << std::endl;
}
......@@ -486,7 +486,7 @@ void discoveryEnrolleeResource(void (*f)(std::shared_ptr<OC::OCResource> resourc
std::unique_lock<std::mutex> lck(g_discoverymtx);
g_cond.wait_for(lck, std::chrono::seconds(5));
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception in discoveryEnrolleeResource: " << e.what();
}
......
......@@ -148,7 +148,7 @@ void provisionSecurity()
{
remoteEnrollee->provisionSecurity((SecurityProvStatusCbWithOption)provisionSecurityStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionSecurity call" << e.reason();
return;
......@@ -182,7 +182,7 @@ void getStatus()
{
remoteEnrollee->getStatus(getStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during getConfiguration call" << e.reason();
return;
......@@ -215,7 +215,7 @@ void getConfiguration()
{
remoteEnrollee->getConfiguration(getConfigurationCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during getConfiguration call" << e.reason();
return;
......@@ -250,7 +250,7 @@ void provisionDeviceProperty()
{
remoteEnrollee->provisionDeviceProperties(devProp, deviceProvisioningStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionDeviceProperties call" << e.reason();
return;
......@@ -285,7 +285,7 @@ void requestToConnect()
types.push_back(ES_CONNECT_COAPCLOUD);
remoteEnrollee->requestToConnect(types, connectRequestStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionDeviceProperties call" << e.reason();
return;
......@@ -330,7 +330,7 @@ void provisionCloudProperty()
{
remoteEnrollee->provisionCloudProperties(cloudProp, cloudProvisioningStatusCallback);
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception during provisionCloudProperties call" << e.reason();
return;
......@@ -387,7 +387,7 @@ void foundUnsecuredResource(std::shared_ptr<OC::OCResource> resource)
}
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
std::cerr << "Exception in foundResource: " << e.what() << std::endl;
}
......@@ -466,7 +466,7 @@ void foundSecuredResource(std::shared_ptr<OC::OCResource> resource)
}
}
}
catch (std::exception &e)
catch (const std::exception &e)
{
std::cerr << "Exception in foundResource: " << e.what() << std::endl;
}
......@@ -484,7 +484,7 @@ void discoveryEnrolleeResource(void (*f)(std::shared_ptr<OC::OCResource> resourc
std::unique_lock<std::mutex> lck(g_discoverymtx);
g_cond.wait_for(lck, std::chrono::seconds(5));
}
catch (OCException &e)
catch (const OCException &e)
{
std::cout << "Exception in discoveryEnrolleeResource: " << e.what();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment