From 15dfea4d8563636de9c10d0b395b4d99d02e3dc3 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sun, 28 Oct 2018 14:04:29 -0700 Subject: [PATCH] clean up some formatting issues w/ standard type PR, etc. --- src/core/haval.h | 2 +- src/db/blockfile.cpp | 2 +- src/db/blockfile.h | 2 +- src/fco/fcospecattr.cpp | 2 +- src/fco/fcospeclist.cpp | 8 ++++++-- src/fco/signature.cpp | 2 +- src/fs/fspropdisplayer.h | 8 ++++---- src/tw/headerinfo.h | 4 ++-- src/tw/systeminfo.h | 2 +- src/twadmin/keygeneration.cpp | 4 ++-- src/twadmin/twadmincl.cpp | 8 ++++---- src/twcrypto/keyfile.cpp | 12 ++++++------ src/twcrypto/keyfile.h | 2 +- src/twtest/twlocale_t.cpp | 2 +- 14 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/core/haval.h b/src/core/haval.h index b89d94f..8f24bca 100644 --- a/src/core/haval.h +++ b/src/core/haval.h @@ -104,7 +104,7 @@ typedef struct { haval_word count[2]; /* number of bits in a message */ haval_word fingerprint[8]; /* current state of fingerprint */ 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; /* Do not remove this line. Protyping depends on it! diff --git a/src/db/blockfile.cpp b/src/db/blockfile.cpp index fa2e5b0..c98098e 100644 --- a/src/db/blockfile.cpp +++ b/src/db/blockfile.cpp @@ -194,7 +194,7 @@ cBlockFile::Block* cBlockFile::GetBlock(int blockNum) //throw (eArchive) #endif 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 earliestIter = it; ++it; // since we don't want to check the first one diff --git a/src/db/blockfile.h b/src/db/blockfile.h index 62198e0..f57afdf 100644 --- a/src/db/blockfile.h +++ b/src/db/blockfile.h @@ -113,7 +113,7 @@ private: int mNumPages; 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 BlockVector mvPagedBlocks; diff --git a/src/fco/fcospecattr.cpp b/src/fco/fcospecattr.cpp index 3f509a4..fb95a5f 100644 --- a/src/fco/fcospecattr.cpp +++ b/src/fco/fcospecattr.cpp @@ -47,7 +47,7 @@ void cFCOSpecAttr::Read(iSerializer* pSerializer, int32_t version) pSerializer->ReadString(mName); pSerializer->ReadInt32(mSeverity); - int32_t size; + int32_t size; TSTRING str; pSerializer->ReadInt32(size); mEmailAddrs.clear(); diff --git a/src/fco/fcospeclist.cpp b/src/fco/fcospeclist.cpp index bceb6b7..404204d 100644 --- a/src/fco/fcospeclist.cpp +++ b/src/fco/fcospeclist.cpp @@ -103,6 +103,7 @@ void cFCOSpecList::Add(iFCOSpec* pSpec, cFCOSpecAttr* pAttr) pAttr = new cFCOSpecAttr; else pAttr->AddRef(); + for (itr = mCanonicalList.begin();; ++itr) { if (itr == mCanonicalList.end() || iFCOSpecUtil::FCOSpecLessThan(*pSpec, *itr->first)) @@ -118,18 +119,22 @@ iFCOSpec* cFCOSpecList::Lookup(iFCOSpec* pSpec) const { std::list::iterator itr; for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr) + { if (itr->first == pSpec) { pSpec->AddRef(); return itr->first; } + } for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr) + { if (iFCOSpecUtil::FCOSpecEqual(*pSpec, *itr->first)) { itr->first->AddRef(); return itr->first; } + } return NULL; } @@ -141,11 +146,10 @@ void cFCOSpecList::Read(iSerializer* pSerializer, int32_t version) Clear(); - int i; int32_t size; pSerializer->ReadInt32(size); - for (i = 0; i < size; ++i) + for (int i = 0; i < size; ++i) { iFCOSpec* pReadInSpec = static_cast(pSerializer->ReadObjectDynCreate()); cFCOSpecAttr* pSpecAttr = static_cast(pSerializer->ReadObjectDynCreate()); diff --git a/src/fco/signature.cpp b/src/fco/signature.cpp index b966803..f695dec 100644 --- a/src/fco/signature.cpp +++ b/src/fco/signature.cpp @@ -110,7 +110,7 @@ void cArchiveSigGen::CalculateSignatures(cArchive& a) uint8_t abBuf[iSignature::SUGGESTED_BLOCK_SIZE * 2]; int cbRead; container_type::size_type i; - uint8_t* pBuf = abBuf; + uint8_t* pBuf = abBuf; if (s_direct) { diff --git a/src/fs/fspropdisplayer.h b/src/fs/fspropdisplayer.h index 2673911..68dbb69 100644 --- a/src/fs/fspropdisplayer.h +++ b/src/fs/fspropdisplayer.h @@ -128,10 +128,10 @@ private: typedef std::map INT64_TO_STRING_MAP; - bool GetUsername( const int64_t& i64uid, TSTRING& tstrUsername) const; - bool GetGroupname( const int64_t& i64uid, TSTRING& tstrGroupname) const; - bool AddUsernameMapping( const int64_t& i64ID, const TSTRING& tstrUsername); - bool AddGroupnameMapping( const int64_t& i64ID, const TSTRING& tstrGroupname); + bool GetUsername(const int64_t& i64uid, TSTRING& tstrUsername) const; + bool GetGroupname(const int64_t& i64uid, TSTRING& tstrGroupname) const; + bool AddUsernameMapping(const int64_t& i64ID, const TSTRING& tstrUsername); + bool AddGroupnameMapping(const int64_t& i64ID, const TSTRING& tstrGroupname); // storage for conversion stuff INT64_TO_STRING_MAP uidToUsername; diff --git a/src/tw/headerinfo.h b/src/tw/headerinfo.h index b9371a3..cef8fd1 100644 --- a/src/tw/headerinfo.h +++ b/src/tw/headerinfo.h @@ -121,7 +121,7 @@ public: const iFCOPropDisplayer* GetPropDisplayer() const; void SetObjectsScanned(int32_t); - int32_t GetObjectsScanned() const; + int32_t GetObjectsScanned() const; // iSerializable interface virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) @@ -130,7 +130,7 @@ private: cGenreHeaderInfo& operator=(cGenreHeaderInfo&); iFCOPropDisplayer* mpPropDisplayer; - int32_t i32_ObjectsScanned; + int32_t i32_ObjectsScanned; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/src/tw/systeminfo.h b/src/tw/systeminfo.h index 3675c5b..4932beb 100644 --- a/src/tw/systeminfo.h +++ b/src/tw/systeminfo.h @@ -59,7 +59,7 @@ public: // these methods get and set the executable's working directory ... it is asserted // that SetExeDir() has been called when GetExeDir() is called. - static int64_t GetExeStartTime(); + static int64_t GetExeStartTime(); static void SetExeStartTime(const int64_t& time); // 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. diff --git a/src/twadmin/keygeneration.cpp b/src/twadmin/keygeneration.cpp index b0ce097..14a8f40 100644 --- a/src/twadmin/keygeneration.cpp +++ b/src/twadmin/keygeneration.cpp @@ -46,8 +46,8 @@ struct tGK { bool doneFlag; int retValue; - int8_t* passphrase; - int32_t passphraseLen; + int8_t* passphrase; + int32_t passphraseLen; const TCHAR* keyPath; enum ReturnValue diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index dddf3f0..d1076d3 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -2062,10 +2062,10 @@ static bool ChangePassphrase(const TCHAR* keyPath, wc16_string passphraseOld, wc // we must allocate a BIGENDIAN copy // and delete it before we return. // auto_ptr does not help (won't work with arrays). - size_t passphraseLenOld = passphraseOld.length() * sizeof(WCHAR16); - size_t passphraseLen = passphrase.length() * sizeof(WCHAR16); - int8_t* passphraseCopyOld = new int8_t[passphraseLenOld]; - int8_t* passphraseCopy = new int8_t[passphraseLen]; + size_t passphraseLenOld = passphraseOld.length() * sizeof(WCHAR16); + size_t passphraseLen = passphrase.length() * sizeof(WCHAR16); + int8_t* passphraseCopyOld = new int8_t[passphraseLenOld]; + int8_t* passphraseCopy = new int8_t[passphraseLen]; #ifdef WORDS_BIGENDIAN memcpy(passphraseCopyOld, passphraseOld.data(), passphraseLenOld); memcpy(passphraseCopy, passphrase.data(), passphraseLen); diff --git a/src/twcrypto/keyfile.cpp b/src/twcrypto/keyfile.cpp index f48752b..6241a3e 100644 --- a/src/twcrypto/keyfile.cpp +++ b/src/twcrypto/keyfile.cpp @@ -343,7 +343,7 @@ void cKeyFile::WriteMem(int8_t* pMem) const // throw eKeyFile() memcpy(pMem, mpPrivateKeyMem, mPrivateKeyMemLen); } -int32_t cKeyFile::GetWriteLen() // throw eKeyFile() +int cKeyFile::GetWriteLen() // throw eKeyFile() { if (!KeysLoaded()) { @@ -359,7 +359,7 @@ int32_t cKeyFile::GetWriteLen() // throw eKeyFile() 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; int16_t i16; @@ -470,7 +470,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain()); // 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); 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) { - RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen); + RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen); delete [] plainPrivateKeyMem; RandomizeBytes(passphrase, passphraseLen); return 0; @@ -498,7 +498,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas if (memcmp(plainPrivateKeyMem, privateHash.GetKey(), cHashedKey128::GetWriteLen()) != 0) { // passphrase didn't do the job - RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen); + RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen); delete [] plainPrivateKeyMem; RandomizeBytes(passphrase, passphraseLen); return 0; @@ -506,7 +506,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t)); - RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen); + RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen); delete [] plainPrivateKeyMem; RandomizeBytes(passphrase, passphraseLen); diff --git a/src/twcrypto/keyfile.h b/src/twcrypto/keyfile.h index a3ed7b2..a6e3270 100644 --- a/src/twcrypto/keyfile.h +++ b/src/twcrypto/keyfile.h @@ -74,7 +74,7 @@ public: void ReadMem(const int8_t* pMem); // 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 // exception if keys are not currently loaded. diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index fbc302b..c84692b 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -70,7 +70,7 @@ void TestItoa() // // setup // - int32_t n = 123456; + int32_t n = 123456; TSTRING str; //