Whitespace checkin

pull/35/head
Jeffrey Walton 2015-07-30 13:07:33 -04:00
parent 7ad12ab5b0
commit 77206baf56
17 changed files with 45 additions and 45 deletions

View File

@ -191,7 +191,7 @@ public:
if (!m_done)
{
R value;
if(!m_source.GetValue(name, value))
if (!m_source.GetValue(name, value))
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'");
(m_pObject->*pm)(value);
}

View File

@ -299,7 +299,7 @@ public:
CRYPTOPP_DLL bool GetAsUIntValue(const char *name, unsigned int &value) const
{
int v;
if(!GetValue(name, v) || v < 0) return false;
if (!GetValue(name, v) || v < 0) return false;
value = static_cast<unsigned int>(v);
return true;
}
@ -314,7 +314,7 @@ public:
CRYPTOPP_DLL unsigned int GetAsUIntValueWithDefault(const char *name, unsigned int defaultValue) const
{
int v;
if(!GetValue(name, v) || v < 0) return defaultValue;
if (!GetValue(name, v) || v < 0) return defaultValue;
return static_cast<unsigned int>(v);
}

View File

@ -65,12 +65,12 @@ void Gunzip::ProcessPrestreamHeader()
if (flags & FILENAME) // skip filename
do
if(!m_inQueue.Get(b)) throw HeaderErr();
if (!m_inQueue.Get(b)) throw HeaderErr();
while (b);
if (flags & COMMENTS) // skip comments
do
if(!m_inQueue.Get(b)) throw HeaderErr();
if (!m_inQueue.Get(b)) throw HeaderErr();
while (b);
}

6
hkdf.h
View File

@ -55,7 +55,7 @@ unsigned int HKDF<T>::DeriveKey(byte *derived, size_t derivedLen, const byte *se
CRYPTOPP_ASSERT(derived && derivedLen);
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
if(derivedLen > MaxDerivedKeyLength())
if (derivedLen > MaxDerivedKeyLength())
throw InvalidArgument("HKDF: derivedLen must be less than or equal to MaxDerivedKeyLength");
HMAC<T> hmac;
@ -74,8 +74,8 @@ unsigned int HKDF<T>::DeriveKey(byte *derived, size_t derivedLen, const byte *se
while (derivedLen > 0)
{
if(block++) {hmac.Update(buffer, buffer.size());}
if(context && contextLen) {hmac.Update(context, contextLen);}
if (block++) {hmac.Update(buffer, buffer.size());}
if (context && contextLen) {hmac.Update(context, contextLen);}
hmac.CalculateDigest(buffer, &block, 1);
size_t segmentLen = STDMIN(derivedLen, DIGEST_SIZE);

View File

@ -380,7 +380,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
if (m_possiblePadding)
{
size_t len = find_if(begin, end, bind2nd(not_equal_to<byte>(), byte(0))) - begin;
size_t len = find_if (begin, end, bind2nd(not_equal_to<byte>(), byte(0))) - begin;
m_zeroCount += len;
begin += len;
if (begin == end)
@ -401,7 +401,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
#else
typedef reverse_iterator<const byte *> RevIt;
#endif
const byte *x = find_if(RevIt(end), RevIt(begin), bind2nd(not_equal_to<byte>(), byte(0))).base();
const byte *x = find_if (RevIt(end), RevIt(begin), bind2nd(not_equal_to<byte>(), byte(0))).base();
if (x != begin && *(x-1) == 1)
{
AttachedTransformation()->Put(begin, x-begin-1);

View File

@ -28,7 +28,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
{
if (num+len >= blockSize)
{
if(data && input)
if (data && input)
memcpy(data+num, input, blockSize-num);
HashBlock(dataBuf);
@ -39,7 +39,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
}
else
{
if(data && input)
if (data && input)
memcpy(data+num, input, len);
return;
@ -64,7 +64,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
else
do
{ // copy input first if it's not aligned correctly
if(data && input)
if (data && input)
memcpy(data, input, blockSize);
HashBlock(dataBuf);

10
misc.h
View File

@ -205,7 +205,7 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou
// TODO: fix callers. Its easier than it sounds because of the way
// Put and Put2 are used in filters.
if(dest && src && count)
if (dest && src && count)
memcpy(dest, src, count);
}
@ -219,7 +219,7 @@ inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t co
// TODO: fix callers. Its easier than it sounds because of the way
// Put and Put2 are used in filters.
if(dest && src && count)
if (dest && src && count)
memmove(dest, src, count);
}
@ -237,8 +237,8 @@ inline void * memset_z(void *ptr, int value, size_t num)
if (__builtin_constant_p(num) && num==0)
return ptr;
#endif
if(!ptr) return NULL;
if(!num) return ptr;
if (!ptr) return NULL;
if (!num) return ptr;
return memset(ptr, value, num);
}
@ -1531,7 +1531,7 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c
T t1, t2 = 0;
t1 = ConditionalByteReverse(order, value);
if(xorBlock) memmove(&t2, xorBlock, sizeof(T));
if (xorBlock) memmove(&t2, xorBlock, sizeof(T));
memmove(block, &(t1 ^= t2), sizeof(T));
}

View File

@ -52,7 +52,7 @@ void CFB_ModePolicy::TransformRegister()
m_cipher->ProcessBlock(m_register, m_temp);
const unsigned int updateSize = BlockSize()-m_feedbackSize;
if(updateSize)
if (updateSize)
memmove_s(m_register, m_register.size(), m_register+m_feedbackSize, updateSize);
memcpy_s(m_register+updateSize, m_register.size()-updateSize, m_temp, m_feedbackSize);
}

View File

@ -87,7 +87,7 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte
// DB = pHash' || 00 ... || 01 || M
byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01);
invalid = (M == maskedDB+dbLen) || invalid;
invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
invalid = (std::find_if (maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid;
if (invalid)

View File

@ -47,7 +47,7 @@ OS_RNG_Err::OS_RNG_Err(const std::string &operation)
MicrosoftCryptoProvider::MicrosoftCryptoProvider()
{
if(!CryptAcquireContext(&m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
if (!CryptAcquireContext(&m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
throw OS_RNG_Err("CryptAcquireContext");
}

View File

@ -78,7 +78,7 @@ void PSSR_MEM_Base::ComputeMessageRepresentative(RandomNumberGenerator &rng,
xorbuf(xorStart + 1, recoverableMessage, recoverableMessageLength);
xorbuf(xorStart + 1 + recoverableMessageLength, salt, salt.size());
if(representative && hashIdentifier.first)
if (representative && hashIdentifier.first)
memcpy(representative + representativeByteLength - u, hashIdentifier.first, hashIdentifier.second);
representative[representativeByteLength - 1] = hashIdentifier.second ? 0xcc : 0xbc;
@ -115,13 +115,13 @@ DecodingResult PSSR_MEM_Base::RecoverMessageFromRepresentative(
// extract salt and recoverableMessage from DB = 00 ... || 01 || M || salt
byte *salt = representative + representativeByteLength - u - digestSize - saltSize;
byte *M = std::find_if(representative, salt-1, std::bind2nd(std::not_equal_to<byte>(), byte(0)));
byte *M = std::find_if (representative, salt-1, std::bind2nd(std::not_equal_to<byte>(), byte(0)));
recoverableMessageLength = salt-M-1;
if (*M == 0x01
&& (size_t)(M - representative - (representativeBitLength % 8 != 0)) >= MinPadLen(digestSize)
&& recoverableMessageLength <= MaxRecoverableLength(representativeBitLength, hashIdentifier.second, digestSize))
{
if(recoverableMessage && M && recoverableMessageLength)
if (recoverableMessage && M && recoverableMessageLength)
memcpy(recoverableMessage, M+1, recoverableMessageLength);
}
else

View File

@ -42,7 +42,7 @@ public:
inline size_t Put(const byte *begin, size_t length)
{
if(!begin || !length) return length;
if (!begin || !length) return length;
size_t l = STDMIN(length, MaxSize()-m_tail);
if (buf+m_tail != begin)
memcpy(buf+m_tail, begin, l);
@ -61,7 +61,7 @@ public:
inline size_t Peek(byte *target, size_t copyMax) const
{
if(!target || !copyMax) return 0;
if (!target || !copyMax) return 0;
size_t len = STDMIN(copyMax, m_tail-m_head);
memcpy(target, buf+m_head, len);
return len;
@ -428,7 +428,7 @@ byte * ByteQueue::CreatePutSpace(size_t &size)
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
{
if(this == &rhs) return *this;
if (this == &rhs) return *this;
Destroy();
CopyFrom(rhs);

12
rw.cpp
View File

@ -124,7 +124,7 @@ void InvertibleRWFunction::PrecomputeTweakedRoots() const
{
ModularArithmetic modp(m_p), modq(m_q);
#pragma omp parallel sections if(CRYPTOPP_RW_USE_OMP)
#pragma omp parallel sections if (CRYPTOPP_RW_USE_OMP)
{
#pragma omp section
m_pre_2_9p = modp.Exponentiate(2, (9 * m_p - 11)/8);
@ -150,7 +150,7 @@ void InvertibleRWFunction::LoadPrecomputation(BufferedTransformation &bt)
void InvertibleRWFunction::SavePrecomputation(BufferedTransformation &bt) const
{
if(!m_precompute)
if (!m_precompute)
Precompute();
DERSequenceEncoder seq(bt);
@ -187,7 +187,7 @@ Integer InvertibleRWFunction::CalculateInverse(RandomNumberGenerator &rng, const
{
DoQuickSanityCheck();
if(!m_precompute)
if (!m_precompute)
Precompute();
ModularArithmetic modn(m_n), modp(m_p), modq(m_q);
@ -210,19 +210,19 @@ Integer InvertibleRWFunction::CalculateInverse(RandomNumberGenerator &rng, const
Integer e, f;
const Integer U = modq.Exponentiate(h, (q+1)/8);
if(((modq.Exponentiate(U, 4) - h) % q).IsZero())
if (((modq.Exponentiate(U, 4) - h) % q).IsZero())
e = Integer::One();
else
e = -1;
const Integer eh = e*h, V = modp.Exponentiate(eh, (p-3)/8);
if(((modp.Multiply(modp.Exponentiate(V, 4), modp.Exponentiate(eh, 2)) - eh) % p).IsZero())
if (((modp.Multiply(modp.Exponentiate(V, 4), modp.Exponentiate(eh, 2)) - eh) % p).IsZero())
f = Integer::One();
else
f = 2;
Integer W, X;
#pragma omp parallel sections if(CRYPTOPP_RW_USE_OMP)
#pragma omp parallel sections if (CRYPTOPP_RW_USE_OMP)
{
#pragma omp section
{

View File

@ -114,7 +114,7 @@ public:
template <class T> value_ptr<T>& value_ptr<T>::operator=(const value_ptr<T>& rhs)
{
if(this != &rhs)
if (this != &rhs)
{
T *old_p = this->m_p;
this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
@ -138,7 +138,7 @@ public:
template <class T> clonable_ptr<T>& clonable_ptr<T>::operator=(const clonable_ptr<T>& rhs)
{
if(this != &rhs)
if (this != &rhs)
{
T *old_p = this->m_p;
this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
@ -225,7 +225,7 @@ template <class T> T* counted_ptr<T>::get()
template <class T> counted_ptr<T> & counted_ptr<T>::operator=(const counted_ptr<T>& rhs)
{
if(this == &rhs) { return *this; }
if (this == &rhs) { return *this; }
if (m_p != rhs.m_p)
{

2
trap.h
View File

@ -23,7 +23,7 @@
// Linux and Unix
#if !defined(NDEBUG) && defined(CRYPTOPP_UNIX_AVAILABLE)
# define CRYPTOPP_ASSERT(exp) { \
if(!(exp)) { \
if (!(exp)) { \
std::ostringstream oss; \
oss << "Assertion failed: " << (char*)(__FILE__) << "(" \
<< (int)(__LINE__) << "): " << (char*)(__func__) \

View File

@ -337,14 +337,14 @@ bool TestConversion()
signed int v; bool p = true;
{
// Guard i686 collision of type sizes
if(sizeof(signed int) != sizeof(signed long))
if (sizeof(signed int) != sizeof(signed long))
{
signed long v1 = std::numeric_limits<signed long>::min(); p = !SafeConvert(v1, v) && p;
signed long v2 = std::numeric_limits<signed long>::max(); p = !SafeConvert(v2, v) && p;
unsigned long v3 = std::numeric_limits<unsigned long>::max(); p = !SafeConvert(v3, v) && p;
}
// Guard i686 collision of type sizes
if(sizeof(signed int) != sizeof(signed long long))
if (sizeof(signed int) != sizeof(signed long long))
{
signed long long v1 = std::numeric_limits<signed long long>::min(); p = !SafeConvert(v1, v) && p;
signed long long v2 = std::numeric_limits<signed long long>::max(); p = !SafeConvert(v2, v) && p;
@ -373,12 +373,12 @@ bool TestConversion()
unsigned int v; bool p = true;
{
// Guard i686 collision of type sizes
if(sizeof(unsigned int) != sizeof(unsigned long))
if (sizeof(unsigned int) != sizeof(unsigned long))
{
unsigned long v1 = std::numeric_limits<unsigned long>::max(); p = !SafeConvert(v1, v) && p;
}
// Guard i686 collision of type sizes
if(sizeof(unsigned int) != sizeof(unsigned long long))
if (sizeof(unsigned int) != sizeof(unsigned long long))
{
unsigned long long v1 = std::numeric_limits<unsigned long long>::max(); p = !SafeConvert(v1, v) && p;
}
@ -406,7 +406,7 @@ bool TestConversion()
/********** signed long overflow **********/
{
// Guard x86_64 collision of type sizes
if(sizeof(signed long) != sizeof(signed long long))
if (sizeof(signed long) != sizeof(signed long long))
{
signed long v; bool p = true;
{
@ -439,7 +439,7 @@ bool TestConversion()
/********** unsigned long overflow **********/
{
// Guard x86_64 collision of type sizes
if(sizeof(unsigned long) != sizeof(unsigned long long))
if (sizeof(unsigned long) != sizeof(unsigned long long))
{
unsigned long v; bool p = true;
{

View File

@ -668,11 +668,11 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType)
m_literalCounts[256] = 1;
HuffmanEncoder::GenerateCodeLengths(literalCodeLengths, 15, m_literalCounts, 286);
m_dynamicLiteralEncoder.Initialize(literalCodeLengths, 286);
unsigned int hlit = (unsigned int)(find_if(RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (literalCodeLengths.begin()+257));
unsigned int hlit = (unsigned int)(find_if (RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (literalCodeLengths.begin()+257));
HuffmanEncoder::GenerateCodeLengths(distanceCodeLengths, 15, m_distanceCounts, 30);
m_dynamicDistanceEncoder.Initialize(distanceCodeLengths, 30);
unsigned int hdist = (unsigned int)(find_if(RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (distanceCodeLengths.begin()+1));
unsigned int hdist = (unsigned int)(find_if (RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (distanceCodeLengths.begin()+1));
SecBlockWithHint<unsigned int, 286+30> combinedLengths(hlit+257+hdist+1);
memcpy(combinedLengths, literalCodeLengths, (hlit+257)*sizeof(unsigned int));