Commit 5d154682 authored by hybrid's avatar hybrid

Bug fix for replace method from Nalin.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3255 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 93959cf9
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
: array(0), allocated(1), used(1) : array(0), allocated(1), used(1)
{ {
array = allocator.allocate(1); // new T[1]; array = allocator.allocate(1); // new T[1];
array[0] = 0x0; array[0] = 0;
} }
...@@ -1072,7 +1072,7 @@ public: ...@@ -1072,7 +1072,7 @@ public:
} }
// Re-allocate the string now, if needed. // Re-allocate the string now, if needed.
u32 len = replace_size * find_count; u32 len = delta * find_count;
if (used + len > allocated) if (used + len > allocated)
reallocate(used + len); reallocate(used + len);
...@@ -1100,12 +1100,12 @@ public: ...@@ -1100,12 +1100,12 @@ public:
array[pos + i] = replace[i]; array[pos + i] = replace[i];
pos += replace_size; pos += replace_size;
used += replace_size; used += delta;
} }
// Terminate the string and return ourself. // Terminate the string and return ourself.
++used;
array[used] = 0; array[used] = 0;
++used;
return *this; return *this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment