From: Mikko L. <laz...@us...> - 2004-06-12 07:33:53
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2645 Modified Files: Buffer.h List.h String.h Log Message: - Fixed Buffer in several cases. - Some minor changes to get things compiled Index: Buffer.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Buffer.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Buffer.h 11 Jun 2004 23:13:17 -0000 1.7 --- Buffer.h 12 Jun 2004 07:33:29 -0000 1.8 *************** *** 50,57 **** #include "Array.h" #include "rtkdef.h" - #include <stdlib.h> /* malloc() */ - #include <string.h> /* memcpy() */ ! #if _DEBUG #include "String.h" #endif --- 50,55 ---- #include "Array.h" #include "rtkdef.h" ! #ifdef _DEBUG #include "String.h" #endif *************** *** 65,70 **** { uchar* _data; /// Internal pointer to Buffer memory-block. ! uint _allocated; /// Size of Buffer object in bytes. ! uint _size; /// Number of data-bytes in Buffer object. /** --- 63,68 ---- { uchar* _data; /// Internal pointer to Buffer memory-block. ! ulong _allocated; /// Size of Buffer object in bytes. ! ulong _size; /// Number of data-bytes in Buffer object. /** *************** *** 72,76 **** * @returns uchar* pointer to new memory block. */ ! uchar* Allocate(uint arg_num); public: --- 70,74 ---- * @returns uchar* pointer to new memory block. */ ! uchar* Allocate(ulong arg_num); public: *************** *** 80,101 **** Buffer(): _size(0), _data(0), _allocated(0) { } ! ~Buffer() { free(_data); } /** * Returns pointer to internal data memory-block. ! * @returns pointer to the data buffer. */ ! const uchar* Data() ! { ! if (_size == _allocated) ! Allocate(1); ! _data[_size] = '\0'; // i think this would be usefull ! return _data; ! } // Data() ! /** Returns current size of Buffer. ! * @returns uint current size of Buffer. */ ! uint GetSize() const { return _size; } /** --- 78,104 ---- Buffer(): _size(0), _data(0), _allocated(0) { } ! virtual ~Buffer(); /** + * Clear the buffer and free all it's resources. + */ + void Clear(); + + /** * Returns pointer to internal data memory-block. ! * @returns pointer to the data buffer. ! * @note return value value may be NULL, if buffer is not allocated yet */ ! const uchar* Data() const { return _data; } ! /** Returns current number of written data bytes in Buffer. ! * @returns ulong current size of Buffer. */ ! ulong GetSize() const { return _size; } ! ! /** Returns number of bytes allocated by Buffer currently ! * @returns ulong current internal size of Buffer. ! */ ! ulong GetAllocated() const { return _allocated; } /** *************** *** 103,107 **** * @returns int 0 if everything OK. */ ! int SetSize(uchar arg_size); /** Writes one single byte to the Buffer object --- 106,110 ---- * @returns int 0 if everything OK. */ ! int SetSize(ulong arg_size); /** Writes one single byte to the Buffer object *************** *** 113,121 **** * Writes arbitrary number of bytes to the Buffer object. */ ! void Write(const uchar* arg_byte_array, uint arg_num); ! void Buffer::Fill(uchar arg_char); ! #if _DEBUG void FromFile(const String& arg_fname); void ToFile(const String& arg_fname) const; --- 116,124 ---- * Writes arbitrary number of bytes to the Buffer object. */ ! void Write(const uchar* arg_byte_array, ulong arg_num); ! void Fill(uchar arg_char); ! #ifdef _DEBUG void FromFile(const String& arg_fname); void ToFile(const String& arg_fname) const; Index: List.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/List.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** List.h 28 Feb 2004 07:39:43 -0000 1.6 --- List.h 12 Jun 2004 07:33:29 -0000 1.7 *************** *** 43,46 **** --- 43,47 ---- //--------------------------------------------------------------------------- #include "Export.h" + #include "conf.h" //--------------------------------------------------------------------------- Index: String.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/String.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** String.h 11 Jun 2004 17:47:19 -0000 1.8 --- String.h 12 Jun 2004 07:33:29 -0000 1.9 *************** *** 40,43 **** --- 40,45 ---- #define _RTK_STRING_H_ 1 + #include <stdlib.h> /* free() */ + #include "Export.h" #include "rchar.h" |