clean up some formatting issues w/ standard type PR, etc.

This commit is contained in:
Brian Cox 2018-10-28 14:04:29 -07:00
parent c9e32170ba
commit 15dfea4d85
14 changed files with 32 additions and 28 deletions

View File

@ -104,7 +104,7 @@ typedef struct {
haval_word count[2]; /* number of bits in a message */ haval_word count[2]; /* number of bits in a message */
haval_word fingerprint[8]; /* current state of fingerprint */ haval_word fingerprint[8]; /* current state of fingerprint */
haval_word block[32]; /* buffer for a 32-word block */ haval_word block[32]; /* buffer for a 32-word block */
uint8_t remainder[32*4]; /* unhashed chars (No.<128) */ uint8_t remainder[32*4]; /* unhashed chars (No.<128) */
} haval_state; } haval_state;
/* Do not remove this line. Protyping depends on it! /* Do not remove this line. Protyping depends on it!

View File

@ -194,7 +194,7 @@ cBlockFile::Block* cBlockFile::GetBlock(int blockNum) //throw (eArchive)
#endif #endif
d.TraceNever("\tBlock %d was not in memory; paging it in\n", blockNum); d.TraceNever("\tBlock %d was not in memory; paging it in\n", blockNum);
uint32_t earliestTime = mvPagedBlocks[0].GetTimestamp(); uint32_t earliestTime = mvPagedBlocks[0].GetTimestamp();
BlockVector::iterator it = mvPagedBlocks.begin(); BlockVector::iterator it = mvPagedBlocks.begin();
BlockVector::iterator earliestIter = it; BlockVector::iterator earliestIter = it;
++it; // since we don't want to check the first one ++it; // since we don't want to check the first one

View File

@ -113,7 +113,7 @@ private:
int mNumPages; int mNumPages;
int mNumBlocks; // the total number of blocks in the archive. int mNumBlocks; // the total number of blocks in the archive.
uint32_t mTimer; // keeps track of the current "time" uint32_t mTimer; // keeps track of the current "time"
cBidirArchive* mpArchive; // note: I always own the deletion of the archive cBidirArchive* mpArchive; // note: I always own the deletion of the archive
BlockVector mvPagedBlocks; BlockVector mvPagedBlocks;

View File

@ -47,7 +47,7 @@ void cFCOSpecAttr::Read(iSerializer* pSerializer, int32_t version)
pSerializer->ReadString(mName); pSerializer->ReadString(mName);
pSerializer->ReadInt32(mSeverity); pSerializer->ReadInt32(mSeverity);
int32_t size; int32_t size;
TSTRING str; TSTRING str;
pSerializer->ReadInt32(size); pSerializer->ReadInt32(size);
mEmailAddrs.clear(); mEmailAddrs.clear();

View File

@ -103,6 +103,7 @@ void cFCOSpecList::Add(iFCOSpec* pSpec, cFCOSpecAttr* pAttr)
pAttr = new cFCOSpecAttr; pAttr = new cFCOSpecAttr;
else else
pAttr->AddRef(); pAttr->AddRef();
for (itr = mCanonicalList.begin();; ++itr) for (itr = mCanonicalList.begin();; ++itr)
{ {
if (itr == mCanonicalList.end() || iFCOSpecUtil::FCOSpecLessThan(*pSpec, *itr->first)) if (itr == mCanonicalList.end() || iFCOSpecUtil::FCOSpecLessThan(*pSpec, *itr->first))
@ -118,18 +119,22 @@ iFCOSpec* cFCOSpecList::Lookup(iFCOSpec* pSpec) const
{ {
std::list<PairType>::iterator itr; std::list<PairType>::iterator itr;
for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr) for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr)
{
if (itr->first == pSpec) if (itr->first == pSpec)
{ {
pSpec->AddRef(); pSpec->AddRef();
return itr->first; return itr->first;
} }
}
for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr) for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr)
{
if (iFCOSpecUtil::FCOSpecEqual(*pSpec, *itr->first)) if (iFCOSpecUtil::FCOSpecEqual(*pSpec, *itr->first))
{ {
itr->first->AddRef(); itr->first->AddRef();
return itr->first; return itr->first;
} }
}
return NULL; return NULL;
} }
@ -141,11 +146,10 @@ void cFCOSpecList::Read(iSerializer* pSerializer, int32_t version)
Clear(); Clear();
int i;
int32_t size; int32_t size;
pSerializer->ReadInt32(size); pSerializer->ReadInt32(size);
for (i = 0; i < size; ++i) for (int i = 0; i < size; ++i)
{ {
iFCOSpec* pReadInSpec = static_cast<iFCOSpec*>(pSerializer->ReadObjectDynCreate()); iFCOSpec* pReadInSpec = static_cast<iFCOSpec*>(pSerializer->ReadObjectDynCreate());
cFCOSpecAttr* pSpecAttr = static_cast<cFCOSpecAttr*>(pSerializer->ReadObjectDynCreate()); cFCOSpecAttr* pSpecAttr = static_cast<cFCOSpecAttr*>(pSerializer->ReadObjectDynCreate());

View File

@ -110,7 +110,7 @@ void cArchiveSigGen::CalculateSignatures(cArchive& a)
uint8_t abBuf[iSignature::SUGGESTED_BLOCK_SIZE * 2]; uint8_t abBuf[iSignature::SUGGESTED_BLOCK_SIZE * 2];
int cbRead; int cbRead;
container_type::size_type i; container_type::size_type i;
uint8_t* pBuf = abBuf; uint8_t* pBuf = abBuf;
if (s_direct) if (s_direct)
{ {

View File

@ -128,10 +128,10 @@ private:
typedef std::map<int64_t, TSTRING> INT64_TO_STRING_MAP; typedef std::map<int64_t, TSTRING> INT64_TO_STRING_MAP;
bool GetUsername( const int64_t& i64uid, TSTRING& tstrUsername) const; bool GetUsername(const int64_t& i64uid, TSTRING& tstrUsername) const;
bool GetGroupname( const int64_t& i64uid, TSTRING& tstrGroupname) const; bool GetGroupname(const int64_t& i64uid, TSTRING& tstrGroupname) const;
bool AddUsernameMapping( const int64_t& i64ID, const TSTRING& tstrUsername); bool AddUsernameMapping(const int64_t& i64ID, const TSTRING& tstrUsername);
bool AddGroupnameMapping( const int64_t& i64ID, const TSTRING& tstrGroupname); bool AddGroupnameMapping(const int64_t& i64ID, const TSTRING& tstrGroupname);
// storage for conversion stuff // storage for conversion stuff
INT64_TO_STRING_MAP uidToUsername; INT64_TO_STRING_MAP uidToUsername;

View File

@ -121,7 +121,7 @@ public:
const iFCOPropDisplayer* GetPropDisplayer() const; const iFCOPropDisplayer* GetPropDisplayer() const;
void SetObjectsScanned(int32_t); void SetObjectsScanned(int32_t);
int32_t GetObjectsScanned() const; int32_t GetObjectsScanned() const;
// iSerializable interface // iSerializable interface
virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive)
@ -130,7 +130,7 @@ private:
cGenreHeaderInfo& operator=(cGenreHeaderInfo&); cGenreHeaderInfo& operator=(cGenreHeaderInfo&);
iFCOPropDisplayer* mpPropDisplayer; iFCOPropDisplayer* mpPropDisplayer;
int32_t i32_ObjectsScanned; int32_t i32_ObjectsScanned;
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -59,7 +59,7 @@ public:
// these methods get and set the executable's working directory ... it is asserted // these methods get and set the executable's working directory ... it is asserted
// that SetExeDir() has been called when GetExeDir() is called. // that SetExeDir() has been called when GetExeDir() is called.
static int64_t GetExeStartTime(); static int64_t GetExeStartTime();
static void SetExeStartTime(const int64_t& time); static void SetExeStartTime(const int64_t& time);
// Get and set the approximate time (time_t format) which the excecutable was started. // Get and set the approximate time (time_t format) which the excecutable was started.
// This will be used for all times having to do with this run of the executable. // This will be used for all times having to do with this run of the executable.

View File

@ -46,8 +46,8 @@ struct tGK
{ {
bool doneFlag; bool doneFlag;
int retValue; int retValue;
int8_t* passphrase; int8_t* passphrase;
int32_t passphraseLen; int32_t passphraseLen;
const TCHAR* keyPath; const TCHAR* keyPath;
enum ReturnValue enum ReturnValue

View File

@ -2062,10 +2062,10 @@ static bool ChangePassphrase(const TCHAR* keyPath, wc16_string passphraseOld, wc
// we must allocate a BIGENDIAN copy // we must allocate a BIGENDIAN copy
// and delete it before we return. // and delete it before we return.
// auto_ptr does not help (won't work with arrays). // auto_ptr does not help (won't work with arrays).
size_t passphraseLenOld = passphraseOld.length() * sizeof(WCHAR16); size_t passphraseLenOld = passphraseOld.length() * sizeof(WCHAR16);
size_t passphraseLen = passphrase.length() * sizeof(WCHAR16); size_t passphraseLen = passphrase.length() * sizeof(WCHAR16);
int8_t* passphraseCopyOld = new int8_t[passphraseLenOld]; int8_t* passphraseCopyOld = new int8_t[passphraseLenOld];
int8_t* passphraseCopy = new int8_t[passphraseLen]; int8_t* passphraseCopy = new int8_t[passphraseLen];
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
memcpy(passphraseCopyOld, passphraseOld.data(), passphraseLenOld); memcpy(passphraseCopyOld, passphraseOld.data(), passphraseLenOld);
memcpy(passphraseCopy, passphrase.data(), passphraseLen); memcpy(passphraseCopy, passphrase.data(), passphraseLen);

View File

@ -343,7 +343,7 @@ void cKeyFile::WriteMem(int8_t* pMem) const // throw eKeyFile()
memcpy(pMem, mpPrivateKeyMem, mPrivateKeyMemLen); memcpy(pMem, mpPrivateKeyMem, mPrivateKeyMemLen);
} }
int32_t cKeyFile::GetWriteLen() // throw eKeyFile() int cKeyFile::GetWriteLen() // throw eKeyFile()
{ {
if (!KeysLoaded()) if (!KeysLoaded())
{ {
@ -359,7 +359,7 @@ int32_t cKeyFile::GetWriteLen() // throw eKeyFile()
mPrivateKeyMemLen; // the private key mPrivateKeyMemLen; // the private key
} }
void cKeyFile::ProtectKeys(int8_t* passphrase, int32_t passphraseLen) // throw eKeyFile() void cKeyFile::ProtectKeys(int8_t* passphrase, int passphraseLen) // throw eKeyFile()
{ {
int i; int i;
int16_t i16; int16_t i16;
@ -470,7 +470,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain()); ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain());
// get a copy of the ciphertext and decrypt it // get a copy of the ciphertext and decrypt it
uint8_t* plainPrivateKeyMem = new uint8_t[mPrivateKeyMemLen]; int8_t* plainPrivateKeyMem = new int8_t[mPrivateKeyMemLen];
memcpy(plainPrivateKeyMem, mpPrivateKeyMem, mPrivateKeyMemLen); memcpy(plainPrivateKeyMem, mpPrivateKeyMem, mPrivateKeyMemLen);
ASSERT(mPrivateKeyMemLen % des.GetBlockSizePlain() == 0); ASSERT(mPrivateKeyMemLen % des.GetBlockSizePlain() == 0);
@ -486,7 +486,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
if (len + cHashedKey128::GetWriteLen() + sizeof(int16_t) > (unsigned int)mPrivateKeyMemLen) if (len + cHashedKey128::GetWriteLen() + sizeof(int16_t) > (unsigned int)mPrivateKeyMemLen)
{ {
RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen); RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen);
delete [] plainPrivateKeyMem; delete [] plainPrivateKeyMem;
RandomizeBytes(passphrase, passphraseLen); RandomizeBytes(passphrase, passphraseLen);
return 0; return 0;
@ -498,7 +498,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
if (memcmp(plainPrivateKeyMem, privateHash.GetKey(), cHashedKey128::GetWriteLen()) != 0) if (memcmp(plainPrivateKeyMem, privateHash.GetKey(), cHashedKey128::GetWriteLen()) != 0)
{ {
// passphrase didn't do the job // passphrase didn't do the job
RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen); RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen);
delete [] plainPrivateKeyMem; delete [] plainPrivateKeyMem;
RandomizeBytes(passphrase, passphraseLen); RandomizeBytes(passphrase, passphraseLen);
return 0; return 0;
@ -506,7 +506,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t)); mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t));
RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen); RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen);
delete [] plainPrivateKeyMem; delete [] plainPrivateKeyMem;
RandomizeBytes(passphrase, passphraseLen); RandomizeBytes(passphrase, passphraseLen);

View File

@ -74,7 +74,7 @@ public:
void ReadMem(const int8_t* pMem); // throw eKeyFile() void ReadMem(const int8_t* pMem); // throw eKeyFile()
void WriteMem(int8_t* pMem) const; // throw eKeyFile() void WriteMem(int8_t* pMem) const; // throw eKeyFile()
int GetWriteLen(); // throw eKeyFile() int GetWriteLen(); // throw eKeyFile()
// Functions to read and write the key to memory. GetWriteLen() will throw an // Functions to read and write the key to memory. GetWriteLen() will throw an
// exception if keys are not currently loaded. // exception if keys are not currently loaded.

View File

@ -70,7 +70,7 @@ void TestItoa()
// //
// setup // setup
// //
int32_t n = 123456; int32_t n = 123456;
TSTRING str; TSTRING str;
// //