[Scummvm-cvs-logs] CVS: scummvm/common array.h,1.1,1.2 stack.h,1.2,1.3
Eugene Sandulenko
sev at users.sourceforge.net
Thu Aug 12 14:35:03 CEST 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm NEWS,1.54.2.15,1.54.2.16
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga module.mk,1.15,1.16 script.cpp,1.19,1.20 script.h,1.11,1.12 sdebug.cpp,1.15,1.16 sfuncs.cpp,1.14,1.15 sthread.cpp,1.20,1.21 sthread.h,1.7,1.8 sstack.cpp,1.8,NONE sstack.h,1.3,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9606
Modified Files:
array.h stack.h
Log Message:
Fix compilation of remove_at() in array.h. It was never tested before.
Make stacks' pop() return top value, not just move stack pointer.
Index: array.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/array.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- array.h 9 Apr 2004 15:10:21 -0000 1.1
+++ array.h 12 Aug 2004 21:33:58 -0000 1.2
@@ -78,11 +78,9 @@
_size++;
}
- T& remove_at(int idx) {
- T& tmp;
-
+ T remove_at(int idx) {
assert(idx >= 0 && idx < _size);
- tmp = _data[idx];
+ T tmp = _data[idx];
for (int i = idx; i < _size - 1; i++)
_data[i] = _data[i+1];
_size--;
Index: stack.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/stack.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- stack.h 5 May 2004 01:19:42 -0000 1.2
+++ stack.h 12 Aug 2004 21:33:59 -0000 1.3
@@ -54,9 +54,12 @@
else
return 0;
}
- void pop() {
+ T pop() {
+ T tmp;
assert(_size > 0);
+ tmp = _stack[_size];
_stack[--_size] = 0;
+ return tmp;
}
int size() const {
return _size;
@@ -94,8 +97,10 @@
else
return 0;
}
- void pop() {
+ T pop() {
+ T tmp = top();
_stack.remove_at(size() - 1);
+ return tmp;
}
int size() const {
return _stack.size();
- Previous message: [Scummvm-cvs-logs] CVS: scummvm NEWS,1.54.2.15,1.54.2.16
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga module.mk,1.15,1.16 script.cpp,1.19,1.20 script.h,1.11,1.12 sdebug.cpp,1.15,1.16 sfuncs.cpp,1.14,1.15 sthread.cpp,1.20,1.21 sthread.h,1.7,1.8 sstack.cpp,1.8,NONE sstack.h,1.3,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list