Ver código fonte

2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Defined static const std::string IP("ip"), PORT("port") and use 
them
	instead of string literals.
	* src/DefaultPeerListProcessor.cc
	* src/DefaultPeerListProcessor.h
Tatsuhiro Tsujikawa 17 anos atrás
pai
commit
1aeefb5c4b
3 arquivos alterados com 17 adições e 2 exclusões
  1. 7 0
      ChangeLog
  2. 6 2
      src/DefaultPeerListProcessor.cc
  3. 4 0
      src/DefaultPeerListProcessor.h

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-05-14  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Defined static const std::string IP("ip"), PORT("port") and use them
+	instead of string literals.
+	* src/DefaultPeerListProcessor.cc
+	* src/DefaultPeerListProcessor.h
+
 2008-05-14  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Made string literals for torrent file processing static const

+ 6 - 2
src/DefaultPeerListProcessor.cc

@@ -40,6 +40,10 @@
 
 namespace aria2 {
 
+const std::string DefaultPeerListProcessor::IP("ip");
+
+const std::string DefaultPeerListProcessor::PORT("port");
+
 DefaultPeerListProcessor::DefaultPeerListProcessor() {}
 
 DefaultPeerListProcessor::~DefaultPeerListProcessor() {}
@@ -63,8 +67,8 @@ void DefaultPeerListProcessor::extractPeer
     if(!peerDic) {
       break;
     }
-    const Data* ip = dynamic_cast<const Data*>(peerDic->get("ip"));
-    const Data* port = dynamic_cast<const Data*>(peerDic->get("port"));
+    const Data* ip = dynamic_cast<const Data*>(peerDic->get(IP));
+    const Data* port = dynamic_cast<const Data*>(peerDic->get(PORT));
     if(!ip || !port || !port->isNumber()) {
       continue;
     }

+ 4 - 0
src/DefaultPeerListProcessor.h

@@ -40,6 +40,10 @@
 namespace aria2 {
 
 class DefaultPeerListProcessor : public PeerListProcessor {
+private:
+  static const std::string IP;
+
+  static const std::string PORT;
 public:
   DefaultPeerListProcessor();