gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10520: Minor corrections to XML / X


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10520: Minor corrections to XML / XMLNode; some test passes.
Date: Thu, 08 Jan 2009 11:13:38 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10520
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-01-08 11:13:38 +0100
message:
  Minor corrections to XML / XMLNode; some test passes.
modified:
  libcore/asobj/XMLNode_as.cpp
  libcore/asobj/XML_as.cpp
  testsuite/actionscript.all/XML.as
    ------------------------------------------------------------
    revno: 10519.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-08 10:06:51 +0100
    message:
      Corrections to XML parsing and XMLNode output (escape attribute values).
    modified:
      libcore/asobj/XMLNode_as.cpp
      libcore/asobj/XML_as.cpp
    ------------------------------------------------------------
    revno: 10519.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-08 10:54:57 +0100
    message:
      Passing tests.
    modified:
      testsuite/actionscript.all/XML.as
=== modified file 'libcore/asobj/XMLNode_as.cpp'
--- a/libcore/asobj/XMLNode_as.cpp      2008-12-27 19:56:32 +0000
+++ b/libcore/asobj/XMLNode_as.cpp      2009-01-08 09:06:51 +0000
@@ -388,24 +388,22 @@
         enumerateAttributes(xml, attrs);
         if (!attrs.empty()) {
 
-            for (PropertyList::SortedPropertyList::const_iterator i = 
+            for (PropertyList::SortedPropertyList::iterator i = 
                     attrs.begin(), e = attrs.end(); i != e; ++i) { 
-
+                XML_as::escape(i->second);
                 xmlout << " " << i->first << "=\"" << i->second << "\"";
             }
         }
 
        // If the node has no content, just close the tag now
-       if ( nodeValue.empty() && xml._children.empty() )
-       {
+       if ( nodeValue.empty() && xml._children.empty() ) {
                xmlout << " />";
-               return;
+            return;
        }
-       else
-       {
-        // Will use a closing tag later
-        xmlout << ">";
-       }
+        else {
+            // Will use a closing tag later
+            xmlout << ">";
+        }
 
     }
 

=== modified file 'libcore/asobj/XML_as.cpp'
--- a/libcore/asobj/XML_as.cpp  2009-01-08 08:36:56 +0000
+++ b/libcore/asobj/XML_as.cpp  2009-01-08 09:06:51 +0000
@@ -221,6 +221,11 @@
         return;
     }
     std::string name(it, end);
+    
+    if (name.empty()) {
+        _status = XML_UNTERMINATED_ELEMENT;
+        return;
+    }
 
     // Point iterator to the character after the name.
     it = end;
@@ -409,6 +414,9 @@
             }
         }
         
+        // Do nothing more if there was an error in attributes parsing.
+        if (_status != XML_OK) return;
+
         for (Attributes::const_reverse_iterator i = attributes.rbegin(),
                 e = attributes.rend(); i != e; ++i) {
             childNode->setAttribute(i->first, i->second);
@@ -423,7 +431,8 @@
         return;
     }
 
-    // This may be xml.end(), which is okay.
+    // If we reach here, this is a closing tag.
+
     it = std::find(endName, xml.end(), '>');
 
     if (it == xml.end())

=== modified file 'testsuite/actionscript.all/XML.as'
--- a/testsuite/actionscript.all/XML.as 2008-11-24 13:14:17 +0000
+++ b/testsuite/actionscript.all/XML.as 2009-01-08 09:54:57 +0000
@@ -960,10 +960,10 @@
 check_equals(h.toString(), "<open><open2 /></open>");
 
 h = new XML("<open att='");
-xcheck_equals(h.toString(), "");
+check_equals(h.toString(), "");
 
 h = new XML("<open att      r='kk'");
-xcheck_equals(h.toString(), "");
+check_equals(h.toString(), "");
 
 h = new XML("<open>& ' \"<");
 check_equals(h.toString(), "<open>&amp; &apos; &quot;</open>");


reply via email to

[Prev in Thread] Current Thread [Next in Thread]