コード例 #1
0
ファイル: array.cpp プロジェクト: barak/raidutils
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);

}
コード例 #2
0
ファイル: mstring.cpp プロジェクト: bugslayer312/Job-tasks
mstring& mstring::operator=(const mstring& rhs){
    if (this == &rhs) {
        return *this;
    }
    freeBuff();
    initWithBuf(rhs);
    return *this;
}
コード例 #3
0
ファイル: array.cpp プロジェクト: barak/raidutils
void    baseArray_C::reAlloc()
{

    // Free the current object buffer
    freeBuff();
    // Zero the object count
    objCount =
    // Zero the object allocation size
    totalObjs = 0;

}
コード例 #4
0
ファイル: array.cpp プロジェクト: barak/raidutils
baseArray_C::~baseArray_C()
{

    freeBuff();

}
コード例 #5
0
ファイル: mstring.cpp プロジェクト: bugslayer312/Job-tasks
mstring::~mstring(){
    freeBuff();
}