Ver código fonte

Removed MetalinkResource static strings

Tatsuhiro Tsujikawa 13 anos atrás
pai
commit
8788cae7e3
3 arquivos alterados com 5 adições e 27 exclusões
  1. 5 6
      src/MetalinkParserController.cc
  2. 0 10
      src/MetalinkResource.cc
  3. 0 11
      src/MetalinkResource.h

+ 5 - 6
src/MetalinkParserController.cc

@@ -192,15 +192,14 @@ void MetalinkParserController::setTypeOfResource(const std::string& type)
   if(!tResource_) {
     return;
   }
-  if(type == MetalinkResource::FTP) {
+  if(type == "ftp") {
     tResource_->type = MetalinkResource::TYPE_FTP;
-  } else if(type == MetalinkResource::HTTP) {
+  } else if(type == "http") {
     tResource_->type = MetalinkResource::TYPE_HTTP;
-  } else if(type == MetalinkResource::HTTPS) {
+  } else if(type == "https") {
     tResource_->type = MetalinkResource::TYPE_HTTPS;
-  } else if(type == MetalinkResource::BITTORRENT) {
-    tResource_->type = MetalinkResource::TYPE_BITTORRENT;
-  } else if(type == MetalinkResource::TORRENT) { // Metalink4Spec
+  } else if(type == "bittorrent" || type == "torrent") {
+    // "torrent" is Metalink4Spec
     tResource_->type = MetalinkResource::TYPE_BITTORRENT;
   } else {
     tResource_->type = MetalinkResource::TYPE_NOT_SUPPORTED;

+ 0 - 10
src/MetalinkResource.cc

@@ -40,16 +40,6 @@ std::string MetalinkResource::type2String[] = {
   "ftp", "http", "https", "bittorrent", "not_supported", "unknown"
 };
 
-const std::string MetalinkResource::HTTP("http");
-
-const std::string MetalinkResource::HTTPS("https");
-
-const std::string MetalinkResource::FTP("ftp");
-
-const std::string MetalinkResource::BITTORRENT("bittorrent");
-
-const std::string MetalinkResource::TORRENT("torrent");
-
 MetalinkResource::MetalinkResource()
   : type(TYPE_UNKNOWN),
     priority(getLowestPriority()),

+ 0 - 11
src/MetalinkResource.h

@@ -52,17 +52,6 @@ public:
   };
 
   static std::string type2String[];
-
-  static const std::string HTTP;
-
-  static const std::string HTTPS;
-
-  static const std::string FTP;
-
-  static const std::string BITTORRENT;
-
-  static const std::string TORRENT; // Metalink4Spec
-
 public:
   std::string url;
   TYPE type;