diff options
author | Matthias Maennich <matthias@maennich.net> | 2017-09-21 21:06:05 (GMT) |
---|---|---|
committer | Matthias Maennich <matthias@maennich.net> | 2017-09-25 22:07:19 (GMT) |
commit | f0489856e30b1b5236d1897071ea38dfde438fc7 (patch) | |
tree | f2a786e0c3fe5e9d234f62c3ca3cacfdbd70ef8f /Source/cmCryptoHash.cxx | |
parent | eae3765b67b653d3f00afa44a60719a387262af8 (diff) | |
download | CMake-f0489856e30b1b5236d1897071ea38dfde438fc7.zip CMake-f0489856e30b1b5236d1897071ea38dfde438fc7.tar.gz CMake-f0489856e30b1b5236d1897071ea38dfde438fc7.tar.bz2 |
Retire std::auto_ptr and its macro CM_AUTO_PTR
Signed-off-by: Matthias Maennich <matthias@maennich.net>
Diffstat (limited to 'Source/cmCryptoHash.cxx')
-rw-r--r-- | Source/cmCryptoHash.cxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 965f55b..d914eb1 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -2,11 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCryptoHash.h" +#include "cmAlgorithms.h" #include "cm_kwiml.h" #include "cm_rhash.h" #include "cmsys/FStream.hxx" #include <string.h> +#include <memory> // IWYU pragma: keep + static unsigned int const cmCryptoHashAlgoToId[] = { /* clang-format needs this comment to break after the opening brace */ RHASH_MD5, // @@ -43,39 +46,39 @@ cmCryptoHash::~cmCryptoHash() rhash_free(this->CTX); } -CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo) +std::unique_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo) { if (strcmp(algo, "MD5") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoMD5)); + return cm::make_unique<cmCryptoHash>(AlgoMD5); } if (strcmp(algo, "SHA1") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA1)); + return cm::make_unique<cmCryptoHash>(AlgoSHA1); } if (strcmp(algo, "SHA224") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA224)); + return cm::make_unique<cmCryptoHash>(AlgoSHA224); } if (strcmp(algo, "SHA256") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA256)); + return cm::make_unique<cmCryptoHash>(AlgoSHA256); } if (strcmp(algo, "SHA384") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA384)); + return cm::make_unique<cmCryptoHash>(AlgoSHA384); } if (strcmp(algo, "SHA512") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA512)); + return cm::make_unique<cmCryptoHash>(AlgoSHA512); } if (strcmp(algo, "SHA3_224") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_224)); + return cm::make_unique<cmCryptoHash>(AlgoSHA3_224); } if (strcmp(algo, "SHA3_256") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_256)); + return cm::make_unique<cmCryptoHash>(AlgoSHA3_256); } if (strcmp(algo, "SHA3_384") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_384)); + return cm::make_unique<cmCryptoHash>(AlgoSHA3_384); } if (strcmp(algo, "SHA3_512") == 0) { - return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(AlgoSHA3_512)); + return cm::make_unique<cmCryptoHash>(AlgoSHA3_512); } - return CM_AUTO_PTR<cmCryptoHash>(nullptr); + return std::unique_ptr<cmCryptoHash>(nullptr); } bool cmCryptoHash::IntFromHexDigit(char input, char& output) |