Logo Search packages:      
Sourcecode: einstein version File versions  Download package

void Buffer::setSize ( size_t  size  ) 

Set buffer size, expands memory if needed

Parameters:
size new size

Definition at line 25 of file buffer.cpp.

Referenced by ResVariant::getData(), SimpleResourceFile::load(), putByte(), and putData().

{
    if (sz > allocated) {
        int newAl = allocated + sz + 1024;
        void *d = realloc(data, newAl);
        if (! d)
            throw Exception(L"Error expanding buffer memory");
        data = d;
        allocated = newAl;
    }
    
    size = sz;
}


Generated by  Doxygen 1.6.0   Back to index