gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/timers.cpp server/timers.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/timers.cpp server/timers.h
Date: Sun, 09 Dec 2007 20:40:50 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/09 20:40:49

Modified files:
        .              : ChangeLog 
        server         : timers.cpp timers.h 

Log message:
        let 0 be a valid start timer for intervals.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5112&r2=1.5113
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.29&r2=1.30

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5112
retrieving revision 1.5113
diff -u -b -r1.5112 -r1.5113
--- ChangeLog   8 Dec 2007 09:11:24 -0000       1.5112
+++ ChangeLog   9 Dec 2007 20:40:49 -0000       1.5113
@@ -1,3 +1,8 @@
+2007-12-09 Sandro Santilli <address@hidden>
+
+       * server/timers.{cpp,h}: let 0 be a valid start timer
+         for intervals.
+
 2007-12-08 Sandro Santilli <address@hidden>
 
        * ManualClock.h: moved from testsuite to server

Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/timers.cpp   4 Dec 2007 11:45:30 -0000       1.40
+++ server/timers.cpp   9 Dec 2007 20:40:49 -0000       1.41
@@ -19,7 +19,7 @@
 //
 //
 
-/* $Id: timers.cpp,v 1.40 2007/12/04 11:45:30 strk Exp $ */
+/* $Id: timers.cpp,v 1.41 2007/12/09 20:40:49 strk Exp $ */
 
 #include "timers.h"
 #include "as_function.h" // for class as_function
@@ -31,13 +31,15 @@
 #include "VM.h"
 #include "movie_root.h"
 
+#include <limits> // for numeric_limits
+
 using namespace std;
 
 namespace gnash {
 
   Timer::Timer() :
       _interval(0),
-      _start(0),
+      _start(std::numeric_limits<unsigned long>::max()),
       _object(0)
   {
   }
@@ -49,7 +51,7 @@
   
 
   void
-  Timer::setInterval(as_function& method, boost::uint64_t ms, 
boost::intrusive_ptr<as_object> this_ptr)
+  Timer::setInterval(as_function& method, unsigned long ms, 
boost::intrusive_ptr<as_object> this_ptr)
   {
     _function = &method;
     _interval = ms; // keep milliseconds
@@ -59,7 +61,7 @@
   }
 
   void
-  Timer::setInterval(as_function& method, boost::uint64_t ms, 
boost::intrusive_ptr<as_object> this_ptr, 
+  Timer::setInterval(as_function& method, unsigned long ms, 
boost::intrusive_ptr<as_object> this_ptr, 
                  std::vector<as_value>& args)
   {
     _function = &method;
@@ -74,7 +76,7 @@
   Timer::clearInterval()
   {
     _interval = 0;
-    _start = 0;
+    _start = std::numeric_limits<unsigned long>::max();
   }
   
   void
@@ -88,9 +90,9 @@
 bool
 Timer::expired()
 {
-       if (_start)
+       if ( _start != std::numeric_limits<unsigned long>::max() )
        {
-               boost::uint64_t now = VM::get().getTime();
+               unsigned long now = VM::get().getTime();
                assert(now >= _start); // it is possible for now to be == 
_start 
 
                //cout << "Start is " << _start << " interval is " << _interval 
<< " now is " << now << endl;
@@ -229,7 +231,7 @@
        }
 
        // Get interval time
-       boost::uint64_t ms = boost::uint64_t(fn.arg(timer_arg).to_number());
+       unsigned long ms = static_cast<unsigned 
long>(fn.arg(timer_arg).to_number());
 
        // Parse arguments 
        Timer::ArgsContainer args;

Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/timers.h     4 Dec 2007 11:45:30 -0000       1.29
+++ server/timers.h     9 Dec 2007 20:40:49 -0000       1.30
@@ -35,6 +35,7 @@
 
 #include <string>
 #include <vector> 
+#include <limits>
 
 // Forward declarations
 namespace gnash {
@@ -86,7 +87,7 @@
       ///      It is allowed to be NULL as long as fn_call is allowed
       ///      a NULL as 'this_ptr' (we might want to change this).
       ///
-      void setInterval(as_function& method, boost::uint64_t ms, 
boost::intrusive_ptr<as_object> this_ptr);
+      void setInterval(as_function& method, unsigned long ms, 
boost::intrusive_ptr<as_object> this_ptr);
 
       /// Setup the Timer, enabling it.
       //
@@ -106,7 +107,7 @@
       /// @param args
       ///      The list of arguments to pass to the function being invoked.
       ///
-      void setInterval(as_function& method, boost::uint64_t ms, 
boost::intrusive_ptr<as_object> this_ptr, 
+      void setInterval(as_function& method, unsigned long ms, 
boost::intrusive_ptr<as_object> this_ptr, 
                      std::vector<as_value>& args);
 
       /// Clear the timer, ready for reuse
@@ -128,7 +129,10 @@
       //
       /// Note that the timer is constructed as cleared and you
       /// need to call setInterval() to make it not-cleared.
-      bool cleared() const { return ! _start; }
+      bool cleared() const
+      {
+            return _start == std::numeric_limits<unsigned long>::max();
+      }
 
       /// Execute associated function properly setting up context
       void operator() ();
@@ -136,12 +140,6 @@
       /// Arguments list type
       typedef std::vector<as_value> ArgsContainer;
 
-      /// Return number of microseconds between expirations 
-      boost::uint64_t getInterval() const { return _interval; }
-
-      /// Return number of milliseconds after VM start this timer was last 
reset
-      boost::uint64_t getStart() const { return _start; }
-
 #ifdef GNASH_USE_GC
        /// Mark all reachable resources (for GC)
        //
@@ -156,6 +154,13 @@
 
 private:
 
+      /// Return number of milliseconds between expirations 
+      unsigned long getInterval() const { return _interval; }
+
+      /// Return number of milliseconds after VM start this timer was last 
reset
+      unsigned long getStart() const { return _start; }
+
+
       /// Set timer start
       //
       /// Called by every function setting the interval.
@@ -163,10 +168,14 @@
       void start();
 
       /// Number of milliseconds between expirations 
-      boost::uint64_t _interval;
+      unsigned int _interval;
 
-      /// Number of microseconds since epoch at Timer start (?)
-      boost::uint64_t _start;
+      /// Number of milliseconds since epoch at Timer start 
+      //
+      /// This will be numeric_limits<unsigned long>::max()
+      /// if the timer is not active (or cleared)
+      ///
+      unsigned int _start;
 
       /// The associated function, stored in an intrusive pointer
       boost::intrusive_ptr<as_function> _function;




reply via email to

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