Esempio n. 1
0
// append data to the end of the buffer
void DBuffer::AppendData(const uint8_t *data, int length)
{
        if (length <= 0) return;
        EnsureAlloc(fLength + length);

        memcpy(&fData[fLength], data, length);
        fLength += length;
}
Esempio n. 2
0
// return the data, along with a trailing null-terminator
char *DBuffer::String()
{
	// ensure the data returned is null-terminated
	if (fLength == 0 || fData[fLength - 1] != 0)
	{
		EnsureAlloc(fLength + 1);
		fData[fLength] = '\0';
	}
	
	return (char *)fData;
}