mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
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:
committed by
vanhofen
parent
9cfb1d7302
commit
b2eaf63a6e
@@ -675,8 +675,21 @@ CFileHelpers::CFileHelpers()
|
|||||||
|
|
||||||
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()
|
CFileHelpers* CFileHelpers::getInstance()
|
||||||
|
@@ -86,10 +86,11 @@ struct helpersDebugInfo {
|
|||||||
class CFileHelpers
|
class CFileHelpers
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
unsigned long FileBufSize;
|
uint32_t FileBufMaxSize;
|
||||||
char *FileBuf;
|
|
||||||
int fd1, fd2;
|
int fd1, fd2;
|
||||||
|
|
||||||
|
char* initFileBuf(char* buf, uint32_t size);
|
||||||
|
char* deleteFileBuf(char* buf);
|
||||||
bool ConsoleQuiet;
|
bool ConsoleQuiet;
|
||||||
helpersDebugInfo DebugInfo;
|
helpersDebugInfo DebugInfo;
|
||||||
void setDebugInfo(const char* msg, const char* file, const char* func, int line);
|
void setDebugInfo(const char* msg, const char* file, const char* func, int line);
|
||||||
|
Reference in New Issue
Block a user