removed a few compilation warning that might cause compilation errors on some systems

This commit is contained in:
csoler 2015-09-24 18:03:19 -04:00
parent 0614a24bbb
commit 22d4893721
12 changed files with 23 additions and 25 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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<RsPeerId, peerState>::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<RsPeerId, peerState>::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<sockaddr_storage,ZeroedInt>::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 ;

View File

@ -148,7 +148,7 @@ public:
uint32_t tmp ;
ok &= getRawUInt32(data, rssize, &offset, &tmp);
for(int i=0;i<tmp && offset < rssize;++i)
for(uint32_t i=0;i<tmp && offset < rssize;++i)
{
RsPeerId peer_id ;
ok &= peer_id.deserialise(data,rssize,offset) ;
@ -157,7 +157,7 @@ public:
ok &= getRawUInt32(data, rssize, &offset, &tmp);
for(int i=0;i<tmp && offset < rssize;++i)
for(uint32_t i=0;i<tmp && offset < rssize;++i)
{
RsPeerId peer_id ;
ok &= peer_id.deserialise(data,rssize,offset) ;

View File

@ -544,7 +544,7 @@ int NetBinDummy::connect(const struct sockaddr_storage &raddr)
std::cerr << std::endl;
if (parent())
{
struct sockaddr_storage addr = raddr;
//struct sockaddr_storage addr = raddr;
parent()->notifyEvent(this, CONNECT_FAILED, raddr);
}
}

View File

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

View File

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

View File

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

View File

@ -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<in.length();++i)
for(uint32_t i=0;i<in.length();++i)
{
uint8_t hexv ;
char next_char ;

View File

@ -439,8 +439,6 @@ void p3BanList::getBannedIps(std::list<BanListPeer> &lst)
lst.clear() ;
for(std::map<sockaddr_storage,BanListPeer>::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 */