diff options
author | lloyd <[email protected]> | 2012-05-18 20:44:34 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-18 20:44:34 +0000 |
commit | 8383b0b503c812e45f2780217b048a19a8946853 (patch) | |
tree | 939403bad80ee2b1e13b69c82adc316422a9c7d6 /checks | |
parent | c691561f3198f481c13457433efbccc1c9fcd898 (diff) |
Replace 0 and NULL pointer constants with nullptr. Also fix an old
style cast in secmem.h
Diffstat (limited to 'checks')
-rw-r--r-- | checks/dolook.cpp | 20 | ||||
-rw-r--r-- | checks/pk.cpp | 4 | ||||
-rw-r--r-- | checks/pk_bench.cpp | 10 | ||||
-rw-r--r-- | checks/validate.cpp | 6 |
4 files changed, 21 insertions, 19 deletions
diff --git a/checks/dolook.cpp b/checks/dolook.cpp index 20e260f64..364a3f8c3 100644 --- a/checks/dolook.cpp +++ b/checks/dolook.cpp @@ -139,7 +139,7 @@ class KDF_Filter : public Filter Filter* lookup_pbkdf(const std::string& algname, const std::vector<std::string>& params) { - PBKDF* pbkdf = 0; + PBKDF* pbkdf = nullptr; try { pbkdf = get_pbkdf(algname); @@ -149,7 +149,7 @@ Filter* lookup_pbkdf(const std::string& algname, if(pbkdf) return new PBKDF_Filter(pbkdf, params[0], to_u32bit(params[1]), to_u32bit(params[2])); - return 0; + return nullptr; } void RNG_Filter::write(const byte[], size_t length) @@ -163,7 +163,7 @@ void RNG_Filter::write(const byte[], size_t length) Filter* lookup_rng(const std::string& algname, const std::string& key) { - RandomNumberGenerator* prng = 0; + RandomNumberGenerator* prng = nullptr; #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) if(algname == "AutoSeeded") @@ -233,21 +233,21 @@ Filter* lookup_rng(const std::string& algname, return new RNG_Filter(prng); } - return 0; + return nullptr; } Filter* lookup_kdf(const std::string& algname, const std::string& salt, const std::string& params) { - KDF* kdf = 0; + KDF* kdf = nullptr; try { kdf = get_kdf(algname); } - catch(...) { return 0; } + catch(...) { return nullptr; } if(kdf) return new KDF_Filter(kdf, salt, to_u32bit(params)); - return 0; + return nullptr; } Filter* lookup_encoder(const std::string& algname) @@ -278,7 +278,7 @@ Filter* lookup_encoder(const std::string& algname) return new Zlib_Decompression; #endif - return 0; + return nullptr; } } @@ -288,7 +288,7 @@ Filter* lookup(const std::string& algname, { std::string key = params[0]; std::string iv = params[1]; - Filter* filter = 0; + Filter* filter = nullptr; // The order of the lookup has to change based on how the names are // formatted and parsed. @@ -304,6 +304,6 @@ Filter* lookup(const std::string& algname, filter = lookup_pbkdf(algname, params); if(filter) return filter; - return 0; + return nullptr; } diff --git a/checks/pk.cpp b/checks/pk.cpp index 261c5f78c..5ef5df94b 100644 --- a/checks/pk.cpp +++ b/checks/pk.cpp @@ -108,7 +108,7 @@ void validate_save_and_load(const Private_Key* priv_key, DataSource_Memory input_pub(pub_pem); std::auto_ptr<Public_Key> restored_pub(X509::load_key(input_pub)); - if(restored_pub.get() == 0) + if(!restored_pub.get()) std::cout << "Could not recover " << name << " public key\n"; else if(restored_pub->check_key(rng, true) == false) std::cout << "Restored pubkey failed self tests " << name << "\n"; @@ -128,7 +128,7 @@ void validate_save_and_load(const Private_Key* priv_key, std::auto_ptr<Private_Key> restored_priv( PKCS8::load_key(input_priv, rng)); - if(restored_priv.get() == 0) + if(!restored_priv.get()) std::cout << "Could not recover " << name << " privlic key\n"; else if(restored_priv->check_key(rng, true) == false) std::cout << "Restored privkey failed self tests " << name << "\n"; diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index 8241ee5d1..da2221b90 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -83,7 +83,7 @@ const char* ec_domains[] = { "secp256r1", "secp384r1", "secp521r1", - 0 + nullptr }; class Benchmark_Report @@ -462,7 +462,7 @@ void benchmark_dsa_nr(RandomNumberGenerator& rng, const char* domains[] = { "dsa/jce/1024", "dsa/botan/2048", "dsa/botan/3072", - NULL }; + nullptr }; std::string algo_name; @@ -513,7 +513,7 @@ void benchmark_dh(RandomNumberGenerator& rng, "modp/ietf/4096", "modp/ietf/6144", "modp/ietf/8192", - NULL }; + nullptr }; for(size_t j = 0; domains[j]; j++) { @@ -574,7 +574,7 @@ void benchmark_dlies(RandomNumberGenerator& rng, "modp/ietf/4096", "modp/ietf/6144", "modp/ietf/8192", - NULL }; + nullptr }; for(size_t j = 0; domains[j]; j++) { @@ -633,7 +633,7 @@ void benchmark_elg(RandomNumberGenerator& rng, "modp/ietf/4096", "modp/ietf/6144", "modp/ietf/8192", - NULL }; + nullptr }; const std::string algo_name = "ElGamal"; diff --git a/checks/validate.cpp b/checks/validate.cpp index c6a4a29d0..bae5e857f 100644 --- a/checks/validate.cpp +++ b/checks/validate.cpp @@ -474,8 +474,10 @@ bool failed_test(const std::string& algo, try { Botan::Filter* test = lookup(algo, params); - if(test == 0 && is_extension) return !exp_pass; - if(test == 0) + + if(!test && is_extension) return !exp_pass; + + if(!test) { if(algo != last_missing) { |