From: Tomasz Iwanek Date: Mon, 7 Mar 2016 12:11:59 +0000 (+0100) Subject: Metadata/category plugin calling convention of tizen 2.4 X-Git-Tag: accepted/tizen/common/20160315.220748^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75dde1765f085a27452484b49a22f923198e5b11;p=platform%2Fcore%2Fappfw%2Fapp-installers.git Metadata/category plugin calling convention of tizen 2.4 Change-Id: I0d8c332d6b95261b846da9509d2942c18472ce2e --- diff --git a/src/common/plugins/types/category_plugin.cc b/src/common/plugins/types/category_plugin.cc index d156197..f53b7dd 100644 --- a/src/common/plugins/types/category_plugin.cc +++ b/src/common/plugins/types/category_plugin.cc @@ -58,13 +58,13 @@ bool CategoryPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest, return false; std::string name = GetFunctionName(action_type); for (application_x* app : GListRange(manifest->application)) { - // pack all categories starting with key + '/' to list that will + // pack all categories starting with key to list that will // be sent to the plugin. // e.g. all http://tizen.org/category/antivirus/* // will be packed for http://tizen.org/category/antivirus GList* category_list = nullptr; for (const char* category : GListRange(app->category)) { - std::string sub_key_prefix = plugin_info_.name() + "/"; + const std::string& sub_key_prefix = plugin_info_.name(); if (std::string(category).find(sub_key_prefix) == 0) { __category_t* c = reinterpret_cast<__category_t*>( calloc(1, sizeof(__category_t))); @@ -72,10 +72,13 @@ bool CategoryPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest, category_list = g_list_append(category_list, c); } } + + // skip application if it has no given category + if (!category_list) + continue; + int result = 0; - Exec(name, &result, category_list, tag.c_str(), - ActionTypeToPkgmgrActionType(action_type), - manifest->package, app->appid); + Exec(name, &result, manifest->package, app->appid, category_list); if (result) { LOG(ERROR) << "Function: " << name << " of plugin " << plugin_info_.path() << " failed"; diff --git a/src/common/plugins/types/metadata_plugin.cc b/src/common/plugins/types/metadata_plugin.cc index 83ab117..25e495d 100644 --- a/src/common/plugins/types/metadata_plugin.cc +++ b/src/common/plugins/types/metadata_plugin.cc @@ -59,13 +59,13 @@ bool MetadataPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest, return false; std::string name = GetFunctionName(action_type); for (application_x* app : GListRange(manifest->application)) { - // pack all metadata starting with key + '/' to list that will + // pack all metadata starting with key to list that will // be sent to the plugin. // e.g. all http://developer.samsung.com/tizen/metadata/profile/* // will be packed for http://developer.samsung.com/tizen/metadata/profile GList* md_list = nullptr; for (metadata_x* meta : GListRange(app->metadata)) { - std::string sub_key_prefix = plugin_info_.name() + "/"; + const std::string& sub_key_prefix = plugin_info_.name(); if (meta->key && meta->value && std::string(meta->key).find(sub_key_prefix) == 0) { __metadata_t* md = reinterpret_cast<__metadata_t*>( @@ -75,10 +75,13 @@ bool MetadataPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest, md_list = g_list_append(md_list, md); } } + + // skip application if it has no given metadata + if (!md_list) + continue; + int result = 0; - Exec(name, &result, md_list, tag.c_str(), - ActionTypeToPkgmgrActionType(action_type), - manifest->package, app->appid); + Exec(name, &result, manifest->package, app->appid, md_list); if (result) { LOG(ERROR) << "Function: " << name << " of plugin " << plugin_info_.path() << " failed";