diff options
author | pixel <pixel> | 2003-12-12 12:45:20 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-12-12 12:45:20 +0000 |
commit | a174ecb1bd01b4c7b28693ec08eda5acd436867d (patch) | |
tree | 3dc6b7e2856ba82dc4b660c8273629ab2101a9c5 /lib | |
parent | 9a5eedd11cc043fd09c96d57eb901fb85fc1655d (diff) |
Small bugfixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Buffer.cc | 8 | ||||
-rw-r--r-- | lib/LuaHandle.cc | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 414d97c..16966e4 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Buffer.cc,v 1.21 2003-12-10 02:59:31 pixel Exp $ */ +/* $Id: Buffer.cc,v 1.22 2003-12-12 12:45:20 pixel Exp $ */ #include <string.h> #ifdef HAVE_CONFIG_H @@ -132,15 +132,17 @@ Byte Buffer::operator[](size_t p) const { } Byte & Buffer::operator[](size_t p) { + p++; if (p > bufsiz) { int numblocks = p / realloc_threshold; int remains = p % realloc_threshold; buffer = (Byte *) realloc(buffer, bufsiz = ((numblocks + (remains ? 1 : 0)) * realloc_threshold)); } - if (p >= realsiz) { + if (p > realsiz) { memset(buffer + realsiz, 0, p - realsiz); - realsiz = p + 1; + realsiz = p; } + p--; if (seekable) { return buffer[p]; diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 11026d5..d1659a2 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaHandle.cc,v 1.9 2003-12-11 16:53:28 pixel Exp $ */ +/* $Id: LuaHandle.cc,v 1.10 2003-12-12 12:45:20 pixel Exp $ */ #include "LuaHandle.h" @@ -346,7 +346,7 @@ int sLuaHandle::copy(lua_State * _L, int dir) { r = -1; } - if (dir == to) { + if (dir == from) { SWAP(s, d); } |