diff --git a/libretroshare/src/dbase/findex.cc b/libretroshare/src/dbase/findex.cc index 582785f21..1eeea8c9d 100644 --- a/libretroshare/src/dbase/findex.cc +++ b/libretroshare/src/dbase/findex.cc @@ -780,7 +780,7 @@ int FileIndex::loadIndex(const std::string& filename, const RsFileHash& expected fclose(file); return 0; } - int bytesread = 0 ; + uint64_t bytesread = 0 ; if(size != (bytesread = fread(compressed_data,1,size,file))) { std::cerr << "FileIndex::loadIndex(): can't read " << size << " bytes from file " << filename << ". Only " << bytesread << " actually read." << std::endl; @@ -1089,7 +1089,7 @@ int FileIndex::saveIndex(const std::string& filename, RsFileHash &fileHash, uint std::cerr << "FileIndex::saveIndex error opening file for writting: " << filename << ". Giving up." << std::endl; return 0; } - int outwritten ; + uint32_t outwritten ; if(compressed_data_size != (outwritten=fwrite(compressed_data,1,compressed_data_size,file))) { @@ -1370,7 +1370,7 @@ void *FileIndex::findRef(const std::string& fpath) const std::cerr << "FileIndex::updateFileEntry() NULL parent"; std::cerr << std::endl; //#endif - return false; + return NULL; } std::cerr << "Found parent directory: " << std::endl; std::cerr << " parent.name = " << parent->name << std::endl; diff --git a/libretroshare/src/ft/ftchunkmap.cc b/libretroshare/src/ft/ftchunkmap.cc index 49550077b..39d04efe6 100644 --- a/libretroshare/src/ft/ftchunkmap.cc +++ b/libretroshare/src/ft/ftchunkmap.cc @@ -96,7 +96,7 @@ void ChunkMap::setAvailabilityMap(const CompressedChunkMap& map) // do some sanity check // - if( (((int)_map.size()-1)>>5) >= map._map.size() ) + if( (((int)_map.size()-1)>>5) >= (int)map._map.size() ) { std::cerr << "ChunkMap::setPeerAvailabilityMap: Compressed chunkmap received is too small or corrupted." << std::endl; return ; diff --git a/libretroshare/src/gxs/gxssecurity.cc b/libretroshare/src/gxs/gxssecurity.cc index edd005fd9..6c1474f3f 100644 --- a/libretroshare/src/gxs/gxssecurity.cc +++ b/libretroshare/src/gxs/gxssecurity.cc @@ -551,7 +551,7 @@ bool GxsSecurity::decrypt(uint8_t *& out, uint32_t & outlen, const uint8_t *in, in_offset += size_net_ekl; // Conservative limits to detect weird errors due to corrupted encoding. - if(eklen < 0 || eklen > 512 || eklen+in_offset > inlen) + if(eklen < 0 || eklen > 512 || eklen+in_offset > (int)inlen) { std::cerr << "Error while deserialising encryption key length: eklen = " << std::dec << eklen << ". Giving up decryption." << std::endl; free(ek); diff --git a/libretroshare/src/pgp/pgpkeyutil.cc b/libretroshare/src/pgp/pgpkeyutil.cc index f415f8db9..067496bf0 100644 --- a/libretroshare/src/pgp/pgpkeyutil.cc +++ b/libretroshare/src/pgp/pgpkeyutil.cc @@ -125,7 +125,7 @@ std::string PGPKeyManagement::makeArmouredKey(const unsigned char *keydata,size_ uint32_t crc = compute24bitsCRC((unsigned char *)keydata,key_size) ; - unsigned char tmp[3] = { (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff } ; + unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ; std::string crc_string ; Radix64::encode((const char *)tmp,3,crc_string) ; diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index 55cd9eb06..bcde912ef 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -1026,7 +1026,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPgpId &id) RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ /* move to othersList */ - bool success = false; + //bool success = false; std::map::iterator it; //remove ssl and gpg_ids for(it = mFriendList.begin(); it != mFriendList.end(); ++it) @@ -1043,7 +1043,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPgpId &id) mOthersList[it->second.id] = peer; mStatusChanged = true; - success = true; + //success = true; } } @@ -1099,7 +1099,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPeerId &id, bool removePgpId) RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ /* move to othersList */ - bool success = false; + //bool success = false; std::map::iterator it; //remove ssl and gpg_ids for(it = mFriendList.begin(); it != mFriendList.end(); ++it) @@ -1118,7 +1118,7 @@ bool p3PeerMgrIMPL::removeFriend(const RsPeerId &id, bool removePgpId) mOthersList[id] = peer; mStatusChanged = true; - success = true; + //success = true; } } @@ -1555,7 +1555,7 @@ bool p3PeerMgrIMPL::locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_sto for(std::map::const_iterator it(addr_counts.begin());it!=addr_counts.end();++it) { - if(it->second.n > count) + if(uint32_t(it->second.n) > count) { addr = it->first ; count = it->second.n ; diff --git a/libretroshare/src/pqi/p3servicecontrol.cc b/libretroshare/src/pqi/p3servicecontrol.cc index 4b3c48f65..820b29a4c 100644 --- a/libretroshare/src/pqi/p3servicecontrol.cc +++ b/libretroshare/src/pqi/p3servicecontrol.cc @@ -148,7 +148,7 @@ public: uint32_t tmp ; ok &= getRawUInt32(data, rssize, &offset, &tmp); - for(int i=0;inotifyEvent(this, CONNECT_FAILED, raddr); } } diff --git a/libretroshare/src/pqi/pqiqos.cc b/libretroshare/src/pqi/pqiqos.cc index 25db06432..b0d5ec5f5 100644 --- a/libretroshare/src/pqi/pqiqos.cc +++ b/libretroshare/src/pqi/pqiqos.cc @@ -27,7 +27,7 @@ void pqiQoS::clear() { void *item ; - for(int i=0;i<_item_queues.size();++i) + for(uint32_t i=0;i<_item_queues.size();++i) while( (item = _item_queues[i].pop()) != NULL) free(item) ; @@ -46,7 +46,7 @@ void pqiQoS::print() const void pqiQoS::in_rsItem(void *ptr,int priority) { - if(priority >= _item_queues.size()) + if(uint32_t(priority) >= _item_queues.size()) { std::cerr << "pqiQoS::in_rsRawItem() ****Warning****: priority " << priority << " out of scope [0," << _item_queues.size()-1 << "]. Priority will be clamped to maximum value." << std::endl; priority = _item_queues.size()-1 ; diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 3bbb8de3f..e980fb258 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -1078,7 +1078,7 @@ bool p3Peers::GetPGPBase64StringAndCheckSum( const RsPgpId& gpg_id, uint32_t crc = PGPKeyManagement::compute24bitsCRC((unsigned char *)mem_block,mem_block_size) ; - unsigned char tmp[3] = { (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff } ; + unsigned char tmp[3] = { uint8_t((crc >> 16) & 0xff), uint8_t((crc >> 8) & 0xff), uint8_t(crc & 0xff) } ; Radix64::encode((const char *)tmp,3,gpg_base64_checksum) ; delete[] mem_block ; diff --git a/libretroshare/src/serialiser/rsserial.cc b/libretroshare/src/serialiser/rsserial.cc index 4635fc2a2..1658cb5b4 100644 --- a/libretroshare/src/serialiser/rsserial.cc +++ b/libretroshare/src/serialiser/rsserial.cc @@ -427,7 +427,7 @@ RsItem * RsSerialiser::deserialise(void *data, uint32_t *size) std::cerr << "RsSerialiser::deserialise() pkt_size: " << pkt_size << " vs *size: " << *size; std::cerr << std::endl; - RsItem *item2 = (it->second)->deserialise(data, &pkt_size); + //RsItem *item2 = (it->second)->deserialise(data, &pkt_size); uint32_t failedtype = getRsItemId(data); std::cerr << "RsSerialiser::deserialise() FAILED PACKET Size: "; diff --git a/libretroshare/src/serialiser/rstlvbase.cc b/libretroshare/src/serialiser/rstlvbase.cc index 5bd704fe4..afc29a99e 100644 --- a/libretroshare/src/serialiser/rstlvbase.cc +++ b/libretroshare/src/serialiser/rstlvbase.cc @@ -523,9 +523,9 @@ static bool readHex(char s1,char s2,uint8_t& v) static bool find_decoded_string(const std::string& in,const std::string& suspicious_string) { - int ss_pointer = 0 ; + uint32_t ss_pointer = 0 ; - for(int i=0;i &lst) lst.clear() ; for(std::map::const_iterator it(mBanSet.begin());it!=mBanSet.end();++it) { - bool already_banned = false ; - if(!acceptedBanSet_locked(it->second)) continue ; @@ -498,7 +496,7 @@ bool p3BanList::addIpRange(const sockaddr_storage &addr, int masked_bytes,uint32 { RS_STACK_MUTEX(mBanMtx) ; - if(getBitRange(addr) > masked_bytes) + if(getBitRange(addr) > uint32_t(masked_bytes)) { std::cerr << "(EE) Input to p3BanList::addIpRange is inconsistent: ip=" << sockaddr_storage_iptostring(addr) << "/" << 32-8*masked_bytes << std::endl; return false ; @@ -955,7 +953,7 @@ bool p3BanList::addBanEntry(const RsPeerId &peerId, const struct sockaddr_storag { /* see if it needs an update */ if ((mit->second.reason != reason) || - (mit->second.level != level) || + (mit->second.level != uint32_t(level)) || (mit->second.mTs < time_stamp)) { /* update */ @@ -1044,7 +1042,7 @@ int p3BanList::condenseBanSources_locked() continue; } - int lvl = lit->second.level; + uint32_t lvl = lit->second.level; if (it->first != ownId) { /* as from someone else, increment level */