예제 #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;
}
예제 #2
0
파일: DBuffer.cpp 프로젝트: histat/dc-nx
// 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;
}