From: Dejan L. <de...@us...> - 2004-06-11 15:38:04
|
Update of /cvsroot/rtk/rtk/src/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14004/src/core Modified Files: Buffer.cpp Log Message: New implementation of Buffer. Index: Buffer.cpp =================================================================== RCS file: /cvsroot/rtk/rtk/src/core/Buffer.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Buffer.cpp 7 Jun 2004 17:09:54 -0000 1.3 --- Buffer.cpp 11 Jun 2004 15:37:46 -0000 1.4 *************** *** 32,36 **** ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (dejanrtk.cx) * Contributors (chronological order): * $fname $lname, $email --- 32,36 ---- ***** * Authors (chronological order): ! * Dejan Lekic, de...@nu... (de...@rt...) * Contributors (chronological order): * $fname $lname, $email *************** *** 44,49 **** namespace Rtk { ! ! // Nothing here for now... }; // Rtk --- 44,68 ---- namespace Rtk { ! uchar* Buffer::Allocate(uint arg_num) ! { ! uint newsize = _size + arg_num; ! if (newsize > _allocated) ! { ! _allocated *= 2; ! if (_allocated < newsize) ! _allocated = newsize; ! uchar *newdata = new unsigned char[_allocated]; ! memcpy(newdata, _data, _size); ! delete[] _data; ! _data = newdata; ! } // if ! return _data + _size; ! } ! ! void Buffer::Write(const uchar* arg_byte_array, uint arg_num) ! { ! memcpy(Allocate(arg_num), arg_byte_array, arg_num); ! _size += arg_num; ! } // Write() }; // Rtk |