[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10464: Minor corrections.
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10464: Minor corrections. |
Date: |
Thu, 18 Dec 2008 13:59:39 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10464
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2008-12-18 13:59:39 +0100
message:
Minor corrections.
modified:
libcore/asobj/LocalConnection.cpp
libcore/asobj/LocalConnection.h
testsuite/actionscript.all/LocalConnection.as
------------------------------------------------------------
revno: 10460.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Thu 2008-12-18 13:36:38 +0100
message:
More fixes to LocalConnection.
modified:
libcore/asobj/LocalConnection.cpp
libcore/asobj/LocalConnection.h
testsuite/actionscript.all/LocalConnection.as
=== modified file 'libcore/asobj/LocalConnection.cpp'
--- a/libcore/asobj/LocalConnection.cpp 2008-12-18 11:25:16 +0000
+++ b/libcore/asobj/LocalConnection.cpp 2008-12-18 12:36:38 +0000
@@ -111,6 +111,7 @@
void
LocalConnection::close()
{
+ _connected = false;
#ifndef NETWORK_CONN
closeMem();
#endif
@@ -126,12 +127,12 @@
LocalConnection::connect(const std::string& name)
{
- if (name.empty()) {
- _name = "none, sysv segment type";
- }
- else {
- _name = name;
- }
+ assert(!name.empty());
+
+ _name = name;
+
+ // TODO: does this depend on success?
+ _connected = true;
log_debug("trying to open shared memory segment: \"%s\"", _name);
@@ -144,8 +145,6 @@
return;
}
- _connected = true;
-
return;
}
@@ -185,16 +184,16 @@
return domain;
}
+ pos = domain.rfind(".", pos - 1);
+
// If there is no second '.', return the whole thing.
- pos = domain.rfind(".", pos - 1);
-
+ 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.
- if (pos == std::string::npos) {
- return domain;
- }
-
+ // UK websites, and not even Adobe is that stupid. I think.
return domain.substr(pos + 1);
}
@@ -243,6 +242,9 @@
boost::intrusive_ptr<LocalConnection> ptr =
ensureType<LocalConnection>(fn.this_ptr);
+ // If already connected, don't try again until close() is called.
+ if (ptr->connected()) return false;
+
if (!fn.nargs) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("LocalConnection.connect() expects exactly "
@@ -261,6 +263,10 @@
std::string name = fn.arg(0).to_string();
+ if (name.empty()) {
+ return as_value(false);
+ }
+
ptr->connect(name);
// We don't care whether connected or not.
@@ -343,7 +349,6 @@
void
attachLocalConnectionInterface(as_object& o)
{
-
o.init_member("close", new builtin_function(localconnection_close));
o.init_member("connect", new builtin_function(localconnection_connect));
o.init_member("domain", new builtin_function(localconnection_domain));
=== modified file 'libcore/asobj/LocalConnection.h'
--- a/libcore/asobj/LocalConnection.h 2008-12-18 11:25:16 +0000
+++ b/libcore/asobj/LocalConnection.h 2008-12-18 12:36:38 +0000
@@ -60,7 +60,6 @@
bool _connected;
std::string _name;
- std::map<const char *, short> _allocated;
// The immutable domain of this LocalConnection, based on the
// originating SWF's domain.
=== modified file 'testsuite/actionscript.all/LocalConnection.as'
--- a/testsuite/actionscript.all/LocalConnection.as 2008-12-18 11:25:16
+0000
+++ b/testsuite/actionscript.all/LocalConnection.as 2008-12-18 12:36:38
+0000
@@ -95,6 +95,20 @@
check_equals(ret, false);
check_equals(statuses.length, 0);
+ret = rec.connect("");
+check_equals(ret, false);
+check_equals(statuses.length, 0);
+
+ret = rec.connect("string", 7);
+check_equals(ret, true);
+check_equals(statuses.length, 0);
+
+ret = rec.connect("string");
+check_equals(ret, false);
+check_equals(statuses.length, 0);
+
+rec.close();
+
ret = rec.connect("string");
check_equals(ret, true);
check_equals(statuses.length, 0);
@@ -180,7 +194,7 @@
rec.close();
-totals(46);
+totals(52);
#endif // OUTPUT_VERSION >= 6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10464: Minor corrections.,
Benjamin Wolsey <=