2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Removed "using namespace std;" from all sources. Appended std:: 
prefix to c++
	standard classes.
	Included string.h where mem* function are used.
This commit is contained in:
Tatsuhiro Tsujikawa 2008-02-08 15:53:45 +00:00
parent d82e183d34
commit 1b7c198289
801 changed files with 12024 additions and 8627 deletions

View file

@ -10,6 +10,8 @@
#include "PeerMessageUtil.h"
#include <cppunit/extensions/HelperMacros.h>
namespace aria2 {
class DHTFindNodeReplyMessageTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(DHTFindNodeReplyMessageTest);
@ -28,17 +30,17 @@ CPPUNIT_TEST_SUITE_REGISTRATION(DHTFindNodeReplyMessageTest);
void DHTFindNodeReplyMessageTest::testGetBencodedMessage()
{
DHTNodeHandle localNode = new DHTNode();
DHTNodeHandle remoteNode = new DHTNode();
SharedHandle<DHTNode> localNode = new DHTNode();
SharedHandle<DHTNode> remoteNode = new DHTNode();
char tid[DHT_TRANSACTION_ID_LENGTH];
DHTUtil::generateRandomData(tid, DHT_TRANSACTION_ID_LENGTH);
string transactionID(&tid[0], &tid[DHT_TRANSACTION_ID_LENGTH]);
std::string transactionID(&tid[0], &tid[DHT_TRANSACTION_ID_LENGTH]);
DHTFindNodeReplyMessage msg(localNode, remoteNode, transactionID);
string compactNodeInfo;
DHTNodeHandle nodes[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
std::string compactNodeInfo;
SharedHandle<DHTNode> nodes[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
for(size_t i = 0; i < DHTBucket::K; ++i) {
nodes[i] = new DHTNode();
nodes[i]->setIPAddress("192.168.0."+Util::uitos(i+1));
@ -47,12 +49,12 @@ void DHTFindNodeReplyMessageTest::testGetBencodedMessage()
char buf[6];
CPPUNIT_ASSERT(PeerMessageUtil::createcompact(buf, nodes[i]->getIPAddress(), nodes[i]->getPort()));
compactNodeInfo +=
string(&nodes[i]->getID()[0], &nodes[i]->getID()[DHT_ID_LENGTH])+
string(&buf[0], &buf[sizeof(buf)]);
std::string(&nodes[i]->getID()[0], &nodes[i]->getID()[DHT_ID_LENGTH])+
std::string(&buf[0], &buf[sizeof(buf)]);
}
msg.setClosestKNodes(DHTNodes(&nodes[0], &nodes[DHTBucket::K]));
msg.setClosestKNodes(std::deque<SharedHandle<DHTNode> >(&nodes[0], &nodes[DHTBucket::K]));
string msgbody = msg.getBencodedMessage();
std::string msgbody = msg.getBencodedMessage();
SharedHandle<Dictionary> cm = new Dictionary();
cm->put("t", new Data(transactionID));
@ -67,3 +69,5 @@ void DHTFindNodeReplyMessageTest::testGetBencodedMessage()
CPPUNIT_ASSERT_EQUAL(v.getBencodedData(), msgbody);
}
} // namespace aria2