diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-07 20:06:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 18:05:32 (GMT) |
commit | 77f60392d93f41a8828d3db1d7b76d45f1535d07 (patch) | |
tree | f9269d9beaa720270a4d2eed879d79b9d22aef54 /Source/cmCryptoHash.cxx | |
parent | 473ca1ac4a5df336ff09ee2c666e437eabf43bc9 (diff) | |
download | CMake-77f60392d93f41a8828d3db1d7b76d45f1535d07.zip CMake-77f60392d93f41a8828d3db1d7b76d45f1535d07.tar.gz CMake-77f60392d93f41a8828d3db1d7b76d45f1535d07.tar.bz2 |
stringapi: Accept strings when MD5 hashing data
Diffstat (limited to 'Source/cmCryptoHash.cxx')
-rw-r--r-- | Source/cmCryptoHash.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 7f4b10f..0d3c6bb 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -35,18 +35,18 @@ cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo) } //---------------------------------------------------------------------------- -std::string cmCryptoHash::HashString(const char* input) +std::string cmCryptoHash::HashString(const std::string& input) { this->Initialize(); - this->Append(reinterpret_cast<unsigned char const*>(input), - static_cast<int>(strlen(input))); + this->Append(reinterpret_cast<unsigned char const*>(&input[0]), + static_cast<int>(input.size())); return this->Finalize(); } //---------------------------------------------------------------------------- -std::string cmCryptoHash::HashFile(const char* file) +std::string cmCryptoHash::HashFile(const std::string& file) { - cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary); + cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary); if(!fin) { return ""; |