CFileHelpers: Rework FileBuf handling

FileBuf: Reserve memory only when it is needed (copyFile)
copyFile: Reserve for small files, only as much memory as is required


Origin commit data
------------------
Branch: ni/coolstream
Commit: 0a1cdb3d4e
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2016-09-06 (Tue, 06 Sep 2016)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2016-09-06 11:30:06 +02:00
committed by vanhofen
parent 9cfb1d7302
commit b2eaf63a6e
2 changed files with 18 additions and 4 deletions

View File

@@ -675,8 +675,21 @@ CFileHelpers::CFileHelpers()
CFileHelpers::~CFileHelpers()
{
if (FileBuf != NULL)
delete [] FileBuf;
}
char* CFileHelpers::initFileBuf(char* buf, uint32_t size)
{
if (buf == NULL)
buf = new char[size];
return buf;
}
char* CFileHelpers::deleteFileBuf(char* buf)
{
if (buf != NULL)
delete [] buf;
buf = NULL;
return buf;
}
CFileHelpers* CFileHelpers::getInstance()