diff options
author | Brad King <brad.king@kitware.com> | 2013-06-14 13:01:22 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-06-14 13:01:22 (GMT) |
commit | d556631079c8c54eb1a569b5b702412170ceee94 (patch) | |
tree | 19a4751915b02ee826a05ab5dfe95193fa88483c /Source | |
parent | 1f8733a0c25442a90397f0f7dd0fcb583b15ae8e (diff) | |
parent | 75994d953e261b388aa31e4d8ecd8af9fe53142b (diff) | |
download | CMake-d556631079c8c54eb1a569b5b702412170ceee94.zip CMake-d556631079c8c54eb1a569b5b702412170ceee94.tar.gz CMake-d556631079c8c54eb1a569b5b702412170ceee94.tar.bz2 |
Merge topic 'sha2-alignment'
75994d9 cmCryptoHash: Increase alignment of HashFile buffer
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCryptoHash.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index a1505bd..a4f6ac4 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -54,8 +54,8 @@ std::string cmCryptoHash::HashFile(const char* file) this->Initialize(); // Should be efficient enough on most system: - const int bufferSize = 4096; - char buffer[bufferSize]; + cm_sha2_uint64_t buffer[512]; + char* buffer_c = reinterpret_cast<char*>(buffer); unsigned char const* buffer_uc = reinterpret_cast<unsigned char const*>(buffer); // This copy loop is very sensitive on certain platforms with @@ -65,7 +65,7 @@ std::string cmCryptoHash::HashFile(const char* file) // error occurred. Therefore, the loop should be safe everywhere. while(fin) { - fin.read(buffer, bufferSize); + fin.read(buffer_c, sizeof(buffer)); if(int gcount = static_cast<int>(fin.gcount())) { this->Append(buffer_uc, gcount); |