mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 09:18:45 -04:00
applied removal of realloc to other files in file_sharing/ directory
This commit is contained in:
parent
0cb7778ceb
commit
5fbc263a36
4 changed files with 38 additions and 20 deletions
|
@ -353,8 +353,12 @@ void HashStorage::locked_save()
|
|||
|
||||
bool HashStorage::readHashStorageInfo(const unsigned char *data,uint32_t total_size,uint32_t& offset,HashStorageInfo& info) const
|
||||
{
|
||||
unsigned char *section_data = NULL ;
|
||||
uint32_t section_size = 0;
|
||||
unsigned char *section_data = (unsigned char *)rs_malloc(FL_BASE_TMP_SECTION_SIZE) ;
|
||||
|
||||
if(!section_data)
|
||||
return false ;
|
||||
|
||||
uint32_t section_size = FL_BASE_TMP_SECTION_SIZE;
|
||||
uint32_t section_offset = 0;
|
||||
|
||||
// This way, the entire section is either read or skipped. That avoids the risk of being stuck somewhere in the middle
|
||||
|
@ -375,9 +379,13 @@ bool HashStorage::readHashStorageInfo(const unsigned char *data,uint32_t total_s
|
|||
|
||||
bool HashStorage::writeHashStorageInfo(unsigned char *& data,uint32_t& total_size,uint32_t& offset,const HashStorageInfo& info) const
|
||||
{
|
||||
unsigned char *section_data = NULL ;
|
||||
unsigned char *section_data = (unsigned char *)rs_malloc(FL_BASE_TMP_SECTION_SIZE) ;
|
||||
|
||||
if(!section_data)
|
||||
return false ;
|
||||
|
||||
uint32_t section_offset = 0 ;
|
||||
uint32_t section_size = 0;
|
||||
uint32_t section_size = FL_BASE_TMP_SECTION_SIZE;
|
||||
|
||||
if(!FileListIO::writeField(section_data,section_size,section_offset,FILE_LIST_IO_TAG_FILE_NAME ,info.filename )) return false ;
|
||||
if(!FileListIO::writeField(section_data,section_size,section_offset,FILE_LIST_IO_TAG_FILE_SIZE ,info.size )) return false ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue