summaryrefslogtreecommitdiff
path: root/algparam.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-11-05 01:59:46 -0500
committerJeffrey Walton <noloader@gmail.com>2015-11-05 01:59:46 -0500
commit48809d4e85c125814425c621d8d0d89f95405924 (patch)
tree1010fd16c4b1199f3d27dd726dda241a2bd29f83 /algparam.cpp
parent025337a94aceb75d188149db70c2094673772816 (diff)
downloadcryptopp-git-48809d4e85c125814425c621d8d0d89f95405924.tar.gz
CRYPTOPP 5.6.3 RC6 checkin
Diffstat (limited to 'algparam.cpp')
-rw-r--r--algparam.cpp156
1 files changed, 77 insertions, 79 deletions
diff --git a/algparam.cpp b/algparam.cpp
index 9976fb28..2e93c9db 100644
--- a/algparam.cpp
+++ b/algparam.cpp
@@ -1,79 +1,77 @@
-// algparam.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-
-#ifndef CRYPTOPP_IMPORTS
-
-#include "algparam.h"
-#include "misc.h"
-#include "trap.h"
-
-NAMESPACE_BEGIN(CryptoPP)
-
-PAssignIntToInteger g_pAssignIntToInteger = NULL;
-
-bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
-{
- if (strcmp(name, "ValueNames") == 0)
- return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);
- else
- return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);
-}
-
-void AlgorithmParametersBase::operator=(const AlgorithmParametersBase& rhs)
-{
- CRYPTOPP_UNUSED(rhs);
- CRYPTOPP_ASSERT(false);
-}
-
-bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
-{
- if (strcmp(name, "ValueNames") == 0)
- {
- NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType);
- if (m_next.get())
- m_next->GetVoidValue(name, valueType, pValue);
- (*reinterpret_cast<std::string *>(pValue) += m_name) += ";";
- return true;
- }
- else if (strcmp(name, m_name) == 0)
- {
- AssignValue(name, valueType, pValue);
- m_used = true;
- return true;
- }
- else if (m_next.get())
- return m_next->GetVoidValue(name, valueType, pValue);
- else
- return false;
-}
-
-AlgorithmParameters::AlgorithmParameters()
- : m_defaultThrowIfNotUsed(true)
-{
-}
-
-AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
- : m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed)
-{
- m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
-}
-
-AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
-{
- // Should this be guarded for operations on itself??? This class befuddles me at times...
- m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
- return *this;
-}
-
-bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
-{
- if (m_next.get())
- return m_next->GetVoidValue(name, valueType, pValue);
- else
- return false;
-}
-
-NAMESPACE_END
-
-#endif
+// algparam.cpp - written and placed in the public domain by Wei Dai
+
+#include "pch.h"
+
+#ifndef CRYPTOPP_IMPORTS
+
+#include "algparam.h"
+#include "integer.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+PAssignIntToInteger g_pAssignIntToInteger = NULL;
+
+bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
+{
+ if (strcmp(name, "ValueNames") == 0)
+ return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);
+ else
+ return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);
+}
+
+void AlgorithmParametersBase::operator=(const AlgorithmParametersBase &rhs)
+{
+ CRYPTOPP_UNUSED(rhs);
+ assert(false);
+}
+
+bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
+{
+ if (strcmp(name, "ValueNames") == 0)
+ {
+ NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType);
+ if (m_next.get())
+ m_next->GetVoidValue(name, valueType, pValue);
+ (*reinterpret_cast<std::string *>(pValue) += m_name) += ";";
+ return true;
+ }
+ else if (strcmp(name, m_name) == 0)
+ {
+ AssignValue(name, valueType, pValue);
+ m_used = true;
+ return true;
+ }
+ else if (m_next.get())
+ return m_next->GetVoidValue(name, valueType, pValue);
+ else
+ return false;
+}
+
+AlgorithmParameters::AlgorithmParameters()
+ : m_defaultThrowIfNotUsed(true)
+{
+}
+
+AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
+ : m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed)
+{
+ m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
+}
+
+AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
+{
+ m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
+ return *this;
+}
+
+bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
+{
+ if (m_next.get())
+ return m_next->GetVoidValue(name, valueType, pValue);
+ else
+ return false;
+}
+
+NAMESPACE_END
+
+#endif