diff options
author | lloyd <[email protected]> | 2007-10-19 18:11:06 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-10-19 18:11:06 +0000 |
commit | 807b84081f91f1f0cd5255198ce31745d410c28c (patch) | |
tree | 20574311297aee66974abce1fa138b0116aff5fc /checks | |
parent | 11d6a889becbb8fe6c2d78dd60b9673b791c17b9 (diff) |
Remove several uses of old style C casts in favor of C++98's static_cast and
reinterpret_cast
Diffstat (limited to 'checks')
-rw-r--r-- | checks/dolook2.cpp | 2 | ||||
-rw-r--r-- | checks/pk.cpp | 17 | ||||
-rw-r--r-- | checks/validate.cpp | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/checks/dolook2.cpp b/checks/dolook2.cpp index 53e71dc26..b6c9ba339 100644 --- a/checks/dolook2.cpp +++ b/checks/dolook2.cpp @@ -19,7 +19,7 @@ class S2K_Filter : public Filter { public: void write(const byte in[], u32bit len) - { passphrase += std::string((const char*)in, len); } + { passphrase += std::string(reinterpret_cast<const char*>(in), len); } void end_msg() { s2k->change_salt(salt, salt.size()); diff --git a/checks/pk.cpp b/checks/pk.cpp index bb0a27f2a..f2c2401fd 100644 --- a/checks/pk.cpp +++ b/checks/pk.cpp @@ -28,7 +28,7 @@ using namespace Botan; static BigInt to_bigint(const std::string& h) { - return BigInt::decode((const byte*)h.data(), + return BigInt::decode(reinterpret_cast<const byte*>(h.data()), h.length(), BigInt::Hexadecimal); } @@ -326,7 +326,9 @@ u32bit validate_rsa_enc_pkcs8(const std::string& algo, strip_newlines(pass); /* it will have a newline thanks to the messy decoding method we use */ - DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length()); + DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()), + str[0].length()); + Private_Key* privkey = PKCS8::load_key(keysource, pass); RSA_PrivateKey* rsapriv = dynamic_cast<RSA_PrivateKey*>(privkey); @@ -441,7 +443,8 @@ u32bit validate_rsa_ver_x509(const std::string& algo, if(str.size() != 5) /* is actually 3, parse() adds extra empty ones */ throw Exception("Invalid input from pk_valid.dat"); - DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length()); + DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()), + str[0].length()); Public_Key* key = X509::load_key(keysource); @@ -518,7 +521,9 @@ u32bit validate_dsa_sig(const std::string& algo, strip_newlines(pass); /* it will have a newline thanks to the messy decoding method we use */ - DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length()); + DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()), + str[0].length()); + Private_Key* privkey = PKCS8::load_key(keysource, pass); DSA_PrivateKey* dsapriv = dynamic_cast<DSA_PrivateKey*>(privkey); @@ -545,7 +550,9 @@ u32bit validate_dsa_ver(const std::string& algo, if(str.size() != 5) /* is actually 3, parse() adds extra empty ones */ throw Exception("Invalid input from pk_valid.dat"); - DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length()); + DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()), + str[0].length()); + Public_Key* key = X509::load_key(keysource); DSA_PublicKey* dsakey = dynamic_cast<DSA_PublicKey*>(key); diff --git a/checks/validate.cpp b/checks/validate.cpp index b10b53b98..d634d3bb3 100644 --- a/checks/validate.cpp +++ b/checks/validate.cpp @@ -263,7 +263,7 @@ bool failed_test(const std::string& algo, bool OK = true; for(u32bit j = offset; j != offset+length; j++) - if((byte)output[j] != peekbuf[j-offset]) + if(static_cast<byte>(output[j]) != peekbuf[j-offset]) OK = false; if(!OK) |