[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/xml.cpp server/aso...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/xml.cpp server/aso... |
Date: |
Tue, 19 Feb 2008 08:51:03 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/02/19 08:51:02
Modified files:
. : ChangeLog
server/asobj : xml.cpp xml.h
Log message:
fix getBytesLoaded/Total to return undefined when nothing was loaded
(reguardless of the .loaded property setting).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5688&r2=1.5689
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.h?cvsroot=gnash&r1=1.29&r2=1.30
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5688
retrieving revision 1.5689
diff -u -b -r1.5688 -r1.5689
--- ChangeLog 19 Feb 2008 08:04:27 -0000 1.5688
+++ ChangeLog 19 Feb 2008 08:51:01 -0000 1.5689
@@ -1,5 +1,8 @@
2008-02-19 Sandro Santilli <address@hidden>
+ * server/asobj/xml.{cpp,h}: fix getBytesLoaded/Total to return
+ undefined when nothing was loaded (reguardless of the .loaded
+ property setting).
* libbase/rc.{cpp,h}: return as soon as directive matches
pattern while parsing 'set' lines.
* testsuite/libamf.all/Makefile.am: set GNASHRC to use
Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- server/asobj/xml.cpp 18 Feb 2008 23:13:52 -0000 1.73
+++ server/asobj/xml.cpp 19 Feb 2008 08:51:02 -0000 1.74
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: xml.cpp,v 1.73 2008/02/18 23:13:52 strk Exp $ */
+/* $Id: xml.cpp,v 1.74 2008/02/19 08:51:02 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "gnashconfig.h"
@@ -91,8 +91,8 @@
_status(sOK),
_loadThreads(),
_loadCheckerTimer(0),
- _bytesTotal(0),
- _bytesLoaded(0)
+ _bytesTotal(-1),
+ _bytesLoaded(-1)
{
//GNASH_REPORT_FUNCTION;
#ifdef DEBUG_MEMORY_ALLOCATION
@@ -113,8 +113,8 @@
_status(sOK),
_loadThreads(),
_loadCheckerTimer(0),
- _bytesTotal(0),
- _bytesLoaded(0)
+ _bytesTotal(-1),
+ _bytesLoaded(-1)
{
//GNASH_REPORT_FUNCTION;
#ifdef DEBUG_MEMORY_ALLOCATION
@@ -429,31 +429,21 @@
#endif
}
- _bytesLoaded = _bytesTotal = 0;
+ _bytesLoaded = 0;
+ _bytesTotal = -1;
}
-size_t
+long int
XML::getBytesLoaded() const
{
- if ( _loadThreads.empty() )
- {
return _bytesLoaded;
- return 0;
- }
- LoadThread* lt = _loadThreads.front();
- return lt->getBytesLoaded();
}
-size_t
+long int
XML::getBytesTotal() const
{
- if ( _loadThreads.empty() )
- {
return _bytesTotal;
- }
- LoadThread* lt = _loadThreads.front();
- return lt->getBytesTotal();
}
/* private */
@@ -476,6 +466,9 @@
// TODO: notify progress
+ _bytesLoaded = lt->getBytesLoaded();
+ _bytesTotal = lt->getBytesTotal();
+
#ifdef DEBUG_XML_LOADS
log_debug("XML loads thread %p got %ld/%ld bytes", (void*)lt,
lt->getBytesLoaded(), lt->getBytesTotal() );
#endif
@@ -497,8 +490,6 @@
buf[actuallyRead] = '\0';
as_value dataVal(buf.get()); // memory copy here (optimize?)
- _bytesTotal = lt->getBytesTotal();
- _bytesLoaded = lt->getBytesLoaded();
it = _loadThreads.erase(it);
delete lt; // supposedly joins the thread...
@@ -835,27 +826,17 @@
as_value xml_getbytesloaded(const fn_call& fn)
{
boost::intrusive_ptr<XML> ptr = ensureType<XML>(fn.this_ptr);
- if ( ptr->loaded() )
- {
- return as_value(ptr->getBytesLoaded());
- }
- else
- {
- return as_value(0);
- }
+ long int ret = ptr->getBytesLoaded();
+ if ( ret < 0 ) return as_value();
+ else return as_value(ret);
}
as_value xml_getbytestotal(const fn_call& fn)
{
boost::intrusive_ptr<XML> ptr = ensureType<XML>(fn.this_ptr);
- if ( ptr->loaded() )
- {
- return as_value(ptr->getBytesTotal());
- }
- else
- {
- return as_value();
- }
+ long int ret = ptr->getBytesTotal();
+ if ( ret < 0 ) return as_value();
+ else return as_value(ret);
}
as_value xml_parsexml(const fn_call& fn)
Index: server/asobj/xml.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/asobj/xml.h 18 Feb 2008 23:13:53 -0000 1.29
+++ server/asobj/xml.h 19 Feb 2008 08:51:02 -0000 1.30
@@ -152,8 +152,11 @@
bool sendAndLoad(const URL& url, XML& target);
- size_t getBytesLoaded() const;
- size_t getBytesTotal() const;
+ /// @return -1 if no loaded was started yet
+ long int getBytesLoaded() const;
+
+ /// @return -1 if no loaded was started yet
+ long int getBytesTotal() const;
private:
@@ -232,8 +235,8 @@
/// them completed. If any did, invoke the onData event
void checkLoads();
- size_t _bytesTotal;
- size_t _bytesLoaded;
+ long int _bytesTotal;
+ long int _bytesLoaded;
};