uSHORT baseArray_C::setAlloc(uSHORT numObjs) { uSHORT retVal = 0; if ((numObjs > 0) && (objSize > 0) && (numObjs >= objCount)) { // Allocate a new buffer uCHAR *newBuff_P = new uCHAR[(numObjs+1)*objSize]; // If the new buffer was allocated... if (newBuff_P != (uCHAR *)NULL) { retVal = 1; // If an old buffer exists... if (buff_P != (uCHAR *)NULL) { // Copy the old buffer data to the new buffer memcpy(newBuff_P,buff_P,objCount*objSize); // Free the old buffer freeBuff(); } // Set the total # of objects allocated totalObjs = numObjs; // Set the array buffer pointer buff_P = newBuff_P; } } return (retVal); }
mstring& mstring::operator=(const mstring& rhs){ if (this == &rhs) { return *this; } freeBuff(); initWithBuf(rhs); return *this; }
void baseArray_C::reAlloc() { // Free the current object buffer freeBuff(); // Zero the object count objCount = // Zero the object allocation size totalObjs = 0; }
baseArray_C::~baseArray_C() { freeBuff(); }
mstring::~mstring(){ freeBuff(); }