- don't parse desc and summary twice
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 24 May 2006 12:58:48 +0000 (12:58 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 24 May 2006 12:58:48 +0000 (12:58 +0000)
- fix a segfault with tranlated text

zypp/parser/xmlstore/XMLLanguageParser.cc
zypp/parser/xmlstore/XMLParserData.cc
zypp/parser/xmlstore/XMLParserData.h
zypp/parser/xmlstore/XMLPatchParser.cc
zypp/parser/xmlstore/XMLPatternParser.cc
zypp/parser/xmlstore/XMLProductParser.cc
zypp/target/store/XMLFilesBackend.cc
zypp/target/store/xml/XMLSelectionImpl.cc
zypp/target/store/xml/XMLSelectionImpl.h

index 3eba8eb..6c5b78c 100644 (file)
@@ -58,21 +58,15 @@ namespace zypp {
         parseResObjectCommonData( dataPtr, dataNode);
         parseDependencies( dataPtr, dataNode);
         
-        for (xmlNodePtr child = dataNode->children; child && child != dataNode; child = child->next)
-        {
-          if (_helper.isElement(child))
-          {
-            string name = _helper.name(child);
-            
-            if (name == "summary")
-            {
-              dataPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
-            else if (name == "description") {
-              dataPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
-          }
-        }
+//         for (xmlNodePtr child = dataNode->children; child && child != dataNode; child = child->next)
+//         {
+//           if (_helper.isElement(child))
+//           {
+//             string name = _helper.name(child);
+//             
+//             
+//           }
+//         }
         return dataPtr;
       } /* end process */
       
index f230b29..2831656 100644 (file)
@@ -29,7 +29,7 @@ namespace zypp {
       XMLResObjectData::XMLResObjectData() : install_only(false)
       { }
       
-      XMLPatternData::XMLPatternData()
+      XMLPatternData::XMLPatternData() : userVisible(true)
       { }
 
       /*
index 476a637..a94e469 100644 (file)
@@ -93,7 +93,7 @@ namespace zypp {
         XMLPatternData();
         
         std::string default_;
-        std::string userVisible;
+        bool userVisible;
         TranslatedText category;
         std::string icon;
         std::string script;
index 273d0de..96b41b1 100644 (file)
@@ -73,13 +73,7 @@ namespace zypp {
           {
             string name = _helper.name(child);
             
-            if (name == "summary") {
-              patchPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
-            else if (name == "description") {
-              patchPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
-            else if (name == "id") {
+            if (name == "id") {
               patchPtr->patchId = _helper.content(child);
             }
             else if (name == "timestamp") {
index 88be596..32c09b2 100644 (file)
@@ -64,18 +64,11 @@ namespace zypp {
           {
             string name = _helper.name(child);
             
-            if (name == "summary")
-            {
-              dataPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
-            else if (name == "default") {
+            if (name == "default") {
               dataPtr->default_ = _helper.content(child);
             }
             else if (name == "uservisible") {
-              dataPtr->userVisible = _helper.content(child);
-            }
-            else if (name == "description") {
-              dataPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
+              dataPtr->userVisible = (_helper.content(child) == "false") ? false : true;
             }
             else if (name == "category") {
               dataPtr->category.setText(_helper.content(child));
index a544d78..e972b56 100644 (file)
@@ -77,12 +77,6 @@ namespace zypp {
             else if (name == "shortname") {
               productPtr->short_name.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
             }
-            else if (name == "summary") {
-              productPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
-            else if (name == "description") {
-              productPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
-            }
             else if (name == "product-flags") {
               parseProductFlags( productPtr, child);
             }
index 9646021..1d83d4f 100644 (file)
@@ -1017,7 +1017,7 @@ XMLFilesBackend::createPattern( const zypp::parser::xmlstore::XMLPatternData & p
     impl->_build_time = parsed.build_time;
     impl->_install_time = parsed.install_time;
     
-    impl->_user_visible = ((parsed.userVisible == "false" ) ? false : true );
+    impl->_user_visible = parsed.userVisible;
     impl->_default = ((parsed.default_ == "false" ) ? false : true );
     impl->_category = parsed.category;
     impl->_icon = parsed.icon;
@@ -1059,10 +1059,10 @@ XMLFilesBackend::createSelection( const zypp::parser::xmlstore::XMLPatternData &
     impl->_build_time = parsed.build_time;
     impl->_install_time = parsed.install_time;
     
-    impl->_visible = ((parsed.userVisible == "false" ) ? false : true );
+    impl->_visible = parsed.userVisible;
     impl->_name = parsed.name;
     //impl->_default = ((parsed.default_ == "false" ) ? false : true );
-    impl->_category = parsed.category.text();
+    impl->_category = parsed.category;
 
     Arch arch;
     if (!parsed.arch.empty())
index 797c269..5b9ca47 100644 (file)
@@ -25,7 +25,7 @@ namespace zypp
     // METHOD NAME : XMLSelectionImpl::XMLSelectionImpl
     // METHOD TYPE : Ctor
     //
-    XMLSelectionImpl::XMLSelectionImpl()
+    XMLSelectionImpl::XMLSelectionImpl() : _visible(true)
     {}
 
     ///////////////////////////////////////////////////////////////////
@@ -37,7 +37,7 @@ namespace zypp
     {}
 
     Label XMLSelectionImpl::category() const
-    { return _category; }
+    { return _category.text(); }
 
     bool XMLSelectionImpl::visible() const
     { return _visible; }
index a0b0ff4..d8771a6 100644 (file)
@@ -89,7 +89,7 @@ namespace zypp
       std::string _release;
       std::string _arch;
       std::string _order;
-      std::string _category;
+      TranslatedText _category;
       bool _visible;
 
       std::set<std::string> _suggests;