From b7bbd6c6b05c2d2e735b36add78b905988c6e943 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Tue, 4 Aug 2015 10:37:51 +0900 Subject: [PATCH] Excluded hard-coded and platform specific code and debug statements with cout Change-Id: I50bd7615b8733208776908c4c1040f558df42a89 Signed-off-by: Markus Jung Reviewed-on: https://gerrit.iotivity.org/gerrit/2094 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- .../src/resourceContainer/src/BundleResource.cpp | 1 - .../src/resourceContainer/src/Configuration.cpp | 60 +++++++++------------- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp b/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp index 942a516..b74f9fc 100644 --- a/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp +++ b/service/resource-encapsulation/src/resourceContainer/src/BundleResource.cpp @@ -60,7 +60,6 @@ namespace OIC void BundleResource::setAttribute(std::string key, RCSResourceAttributes::Value &&value) { - cout << "Bundle resource set attribute " << value.toString() << "|" << endl; m_resourceAttributes[key] = value; } diff --git a/service/resource-encapsulation/src/resourceContainer/src/Configuration.cpp b/service/resource-encapsulation/src/resourceContainer/src/Configuration.cpp index 9130b69..22b22e6 100644 --- a/service/resource-encapsulation/src/resourceContainer/src/Configuration.cpp +++ b/service/resource-encapsulation/src/resourceContainer/src/Configuration.cpp @@ -50,8 +50,6 @@ namespace OIC { m_loaded = false; - getCurrentPath(&m_pathConfigFile); - m_pathConfigFile.append("/"); m_pathConfigFile.append(configFile); getConfigDocument(m_pathConfigFile); @@ -79,18 +77,21 @@ namespace OIC { //cout << "Name of first node is: " << m_xmlDoc.first_node()->name() << endl; - for (bundle = m_xmlDoc.first_node()->first_node("bundle"); bundle; bundle = bundle->next_sibling()) + for (bundle = m_xmlDoc.first_node()->first_node("bundle"); bundle; bundle = + bundle->next_sibling()) { std::map< std::string, std::string > bundleMap; //cout << "Bundle: " << bundle->name() << endl; - for (subItem = bundle->first_node(); subItem; subItem = subItem->next_sibling()) + for (subItem = bundle->first_node(); subItem; + subItem = subItem->next_sibling()) { strKey = subItem->name(); strValue = subItem->value(); if (strlen(subItem->value()) > 0) { - bundleMap.insert(std::make_pair(trim_both(strKey), trim_both(strValue))); + bundleMap.insert( + std::make_pair(trim_both(strKey), trim_both(strValue))); //cout << strKey << " " << strValue << endl; } } @@ -119,7 +120,8 @@ namespace OIC std::map< std::string, std::string > bundleConfigMap; // - for (bundle = m_xmlDoc.first_node()->first_node("bundle"); bundle; bundle = bundle->next_sibling()) + for (bundle = m_xmlDoc.first_node()->first_node("bundle"); bundle; bundle = + bundle->next_sibling()) { // strBundleId = bundle->first_node("id")->value(); @@ -134,7 +136,8 @@ namespace OIC // strVersion = bundle->first_node("version")->value(); - bundleConfigMap.insert(std::make_pair("version", trim_both(strVersion))); + bundleConfigMap.insert( + std::make_pair("version", trim_both(strVersion))); configOutput->push_back(bundleConfigMap); @@ -165,7 +168,8 @@ namespace OIC try { // - for (bundle = m_xmlDoc.first_node()->first_node("bundle"); bundle; bundle = bundle->next_sibling()) + for (bundle = m_xmlDoc.first_node()->first_node("bundle"); bundle; bundle = + bundle->next_sibling()) { // strBundleId = bundle->first_node("id")->value(); @@ -173,12 +177,13 @@ namespace OIC if (!strBundleId.compare(bundleId)) { // - for (resource = bundle->first_node("resources")->first_node("resourceInfo"); resource; - resource = resource->next_sibling()) + for (resource = bundle->first_node("resources")->first_node( + "resourceInfo"); resource; resource = resource->next_sibling()) { resourceInfo tempResourceInfo; - for (item = resource->first_node(); item; item = item->next_sibling()) + for (item = resource->first_node(); item; item = + item->next_sibling()) { strKey = item->name(); strValue = item->value(); @@ -197,21 +202,25 @@ namespace OIC else { - for (subItem = item->first_node(); subItem; subItem = subItem->next_sibling()) + for (subItem = item->first_node(); subItem; subItem = + subItem->next_sibling()) { map< string, string > propertyMap; strKey = subItem->name(); - for (subItem2 = subItem->first_node(); subItem2; subItem2 = subItem2->next_sibling()) + for (subItem2 = subItem->first_node(); subItem2; + subItem2 = subItem2->next_sibling()) { string newStrKey = subItem2->name(); string newStrValue = subItem2->value(); - propertyMap[trim_both(newStrKey)] = trim_both(newStrValue); + propertyMap[trim_both(newStrKey)] = trim_both( + newStrValue); } - tempResourceInfo.resourceProperty[trim_both(strKey)].push_back(propertyMap); + tempResourceInfo.resourceProperty[trim_both(strKey)].push_back( + propertyMap); } } } @@ -247,7 +256,7 @@ namespace OIC try { - m_xmlDoc.parse< 0 >((char *)m_strConfigData.c_str()); + m_xmlDoc.parse< 0 >((char *) m_strConfigData.c_str()); m_loaded = true; } catch (rapidxml::parse_error &e) @@ -261,24 +270,5 @@ namespace OIC std::cout << "Configuration File load failed !!" << std::endl; } } - - void Configuration::getCurrentPath(std::string *pPath) - { - char buffer[2048]; - char *strPath = NULL; - - int length = readlink("/proc/self/exe", buffer, 2047); - - if (length > 0 && length < 2047) - { - buffer[length] = '\0'; - - strPath = strrchr(buffer, '/'); - - *strPath = '\0'; - - pPath->append(buffer); - } - } } } -- 2.7.4