[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12224: Minor cleanup from investiga
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12224: Minor cleanup from investigating clang++ compile failure: move function |
Date: |
Sat, 05 Jun 2010 12:43:42 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12224
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sat 2010-06-05 12:43:42 +0200
message:
Minor cleanup from investigating clang++ compile failure: move function
outside class as it needs no access to the class member at all.
modified:
libcore/asobj/flash/net/LocalConnection_as.cpp
=== modified file 'libcore/asobj/flash/net/LocalConnection_as.cpp'
--- a/libcore/asobj/flash/net/LocalConnection_as.cpp 2010-05-18 08:00:19
+0000
+++ b/libcore/asobj/flash/net/LocalConnection_as.cpp 2010-06-05 10:43:42
+0000
@@ -132,6 +132,8 @@
bool validFunctionName(const std::string& func);
void attachLocalConnectionInterface(as_object& o);
+ std::string getDomain(as_object& o);
+
void removeListener(const std::string& name, SharedMem& mem);
bool addListener(const std::string& name, SharedMem& mem);
bool findListener(const std::string& name, SharedMem& mem);
@@ -198,6 +200,8 @@
static const size_t listenersOffset = 40976;
/// Create a LocalConnection_as object.
+ //
+ /// @param owner The as_object that owns this Relay.
LocalConnection_as(as_object* owner);
virtual ~LocalConnection_as() {
@@ -236,12 +240,6 @@
private:
- /// Work out the domain.
- //
- /// Called once on construction to set _domain, though it will do
- /// no harm to call it again.
- std::string getDomain();
-
std::string _name;
// The immutable domain of this LocalConnection_as, based on the
@@ -262,10 +260,10 @@
const size_t LocalConnection_as::listenersOffset;
const size_t LocalConnection_as::defaultSize;
-LocalConnection_as::LocalConnection_as(as_object* owner)
+LocalConnection_as::LocalConnection_as(as_object* o)
:
- ActiveRelay(owner),
- _domain(getDomain()),
+ ActiveRelay(o),
+ _domain(getDomain(owner())),
_connected(false),
_shm(defaultSize),
_lastTime(0)
@@ -482,55 +480,6 @@
return;
}
-/// String representing the domain of the current SWF file.
-//
-/// This is set on construction, as it should be constant.
-/// The domain is either the "localhost", or the hostname from the
-/// network connection. This behaviour changed for SWF v7. Prior to v7
-/// only the domain was returned, ie dropping off node names like
-/// "www". As of v7, the behaviour is to return the full host
-/// name. Gnash supports both behaviours based on the version.
-std::string
-LocalConnection_as::getDomain()
-{
-
- URL url(getRoot(owner()).getOriginalURL());
-
- if (url.hostname().empty()) {
- return "localhost";
- }
-
- // Adjust the name based on the swf version. Prior to v7, the nodename part
- // was removed. For v7 or later. the full hostname is returned. The
- // localhost is always just the localhost.
- if (getSWFVersion(owner()) > 6) {
- return url.hostname();
- }
-
- const std::string& domain = url.hostname();
-
- std::string::size_type pos;
- pos = domain.rfind('.');
-
- // If there is no '.', return the whole thing.
- if (pos == std::string::npos) {
- return domain;
- }
-
- pos = domain.rfind(".", pos - 1);
-
- // If there is no second '.', return the whole thing.
- if (pos == std::string::npos) {
- return domain;
- }
-
- // Return everything after the second-to-last '.'
- // FIXME: this must be wrong, or it would return 'org.uk' for many
- // UK websites, and not even Adobe is that stupid. I think.
- return domain.substr(pos + 1);
-
-}
-
void
localconnection_class_init(as_object& where, const ObjectURI& uri)
{
@@ -974,6 +923,55 @@
return vm.getTime() & 0x7fffffff;
}
+/// String representing the domain of the current SWF file.
+//
+/// This is set on construction, as it should be constant.
+/// The domain is either the "localhost", or the hostname from the
+/// network connection. This behaviour changed for SWF v7. Prior to v7
+/// only the domain was returned, ie dropping off node names like
+/// "www". As of v7, the behaviour is to return the full host
+/// name. Gnash supports both behaviours based on the version.
+std::string
+getDomain(as_object& o)
+{
+
+ URL url(getRoot(o).getOriginalURL());
+
+ if (url.hostname().empty()) {
+ return "localhost";
+ }
+
+ // Adjust the name based on the swf version. Prior to v7, the nodename part
+ // was removed. For v7 or later. the full hostname is returned. The
+ // localhost is always just the localhost.
+ if (getSWFVersion(o) > 6) {
+ return url.hostname();
+ }
+
+ const std::string& domain = url.hostname();
+
+ std::string::size_type pos;
+ pos = domain.rfind('.');
+
+ // If there is no '.', return the whole thing.
+ if (pos == std::string::npos) {
+ return domain;
+ }
+
+ pos = domain.rfind(".", pos - 1);
+
+ // If there is no second '.', return the whole thing.
+ if (pos == std::string::npos) {
+ return domain;
+ }
+
+ // Return everything after the second-to-last '.'
+ // FIXME: this must be wrong, or it would return 'org.uk' for many
+ // UK websites, and not even Adobe is that stupid. I think.
+ return domain.substr(pos + 1);
+
+}
+
} // anonymous namespace
} // end of gnash namespace
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12224: Minor cleanup from investigating clang++ compile failure: move function,
Benjamin Wolsey <=