Quellcode durchsuchen

2010-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Fixed compile error and unit test error without openssl and
	gnutls.
	* src/MetalinkParserController.cc
	* test/MetalinkProcessorTest.cc
Tatsuhiro Tsujikawa vor 15 Jahren
Ursprung
Commit
ab6644c3de
3 geänderte Dateien mit 12 neuen und 4 gelöschten Zeilen
  1. 7 0
      ChangeLog
  2. 2 0
      src/MetalinkParserController.cc
  3. 3 4
      test/MetalinkProcessorTest.cc

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2010-03-08  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Fixed compile error and unit test error without openssl and
+	gnutls.
+	* src/MetalinkParserController.cc
+	* test/MetalinkProcessorTest.cc
+
 2010-03-08  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Fixed unitest fails if openssl doesn't support sha-256.

+ 2 - 0
src/MetalinkParserController.cc

@@ -53,12 +53,14 @@
 
 namespace aria2 {
 
+#ifdef ENABLE_MESSAGE_DIGEST
 static bool isValidHash(const std::string& algo, const std::string& hash)
 {
   return util::isHexDigit(hash) &&
     MessageDigestContext::supports(algo) &&
     MessageDigestContext::digestLength(algo)*2 == hash.size();
 }
+#endif // ENABLE_MESSAGE_DIGEST
 
 MetalinkParserController::MetalinkParserController():
   _metalinker(new Metalinker())

+ 3 - 4
test/MetalinkProcessorTest.cc

@@ -121,10 +121,7 @@ void MetalinkProcessorTest::testParseFileV4()
       (std::string("44213f9f4d59b557314fadcd233232eebcac8012"),
        e->chunkChecksum->getChecksum(2));    
   }
-#else // !ENABLE_MESSAGE_DIGEST
-  CPPUNIT_ASSERT(e->checksum.isNull());
-  CPPUNIT_ASSERT(e->chunkChecksum.isNull());
-#endif // !ENABLE_MESSAGE_DIGEST
+#endif // ENABLE_MESSAGE_DIGEST
   CPPUNIT_ASSERT(!e->getSignature().isNull());
   CPPUNIT_ASSERT_EQUAL(std::string("application/pgp-signature"),
                        e->getSignature()->getType());
@@ -339,6 +336,7 @@ void MetalinkProcessorTest::testParseFileV4_attrs()
       // success
     }
   }
+#ifdef ENABLE_MESSAGE_DIGEST
   {
     // Testing pieces@length
     // No pieces@length
@@ -455,6 +453,7 @@ void MetalinkProcessorTest::testParseFileV4_attrs()
       CPPUNIT_FAIL("exception must be thrown.");
     } catch(RecoverableException& e) {}
   }
+#endif // ENABLE_MESSAGE_DIGEST
   {
     // Testing signature@mediatype
     // No hash@type