[Bug] Fix generation of multiple entries in platform manifest 16/46816/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Wed, 26 Aug 2015 09:51:13 +0000 (11:51 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Wed, 26 Aug 2015 10:17:09 +0000 (03:17 -0700)
Iteration should start from beginning of the list.
Wrongly generated elements:
 - app-control,
 - ui-application,
 - svc-application.

Change-Id: Idecb65a87059bb8e824e61c24a71bde19c01207d

src/wgt/step/step_generate_xml.cc

index 95812f8..bdf7d07 100755 (executable)
@@ -99,8 +99,9 @@ common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml(
     LOG(DEBUG) << "Icon was not found in package";
   }
 
-  for (appcontrol_x* appc = app->appcontrol; appc != nullptr;
-      appc = appc->next) {
+  appcontrol_x* appc = nullptr;
+  PKGMGR_LIST_MOVE_NODE_TO_HEAD(app->appcontrol, appc);
+  for (; appc != nullptr; appc = appc->next) {
     xmlTextWriterStartElement(writer, BAD_CAST "app-control");
 
     if (appc->operation) {
@@ -257,16 +258,19 @@ common_installer::Step::Status StepGenerateXml::process() {
   }
 
   // add ui-application element per ui application
-  for (uiapplication_x* ui = context_->manifest_data.get()->uiapplication;
-      ui != nullptr; ui = ui->next) {
+  uiapplication_x* ui = nullptr;
+  PKGMGR_LIST_MOVE_NODE_TO_HEAD(context_->manifest_data.get()->uiapplication,
+                                ui);
+  for (; ui; ui = ui->next) {
     xmlTextWriterStartElement(writer, BAD_CAST "ui-application");
     GenerateApplicationCommonXml(ui, writer);
     xmlTextWriterEndElement(writer);
   }
   // add service-application element per service application
-  for (serviceapplication_x* svc =
-       context_->manifest_data.get()->serviceapplication;
-       svc != nullptr; svc = svc->next) {
+  serviceapplication_x* svc = nullptr;
+  PKGMGR_LIST_MOVE_NODE_TO_HEAD(
+      context_->manifest_data.get()->serviceapplication, svc);
+  for (; svc; svc = svc->next) {
     xmlTextWriterStartElement(writer, BAD_CAST "service-application");
     GenerateApplicationCommonXml(svc, writer);
     xmlTextWriterEndElement(writer);