Stylecheck fix 95/35995/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 16 Feb 2015 15:37:54 +0000 (16:37 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Fri, 27 Feb 2015 12:57:20 +0000 (13:57 +0100)
Change-Id: I9efb79ec07d84a6366c6f75307218d8a195ce5cf

src/common/security_registration.cc
src/common/step/step_generate_xml.cc
src/common/step/step_revoke_security.cc
src/unit_tests/utils_values_unittest.cc
src/unit_tests/widget_manifest_parser_manifest_unittest.cc
src/unit_tests/widget_manifest_parser_manifest_util_unittest.cc
src/utils/string_util.cc
src/wgt/step/step_parse.h
src/widget-manifest-parser/application_data.cc
src/widget-manifest-parser/widget_manifest_parser.cc
src/widget-manifest-parser/widget_manifest_parser.h

index c5dc0c9..92ed404 100644 (file)
@@ -54,7 +54,7 @@ bool PrepareRequest(const std::string& app_id, const std::string& pkg_id,
     for (; privileges != nullptr; privileges = privileges->next) {
       privilege_x* priv;
       PKGMGR_LIST_MOVE_NODE_TO_HEAD(privileges->privilege, priv);
-      for (;priv != nullptr; priv = priv->next) {
+      for (; priv != nullptr; priv = priv->next) {
         security_manager_app_inst_req_add_privilege(req, priv->text);
       }
     }
index c516a3d..7d9aa43 100644 (file)
@@ -204,11 +204,11 @@ Step::Status StepGenerateXml::process() {
   }
 
   // add privilege element
-  privileges_x *pvlg = nullptr;
+  privileges_xpvlg = nullptr;
   PKGMGR_LIST_MOVE_NODE_TO_HEAD(context_->manifest_data()->privileges, pvlg);
   for (; pvlg != nullptr; pvlg = pvlg->next) {
     xmlTextWriterStartElement(writer, BAD_CAST "privileges");
-    privilege_x *pv;
+    privilege_x* pv = nullptr;
     PKGMGR_LIST_MOVE_NODE_TO_HEAD(pvlg->privilege, pv);
     for (; pv != nullptr; pv = pv->next) {
       xmlTextWriterWriteFormatElement(writer, BAD_CAST "privilege",
index 6351fc6..9b1fb4e 100644 (file)
@@ -12,7 +12,8 @@ namespace revoke_security {
 Step::Status StepRevokeSecurity::process() {
   if (!UnregisterSecurityContextForApps(
       context_->pkgid(), context_->manifest_data())) {
-    LOG(ERROR) << "Failure on unregistering security context for app " << context_->pkgid();
+    LOG(ERROR) << "Failure on unregistering security context for app "
+               << context_->pkgid();
     return Status::ERROR;
   }
   LOG(DEBUG) << "Security context uninstalled";
@@ -23,7 +24,8 @@ Step::Status StepRevokeSecurity::undo() {
   if (!RegisterSecurityContextForApps(
       context_->pkgid(), context_->GetRootApplicationPath(),
       context_->manifest_data())) {
-    LOG(ERROR) << "Failure on re-installing security context for app " << context_->pkgid();
+    LOG(ERROR) << "Failure on re-installing security context for app "
+               << context_->pkgid();
     return Status::ERROR;
   }
   LOG(DEBUG) << "Security context installed";
index 990d5d8..2cd2a6e 100644 (file)
@@ -631,7 +631,8 @@ TEST(ValuesTest, DeepCopyCovariantReturnTypes) {
   std::unique_ptr<Value> copy_int_value(original_int_value->DeepCopy());
   std::unique_ptr<Value> copy_double_value(original_double_value->DeepCopy());
   std::unique_ptr<Value> copy_string_value(original_string_value->DeepCopy());
-  std::unique_ptr<Value> copy_string16_value(original_string16_value->DeepCopy());
+  std::unique_ptr<Value> copy_string16_value(
+      original_string16_value->DeepCopy());
   std::unique_ptr<Value> copy_binary_value(original_binary_value->DeepCopy());
   std::unique_ptr<Value> copy_list_value(original_list_value->DeepCopy());
 
@@ -742,27 +743,27 @@ TEST(ValuesTest, MergeDictionary) {
   EXPECT_EQ(4U, base->size());
   std::string base_key_value;
   EXPECT_TRUE(base->GetString("base_key", &base_key_value));
-  EXPECT_EQ("base_key_value_base", base_key_value); // Base value preserved.
+  EXPECT_EQ("base_key_value_base", base_key_value);  // Base value preserved.
   std::string collide_key_value;
   EXPECT_TRUE(base->GetString("collide_key", &collide_key_value));
-  EXPECT_EQ("collide_key_value_merge", collide_key_value); // Replaced.
+  EXPECT_EQ("collide_key_value_merge", collide_key_value);  // Replaced.
   std::string merge_key_value;
   EXPECT_TRUE(base->GetString("merge_key", &merge_key_value));
-  EXPECT_EQ("merge_key_value_merge", merge_key_value); // Merged in.
+  EXPECT_EQ("merge_key_value_merge", merge_key_value);  // Merged in.
 
   DictionaryValue* res_sub_dict;
   EXPECT_TRUE(base->GetDictionary("sub_dict_key", &res_sub_dict));
   EXPECT_EQ(3U, res_sub_dict->size());
   std::string sub_base_key_value;
   EXPECT_TRUE(res_sub_dict->GetString("sub_base_key", &sub_base_key_value));
-  EXPECT_EQ("sub_base_key_value_base", sub_base_key_value); // Preserved.
+  EXPECT_EQ("sub_base_key_value_base", sub_base_key_value);  // Preserved.
   std::string sub_collide_key_value;
   EXPECT_TRUE(res_sub_dict->GetString("sub_collide_key",
                                       &sub_collide_key_value));
-  EXPECT_EQ("sub_collide_key_value_merge", sub_collide_key_value); // Replaced.
+  EXPECT_EQ("sub_collide_key_value_merge", sub_collide_key_value);  // Replaced.
   std::string sub_merge_key_value;
   EXPECT_TRUE(res_sub_dict->GetString("sub_merge_key", &sub_merge_key_value));
-  EXPECT_EQ("sub_merge_key_value_merge", sub_merge_key_value); // Merged in.
+  EXPECT_EQ("sub_merge_key_value_merge", sub_merge_key_value);  // Merged in.
 }
 
 TEST(ValuesTest, MergeDictionaryDeepCopy) {
@@ -833,7 +834,8 @@ TEST(ValuesTest, DictionaryIterator) {
   EXPECT_TRUE(seen2);
 }
 
-// DictionaryValue/ListValue's Get*() methods should accept nullptr as an out-value
+// DictionaryValue/ListValue's Get*() methods should
+// accept nullptr as an out-value
 // and still return true/false based on success.
 TEST(ValuesTest, GetWithnullptrOutValue) {
   DictionaryValue main_dict;
@@ -900,23 +902,39 @@ TEST(ValuesTest, GetWithnullptrOutValue) {
   EXPECT_FALSE(main_dict.GetDouble("list", nullptr));
   EXPECT_FALSE(main_dict.GetDouble("DNE", nullptr));
 
-  EXPECT_FALSE(main_dict.GetString("bool", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("int", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("double", static_cast<std::string*>(nullptr)));
-  EXPECT_TRUE(main_dict.GetString("string", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("binary", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("dict", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("list", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("DNE", static_cast<std::string*>(nullptr)));
-
-  EXPECT_FALSE(main_dict.GetString("bool", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("int", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("double", static_cast<std::string*>(nullptr)));
-  EXPECT_TRUE(main_dict.GetString("string", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("binary", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("dict", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("list", static_cast<std::string*>(nullptr)));
-  EXPECT_FALSE(main_dict.GetString("DNE", static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("bool",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("int",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("double",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_TRUE(main_dict.GetString("string",
+                                  static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("binary",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("dict",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("list",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("DNE",
+                                   static_cast<std::string*>(nullptr)));
+
+  EXPECT_FALSE(main_dict.GetString("bool",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("int",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("double",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_TRUE(main_dict.GetString("string",
+                                  static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("binary",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("dict",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("list",
+                                   static_cast<std::string*>(nullptr)));
+  EXPECT_FALSE(main_dict.GetString("DNE",
+                                   static_cast<std::string*>(nullptr)));
 
   EXPECT_FALSE(main_dict.GetBinary("bool", nullptr));
   EXPECT_FALSE(main_dict.GetBinary("int", nullptr));
index b4517d5..1443527 100644 (file)
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE-xwalk file.
 
-#include "widget-manifest-parser/manifest.h"
-
 #include <gtest/gtest.h>
 
 #include <algorithm>
@@ -14,6 +12,7 @@
 
 #include "utils/values.h"
 #include "widget-manifest-parser/application_manifest_constants.h"
+#include "widget-manifest-parser/manifest.h"
 
 namespace errors = common_installer::application_manifest_errors;
 namespace keys = common_installer::application_widget_keys;
@@ -46,7 +45,8 @@ class ManifestTest : public testing::Test {
 
 // Verifies that application can access the correct keys.
 TEST_F(ManifestTest, ApplicationData) {
-  std::unique_ptr<utils::DictionaryValue> manifest_value(new utils::DictionaryValue());
+  std::unique_ptr<utils::DictionaryValue> manifest_value(
+      new utils::DictionaryValue());
   manifest_value->SetString(keys::kNameKey, "extension");
   manifest_value->SetString(keys::kVersionKey, "1");
   manifest_value->SetString("unknown_key", "foo");
index ae9362e..b6b8a37 100644 (file)
@@ -3,8 +3,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE-xwalk file.
 
-#include "widget-manifest-parser/manifest_util.h"
-
 #include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/operations.hpp>
@@ -13,6 +11,7 @@
 #include "widget-manifest-parser/application_data.h"
 #include "widget-manifest-parser/application_manifest_constants.h"
 #include "widget-manifest-parser/manifest.h"
+#include "widget-manifest-parser/manifest_util.h"
 
 using common_installer::widget_manifest_parser::ApplicationData;
 using common_installer::widget_manifest_parser::Manifest;
@@ -62,5 +61,5 @@ TEST_F(ManifestUtilTest,
   ASSERT_STREQ("Manifest file is missing or unreadable.", error.c_str());
 }
 
-}  // namespace widget_manifest_parser
+}  // namespace widget_mnanifest_parser
 }  // namespace common_installer
index a072c65..d90a9ec 100644 (file)
@@ -158,7 +158,8 @@ std::string StripWrappingBidiControlCharactersUTF8(const std::string& text) {
   size_t end_index = text.length() - kBidiControlCharacterLength;
   if (EqualsUTF8Char(&text[end_index], kPopDirectionalFormatting))
     end_index -= 3;
-  return text.substr(begin_index, end_index - begin_index + kBidiControlCharacterLength);
+  return text.substr(begin_index,
+      end_index - begin_index + kBidiControlCharacterLength);
 }
 
 std::string GetDirTextUTF8(const std::string& text, const std::string& dir) {
@@ -193,7 +194,7 @@ std::string DecodePercentEscapedCharacter(const std::string& path) {
     if ('%' == input[i]) {
       if (i + 2 >= input.size())
         return std::string();
-      char str[3] = {"\0",};
+      char str[3] = {"\0", };
       str[0] = input[i + 1];
       str[1] = input[i + 2];
       int result = strtol(str, NULL, 16);
index 6da70d7..68105cc 100644 (file)
@@ -23,8 +23,9 @@ class StepParse : public common_installer::Step {
   Status undo() override { return Status::OK; }
 
  private:
-  std::unique_ptr<common_installer::widget_manifest_parser::WidgetManifestParser>
-      parser_;
+  std::unique_ptr<
+      common_installer::widget_manifest_parser::WidgetManifestParser>
+          parser_;
   boost::filesystem::path config_;
   bool Check(const boost::filesystem::path& widget_path);
 
index 5b2901e..34fd98e 100644 (file)
@@ -147,9 +147,9 @@ bool ApplicationData::LoadID(const std::string& explicit_id,
   std::string application_id;
   auto iter = manifest_data_.find(widget_keys::kTizenApplicationKey);
   const TizenApplicationInfo* tizen_app_info;
-  if (iter == manifest_data_.end())
+  if (iter == manifest_data_.end()) {
     tizen_app_info = nullptr;
-  else {
+  else {
     tizen_app_info = static_cast<TizenApplicationInfo*>(iter->second.get());
     application_id = tizen_app_info->id();
   }
index bc021a9..432a9d8 100644 (file)
@@ -176,7 +176,8 @@ parser::TizenApplicationInfo* WidgetManifestParser::ExtractApplicationInfo(
   return info;
 }
 
-parser::WidgetInfo* WidgetManifestParser::ExtractWidgetInfo(const ApplicationData& app_data) {
+parser::WidgetInfo* WidgetManifestParser::ExtractWidgetInfo(
+    const ApplicationData& app_data) {
   parser::WidgetInfo* info = static_cast<parser::WidgetInfo*>(
       app_data.GetManifestData(keys::kWidgetKey));
   return info;
index 41c5b6e..5385a92 100644 (file)
@@ -23,7 +23,7 @@ namespace widget_manifest_parser {
 
 class WidgetManifestParser {
  public:
-  explicit WidgetManifestParser();
+  WidgetManifestParser();
   ~WidgetManifestParser();
 
   const std::string& GetErrorMessage();