Removed some more compiler warnings from Windows compile (GCC 4.4).

Added -Wextra to the Windows compile.
Added new define in libbitdht for snprintf and fprintf to proper handling of "%ll" under Windows.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4951 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-02-17 10:03:38 +00:00
parent 2d2b7230d1
commit 970d88200d
35 changed files with 170 additions and 125 deletions

View file

@ -36,7 +36,6 @@ void bdMsgHistoryList::printHistory(std::ostream &out, int mode, time_t start_ts
sit = msgHistory.lower_bound(start_ts);
eit = msgHistory.upper_bound(end_ts);
time_t curr_ts = 0;
time_t old_ts = 0;
bool time_changed = false;
bool first_line = true;
@ -45,7 +44,6 @@ void bdMsgHistoryList::printHistory(std::ostream &out, int mode, time_t start_ts
time_changed = false;
if (curr_ts != it->first)
{
old_ts = curr_ts;
curr_ts = it->first;
time_changed = true;
}

View file

@ -168,7 +168,7 @@ bool bdNodeManager::setAttachMode(bool on)
}
/* Friend Tracking */
void bdNodeManager::addBadPeer(const struct sockaddr_in &addr, uint32_t source, uint32_t reason, uint32_t age)
void bdNodeManager::addBadPeer(const struct sockaddr_in &/*addr*/, uint32_t /*source*/, uint32_t /*reason*/, uint32_t /*age*/)
{
std::cerr << "bdNodeManager::addBadPeer() not implemented yet!";
std::cerr << std::endl;

View file

@ -27,6 +27,7 @@
#include "bitdht/bdpeer.h"
#include "util/bdnet.h"
#include "util/bdrandom.h"
#include "util/bdstring.h"
#include "bitdht/bdiface.h"
#include <stdlib.h>
@ -941,13 +942,13 @@ int bdSpace::printDHT()
if (size)
{
if (doPrint)
fprintf(stderr, "Estimated NetSize >> %llu\n", no_nets);
bd_fprintf(stderr, "Estimated NetSize >> %llu\n", no_nets);
}
else
{
#ifdef BITDHT_DEBUG
if (doPrint)
fprintf(stderr, " Bucket = Net / >> %llu\n", no_nets);
bd_fprintf(stderr, " Bucket = Net / >> %llu\n", no_nets);
#endif
}
}
@ -957,14 +958,14 @@ int bdSpace::printDHT()
if (size)
{
if (doPrint)
fprintf(stderr, "Estimated NetSize = %llu\n", no_peers);
bd_fprintf(stderr, "Estimated NetSize = %llu\n", no_peers);
}
else
{
#ifdef BITDHT_DEBUG
if (doPrint)
fprintf(stderr, " Bucket = Net / %llu\n", no_nets);
bd_fprintf(stderr, " Bucket = Net / %llu\n", no_nets);
#endif
}
@ -994,7 +995,7 @@ int bdSpace::printDHT()
}
else
{
fprintf(stderr, "Estimated Network Size = (%llu / %d) = %llu\n", sum, count, sum / count);
bd_fprintf(stderr, "Estimated Network Size = (%llu / %d) = %llu\n", sum, count, sum / count);
}
return 1;

View file

@ -364,7 +364,6 @@ int bdQuery::addClosestPeer(const bdId *id, uint32_t mode)
#ifdef DEBUG_QUERY
fprintf(stderr, "Dropping Peer that dont reply\n");
#endif
bool removed = false;
for(it = mClosest.begin(); it != mClosest.end(); ++it)
{
time_t sendts = ts - it->second.mLastSendTime;
@ -379,7 +378,6 @@ int bdQuery::addClosestPeer(const bdId *id, uint32_t mode)
fprintf(stderr, "\n");
#endif
mClosest.erase(it);
removed = true;
break ;
}
}
@ -568,12 +566,10 @@ int bdQuery::updatePotentialPeer(const bdId *id, uint32_t mode, uint32_t addType
sit = mPotentialPeers.lower_bound(dist);
eit = mPotentialPeers.upper_bound(dist);
bool found = false;
for(it = sit; it != eit; it++)
{
if (mFns->bdSimilarId(id, &(it->second.mPeerId)))
{
found = true;
it->second.mPeerFlags |= mode;
it->second.mLastRecvTime = now;

View file

@ -161,7 +161,6 @@ void bdStore::addStore(bdPeer *peer)
#endif
/* remove old entry */
bool removed = false;
std::list<bdPeer>::iterator it;
for(it = store.begin(); it != store.end(); )
@ -169,7 +168,6 @@ void bdStore::addStore(bdPeer *peer)
if ((it->mPeerId.addr.sin_addr.s_addr == peer->mPeerId.addr.sin_addr.s_addr) &&
(it->mPeerId.addr.sin_port == peer->mPeerId.addr.sin_port))
{
removed = true;
#ifdef DEBUG_STORE
std::cerr << "bdStore::addStore() Removed Existing Entry: ";
mFns->bdPrintId(std::cerr, &(it->mPeerId));

View file

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h> /* malloc() realloc() free() strtoll() */
#include <string.h> /* memset() */
#include "util/bdstring.h"
#include "bitdht/bencode.h"
@ -425,7 +426,7 @@ int be_encode(be_node *node, char *str, int len)
switch (node->type) {
case BE_STR:
snprintf(str, len, "%lli:", be_str_len(node));
bd_snprintf(str, len, "%lli:", be_str_len(node));
loc += strlen(&(str[loc]));
memcpy(&(str[loc]), node->val.s, be_str_len(node));
@ -433,7 +434,7 @@ int be_encode(be_node *node, char *str, int len)
break;
case BE_INT:
snprintf(str, len, "i%llie", node->val.i);
bd_snprintf(str, len, "i%llie", node->val.i);
loc += strlen(&(str[loc]));
break;