Fixed a bunch of warnings in safe ways

This commit is contained in:
Gio 2016-10-12 20:43:38 +02:00
parent 3c5e12ae84
commit 633a6cf8c2
13 changed files with 41 additions and 48 deletions

View File

@ -29,7 +29,7 @@ private:
std::vector<RsGxsId> mIds;
StateToken mStateToken;
protected:
virtual void gxsDoWork(Request &req, Response &resp)
virtual void gxsDoWork(Request& /*req*/, Response &resp)
{
resp.mDataStream.getStreamToMember();
for(std::vector<RsGxsId>::iterator vit = mIds.begin(); vit != mIds.end(); ++vit)

View File

@ -824,7 +824,6 @@ static Value DeserializeValue(std::string& str, bool* had_error, std::stack<Stac
std::string temp_val;
size_t i = 0;
bool found_digit = false;
bool found_first_valid_char = false;
for (; i < str.length(); i++)
{
@ -894,7 +893,6 @@ static Value DeserializeValue(std::string& str, bool* had_error, std::stack<Stac
if (std::isdigit(str[i]))
found_digit = true;
found_first_valid_char = true;
temp_val += str[i];
}
}

View File

@ -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 ;

View File

@ -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) ;

View File

@ -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 ********************

View File

@ -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) ;
}

View File

@ -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()
{

View File

@ -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 */

View 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;

View File

@ -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

View File

@ -54,7 +54,7 @@
#define IMAGE_NETWORK2 ":/icons/png/netgraph.png"
#define IMAGE_PEERS ":/icons/png/keyring.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
#define IMAGE_CIRCLES ":/icons/png/circles.png"
//#define IMAGE_CIRCLES ":/icons/png/circles.png"
/******
* #define FRIENDS_DEBUG 1

View File

@ -59,7 +59,7 @@ void GxsMessageFramePostWidget::groupIdChanged()
fillComplete();
}
QString GxsMessageFramePostWidget::groupName(bool withUnreadCount)
QString GxsMessageFramePostWidget::groupName(bool /*withUnreadCount*/)
{
QString name = groupId().isNull () ? tr("No name") : mGroupName;

View File

@ -246,7 +246,7 @@ void TerminalApiClient::data_tick()
if(!ask_for_password && runstate == "waiting_account_select"
&& last_char >= '0' && last_char <= '9'
&& (last_char-'0') < accounts.size())
&& static_cast<uint32_t>(last_char-'0') < accounts.size())
{
std::string acc = accounts[last_char-'0'];
JsonStream reqs;