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; std::vector<RsGxsId> mIds;
StateToken mStateToken; StateToken mStateToken;
protected: protected:
virtual void gxsDoWork(Request &req, Response &resp) virtual void gxsDoWork(Request& /*req*/, Response &resp)
{ {
resp.mDataStream.getStreamToMember(); resp.mDataStream.getStreamToMember();
for(std::vector<RsGxsId>::iterator vit = mIds.begin(); vit != mIds.end(); ++vit) 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; std::string temp_val;
size_t i = 0; size_t i = 0;
bool found_digit = false; bool found_digit = false;
bool found_first_valid_char = false;
for (; i < str.length(); i++) 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])) if (std::isdigit(str[i]))
found_digit = true; found_digit = true;
found_first_valid_char = true;
temp_val += str[i]; temp_val += str[i];
} }
} }

View File

@ -270,7 +270,7 @@ void HashStorage::clean()
#endif #endif
for(std::map<std::string,HashStorageInfo>::iterator it(mFiles.begin());it!=mFiles.end();) 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 #ifdef HASHSTORAGE_DEBUG
std::cerr << " Entry too old: " << it->first << ", ts=" << it->second.time_stamp << std::endl ; std::cerr << " Entry too old: " << it->first << ", ts=" << it->second.time_stamp << std::endl ;

View File

@ -621,17 +621,18 @@ 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 (ref == NULL)
{
if(flags & RS_FILE_HINTS_LOCAL) if(flags & RS_FILE_HINTS_LOCAL)
{ {
if(row != 0) if(row != 0) return false;
return false ;
convertEntryIndexToPointer(0,0,result); convertEntryIndexToPointer(0,0,result);
@ -642,8 +643,8 @@ bool p3FileDatabase::findChildPointer(void *ref, int row, void *& result, FileSe
convertEntryIndexToPointer(mRemoteDirectories[row]->root(), row+1, result); convertEntryIndexToPointer(mRemoteDirectories[row]->root(), row+1, result);
return true; return true;
} }
else else return false;
return false; }
uint32_t fi; uint32_t fi;
DirectoryStorage::EntryIndex e ; DirectoryStorage::EntryIndex e ;
@ -667,8 +668,8 @@ bool p3FileDatabase::findChildPointer(void *ref, int row, void *& result, FileSe
return res; 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 int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags flags) const
{ {
RS_STACK_MUTEX(mFLSMtx) ; RS_STACK_MUTEX(mFLSMtx) ;

View File

@ -727,14 +727,13 @@ bool ftController::completeFile(const RsFileHash& hash)
std::string path; std::string path;
std::string name; std::string name;
uint64_t size = 0; uint64_t size = 0;
uint32_t state = 0;
uint32_t period = 0; uint32_t period = 0;
TransferRequestFlags flags ; TransferRequestFlags flags ;
TransferRequestFlags extraflags ; TransferRequestFlags extraflags ;
uint32_t completeCount = 0; uint32_t completeCount = 0;
{ {
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/ RS_STACK_MUTEX(ctrlMutex);
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "ftController:completeFile(" << hash << ")"; std::cerr << "ftController:completeFile(" << hash << ")";
@ -816,7 +815,6 @@ bool ftController::completeFile(const RsFileHash& hash)
name = fc->mName; name = fc->mName;
//hash = fc->mHash; //hash = fc->mHash;
size = fc->mSize; size = fc->mSize;
state = fc->mState;
period = 30 * 24 * 3600; /* 30 days */ period = 30 * 24 * 3600; /* 30 days */
extraflags.clear() ; extraflags.clear() ;
@ -837,7 +835,7 @@ bool ftController::completeFile(const RsFileHash& hash)
if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING) if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mTurtle->stopMonitoringTunnels(hash_to_suppress) ; mTurtle->stopMonitoringTunnels(hash_to_suppress) ;
} /******* UNLOCKED ********/ } // UNLOCK: RS_STACK_MUTEX(ctrlMutex);
/******************** NO Mutex from Now ******************** /******************** NO Mutex from Now ********************

View File

@ -543,7 +543,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags
{ {
return mFileDatabase->RequestDirDetails(ref,details,flags) ; 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) ; return mFileDatabase->getType(ref) ;
} }

View File

@ -1717,7 +1717,7 @@ void RsGenExchange::processMsgMetaChanges()
{ {
RsGxsMsgMetaData* meta = *(msgMetaV.begin()); RsGxsMsgMetaData* meta = *(msgMetaV.begin());
value = (meta->mMsgStatus & ~mask) | (mask & value); 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); m.val.put(RsGeneralDataService::MSG_META_STATUS, value);
delete meta; delete meta;
ok = true; ok = true;
@ -2822,10 +2822,8 @@ void RsGenExchange::processRecvdMessages()
mNetService->rejectMessage(*it) ; mNetService->rejectMessage(*it) ;
} }
bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData *grpMeta) bool RsGenExchange::acceptNewGroup(const RsGxsGrpMetaData* /*grpMeta*/ )
{ { return true; }
return true;
}
void RsGenExchange::processRecvdGroups() 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); X509_print_ex(bio_out, x509, nmflag, reqflag);
BIO_flush(bio_out); (void) BIO_flush(bio_out);
BIO_free(bio_out); BIO_free(bio_out);
/* Save cert to file */ /* 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) 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(); outStr.clear();
uint32_t len = 0; uint32_t len = 0;

View File

@ -206,27 +206,25 @@ void p3BanList::autoFigureOutBanRanges()
{ {
RS_STACK_MUTEX(mBanMtx) ; RS_STACK_MUTEX(mBanMtx) ;
bool changed = false ;
// clear automatic ban ranges // 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) if(it->second.reason == RSBANLIST_REASON_AUTO_RANGE)
{ {
std::map<sockaddr_storage,BanListPeer>::iterator it2=it ; std::map<sockaddr_storage,BanListPeer>::iterator it2=it ;
++it2 ; ++it2 ;
mBanRanges.erase(it) ; mBanRanges.erase(it) ;
it=it2 ; it=it2 ;
changed = true ;
} }
else else ++it;
++it; }
IndicateConfigChanged(); IndicateConfigChanged();
if(!mAutoRangeIps) if(!mAutoRangeIps) return;
return ;
#ifdef DEBUG_BANLIST #ifdef DEBUG_BANLIST
std::cerr << "Automatically figuring out IP ranges from banned IPs." << std::endl; std::cerr << "Automatically figuring out IP ranges from banned IPs." << std::endl;
#endif #endif

View File

@ -54,7 +54,7 @@
#define IMAGE_NETWORK2 ":/icons/png/netgraph.png" #define IMAGE_NETWORK2 ":/icons/png/netgraph.png"
#define IMAGE_PEERS ":/icons/png/keyring.png" #define IMAGE_PEERS ":/icons/png/keyring.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.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 * #define FRIENDS_DEBUG 1

View File

@ -59,7 +59,7 @@ void GxsMessageFramePostWidget::groupIdChanged()
fillComplete(); fillComplete();
} }
QString GxsMessageFramePostWidget::groupName(bool withUnreadCount) QString GxsMessageFramePostWidget::groupName(bool /*withUnreadCount*/)
{ {
QString name = groupId().isNull () ? tr("No name") : mGroupName; 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" if(!ask_for_password && runstate == "waiting_account_select"
&& last_char >= '0' && last_char <= '9' && 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']; std::string acc = accounts[last_char-'0'];
JsonStream reqs; JsonStream reqs;