diff options
author | Jack Lloyd <[email protected]> | 2019-08-04 08:34:34 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-08-04 16:26:50 -0400 |
commit | df31111d6db8f7a2a494511036701b583d2c8340 (patch) | |
tree | 23df7edf12f15710db475407d493ed69ebc22688 /src | |
parent | 8917ec353e518be98a2ab141ab8814802530bf3b (diff) |
Remove unnecessary functions
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/asn1/asn1_oid.cpp | 12 | ||||
-rw-r--r-- | src/lib/asn1/oids.cpp | 16 | ||||
-rw-r--r-- | src/lib/asn1/oids.h | 9 | ||||
-rw-r--r-- | src/tests/test_oid.cpp | 2 |
4 files changed, 14 insertions, 25 deletions
diff --git a/src/lib/asn1/asn1_oid.cpp b/src/lib/asn1/asn1_oid.cpp index bf3e2515b..ca5006232 100644 --- a/src/lib/asn1/asn1_oid.cpp +++ b/src/lib/asn1/asn1_oid.cpp @@ -67,10 +67,13 @@ OID OID::from_string(const std::string& str) // first try as a dotted decimal OID string: std::vector<uint32_t> raw = parse_oid_str(str); - if(raw.empty() == false) + if(raw.size() > 0) return OID(std::move(raw)); - return OIDS::str2oid_or_throw(str); + const OID o = OIDS::str2oid_or_empty(name); + if(o.empty()) + throw Lookup_Error("No OID associated with name " + name); + return o; } /* @@ -106,7 +109,10 @@ std::string OID::to_string() const std::string OID::to_formatted_string() const { - return OIDS::oid2str_or_raw(*this); + const std::string s = OIDS::oid2str_or_empty(oid); + if(!s.empty()) + return s; + return this->to_string(); } /* diff --git a/src/lib/asn1/oids.cpp b/src/lib/asn1/oids.cpp index 8eae538a1..bece7a9b4 100644 --- a/src/lib/asn1/oids.cpp +++ b/src/lib/asn1/oids.cpp @@ -126,22 +126,6 @@ std::string OIDS::oid2str_or_throw(const OID& oid) return s; } -std::string OIDS::oid2str_or_raw(const OID& oid) - { - const std::string s = OIDS::oid2str_or_empty(oid); - if(s.empty()) - return oid.to_string(); - return s; - } - -OID OIDS::str2oid_or_throw(const std::string& name) - { - const OID o = OIDS::str2oid_or_empty(name); - if(o.empty()) - throw Lookup_Error("No OID associated with name " + name); - return o; - } - bool OIDS::have_oid(const std::string& name) { return OID_Map::global_registry().have_oid(name); diff --git a/src/lib/asn1/oids.h b/src/lib/asn1/oids.h index 167d9ade7..480e4f982 100644 --- a/src/lib/asn1/oids.h +++ b/src/lib/asn1/oids.h @@ -46,16 +46,13 @@ BOTAN_UNSTABLE_API std::string oid2str_or_empty(const OID& oid); BOTAN_UNSTABLE_API OID str2oid_or_empty(const std::string& name); BOTAN_UNSTABLE_API std::string oid2str_or_throw(const OID& oid); -BOTAN_UNSTABLE_API OID str2oid_or_throw(const std::string& name); - -BOTAN_UNSTABLE_API std::string oid2str_or_raw(const OID& oid); /** * See if an OID exists in the internal table. * @param oid the oid to check for * @return true if the oid is registered */ -BOTAN_UNSTABLE_API bool have_oid(const std::string& oid); +BOTAN_UNSTABLE_API bool BOTAN_DEPRECATED("Just lookup the value instead") have_oid(const std::string& oid); /** * Tests whether the specified OID stands for the specified name. @@ -63,9 +60,9 @@ BOTAN_UNSTABLE_API bool have_oid(const std::string& oid); * @param name the name to check * @return true if the specified OID stands for the specified name */ -inline bool BOTAN_DEPRECATED("Use oid == str2oid_or_throw(name)") name_of(const OID& oid, const std::string& name) +inline bool BOTAN_DEPRECATED("Use oid == OID::from_string(name)") name_of(const OID& oid, const std::string& name) { - return (oid == str2oid_or_throw(name)); + return (oid == str2oid_or_empty(name)); } inline std::string BOTAN_DEPRECATED("Use oid2str_or_empty") lookup(const OID& oid) diff --git a/src/tests/test_oid.cpp b/src/tests/test_oid.cpp index b8c6d5d7f..9ab1ad440 100644 --- a/src/tests/test_oid.cpp +++ b/src/tests/test_oid.cpp @@ -4,6 +4,8 @@ * Botan is released under the Simplified BSD License (see license.txt) */ +#define BOTAN_NO_DEPRECATED_WARNINGS + #include "tests.h" #if defined(BOTAN_HAS_ASN1) |