Coverage Report

Created: 2024-11-21 07:03

/src/cryptopp/algparam.cpp
Line
Count
Source (jump to first uncovered line)
1
// algparam.cpp - originally written and placed in the public domain by Wei Dai
2
3
#include "pch.h"
4
5
#ifndef CRYPTOPP_IMPORTS
6
7
#include "algparam.h"
8
#include "integer.h"
9
10
NAMESPACE_BEGIN(CryptoPP)
11
12
bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
13
266
{
14
266
  if (strcmp(name, "ValueNames") == 0)
15
0
    return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);
16
266
  else
17
266
    return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);
18
266
}
19
20
void AlgorithmParametersBase::operator=(const AlgorithmParametersBase &rhs)
21
0
{
22
0
  CRYPTOPP_UNUSED(rhs);
23
0
  CRYPTOPP_ASSERT(false);
24
0
}
25
26
bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
27
5.50M
{
28
5.50M
  if (strcmp(name, "ValueNames") == 0)
29
0
  {
30
0
    NameValuePairs::ThrowIfTypeMismatch(name, typeid(std::string), valueType);
31
0
    if (m_next.get())
32
0
        m_next->GetVoidValue(name, valueType, pValue);
33
0
    (*reinterpret_cast<std::string *>(pValue) += m_name) += ";";
34
0
    return true;
35
0
  }
36
5.50M
  else if (strcmp(name, m_name) == 0)
37
5.36M
  {
38
5.36M
    AssignValue(name, valueType, pValue);
39
5.36M
    m_used = true;
40
5.36M
    return true;
41
5.36M
  }
42
140k
  else if (m_next.get())
43
138k
    return m_next->GetVoidValue(name, valueType, pValue);
44
1.95k
  else
45
1.95k
      return false;
46
5.50M
}
47
48
AlgorithmParameters::AlgorithmParameters()
49
  : m_defaultThrowIfNotUsed(true)
50
5.23M
{
51
5.23M
}
52
53
AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
54
  : m_defaultThrowIfNotUsed(x.m_defaultThrowIfNotUsed)
55
5.23M
{
56
5.23M
  m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
57
5.23M
}
58
59
AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
60
0
{
61
0
  m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
62
0
  return *this;
63
0
}
64
65
bool AlgorithmParameters::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
66
5.37M
{
67
5.37M
  if (m_next.get())
68
5.37M
    return m_next->GetVoidValue(name, valueType, pValue);
69
0
  else
70
0
    return false;
71
5.37M
}
72
73
NAMESPACE_END
74
75
#endif