[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10388: Correct namespaceURI method
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10388: Correct namespaceURI method of XMLNode. Fixes bug #24739. |
Date: |
Thu, 04 Dec 2008 09:32:54 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10388
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2008-12-04 09:32:54 +0100
message:
Correct namespaceURI method of XMLNode. Fixes bug #24739.
modified:
libcore/asobj/XMLNode_as.cpp
libcore/asobj/XMLNode_as.h
libcore/impl.cpp
libcore/parser/SWFMovieDefinition.cpp
------------------------------------------------------------
revno: 10387.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Thu 2008-12-04 08:28:59 +0100
message:
Use an absolute URL for the _url property (local SWFs should start with
"file://")
modified:
libcore/impl.cpp
libcore/parser/SWFMovieDefinition.cpp
------------------------------------------------------------
revno: 10387.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Thu 2008-12-04 09:23:23 +0100
message:
Correct XMLNode.namespaceURI implementation.
modified:
libcore/asobj/XMLNode_as.cpp
libcore/asobj/XMLNode_as.h
=== modified file 'libcore/asobj/XMLNode_as.cpp'
--- a/libcore/asobj/XMLNode_as.cpp 2008-11-24 12:44:38 +0000
+++ b/libcore/asobj/XMLNode_as.cpp 2008-12-04 08:23:23 +0000
@@ -352,6 +352,23 @@
}
+
+bool
+XMLNode_as::extractPrefix(std::string& prefix)
+{
+ prefix.clear();
+ if (_name.empty()) return false;
+
+ std::string::size_type pos = _name.find(':');
+ if (pos == std::string::npos || pos == _name.size() - 1) {
+ return false;
+ }
+
+ prefix = _name.substr(0, pos);
+ return true;
+}
+
+
void
XMLNode_as::stringify(const XMLNode_as& xml, std::ostream& xmlout, bool
encode)
{
@@ -668,12 +685,12 @@
return as_value(prefix);
}
-
-/// Returns a namespaceURI set with the xmlns attribute, searching upwards
+/// If the node has a prefix, return the matching namespace. Otherwise,
+/// returns a namespaceURI set with the xmlns attribute, searching upwards
/// through parent nodes if necessary.
//
-/// This property can only be set during XML parsing and cannot be changed
-/// or set using attributes.
+/// This standard namespace can only be set during XML parsing and cannot
+/// be changed or set using attributes.
//
/// Conversely, the similar getNamespaceForPrefix("") can be set and changed
/// through attributes.
@@ -684,12 +701,21 @@
// Read-only property
- if (ptr->nodeName().empty()) {
+ const std::string& name = ptr->nodeName();
+
+ if (name.empty()) {
as_value null;
null.set_null();
return null;
}
+ std::string prefix;
+ if (ptr->extractPrefix(prefix)) {
+ std::string ns;
+ ptr->getNamespaceForPrefix(prefix, ns);
+ return as_value(ns);
+ }
+
// Search recursively for a namespace. Return an empty string
// if none found.
XMLNode_as* node = ptr.get();
@@ -718,15 +744,9 @@
return null;
}
- const std::string& nodeName = ptr->nodeName();
- if (nodeName.empty()) return as_value("");
-
- std::string::size_type pos = nodeName.find(':');
- if (pos == std::string::npos || pos == nodeName.size() - 1) {
- return as_value("");
- }
-
- return as_value(nodeName.substr(0, pos));
+ std::string prefix;
+ if (!ptr->extractPrefix(prefix)) return as_value("");
+ return as_value(prefix);
}
=== modified file 'libcore/asobj/XMLNode_as.h'
--- a/libcore/asobj/XMLNode_as.h 2008-11-21 15:15:25 +0000
+++ b/libcore/asobj/XMLNode_as.h 2008-12-04 08:23:23 +0000
@@ -106,6 +106,8 @@
///
void nodeNameSet(const std::string& name) { _name = name; }
+ bool extractPrefix(std::string& prefix);
+
/// Set value of this node, overriding any previous value
void nodeValueSet(const std::string& value) { _value = value; }
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2008-11-08 22:02:22 +0000
+++ b/libcore/impl.cpp 2008-12-04 07:28:59 +0000
@@ -347,7 +347,9 @@
std::auto_ptr<SWFMovieDefinition> m (new SWFMovieDefinition(runInfo));
- if (!m->readHeader(in, url)) return 0;
+ const std::string& absURL = URL(url).str();
+
+ if (!m->readHeader(in, absURL)) return 0;
if (startLoaderThread && !m->completeLoad()) return 0;
return m.release();
=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp 2008-11-21 15:15:25 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp 2008-12-04 07:28:59 +0000
@@ -325,7 +325,8 @@
// Read header and assign url
bool
-SWFMovieDefinition::readHeader(std::auto_ptr<IOChannel> in, const std::string&
url)
+SWFMovieDefinition::readHeader(std::auto_ptr<IOChannel> in,
+ const std::string& url)
{
_in = in;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10388: Correct namespaceURI method of XMLNode. Fixes bug #24739.,
Benjamin Wolsey <=