From: Piotr Ganicz Date: Tue, 16 Aug 2016 10:45:38 +0000 (+0200) Subject: Prevent generating invalid manifest. X-Git-Tag: accepted/tizen/common/20160817.133230~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F84093%2F2;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Prevent generating invalid manifest. This patch removes empty labels from manifest when generating. Change-Id: Iade7cbfefb7d282a6645d389b25c3bc713e5a87d --- diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 262acb9..879c7fd 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -198,13 +198,15 @@ common_installer::Step::Status StepGenerateXml::GenerateApplicationCommonXml( } for (label_x* label : GListRange(app->label)) { - xmlTextWriterStartElement(writer, BAD_CAST "label"); - if (label->lang && strcmp(DEFAULT_LOCALE, label->lang) != 0) { - xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang", - BAD_CAST label->lang); + if (label->name && strcmp(label->name, "") != 0) { + xmlTextWriterStartElement(writer, BAD_CAST "label"); + if (label->lang && strcmp(DEFAULT_LOCALE, label->lang) != 0) { + xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang", + BAD_CAST label->lang); + } + xmlTextWriterWriteString(writer, BAD_CAST label->name); + xmlTextWriterEndElement(writer); } - xmlTextWriterWriteString(writer, BAD_CAST label->name); - xmlTextWriterEndElement(writer); } if (app->icon) { @@ -413,13 +415,15 @@ void StepGenerateXml::GenerateManifestElementAttributes( void StepGenerateXml::GenerateLangLabels(xmlTextWriterPtr writer) { for (label_x* label : GListRange(context_->manifest_data.get()->label)) { - xmlTextWriterStartElement(writer, BAD_CAST "label"); - if (label->lang && strcmp(DEFAULT_LOCALE, label->lang) != 0) { + if (label->name && strcmp(label->name, "") != 0) { + xmlTextWriterStartElement(writer, BAD_CAST "label"); + if (label->lang && strcmp(DEFAULT_LOCALE, label->lang) != 0) { xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang", - BAD_CAST label->lang); + BAD_CAST label->lang); + } + xmlTextWriterWriteString(writer, BAD_CAST label->name); + xmlTextWriterEndElement(writer); } - xmlTextWriterWriteString(writer, BAD_CAST label->name); - xmlTextWriterEndElement(writer); } }