summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-11-16 15:04:41 (GMT)
committerBrad King <brad.king@kitware.com>2011-11-16 15:15:44 (GMT)
commit293a7f4e2ae9b458d3efefcfe133d0ad5320a1b2 (patch)
treee3ff0fa7f5d7ba3d6722b0cc1eef4f917a95e7ea /Source/cmFileCommand.cxx
parent46ab0561fc29446a736985816b005200aad9489c (diff)
downloadCMake-293a7f4e2ae9b458d3efefcfe133d0ad5320a1b2.zip
CMake-293a7f4e2ae9b458d3efefcfe133d0ad5320a1b2.tar.gz
CMake-293a7f4e2ae9b458d3efefcfe133d0ad5320a1b2.tar.bz2
cmCryptoHash: Provide factory "New" method
Construct a cmCryptoHash subclass instance based on the name of the desired hash algorithm.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx14
1 files changed, 1 insertions, 13 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 35c743d..bab3116 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -360,19 +360,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
return false;
}
- cmsys::auto_ptr<cmCryptoHash> hash;
- if(args[0] == "MD5")
- { hash.reset(new cmCryptoHashMD5); }
- else if(args[0] == "SHA1")
- { hash.reset(new cmCryptoHashSHA1); }
- else if(args[0] == "SHA224")
- { hash.reset(new cmCryptoHashSHA224); }
- else if(args[0] == "SHA256")
- { hash.reset(new cmCryptoHashSHA256); }
- else if(args[0] == "SHA384")
- { hash.reset(new cmCryptoHashSHA384); }
- else if(args[0] == "SHA512")
- { hash.reset(new cmCryptoHashSHA512); }
+ cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if(hash.get())
{
std::string out = hash->HashFile(args[1].c_str());