Changeset 256 in dev for trunk/abdev/BasicCompiler_Common/src/DataTable.cpp
- Timestamp:
- Aug 1, 2007, 11:19:01 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/DataTable.cpp
r206 r256 8 8 #include <stdlib.h> 9 9 10 DataTable::DataTable(){ 11 pdata = malloc( 1 ); 12 size = 0; 13 } 14 DataTable::~DataTable(){ 15 free( pdata ); 10 void DataTable::Realloc( int size ) 11 { 12 this->buffer = (char *)realloc( this->buffer, size + 100 ); 13 this->size = size; 16 14 } 17 15 18 void DataTable::Init(){ 19 free( pdata ); 20 21 pdata = malloc( 1 ); 22 size = 0; 23 } 24 25 int DataTable::AddBinary( const void *pdata, int size ){ 16 int DataTable::AddBinary( const void *buffer, int size ){ 26 17 int retSize = this->size; 27 18 28 this->pdata = realloc( this->pdata, this->size + size ); 29 memcpy( (char *)this->pdata + this->size, pdata, size ); 30 this->size += size; 19 Realloc( this->size + size ); 20 memcpy( (char *)this->buffer + retSize, buffer, size ); 31 21 32 22 return retSize; … … 89 79 const void *DataTable::GetPtr() const 90 80 { 91 return pdata;81 return buffer; 92 82 } 93 83 int DataTable::GetSize() const
Note:
See TracChangeset
for help on using the changeset viewer.