Added self-assignment guards or comment indicating why the check is not needed
parent
77206baf56
commit
8293570bd4
|
|
@ -61,6 +61,7 @@ AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
|
||||||
|
|
||||||
AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
|
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());
|
m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
ec2n.cpp
6
ec2n.cpp
|
|
@ -237,9 +237,11 @@ const EC2N::Point& EC2N::Double(const Point &P) const
|
||||||
/*
|
/*
|
||||||
EcPrecomputation<EC2N>& EcPrecomputation<EC2N>::operator=(const EcPrecomputation<EC2N> &rhs)
|
EcPrecomputation<EC2N>& EcPrecomputation<EC2N>::operator=(const EcPrecomputation<EC2N> &rhs)
|
||||||
{
|
{
|
||||||
|
if (this != &rhs)
|
||||||
|
{
|
||||||
|
DL_GroupPrecomputation::operator=(rhs);
|
||||||
m_ec = rhs.m_ec;
|
m_ec = rhs.m_ec;
|
||||||
m_ep = rhs.m_ep;
|
}
|
||||||
m_ep.m_group = m_ec.get();
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
gf2n.cpp
1
gf2n.cpp
|
|
@ -211,6 +211,7 @@ unsigned int PolynomialMod2::Parity() const
|
||||||
|
|
||||||
PolynomialMod2& PolynomialMod2::operator=(const PolynomialMod2& t)
|
PolynomialMod2& PolynomialMod2::operator=(const PolynomialMod2& t)
|
||||||
{
|
{
|
||||||
|
// Assign guards for self-assignment
|
||||||
reg.Assign(t.reg);
|
reg.Assign(t.reg);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -428,17 +428,17 @@ byte * ByteQueue::CreatePutSpace(size_t &size)
|
||||||
|
|
||||||
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
|
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
|
||||||
{
|
{
|
||||||
if (this == &rhs) return *this;
|
if (this != &rhs)
|
||||||
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
CopyFrom(rhs);
|
CopyFrom(rhs);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ByteQueue::operator==(const ByteQueue &rhs) const
|
bool ByteQueue::operator==(const ByteQueue &rhs) const
|
||||||
{
|
{
|
||||||
const lword currentSize = CurrentSize();
|
const lword currentSize = CurrentSize();
|
||||||
|
|
||||||
if (currentSize != rhs.CurrentSize())
|
if (currentSize != rhs.CurrentSize())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,7 @@ public:
|
||||||
|
|
||||||
SecBlock<T, A>& operator=(const SecBlock<T, A> &t)
|
SecBlock<T, A>& operator=(const SecBlock<T, A> &t)
|
||||||
{
|
{
|
||||||
|
// Assign guards for self-assignment
|
||||||
Assign(t);
|
Assign(t);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue