mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-15 02:36:08 -04:00
Safer use of BigFile::m_tinyBuf (use sizeof, size correctly, commnet)
This commit is contained in:
@ -311,8 +311,8 @@ bool BigFile::addPart ( int32_t n ) {
|
||||
|
||||
// init using tiny buf to save a malloc for small files
|
||||
if ( m_filePtrsBuf.getCapacity() == 0 ) {
|
||||
memset (m_tinyBuf,0,8);
|
||||
m_filePtrsBuf.setBuf ( m_tinyBuf,8,0,false);
|
||||
memset (m_tinyBuf,0,sizeof(m_tinyBuf));
|
||||
m_filePtrsBuf.setBuf ( m_tinyBuf,sizeof(m_tinyBuf),0,false);
|
||||
m_filePtrsBuf.setLength ( m_filePtrsBuf.getCapacity() );
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ private:
|
||||
// number of parts remaining to be unlinked/renamed
|
||||
int32_t m_partsRemaining;
|
||||
|
||||
char m_tinyBuf[8];
|
||||
char m_tinyBuf[sizeof(File*)]; //used for File* pointers for small files
|
||||
|
||||
// to hold the array of Files
|
||||
SafeBuf m_filePtrsBuf;
|
||||
|
Reference in New Issue
Block a user