diff options
Diffstat (limited to 'lib/Buffer.cc')
-rw-r--r-- | lib/Buffer.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 57b1bf8..85445c6 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -53,3 +53,18 @@ bool Buffer::CanWrite() { String Buffer::GetName() { return "Buffer"; } + +Buffer Buffer::operator=(Buffer & b) { + if (b.buffer != buffer) { + free(buffer); + realsiz = b.realsiz; + ptr = b.ptr; + if ((bufsiz = b.bufsiz)) { + buffer = (char *) malloc(bufsiz); + memcpy(buffer, b.buffer, realsiz); + } else { + buffer = 0; + } + return *this; + } +} |