gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11624: Send onData when there's an


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11624: Send onData when there's an error. Fixes blip.tv again.
Date: Sun, 15 Nov 2009 11:22:25 +0100
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11624
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sun 2009-11-15 11:22:25 +0100
message:
  Send onData when there's an error. Fixes blip.tv again.
modified:
  libcore/asobj/LoadableObject.cpp
=== modified file 'libcore/asobj/LoadableObject.cpp'
--- a/libcore/asobj/LoadableObject.cpp  2009-11-06 13:07:21 +0000
+++ b/libcore/asobj/LoadableObject.cpp  2009-11-15 10:22:25 +0000
@@ -87,18 +87,25 @@
         obj->callMethod(NSV::PROP_ON_DATA, as_value());
         return true;
     }
-    
 
     static const size_t chunksize = 65535;
     uint8_t chunk[chunksize];
 
     size_t actuallyRead = lt->readNonBlocking(chunk, chunksize);
-    if (lt->bad()) return true;
-
-    if ( actuallyRead )
-    {
-        if ( buf.empty() ) // set total size only on first read
+
+    // We must still call onData if the stream is in error condition, e.g.
+    // when an HTTP 404 error is returned.
+    if (lt->bad()) {
+        obj->callMethod(NSV::PROP_ON_DATA, as_value());
+        return true;
+    }
+
+    if (actuallyRead) {
+
+        // set total size only on first read
+        if (buf.empty()) {
             obj->set_member(NSV::PROP_uBYTES_TOTAL, lt->size());
+        }
 
         buf.append(chunk, actuallyRead);
 
@@ -109,15 +116,13 @@
     }
 
     // We haven't finished till EOF 
-    if ( ! lt->eof() ) return false;
-
+    if (!lt->eof()) return false;
 
     log_debug("LoadableObject reached EOF (%d/%d loaded)",
                 buf.size(), lt->size());
 
     // got nothing, won't bother BOFs of nulls
-    if ( buf.empty() )
-    {
+    if (buf.empty()) {
         obj->callMethod(NSV::PROP_ON_DATA, as_value());
         return true;
     }


reply via email to

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