From 27842b85922ca8a7a8b91323c3c99d0524a12dca Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 12 Aug 2011 12:43:24 +0000 Subject: [PATCH] Removed unused parameter warnings in libbitdht. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4557 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/bitdht/bdconnection.cc | 24 ++++++++++++------------ libbitdht/src/bitdht/bdfilter.cc | 1 - libbitdht/src/bitdht/bdmanager.cc | 17 +++++++++++++++++ libbitdht/src/bitdht/bdnode.cc | 11 ++--------- libbitdht/src/bitdht/bdpeer.cc | 2 -- libbitdht/src/bitdht/bdquery.cc | 1 - libbitdht/src/util/bdthreads.h | 3 +++ 7 files changed, 34 insertions(+), 25 deletions(-) diff --git a/libbitdht/src/bitdht/bdconnection.cc b/libbitdht/src/bitdht/bdconnection.cc index 10f1e0eb8..f31008dd4 100644 --- a/libbitdht/src/bitdht/bdconnection.cc +++ b/libbitdht/src/bitdht/bdconnection.cc @@ -212,6 +212,10 @@ int bdConnectManager::checkExistingConnectionAttempt(bdNodeId *target) int bdConnectManager::killConnectionRequest(struct sockaddr_in *laddr, bdNodeId *target, uint32_t mode) { + /* remove unused parameter warnings */ + (void) laddr; + (void) mode; + /* check if connection obj already exists */ #ifdef DEBUG_NODE_CONNECTION std::cerr << "bdConnectManager::killConnectionRequest() Mode: " << mode; @@ -266,7 +270,6 @@ int bdConnectManager::requestConnection_direct(struct sockaddr_in *laddr, bdNode std::cerr << std::endl; #endif /* create a bdConnect, and put into the queue */ - int mode = BITDHT_CONNECT_MODE_DIRECT; bdConnectionRequest connreq; if (checkExistingConnectionAttempt(target)) @@ -830,7 +833,6 @@ int bdConnectManager::startConnectionAttempt(bdConnectionRequest *req) req->mState = BITDHT_CONNREQUEST_INPROGRESS; req->mStateTS = time(NULL); - bool failProxy = false; if (mode == BITDHT_CONNECT_MODE_DIRECT) { // ONE BUG I HAVE SEEN. @@ -1191,7 +1193,6 @@ void bdConnectManager::callbackConnectRequest(bdId *srcId, bdId *proxyId, bdId * } // end of error code switch. // Now act on the decision. - int newerrcode = errcode; if (fatal) { /* kill connection request, do callback */ @@ -1818,7 +1819,7 @@ int bdConnectManager::cleanConnection(bdNodeId *srcId, bdNodeId *proxyId, bdNode } -int bdConnectManager::determinePosition(bdNodeId *sender, bdNodeId *src, bdNodeId *dest) +int bdConnectManager::determinePosition(bdNodeId */*sender*/, bdNodeId *src, bdNodeId *dest) { int pos = BD_PROXY_CONNECTION_UNKNOWN_POINT; if (mOwnId == *src) @@ -1924,7 +1925,6 @@ int bdConnectManager::recvedConnectionRequest(bdId *id, bdId *srcConnAddr, bdId int pos = determinePosition(&(id->id), &(srcConnAddr->id), &(destConnAddr->id)); uint32_t status = createConnectionErrorCode(0, BITDHT_CONNECT_ERROR_UNSUPPORTED, pos); - int param = 0; int msgtype = BITDHT_MSG_TYPE_CONNECT_REPLY; mPub->send_connect_msg(id, msgtype, srcConnAddr, destConnAddr, mode, 0, status); @@ -2383,7 +2383,7 @@ int bdConnectManager::recvedConnectionStart(bdId *id, bdId *srcConnAddr, bdId *d * Acks are set, and connections completed if possible (including callback!). */ -int bdConnectManager::recvedConnectionAck(bdId *id, bdId *srcConnAddr, bdId *destConnAddr, int mode) +int bdConnectManager::recvedConnectionAck(bdId *id, bdId *srcConnAddr, bdId *destConnAddr, int /*mode*/) { /* retrieve existing connection data */ bdConnection *conn = findExistingConnectionBySender(id, srcConnAddr, destConnAddr); @@ -2446,7 +2446,7 @@ int bdConnectManager::recvedConnectionAck(bdId *id, bdId *srcConnAddr, bdId *des /* connection complete! cleanup */ if (conn->mMode == BITDHT_CONNECT_MODE_DIRECT) { - int mode = conn->mMode | BITDHT_CONNECT_ANSWER_OKAY; +// int mode = conn->mMode | BITDHT_CONNECT_ANSWER_OKAY; /* callback to connect to Src address! */ // Slightly different callback, use ConnAddr for start message! // Also callback to ConnectionRequest first. @@ -2645,7 +2645,7 @@ int bdConnection::ConnectionRequestEnd(bdId *id, bdId *srcId, bdId *destId, int // Received AUTH, step up to next stage. // Search for dest ID/IP is done before AUTH. so actually nothing to do here, except set the state -int bdConnection::AuthoriseProxyConnection(bdId *srcId, bdId *proxyId, bdId *destId, int mode, int loc, int bandwidth) +int bdConnection::AuthoriseProxyConnection(bdId */*srcId*/, bdId */*proxyId*/, bdId */*destId*/, int /*mode*/, int /*loc*/, int bandwidth) { mState = BITDHT_CONNECTION_WAITING_REPLY; mLastEvent = time(NULL); @@ -2679,7 +2679,7 @@ int bdConnection::AuthoriseProxyConnection(bdId *srcId, bdId *proxyId, bdId *des /* we are end of a Proxy Connection */ -int bdConnection::AuthoriseEndConnection(bdId *srcId, bdId *proxyId, bdId *destConnAddr, int mode, int loc, int delay) +int bdConnection::AuthoriseEndConnection(bdId */*srcId*/, bdId */*proxyId*/, bdId *destConnAddr, int /*mode*/, int /*loc*/, int delay) { mState = BITDHT_CONNECTION_WAITING_START; mLastEvent = time(NULL); @@ -2725,7 +2725,7 @@ int bdConnection::AuthoriseEndConnection(bdId *srcId, bdId *proxyId, bdId *destC // Auth of the Direct Connection, means we move straight to WAITING_ACK mode. -int bdConnection::AuthoriseDirectConnection(bdId *srcId, bdId *proxyId, bdId *destConnAddr, int mode, int loc) +int bdConnection::AuthoriseDirectConnection(bdId */*srcId*/, bdId */*proxyId*/, bdId *destConnAddr, int /*mode*/, int /*loc*/) { mState = BITDHT_CONNECTION_WAITING_ACK; mLastEvent = time(NULL); @@ -2761,7 +2761,7 @@ int bdConnection::AuthoriseDirectConnection(bdId *srcId, bdId *proxyId, bdId *de } // Proxy Connection => at Proxy, Ready to send out Start and get back ACKs!! -int bdConnection::upgradeProxyConnectionToFinish(bdId *id, bdId *srcConnAddr, bdId *destConnAddr, int mode, int secondDelay, int status) +int bdConnection::upgradeProxyConnectionToFinish(bdId */*id*/, bdId */*srcConnAddr*/, bdId *destConnAddr, int /*mode*/, int secondDelay, int /*status*/) { mState = BITDHT_CONNECTION_WAITING_ACK; mLastEvent = time(NULL); @@ -2820,7 +2820,7 @@ int bdConnection::upgradeProxyConnectionToFinish(bdId *id, bdId *srcConnAddr, bd // Final Sorting out of Addresses. // This is called at the Connection Ends, on receiving the START message. // This will contain either Bandwidth or Delay. -int bdConnection::CompleteConnection(bdId *id, bdId *srcConnAddr, bdId *destConnAddr, int bandwidth, int delay) +int bdConnection::CompleteConnection(bdId */*id*/, bdId *srcConnAddr, bdId *destConnAddr, int bandwidth, int delay) { /* Store Final Addresses */ time_t now = time(NULL); diff --git a/libbitdht/src/bitdht/bdfilter.cc b/libbitdht/src/bitdht/bdfilter.cc index 597d3a6b5..769d1a6c2 100644 --- a/libbitdht/src/bitdht/bdfilter.cc +++ b/libbitdht/src/bitdht/bdfilter.cc @@ -44,7 +44,6 @@ bdFilter::bdFilter(const bdNodeId *ownId, std::list &startList, mOwnId = *ownId; mFns = fns; - time_t now = time(NULL); std::list::iterator it; for(it = startList.begin(); it != startList.end(); it++) diff --git a/libbitdht/src/bitdht/bdmanager.cc b/libbitdht/src/bitdht/bdmanager.cc index 50c8c6e16..b1116afe8 100644 --- a/libbitdht/src/bitdht/bdmanager.cc +++ b/libbitdht/src/bitdht/bdmanager.cc @@ -1260,6 +1260,9 @@ bdDebugCallback::~bdDebugCallback() int bdDebugCallback::dhtPeerCallback(const bdId *id, uint32_t status) { + /* remove unused parameter warnings */ + (void) status; + #ifdef DEBUG_MGR std::cerr << "bdDebugCallback::dhtPeerCallback() Id: "; #endif @@ -1272,6 +1275,10 @@ int bdDebugCallback::dhtPeerCallback(const bdId *id, uint32_t status) int bdDebugCallback::dhtValueCallback(const bdNodeId *id, std::string key, uint32_t status) { + /* remove unused parameter warnings */ + (void) key; + (void) status; + #ifdef DEBUG_MGR std::cerr << "bdDebugCallback::dhtValueCallback() Id: "; #endif @@ -1343,6 +1350,16 @@ void bdNodeManager::callbackConnect(bdId *srcId, bdId *proxyId, bdId *destId, in int bdDebugCallback::dhtConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId *destId, uint32_t mode, uint32_t point, uint32_t param, uint32_t cbtype, uint32_t errcode) { + /* remove unused parameter warnings */ + (void) srcId; + (void) proxyId; + (void) destId; + (void) mode; + (void) point; + (void) param; + (void) cbtype; + (void) errcode; + #ifdef DEBUG_MGR std::cerr << "bdDebugCallback::dhtConnectCallback() Type: " << cbtype; std::cerr << " errCode: " << errcode; diff --git a/libbitdht/src/bitdht/bdnode.cc b/libbitdht/src/bitdht/bdnode.cc index 5abdf439d..672df2870 100644 --- a/libbitdht/src/bitdht/bdnode.cc +++ b/libbitdht/src/bitdht/bdnode.cc @@ -66,8 +66,7 @@ bdNode::bdNode(bdNodeId *ownId, std::string dhtVersion, std::string bootfile, bdDhtFunctions *fns) - :mOwnId(*ownId), mNodeSpace(ownId, fns), mStore(bootfile, fns), mDhtVersion(dhtVersion), mFns(fns), - mQueryMgr(NULL), mConnMgr(NULL), mFilterPeers(NULL) + :mNodeSpace(ownId, fns), mQueryMgr(NULL), mConnMgr(NULL), mFilterPeers(NULL), mOwnId(*ownId), mDhtVersion(dhtVersion), mStore(bootfile, fns), mFns(fns) { init(); /* (uses this pointers) stuff it - do it here! */ @@ -194,12 +193,6 @@ void bdNode::iteration() mFns->bdPrintNodeId(std::cerr, &mOwnId); std::cerr << std::endl; #endif - /* iterate through queries */ - - bdId id; - bdNodeId targetNodeId; - std::list::iterator it; - std::list::iterator bit; /* process incoming msgs */ while(mIncomingMsgs.size() > 0) @@ -418,7 +411,7 @@ void bdNode::checkPotentialPeer(bdId *id, bdId *src) } -void bdNode::addPotentialPeer(bdId *id, bdId *src) +void bdNode::addPotentialPeer(bdId *id, bdId */*src*/) { mPotentialPeers.push_back(*id); } diff --git a/libbitdht/src/bitdht/bdpeer.cc b/libbitdht/src/bitdht/bdpeer.cc index 910f041e3..86057373d 100644 --- a/libbitdht/src/bitdht/bdpeer.cc +++ b/libbitdht/src/bitdht/bdpeer.cc @@ -412,7 +412,6 @@ int bdSpace::find_exactnode(const bdId *id, bdPeer &peer) bdBucket &buck = buckets[buckno]; std::list::iterator eit; - int matchCount = 0; for(eit = buck.entries.begin(); eit != buck.entries.end(); eit++) { if (*id == eit->mPeerId) @@ -576,7 +575,6 @@ int bdSpace::updateAttachedPeers() /* start from the back, as these are the most recently seen (and more likely to be the old ATTACHED) */ for(eit = it->entries.rbegin(); eit != it->entries.rend(); eit++) { - bool added = false; if (doAttached) { if ((eit->mPeerFlags & mAttachedFlags) == mAttachedFlags) diff --git a/libbitdht/src/bitdht/bdquery.cc b/libbitdht/src/bitdht/bdquery.cc index 87a9bdd92..4a076c6f3 100644 --- a/libbitdht/src/bitdht/bdquery.cc +++ b/libbitdht/src/bitdht/bdquery.cc @@ -504,7 +504,6 @@ int bdQuery::worthyPotentialPeer(const bdId *id) * if it is already in mClosest -> false. old peer. * if it is > mClosest.rbegin() -> false. too far way. */ - int retval = 1; std::multimap::iterator it, sit, eit; sit = mClosest.lower_bound(dist); diff --git a/libbitdht/src/util/bdthreads.h b/libbitdht/src/util/bdthreads.h index d44ff947d..23350af18 100644 --- a/libbitdht/src/util/bdthreads.h +++ b/libbitdht/src/util/bdthreads.h @@ -39,6 +39,9 @@ class bdMutex bdMutex(bool recursive = false) { + /* remove unused parameter warnings */ + (void) recursive; + #if 0 // TESTING WITHOUT RECURSIVE if(recursive) {