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
pull/1/head
Tatsuhiro Tsujikawa 2010-03-08 12:17:26 +00:00
parent c4a35932cb
commit ab6644c3de
3 changed files with 12 additions and 4 deletions

View File

@ -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> 2010-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed unitest fails if openssl doesn't support sha-256. Fixed unitest fails if openssl doesn't support sha-256.

View File

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

View File

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