gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/vm/SafeStack.h


From: Chad Musick
Subject: [Gnash-commit] gnash ChangeLog server/vm/SafeStack.h
Date: Tue, 09 Oct 2007 16:17:40 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/10/09 16:17:40

Modified files:
        .              : ChangeLog 
        server/vm      : SafeStack.h 

Log message:
        Remove limitation on size of grow()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4577&r2=1.4578
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/SafeStack.h?cvsroot=gnash&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4577
retrieving revision 1.4578
diff -u -b -r1.4577 -r1.4578
--- ChangeLog   9 Oct 2007 15:36:56 -0000       1.4577
+++ ChangeLog   9 Oct 2007 16:17:39 -0000       1.4578
@@ -1,3 +1,7 @@
+2007-10-10 Chad Musick <address@hidden>
+
+       * server/vm/SafeStack.h: Remove limit on size of grow()
+
 2007-10-09 Sandro Santilli <address@hidden>
 
        * server/as_environment.cpp: don't use size() or length()

Index: server/vm/SafeStack.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/SafeStack.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/vm/SafeStack.h       8 Oct 2007 06:55:11 -0000       1.2
+++ server/vm/SafeStack.h       9 Oct 2007 16:17:40 -0000       1.3
@@ -66,17 +66,19 @@
        void push(const T t)
        { grow(1); top(0) = t; }
 
+       /// Pop the top of the stack.
+       T& pop()
+       {       T& ret = top(0); drop(1); return ret; }
+
        /// Grow by i entries. Normally this is 1, but there might be sometime
-       /// when you need more than that.  Cannot grow by more than the size
-       /// of block allocations, which is (1 << mChunkShift)
-       /// For mChunkShift == 6, this is 64.
+       /// when you need more than that.
        void grow(unsigned int i)
        {
-               if (((mEnd + i) >> mChunkShift) > mData.size()) 
+               unsigned int available = (1 << mChunkShift) * mData.size() - 
mEnd - 1;
+               while (available < i)
                {
-                       if (i > (1 << mChunkShift))
-                               throw StackException();
                        mData.push_back(new T[1 << mChunkShift]);
+                       available += 1 << mChunkShift;
                }
                mDownstop += i;
                mEnd += i;




reply via email to

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