gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. 77277ba6210114711748


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 77277ba6210114711748214c98493a4a9c5c1dd0
Date: Mon, 25 Oct 2010 15:34:24 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  77277ba6210114711748214c98493a4a9c5c1dd0 (commit)
       via  050521c4cc2f6bfeb1a2929a737d98a3ad6dab67 (commit)
       via  d40448060c664c88ebcd370c41e410e6a2274965 (commit)
       via  90e99a6e288f2af00fe9553672637f49b9e8015d (commit)
       via  b38b68ae78c7749faa074e91e36f635aaaaa3683 (commit)
       via  d3f818de1c47b07cade9b536249698de96aa311b (commit)
       via  dbcdf5049b6572f5a2fa7b7741bdb99063f97a35 (commit)
       via  df2fedb876795816689ec0e824479f5334165daa (commit)
      from  9829e9dc82f7b4e1dc51e30c355f3b5b8325d945 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=77277ba6210114711748214c98493a4a9c5c1dd0


commit 77277ba6210114711748214c98493a4a9c5c1dd0
Merge: 050521c 9829e9d
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 17:09:06 2010 +0200

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=050521c4cc2f6bfeb1a2929a737d98a3ad6dab67


commit 050521c4cc2f6bfeb1a2929a737d98a3ad6dab67
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 16:31:10 2010 +0200

    Tabs to spaces.

diff --git a/libcore/asobj/NetConnection_as.cpp 
b/libcore/asobj/NetConnection_as.cpp
index c91af68..33f721d 100644
--- a/libcore/asobj/NetConnection_as.cpp
+++ b/libcore/asobj/NetConnection_as.cpp
@@ -783,8 +783,8 @@ NetConnection_as::connect(const std::string& uri)
         && (url.protocol() != "http")) {
 
         IF_VERBOSE_ASCODING_ERRORS(
-                   log_aserror("NetConnection.connect(%s): invalid connection "
-                            "protocol", url);
+            log_aserror("NetConnection.connect(%s): invalid connection "
+                 "protocol", url);
         );
         notifyStatus(CONNECT_FAILED);
         return;

http://git.savannah.gnu.org/cgit//commit/?id=d40448060c664c88ebcd370c41e410e6a2274965


commit d40448060c664c88ebcd370c41e410e6a2274965
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 16:30:52 2010 +0200

    Minor cleanups.

diff --git a/libcore/asobj/NetConnection_as.cpp 
b/libcore/asobj/NetConnection_as.cpp
index 9412ad7..c91af68 100644
--- a/libcore/asobj/NetConnection_as.cpp
+++ b/libcore/asobj/NetConnection_as.cpp
@@ -767,8 +767,7 @@ NetConnection_as::connect(const std::string& uri)
     close();
 
     // TODO: check for other kind of invalidities here...
-    if ( uri.empty() )
-    {
+    if (uri.empty()) {
         _isConnected = false;
         notifyStatus(CONNECT_FAILED);
         return;
@@ -784,9 +783,9 @@ NetConnection_as::connect(const std::string& uri)
         && (url.protocol() != "http")) {
 
         IF_VERBOSE_ASCODING_ERRORS(
-                log_aserror("NetConnection.connect(%s): invalid connection "
+                   log_aserror("NetConnection.connect(%s): invalid connection "
                             "protocol", url);
-                                  );
+        );
         notifyStatus(CONNECT_FAILED);
         return;
     }
@@ -802,7 +801,6 @@ NetConnection_as::connect(const std::string& uri)
 
     _currentConnection.reset(new HTTPRemotingHandler(*this, url));
 
-
     // FIXME: We should attempt a connection here (this is called when an
     // argument is passed to NetConnection.connect(url).
     // Would probably return true on success and set isConnected.
@@ -972,8 +970,7 @@ netconnection_call(const fn_call& fn)
 {
     NetConnection_as* ptr = ensure<ThisIsNative<NetConnection_as> >(fn);
 
-    if (fn.nargs < 1)
-    {
+    if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("NetConnection.call(): needs at least one 
argument"));
         );
@@ -1014,9 +1011,7 @@ as_value
 netconnection_close(const fn_call& fn)
 {
     NetConnection_as* ptr = ensure<ThisIsNative<NetConnection_as> >(fn);
-
     ptr->close();
-
     return as_value();
 }
 
@@ -1026,7 +1021,6 @@ as_value
 netconnection_isConnected(const fn_call& fn)
 {
     NetConnection_as* ptr = ensure<ThisIsNative<NetConnection_as> >(fn);
-
     return as_value(ptr->isConnected());
 }
 
@@ -1034,7 +1028,6 @@ as_value
 netconnection_uri(const fn_call& fn)
 {
     NetConnection_as* ptr = ensure<ThisIsNative<NetConnection_as> >(fn);
-
     return as_value(ptr->getURI());
 }
 
@@ -1062,8 +1055,7 @@ attachProperties(as_object& o)
 as_value
 netconnection_new(const fn_call& fn)
 {
-
-    as_object* obj = fn.this_ptr;
+    as_object* obj = ensure<ValidThis>(fn);
     obj->setRelay(new NetConnection_as(obj));
     attachProperties(*obj);
     return as_value();
@@ -1088,8 +1080,7 @@ netconnection_connect(const fn_call& fn)
 
     NetConnection_as* ptr = ensure<ThisIsNative<NetConnection_as> >(fn);
     
-    if (fn.nargs < 1)
-    {
+    if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("NetConnection.connect(): needs at least "
                     "one argument"));
@@ -1110,8 +1101,7 @@ netconnection_connect(const fn_call& fn)
         ptr->connect();
     }
     else {
-        if ( fn.nargs > 1 )
-        {
+        if (fn.nargs > 1) {
             std::stringstream ss; fn.dump_args(ss);
             log_unimpl("NetConnection.connect(%s): args after the first are "
                     "not supported", ss.str());

http://git.savannah.gnu.org/cgit//commit/?id=90e99a6e288f2af00fe9553672637f49b9e8015d


commit 90e99a6e288f2af00fe9553672637f49b9e8015d
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 16:27:38 2010 +0200

    Clean up more.

diff --git a/libcore/asobj/NetConnection_as.cpp 
b/libcore/asobj/NetConnection_as.cpp
index 7a2900d..9412ad7 100644
--- a/libcore/asobj/NetConnection_as.cpp
+++ b/libcore/asobj/NetConnection_as.cpp
@@ -23,8 +23,14 @@
 #include "gnashconfig.h"
 #endif
 
-#include "GnashSystemNetHeaders.h"
 #include "NetConnection_as.h"
+
+#include <iostream>
+#include <string>
+#include <boost/scoped_ptr.hpp>
+#include <utility>
+
+#include "GnashSystemNetHeaders.h"
 #include "log.h"
 #include "GnashException.h"
 #include "builtin_function.h"
@@ -42,10 +48,6 @@
 #include "RunResources.h"
 #include "IOChannel.h"
 
-#include <iostream>
-#include <string>
-#include <boost/scoped_ptr.hpp>
-
 //#define GNASH_DEBUG_REMOTING
 
 // Forward declarations.
@@ -62,6 +64,8 @@ namespace {
     as_value netconnection_call(const fn_call& fn);
     as_value netconnection_addHeader(const fn_call& fn);
     as_value netconnection_new(const fn_call& fn);
+    std::pair<std::string, std::string>
+        getStatusCodeInfo(NetConnection_as::StatusCode code);
 
 }
 
@@ -728,8 +732,7 @@ NetConnection_as::validateURL() const
 void
 NetConnection_as::notifyStatus(StatusCode code)
 {
-    std::pair<std::string, std::string> info;
-    getStatusCodeInfo(code, info);
+    std::pair<std::string, std::string> info = getStatusCodeInfo(code);
 
     /// This is a new normal object each time (see NetConnection.as)
     as_object* o = createObject(getGlobal(owner()));
@@ -743,49 +746,6 @@ NetConnection_as::notifyStatus(StatusCode code)
 
 }
 
-void
-NetConnection_as::getStatusCodeInfo(StatusCode code, NetConnectionStatus& info)
-{
-    /// The Call statuses do exist, but this implementation is a guess.
-    switch (code)
-    {
-        case CONNECT_SUCCESS:
-            info.first = "NetConnection.Connect.Success";
-            info.second = "status";
-            return;
-
-        case CONNECT_FAILED:
-            info.first = "NetConnection.Connect.Failed";
-            info.second = "error";
-            return;
-
-        case CONNECT_APPSHUTDOWN:
-            info.first = "NetConnection.Connect.AppShutdown";
-            info.second = "error";
-            return;
-
-        case CONNECT_REJECTED:
-            info.first = "NetConnection.Connect.Rejected";
-            info.second = "error";
-            return;
-
-        case CALL_FAILED:
-            info.first = "NetConnection.Call.Failed";
-            info.second = "error";
-            return;
-
-        case CALL_BADVERSION:
-            info.first = "NetConnection.Call.BadVersion";
-            info.second = "status";
-            return;
-
-        case CONNECT_CLOSED:
-            info.first = "NetConnection.Connect.Closed";
-            info.second = "status";
-    }
-
-}
-
 
 /// Called on NetConnection.connect(null).
 //
@@ -1174,8 +1134,33 @@ netconnection_addHeader(const fn_call& fn)
     return as_value();
 }
 
-} // anonymous namespace
+std::pair<std::string, std::string>
+getStatusCodeInfo(NetConnection_as::StatusCode code)
+{
+    /// The Call statuses do exist, but this implementation is a guess.
+    switch (code) {
+        case NetConnection_as::CONNECT_SUCCESS:
+            return std::make_pair("NetConnection.Connect.Success", "status");
+        case NetConnection_as::CONNECT_FAILED:
+            return std::make_pair("NetConnection.Connect.Failed", "error");
+        case NetConnection_as::CONNECT_APPSHUTDOWN:
+            return std::make_pair("NetConnection.Connect.AppShutdown", 
"error");
+        case NetConnection_as::CONNECT_REJECTED:
+            return std::make_pair("NetConnection.Connect.Rejected", "error");
+        case NetConnection_as::CALL_FAILED:
+            return std::make_pair("NetConnection.Call.Failed", "error");
+        case NetConnection_as::CALL_BADVERSION:
+            return std::make_pair("NetConnection.Call.BadVersion", "status");
+        case NetConnection_as::CONNECT_CLOSED:
+            return std::make_pair("NetConnection.Connect.Closed", "status");
+        default:
+            std::abort();
+    }
+
+}
+
 
+} // anonymous namespace
 } // end of gnash namespace
 
 // local Variables:
diff --git a/libcore/asobj/NetConnection_as.h b/libcore/asobj/NetConnection_as.h
index ecc470d..549e3fe 100644
--- a/libcore/asobj/NetConnection_as.h
+++ b/libcore/asobj/NetConnection_as.h
@@ -16,7 +16,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-
 #ifndef GNASH_NETCONNECTION_H
 #define GNASH_NETCONNECTION_H
 
@@ -58,7 +57,8 @@ public:
     };
 
     NetConnection_as(as_object* owner);
-    ~NetConnection_as();
+
+    virtual ~NetConnection_as();
 
     /// Process connection stuff
     virtual void update();
@@ -99,10 +99,6 @@ public:
 
 private:
 
-    typedef std::pair<std::string, std::string> NetConnectionStatus;
-
-    void getStatusCodeInfo(StatusCode code, NetConnectionStatus& info);
-
     /// Extend the URL to be used for playing
     void addToURL(const std::string& url);
 

http://git.savannah.gnu.org/cgit//commit/?id=b38b68ae78c7749faa074e91e36f635aaaaa3683


commit b38b68ae78c7749faa074e91e36f635aaaaa3683
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 16:13:55 2010 +0200

    Clean up.

diff --git a/libcore/asobj/NetConnection_as.cpp 
b/libcore/asobj/NetConnection_as.cpp
index f08a970..7a2900d 100644
--- a/libcore/asobj/NetConnection_as.cpp
+++ b/libcore/asobj/NetConnection_as.cpp
@@ -183,7 +183,6 @@ ConnectionHandler::getStream(const std::string&)
 ///
 class HTTPRemotingHandler : public ConnectionHandler
 {
-
 public:
 
     /// Create an handler for HTTP remoting
@@ -197,8 +196,7 @@ public:
     HTTPRemotingHandler(NetConnection_as& nc, const URL& url);
 
     // See dox in ConnectionHandler
-    virtual bool hasPendingCalls() const
-    {
+    virtual bool hasPendingCalls() const {
         return _connection || queued_count;
     }
 
@@ -206,13 +204,9 @@ public:
     virtual bool advance();
 
     // See dox in ConnectionHandler
-    virtual void setReachable() const
-    {
-        for (CallbacksMap::const_iterator i=callbacks.begin(),
-                e=callbacks.end(); i!=e; ++i)
-        {
-            i->second->setReachable();
-        }
+    virtual void setReachable() const {
+        foreachSecond(callbacks.begin(), callbacks.end(),
+                std::mem_fun(&as_object::setReachable));
     }
 
     // See dox in NetworkHandler class
@@ -239,39 +233,35 @@ private:
     //
     NetworkAdapter::RequestHeaders _headers;
 
-    void push_amf(const SimpleBuffer &amf) 
-    {
+    void push_amf(const SimpleBuffer &amf) {
         //GNASH_REPORT_FUNCTION;
 
         _postdata.append(amf.data(), amf.size());
         queued_count++;
     }
 
-    void push_callback(const std::string& id, as_object* callback)
-    {
+    void push_callback(const std::string& id, as_object* callback) {
         callbacks[id] = callback;
     }
 
-    as_object* pop_callback(const std::string& id)
-    {
+    as_object* pop_callback(const std::string& id) {
         CallbacksMap::iterator it = callbacks.find(id);
         if (it != callbacks.end()) {
             as_object* callback = it->second;
             callbacks.erase(it);
             return callback;
         }
-        else return 0;
+        return 0;
     }
 
     void enqueue(const SimpleBuffer &amf, const std::string& identifier,
-                 as_object* callback)
-    {
+                 as_object* callback) {
+
         push_amf(amf);
         push_callback(identifier, callback);
     }
 
-    void enqueue(const SimpleBuffer &amf)
-    {
+    void enqueue(const SimpleBuffer &amf) {
         push_amf(amf);
     }
     
@@ -309,7 +299,7 @@ HTTPRemotingHandler::advance()
 
         // Fill last chunk before reading in the next
         size_t toRead = reply.capacity() - reply.size();
-        if (! toRead) toRead = NCCALLREPLYCHUNK;
+        if (!toRead) toRead = NCCALLREPLYCHUNK;
 
 #ifdef GNASH_DEBUG_REMOTING
         log_debug("Attempt to read %d bytes", toRead);
@@ -325,9 +315,9 @@ HTTPRemotingHandler::advance()
 
 #ifdef GNASH_DEBUG_REMOTING
             log_debug("NetConnection.call: reply buffer capacity (%d) "
-                      "is too small to accept next %d bytes of chunk "
-                      "(current size is %d). Reserving %d bytes.",
-                reply.capacity(), toRead, reply.size(), newCapacity);
+                    "is too small to accept next %d bytes of chunk "
+                    "(current size is %d). Reserving %d bytes.",
+                    reply.capacity(), toRead, reply.size(), newCapacity);
 #endif
 
             reply.reserve(newCapacity);
@@ -464,8 +454,8 @@ HTTPRemotingHandler::advance()
                             // Reply message is: '/id/methodName'
 
                             int ns = 1; // next slash position
-                            while (ns<si-1 && *(b+ns) != '/') ++ns;
-                            if ( ns >= si-1 ) {
+                            while (ns < si-1 && *(b + ns) != '/') ++ns;
+                            if (ns >= si-1) {
                                 std::string msg(
                                         reinterpret_cast<const char*>(b), si);
                                 log_error("NetConnection::call(): invalid "
@@ -483,9 +473,9 @@ HTTPRemotingHandler::advance()
                             b += si;
 
                             // parse past unused string in header
-                            if(b + 2 > end) break;
+                            if (b + 2 > end) break;
                             si = readNetworkShort(b); b += 2; // reply length
-                            if(b + si > end) break;
+                            if (b + si > end) break;
                             b += si;
 
                             // this field is supposed to hold the
@@ -494,7 +484,7 @@ HTTPRemotingHandler::advance()
                             // openstreetmap.org (which works great
                             // in the adobe player) sends
                             // 0xffffffff. So we just ignore it
-                            if(b + 4 > end) break;
+                            if (b + 4 > end) break;
                             li = readNetworkLong(b); b += 4; // reply length
 
 #ifdef GNASH_DEBUG_REMOTING
@@ -557,8 +547,7 @@ HTTPRemotingHandler::advance()
                     }
                 }
             }
-            else
-            {
+            else {
                 log_error("Response from remoting service < 8 bytes");
             }
 
@@ -571,16 +560,18 @@ HTTPRemotingHandler::advance()
         }
     }
 
-    if(!_connection && queued_count > 0) {
-//#ifdef GNASH_DEBUG_REMOTING
+    if (!_connection && queued_count > 0) {
         log_debug("creating connection");
-//#endif
         // set the "number of bodies" header
 
-        (reinterpret_cast<boost::uint16_t*>(_postdata.data() + 4))[0] = 
htons(queued_count);
-        std::string postdata_str(reinterpret_cast<char*>(_postdata.data()), 
_postdata.size());
+        (reinterpret_cast<boost::uint16_t*>(_postdata.data() + 4))[0] =
+            htons(queued_count);
+
+        std::string postdata_str(reinterpret_cast<char*>(_postdata.data()),
+                _postdata.size());
 #ifdef GNASH_DEBUG_REMOTING
-        log_debug("NetConnection.call(): encoded args from %1% calls: %2%", 
queued_count, hexify(postdata.data(), postdata.size(), false));
+        log_debug("NetConnection.call(): encoded args from %1% calls: %2%",
+                queued_count, hexify(postdata.data(), postdata.size(), false));
 #endif
         queued_count = 0;
 

http://git.savannah.gnu.org/cgit//commit/?id=d3f818de1c47b07cade9b536249698de96aa311b


commit d3f818de1c47b07cade9b536249698de96aa311b
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 16:04:10 2010 +0200

    Move call number to base class.

diff --git a/libcore/asobj/NetConnection_as.cpp 
b/libcore/asobj/NetConnection_as.cpp
index bce2dfd..f08a970 100644
--- a/libcore/asobj/NetConnection_as.cpp
+++ b/libcore/asobj/NetConnection_as.cpp
@@ -133,6 +133,10 @@ public:
 
     virtual ~ConnectionHandler() {}
 
+    size_t callNo() {
+        return ++_numCalls;
+    }
+
 protected:
 
     /// Construct a connection handler bound to the given NetConnection object
@@ -143,11 +147,16 @@ protected:
     /// need to mark it reachable.
     ConnectionHandler(NetConnection_as& nc)
         :
-        _nc(nc)
+        _nc(nc),
+        _numCalls(0)
     {}
 
     // Object handling connection status messages
     NetConnection_as& _nc;
+
+private:
+
+    size_t _numCalls;
 };
 
 std::auto_ptr<IOChannel>
@@ -223,7 +232,6 @@ private:
     SimpleBuffer reply;
     int reply_start;
     int queued_count;
-    unsigned int _numCalls; // === queued_count ?
 
     // Quick hack to send Content-Type: application/x-amf
     // TODO: check if we should take headers on a per-call basis
@@ -277,8 +285,7 @@ HTTPRemotingHandler::HTTPRemotingHandler(NetConnection_as& 
nc, const URL& url)
         _connection(0),
         reply(),
         reply_start(0),
-        queued_count(0),
-        _numCalls(0) // TODO: replace by queued count ?
+        queued_count(0)
 {
     // leave space for header
     _postdata.append("\000\000\000\000\000\000", 6);
@@ -614,7 +621,7 @@ HTTPRemotingHandler::call(as_object* asCallback, const 
std::string& methodName,
     os << "/";
     // Call number is not used if the callback is undefined
     if (asCallback) {
-        os << ++_numCalls; 
+        os << callNo(); 
     }
     const std::string callNumberString = os.str();
 
@@ -631,8 +638,7 @@ HTTPRemotingHandler::call(as_object* asCallback, const 
std::string& methodName,
     // STRICT_ARRAY encoding is allowed for remoting
     amf::Writer w(buf, true);
 
-    for (unsigned int i = firstArg; i < args.size(); ++i)
-    {
+    for (size_t i = firstArg; i < args.size(); ++i) {
         const as_value& arg = args[i];
         if (!arg.writeAMF0(w)) {
             log_error("Could not serialize NetConnection.call argument %d",
@@ -867,11 +873,10 @@ NetConnection_as::connect(const std::string& uri)
 void
 NetConnection_as::close()
 {
-    bool needSendClosedStatus = _currentConnection.get() || _isConnected;
+    const bool needSendClosedStatus = _currentConnection.get() || _isConnected;
 
     /// Queue the current call queue if it has pending calls
-    if ( _currentConnection.get() && _currentConnection->hasPendingCalls() )
-    {
+    if (_currentConnection.get() && _currentConnection->hasPendingCalls()) {
         _queuedConnections.push_back(_currentConnection.release());
     }
 
@@ -879,8 +884,7 @@ NetConnection_as::close()
     /// NetStream object be interrupted?
     _isConnected = false;
 
-    if ( needSendClosedStatus )
-    {
+    if (needSendClosedStatus) {
         notifyStatus(CONNECT_CLOSED);
     }
 }
@@ -897,8 +901,7 @@ void
 NetConnection_as::call(as_object* asCallback, const std::string& methodName,
         const std::vector<as_value>& args, size_t firstArg)
 {
-    if ( ! _currentConnection.get() )
-    {
+    if (!_currentConnection.get()) {
         log_aserror("NetConnection.call: can't call while not connected");
         return;
     }
@@ -951,7 +954,6 @@ void
 NetConnection_as::update()
 {
     // Advance
-
 #ifdef GNASH_DEBUG_REMOTING
     log_debug("NetConnection_as::advance: %d calls to advance",
             _queuedConnections.size());
@@ -1007,11 +1009,9 @@ readNetworkLong(const boost::uint8_t* buf) {
 }
 
 
-/// Anonymous namespace for NetConnection interface implementation.
-
+// Anonymous namespace for NetConnection interface implementation.
 namespace {
 
-
 /// NetConnection.call()
 //
 /// Documented to return void, and current tests suggest this might be

http://git.savannah.gnu.org/cgit//commit/?id=dbcdf5049b6572f5a2fa7b7741bdb99063f97a35


commit dbcdf5049b6572f5a2fa7b7741bdb99063f97a35
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 15:54:25 2010 +0200

    Cleanups.

diff --git a/libbase/noseek_fd_adapter.cpp b/libbase/noseek_fd_adapter.cpp
index a777179..69248ea 100644
--- a/libbase/noseek_fd_adapter.cpp
+++ b/libbase/noseek_fd_adapter.cpp
@@ -17,10 +17,6 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "noseek_fd_adapter.h"
-#include "IOChannel.h" // for inheritance
-#include "GnashSystemIOHeaders.h" // for read
-#include "utility.h"
-#include "log.h"
 
 #include <boost/scoped_array.hpp>
 #include <cerrno>
@@ -28,6 +24,11 @@
 #include <string>
 #include <boost/format.hpp>
 
+#include "IOChannel.h" // for inheritance
+#include "GnashSystemIOHeaders.h" // for read
+#include "utility.h"
+#include "log.h"
+
 //#define GNASH_NOSEEK_FD_VERBOSE 1
 
 // define this if you want seeks back to be reported (on stderr)
@@ -126,16 +127,24 @@ private:
 
 const std::streamsize NoSeekFile::chunkSize;
 
-/***********************************************************************
- *
- *  NoSeekFile implementation
- * 
- **********************************************************************/
+NoSeekFile::NoSeekFile(int fd, const char* filename)
+    :
+    _fd(fd),
+    _running(1),
+    _cachefilename(filename),
+    _cached(0)
+{
+    // might throw an exception
+    openCacheFile();
+}
 
+NoSeekFile::~NoSeekFile()
+{
+    std::fclose(_cache);
+}
 
-/*private*/
 std::streamsize
-NoSeekFile::cache(void *from, std::streamsize sz)
+NoSeekFile::cache(void* from, std::streamsize sz)
 {
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
@@ -160,8 +169,7 @@ NoSeekFile::cache(void *from, std::streamsize sz)
 #ifdef GNASH_NOSEEK_FD_VERBOSE
     std::cerr << boost::format(" write %d bytes") % wrote;
 #endif
-    if ( wrote < 1 )
-    {
+    if (wrote < 1) {
         boost::format err = boost::format("writing to cache file: "
                 "requested %d, wrote %d (%s)")
             % sz % wrote % std::strerror(errno);
@@ -191,7 +199,6 @@ NoSeekFile::cache(void *from, std::streamsize sz)
 }
 
 
-/*private*/
 void
 NoSeekFile::fill_cache(std::streamsize size)
 {
@@ -202,8 +209,7 @@ NoSeekFile::fill_cache(std::streamsize size)
     assert(size >= 0);
 
     // See how big is the cache
-    while (_cached < static_cast<size_t>(size))
-    {
+    while (_cached < static_cast<size_t>(size)) {
 
 #ifdef GNASH_NOSEEK_FD_VERBOSE
         size_t bytesNeeded = size - _cached;
@@ -212,9 +218,8 @@ NoSeekFile::fill_cache(std::streamsize size)
             std::endl;
 #endif
 
-        std::streamsize bytesRead = ::read(_fd, (void*)_buf, chunkSize);
-        if (bytesRead < 0)
-        {
+        std::streamsize bytesRead = ::read(_fd, _buf, chunkSize);
+        if (bytesRead < 0) {
             std::cerr << boost::format(_("Error reading %d bytes from "
                         "input stream")) % chunkSize << std::endl;
             _running = false;
@@ -222,10 +227,8 @@ NoSeekFile::fill_cache(std::streamsize size)
             throw IOException("Error reading from input stream");
         }
 
-        if (bytesRead < chunkSize)
-        {
-            if (bytesRead == 0)
-            {
+        if (bytesRead < chunkSize) {
+            if (bytesRead == 0) {
 #ifdef GNASH_NOSEEK_FD_VERBOSE
                 std::cerr << "EOF reached" << std::endl;
 #endif
@@ -237,55 +240,31 @@ NoSeekFile::fill_cache(std::streamsize size)
     }
 }
 
-/*private*/
 void
 NoSeekFile::printInfo()
 {
     std::cerr << "_cache.tell = " << tell() << std::endl;
 }
 
-/*private*/
 void
 NoSeekFile::openCacheFile()
 {
-    if ( _cachefilename )
-    {
-        _cache = fopen(_cachefilename, "w+b");
-        if ( ! _cache )
-        {
+    if (_cachefilename) {
+        _cache = std::fopen(_cachefilename, "w+b");
+        if (!_cache) {
             throw IOException("Could not create cache file " + 
                     std::string(_cachefilename));
         }
     }
-    else
-    {
+    else {
         _cache = tmpfile();
-        if ( ! _cache ) {
+        if (!_cache) {
             throw IOException("Could not create temporary cache file");
         }
     }
 
 }
 
-/*public*/
-NoSeekFile::NoSeekFile(int fd, const char* filename)
-    :
-    _fd(fd),
-    _running(1),
-    _cachefilename(filename),
-    _cached(0)
-{
-    // might throw an exception
-    openCacheFile();
-}
-
-/*public*/
-NoSeekFile::~NoSeekFile()
-{
-    std::fclose(_cache);
-}
-
-/*public*/
 std::streamsize
 NoSeekFile::read(void *dst, std::streamsize bytes)
 {
@@ -293,8 +272,7 @@ NoSeekFile::read(void *dst, std::streamsize bytes)
     std::cerr << boost::format("read_cache(%d) called") % bytes << std::endl;
 #endif
 
-    if (eof())
-    {
+    if (eof()) {
 #ifdef GNASH_NOSEEK_FD_VERBOSE
         std::cerr << "read_cache: at eof!" << std::endl;
 #endif
@@ -309,16 +287,13 @@ NoSeekFile::read(void *dst, std::streamsize bytes)
 
     std::streamsize ret = std::fread(dst, 1, bytes, _cache);
 
-    if (ret == 0)
-    {
-        if (std::ferror(_cache))
-        {
+    if (ret == 0) {
+        if (std::ferror(_cache)) {
             std::cerr << "an error occurred while reading from cache" <<
                 std::endl;
         }
 #if GNASH_NOSEEK_FD_VERBOSE
-        if (std::feof(_cache))
-        {
+        if (std::feof(_cache)) {
             std::cerr << "EOF reached while reading from cache" << std::endl;
         }
 #endif
@@ -333,11 +308,10 @@ NoSeekFile::read(void *dst, std::streamsize bytes)
 
 }
 
-/*public*/
 bool
 NoSeekFile::eof() const
 {
-    bool ret = ( ! _running && std::feof(_cache) );
+    bool ret = (!_running && std::feof(_cache));
     
 #ifdef GNASH_NOSEEK_FD_VERBOSE
     std::cerr << boost::format("eof() returning %d") % ret << std::endl;
@@ -346,7 +320,6 @@ NoSeekFile::eof() const
 
 }
 
-/*public*/
 std::streampos
 NoSeekFile::tell() const
 {
@@ -360,7 +333,6 @@ NoSeekFile::tell() const
 
 }
 
-/*public*/
 bool
 NoSeekFile::seek(std::streampos pos)
 {
@@ -400,7 +372,8 @@ make_stream(int fd, const char* cachefilename)
 
     try {
         stream = new NoSeekFile(fd, cachefilename);
-    } catch (const std::exception& ex) {
+    } 
+    catch (const std::exception& ex) {
         std::cerr << boost::format("NoSeekFile stream: %s") % ex.what() << 
std::endl;
         delete stream;
         return NULL;
diff --git a/libbase/noseek_fd_adapter.h b/libbase/noseek_fd_adapter.h
index 43a3013..f76be07 100644
--- a/libbase/noseek_fd_adapter.h
+++ b/libbase/noseek_fd_adapter.h
@@ -31,8 +31,7 @@ class IOChannel;
 /// Code to use volatile (non-back-seekable) streams as IOChannel
 /// objects (which are seekable by definition) by storing read bytes
 /// in a temporary file.
-namespace noseek_fd_adapter
-{
+namespace noseek_fd_adapter {
 
 /// \brief
 /// Returns a read-only IOChannel that fetches data

http://git.savannah.gnu.org/cgit//commit/?id=df2fedb876795816689ec0e824479f5334165daa


commit df2fedb876795816689ec0e824479f5334165daa
Author: Benjamin Wolsey <address@hidden>
Date:   Mon Oct 25 15:39:46 2010 +0200

    Drop unused function declaration.

diff --git a/libbase/zlib_adapter.cpp b/libbase/zlib_adapter.cpp
index acde573..93353a7 100644
--- a/libbase/zlib_adapter.cpp
+++ b/libbase/zlib_adapter.cpp
@@ -28,10 +28,6 @@ namespace zlib_adapter
     std::auto_ptr<IOChannel> make_inflater(std::auto_ptr<IOChannel> /*in*/) {
         std::abort(); 
     }
-
-    IOChannel* make_deflater(IOChannel* /*out*/) {
-        std::abort(); 
-    }
 }
 
 #else // HAVE_ZLIB_H
@@ -316,7 +312,7 @@ 
InflaterIOChannel::InflaterIOChannel(std::auto_ptr<IOChannel> in)
 std::auto_ptr<IOChannel> make_inflater(std::auto_ptr<IOChannel> in)
 {
     assert(in.get());
-    return std::auto_ptr<IOChannel> (new InflaterIOChannel(in));
+    return std::auto_ptr<IOChannel>(new InflaterIOChannel(in));
 }
 
 }
diff --git a/libbase/zlib_adapter.h b/libbase/zlib_adapter.h
index 9b8a880..9d590d5 100644
--- a/libbase/zlib_adapter.h
+++ b/libbase/zlib_adapter.h
@@ -32,14 +32,6 @@ namespace zlib_adapter
     DSOEXPORT std::auto_ptr<IOChannel>
         make_inflater(std::auto_ptr<IOChannel> in);
 
-    /// \brief
-    /// Returns a write-only IOChannel stream that deflates the remaining
-    /// content of the given input stream.
-    //
-    /// TODO: take and return by auto_ptr
-    ///
-    DSOEXPORT IOChannel* make_deflater(IOChannel* out);
-
 } // namespace gnash.zlib_adapter
 } // namespace gnash
 

-----------------------------------------------------------------------

Summary of changes:
 libbase/noseek_fd_adapter.cpp      |  103 +++++++-----------
 libbase/noseek_fd_adapter.h        |    3 +-
 libbase/zlib_adapter.cpp           |    6 +-
 libbase/zlib_adapter.h             |    8 --
 libcore/asobj/NetConnection_as.cpp |  216 +++++++++++++++---------------------
 libcore/asobj/NetConnection_as.h   |    8 +-
 6 files changed, 133 insertions(+), 211 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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