mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 15:45:04 -04:00
Fixed a bunch of warnings in safe ways
This commit is contained in:
parent
3c5e12ae84
commit
633a6cf8c2
13 changed files with 41 additions and 48 deletions
|
@ -270,7 +270,7 @@ void HashStorage::clean()
|
|||
#endif
|
||||
|
||||
for(std::map<std::string,HashStorageInfo>::iterator it(mFiles.begin());it!=mFiles.end();)
|
||||
if(it->second.time_stamp + duration < (uint64_t)now)
|
||||
if((uint64_t)(it->second.time_stamp + duration) < (uint64_t)now)
|
||||
{
|
||||
#ifdef HASHSTORAGE_DEBUG
|
||||
std::cerr << " Entry too old: " << it->first << ", ts=" << it->second.time_stamp << std::endl ;
|
||||
|
|
|
@ -621,29 +621,30 @@ void p3FileDatabase::requestDirUpdate(void *ref)
|
|||
}
|
||||
}
|
||||
|
||||
bool p3FileDatabase::findChildPointer(void *ref, int row, void *& result, FileSearchFlags flags) const
|
||||
bool p3FileDatabase::findChildPointer( void *ref, int row, void *& result,
|
||||
FileSearchFlags flags ) const
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
RS_STACK_MUTEX(mFLSMtx);
|
||||
|
||||
result = NULL ;
|
||||
result = NULL;
|
||||
|
||||
if (ref == NULL)
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
{
|
||||
if(row != 0)
|
||||
return false ;
|
||||
if (ref == NULL)
|
||||
{
|
||||
if(flags & RS_FILE_HINTS_LOCAL)
|
||||
{
|
||||
if(row != 0) return false;
|
||||
|
||||
convertEntryIndexToPointer(0,0,result);
|
||||
convertEntryIndexToPointer(0,0,result);
|
||||
|
||||
return true ;
|
||||
}
|
||||
else if((uint32_t)row < mRemoteDirectories.size())
|
||||
{
|
||||
convertEntryIndexToPointer(mRemoteDirectories[row]->root(),row+1,result);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if((uint32_t)row < mRemoteDirectories.size())
|
||||
{
|
||||
convertEntryIndexToPointer(mRemoteDirectories[row]->root(), row+1, result);
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
uint32_t fi;
|
||||
DirectoryStorage::EntryIndex e ;
|
||||
|
@ -667,8 +668,8 @@ bool p3FileDatabase::findChildPointer(void *ref, int row, void *& result, FileSe
|
|||
|
||||
return res;
|
||||
}
|
||||
// This function converts a pointer into directory details, to be used by the AbstractItemModel for browsing the files.
|
||||
|
||||
// This function converts a pointer into directory details, to be used by the AbstractItemModel for browsing the files.
|
||||
int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags flags) const
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
|
|
|
@ -727,14 +727,13 @@ bool ftController::completeFile(const RsFileHash& hash)
|
|||
std::string path;
|
||||
std::string name;
|
||||
uint64_t size = 0;
|
||||
uint32_t state = 0;
|
||||
uint32_t period = 0;
|
||||
TransferRequestFlags flags ;
|
||||
TransferRequestFlags extraflags ;
|
||||
uint32_t completeCount = 0;
|
||||
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
RS_STACK_MUTEX(ctrlMutex);
|
||||
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController:completeFile(" << hash << ")";
|
||||
|
@ -816,7 +815,6 @@ bool ftController::completeFile(const RsFileHash& hash)
|
|||
name = fc->mName;
|
||||
//hash = fc->mHash;
|
||||
size = fc->mSize;
|
||||
state = fc->mState;
|
||||
period = 30 * 24 * 3600; /* 30 days */
|
||||
extraflags.clear() ;
|
||||
|
||||
|
@ -837,7 +835,7 @@ bool ftController::completeFile(const RsFileHash& hash)
|
|||
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||
mTurtle->stopMonitoringTunnels(hash_to_suppress) ;
|
||||
|
||||
} /******* UNLOCKED ********/
|
||||
} // UNLOCK: RS_STACK_MUTEX(ctrlMutex);
|
||||
|
||||
|
||||
/******************** NO Mutex from Now ********************
|
||||
|
|
|
@ -543,7 +543,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags
|
|||
{
|
||||
return mFileDatabase->RequestDirDetails(ref,details,flags) ;
|
||||
}
|
||||
uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
|
||||
uint32_t ftServer::getType(void *ref, FileSearchFlags /*flags*/)
|
||||
{
|
||||
return mFileDatabase->getType(ref) ;
|
||||
}
|
||||
|
|
|
@ -1691,7 +1691,7 @@ void RsGenExchange::processMsgMetaChanges()
|
|||
{
|
||||
MsgLocMetaData& m = mit->second;
|
||||
|
||||
int32_t value, mask;
|
||||
int32_t value, mask;
|
||||
bool ok = true;
|
||||
bool changed = false;
|
||||
|
||||
|
@ -1717,7 +1717,7 @@ void RsGenExchange::processMsgMetaChanges()
|
|||
{
|
||||
RsGxsMsgMetaData* meta = *(msgMetaV.begin());
|
||||
value = (meta->mMsgStatus & ~mask) | (mask & value);
|
||||
changed = (meta->mMsgStatus != value);
|
||||
changed = (static_cast<int64_t>(meta->mMsgStatus) != value);
|
||||
m.val.put(RsGeneralDataService::MSG_META_STATUS, value);
|
||||
delete meta;
|
||||
ok = true;
|
||||
|
@ -2822,10 +2822,8 @@ void RsGenExchange::processRecvdMessages()
|
|||
mNetService->rejectMessage(*it) ;
|
||||
}
|
||||
|
||||
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData *grpMeta)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData* /*grpMeta*/ )
|
||||
{ return true; }
|
||||
|
||||
void RsGenExchange::processRecvdGroups()
|
||||
{
|
||||
|
|
|
@ -1059,7 +1059,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
|
|||
|
||||
X509_print_ex(bio_out, x509, nmflag, reqflag);
|
||||
|
||||
BIO_flush(bio_out);
|
||||
(void) BIO_flush(bio_out);
|
||||
BIO_free(bio_out);
|
||||
|
||||
/* Save cert to file */
|
||||
|
|
|
@ -231,7 +231,7 @@ uint32_t getRawStringSize(const std::string &outStr)
|
|||
|
||||
bool getRawString(void *data, uint32_t size, uint32_t *offset, std::string &outStr)
|
||||
{
|
||||
#warning I had to change this. It seems like a bug to not clear the string. Should make sure it's not introducing any side effect.
|
||||
#warning "I had to change this. It seems like a bug to not clear the string. Should make sure it's not introducing any side effect."
|
||||
outStr.clear();
|
||||
|
||||
uint32_t len = 0;
|
||||
|
|
|
@ -206,27 +206,25 @@ void p3BanList::autoFigureOutBanRanges()
|
|||
{
|
||||
RS_STACK_MUTEX(mBanMtx) ;
|
||||
|
||||
bool changed = false ;
|
||||
|
||||
// clear automatic ban ranges
|
||||
|
||||
for(std::map<sockaddr_storage,BanListPeer>::iterator it(mBanRanges.begin());it!=mBanRanges.end();)
|
||||
for(std::map<sockaddr_storage,BanListPeer>::iterator it(mBanRanges.begin());
|
||||
it!=mBanRanges.end(); )
|
||||
{
|
||||
if(it->second.reason == RSBANLIST_REASON_AUTO_RANGE)
|
||||
{
|
||||
std::map<sockaddr_storage,BanListPeer>::iterator it2=it ;
|
||||
++it2 ;
|
||||
mBanRanges.erase(it) ;
|
||||
it=it2 ;
|
||||
|
||||
changed = true ;
|
||||
}
|
||||
else
|
||||
++it;
|
||||
else ++it;
|
||||
}
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
if(!mAutoRangeIps)
|
||||
return ;
|
||||
if(!mAutoRangeIps) return;
|
||||
|
||||
#ifdef DEBUG_BANLIST
|
||||
std::cerr << "Automatically figuring out IP ranges from banned IPs." << std::endl;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue