aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-02-08 21:01:11 +0100
committerDaniel Neus <[email protected]>2016-02-08 21:07:18 +0100
commit4242b7593b5aae2b2d1483fcc7ff002c1deeb956 (patch)
treefcaaab2bf7d050852e90b6694813fdd3b6551786
parent9102d33dbd35e36d385ad813220446384a214030 (diff)
V816 It is more efficient to catch exception by reference rather than by value. asn1_time.cpp 159
-rw-r--r--src/lib/asn1/asn1_time.cpp4
-rw-r--r--src/lib/pbkdf/pbkdf2/pbkdf2.cpp2
-rw-r--r--src/lib/pubkey/keypair/keypair.cpp2
-rw-r--r--src/lib/pubkey/mceies/mceies.cpp2
-rw-r--r--src/lib/pubkey/pk_keys.cpp2
-rw-r--r--src/lib/pubkey/pubkey.cpp2
-rw-r--r--src/tests/test_x509_path.cpp2
7 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/asn1/asn1_time.cpp b/src/lib/asn1/asn1_time.cpp
index a9dffa95c..67fc8b5ac 100644
--- a/src/lib/asn1/asn1_time.cpp
+++ b/src/lib/asn1/asn1_time.cpp
@@ -149,14 +149,14 @@ void X509_Time::set_to(const std::string& t_spec, ASN1_Tag spec_tag)
set_to(t_spec, GENERALIZED_TIME);
return;
}
- catch(Invalid_Argument) {} // Not a generalized time. Continue
+ catch(Invalid_Argument&) {} // Not a generalized time. Continue
try
{
set_to(t_spec, UTC_TIME);
return;
}
- catch(Invalid_Argument) {} // Not a UTC time. Continue
+ catch(Invalid_Argument&) {} // Not a UTC time. Continue
throw Invalid_Argument("Time string could not be parsed as GeneralizedTime or UTCTime.");
}
diff --git a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp
index 94c587f05..5a8f529c6 100644
--- a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp
+++ b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp
@@ -40,7 +40,7 @@ pbkdf2(MessageAuthenticationCode& prf,
{
prf.set_key(reinterpret_cast<const byte*>(passphrase.data()), passphrase.size());
}
- catch(Invalid_Key_Length)
+ catch(Invalid_Key_Length&)
{
throw Exception("PBKDF2 with " + prf.name() +
" cannot accept passphrases of length " +
diff --git a/src/lib/pubkey/keypair/keypair.cpp b/src/lib/pubkey/keypair/keypair.cpp
index ef211ffd4..0f5a48541 100644
--- a/src/lib/pubkey/keypair/keypair.cpp
+++ b/src/lib/pubkey/keypair/keypair.cpp
@@ -59,7 +59,7 @@ bool signature_consistency_check(RandomNumberGenerator& rng,
{
signature = signer.sign_message(message, rng);
}
- catch(Encoding_Error)
+ catch(Encoding_Error&)
{
return false;
}
diff --git a/src/lib/pubkey/mceies/mceies.cpp b/src/lib/pubkey/mceies/mceies.cpp
index 0af71719a..95042e529 100644
--- a/src/lib/pubkey/mceies/mceies.cpp
+++ b/src/lib/pubkey/mceies/mceies.cpp
@@ -98,7 +98,7 @@ mceies_decrypt(const McEliece_PrivateKey& privkey,
aead->finish(pt, 0);
return pt;
}
- catch(Integrity_Failure)
+ catch(Integrity_Failure&)
{
throw;
}
diff --git a/src/lib/pubkey/pk_keys.cpp b/src/lib/pubkey/pk_keys.cpp
index 635934037..ebaa0eb69 100644
--- a/src/lib/pubkey/pk_keys.cpp
+++ b/src/lib/pubkey/pk_keys.cpp
@@ -19,7 +19,7 @@ OID Public_Key::get_oid() const
try {
return OIDS::lookup(algo_name());
}
- catch(Lookup_Error)
+ catch(Lookup_Error&)
{
throw Lookup_Error("PK algo " + algo_name() + " has no defined OIDs");
}
diff --git a/src/lib/pubkey/pubkey.cpp b/src/lib/pubkey/pubkey.cpp
index 37408272a..d3b711f1e 100644
--- a/src/lib/pubkey/pubkey.cpp
+++ b/src/lib/pubkey/pubkey.cpp
@@ -231,7 +231,7 @@ bool PK_Verifier::check_signature(const byte sig[], size_t length)
throw Decoding_Error("PK_Verifier: Unknown signature format " +
std::to_string(m_sig_format));
}
- catch(Invalid_Argument) { return false; }
+ catch(Invalid_Argument&) { return false; }
}
}
diff --git a/src/tests/test_x509_path.cpp b/src/tests/test_x509_path.cpp
index 9bdf3721a..7e2039ab4 100644
--- a/src/tests/test_x509_path.cpp
+++ b/src/tests/test_x509_path.cpp
@@ -145,7 +145,7 @@ std::vector<Test::Result> NIST_Path_Validation_Tests::run()
// Do nothing, just test filesystem access
Botan::get_files_recursive(nist_test_dir);
}
- catch(Botan::No_Filesystem_Access)
+ catch(Botan::No_Filesystem_Access&)
{
Test::Result result("NIST path validation");
result.test_note("Skipping due to missing filesystem access");