Address more cppcheck warnings, mostly around assignment operators & explicit constructors

This commit is contained in:
Brian Cox 2017-03-15 23:41:23 -07:00
parent b1147d65cf
commit 8bd86fe60d
36 changed files with 88 additions and 71 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ src/tripwire/tripwire
src/twadmin/twadmin src/twadmin/twadmin
src/twprint/twprint src/twprint/twprint
src/twtest/twtest src/twtest/twtest
src/test-harness/twtest
**/Makefile **/Makefile
**/*.o **/*.o
**/*.dylib **/*.dylib

View File

@ -751,7 +751,7 @@ bool cHierDatabaseIter::CompareForUpperBound( const cHierEntry& he, const TCHAR*
class cHierDatabaseIterCallCompare class cHierDatabaseIterCallCompare
{ {
public: public:
cHierDatabaseIterCallCompare( const cHierDatabaseIter* pcls ) explicit cHierDatabaseIterCallCompare( const cHierDatabaseIter* pcls )
: pc( pcls ) {}; : pc( pcls ) {};
bool operator()( const cHierEntry& a1, const TCHAR* a2 ) bool operator()( const cHierEntry& a1, const TCHAR* a2 )

View File

@ -114,7 +114,7 @@ private:
class cHierDatabaseIter class cHierDatabaseIter
{ {
public: public:
cHierDatabaseIter( cHierDatabase* pDb ); //throw (eArchive) explicit cHierDatabaseIter( cHierDatabase* pDb ); //throw (eArchive)
~cHierDatabaseIter(); ~cHierDatabaseIter();
// //

View File

@ -68,7 +68,7 @@ public:
}; };
cHierNode( Type type = TYPE_INVALID ) : mType( type ) {} explicit cHierNode( Type type = TYPE_INVALID ) : mType( type ) {}
virtual ~cHierNode() {} virtual ~cHierNode() {}
int32 mType; int32 mType;

View File

@ -53,7 +53,7 @@ public:
}; };
cFCOCompare(); cFCOCompare();
cFCOCompare( const cFCOPropVector& propsToCompare); explicit cFCOCompare( const cFCOPropVector& propsToCompare);
virtual ~cFCOCompare(); virtual ~cFCOCompare();
void SetPropsToCmp(const cFCOPropVector& pv); void SetPropsToCmp(const cFCOPropVector& pv);

View File

@ -440,7 +440,7 @@ bool cFCODataSourceIterImpl::CompareForUpperBound( const iFCO* pFCO, const TCHAR
class cFCODataSourceIterImplCallCompare class cFCODataSourceIterImplCallCompare
{ {
public: public:
cFCODataSourceIterImplCallCompare( const cFCODataSourceIterImpl* pcls ) explicit cFCODataSourceIterImplCallCompare( const cFCODataSourceIterImpl* pcls )
: pc( pcls ) {}; : pc( pcls ) {};
bool operator()( const iFCO* a1, const TCHAR* a2 ) bool operator()( const iFCO* a1, const TCHAR* a2 )

View File

@ -177,7 +177,7 @@ void cFCOName::SetNameInfo(iFCONameInfo* pNI)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// operator= // operator=
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void cFCOName::operator = (const cFCOName& rhs) cFCOName& cFCOName::operator = (const cFCOName& rhs)
{ {
mpPathName->Release(); mpPathName->Release();
// TODO -- I am sure this won't work (const-ness) // TODO -- I am sure this won't work (const-ness)
@ -188,16 +188,19 @@ void cFCOName::operator = (const cFCOName& rhs)
#ifdef _DEBUG #ifdef _DEBUG
mDebugStrName = AsString(); mDebugStrName = AsString();
#endif #endif
return *this;
} }
void cFCOName::operator = (const TSTRING& rhs)
cFCOName& cFCOName::operator = (const TSTRING& rhs)
{ {
*this = rhs.c_str(); *this = rhs.c_str();
#ifdef _DEBUG #ifdef _DEBUG
mDebugStrName = AsString(); mDebugStrName = AsString();
#endif #endif
return *this;
} }
void cFCOName::operator = (const TCHAR* rhs) cFCOName& cFCOName::operator = (const TCHAR* rhs)
{ {
// if I have the only handle on this vector, I can reuse it // if I have the only handle on this vector, I can reuse it
// otherwise, I have to release it. // otherwise, I have to release it.
@ -210,6 +213,7 @@ void cFCOName::operator = (const TCHAR* rhs)
#ifdef _DEBUG #ifdef _DEBUG
mDebugStrName = AsString(); mDebugStrName = AsString();
#endif #endif
return *this;
} }
void cFCOName::ParseString( const TCHAR* pszin ) void cFCOName::ParseString( const TCHAR* pszin )

View File

@ -58,7 +58,7 @@ class cFCOName : public iTypedSerializable
public: public:
typedef cFCONameIter iterator; typedef cFCONameIter iterator;
cFCOName(iFCONameInfo* iNI = NULL); explicit cFCOName(iFCONameInfo* iNI = NULL);
cFCOName(const cFCOName& rhs); cFCOName(const cFCOName& rhs);
explicit cFCOName(const TSTRING& rhs, iFCONameInfo* iNI = NULL); explicit cFCOName(const TSTRING& rhs, iFCONameInfo* iNI = NULL);
@ -67,9 +67,9 @@ public:
// do it unexpectedly // do it unexpectedly
virtual ~cFCOName(); virtual ~cFCOName();
void operator = (const cFCOName& rhs); cFCOName& operator = (const cFCOName& rhs);
void operator = (const TSTRING& rhs); cFCOName& operator = (const TSTRING& rhs);
void operator = (const TCHAR* rhs); cFCOName& operator = (const TCHAR* rhs);
bool operator < (const cFCOName& rhs) const; bool operator < (const cFCOName& rhs) const;
// defines an arbitrary order for cFCONames. This is so that names can // defines an arbitrary order for cFCONames. This is so that names can
@ -165,7 +165,7 @@ class cFCONameIter_i;
class cFCONameIter class cFCONameIter
{ {
public: public:
cFCONameIter(const cFCOName& name); explicit cFCONameIter(const cFCOName& name);
~cFCONameIter(); ~cFCONameIter();
int GetSize() const; // returns the number of entries in the fco name int GetSize() const; // returns the number of entries in the fco name

View File

@ -110,7 +110,7 @@ private:
class cFCONameTbl class cFCONameTbl
{ {
public: public:
cFCONameTbl(int defSize = HASH_VERY_LARGE); explicit cFCONameTbl(int defSize = HASH_VERY_LARGE);
// defSize is the initial hash table size // defSize is the initial hash table size
~cFCONameTbl(); ~cFCONameTbl();

View File

@ -394,7 +394,6 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version)
if (version > 0) if (version > 0)
ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read"))); ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read")));
int i;
int32 newSize; int32 newSize;
pSerializer->ReadInt32(newSize); pSerializer->ReadInt32(newSize);
ASSERT(newSize > 0); ASSERT(newSize > 0);
@ -409,7 +408,7 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version)
} }
else else
{ {
for (i=0; i <= mSize / msBitlength; ++i) for (int i=0; i <= mSize / msBitlength; ++i)
{ {
int32 mask; int32 mask;
pSerializer->ReadInt32(mask); pSerializer->ReadInt32(mask);
@ -421,7 +420,6 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version)
void cFCOPropVector::Write(iSerializer* pSerializer) const void cFCOPropVector::Write(iSerializer* pSerializer) const
{ {
int i;
pSerializer->WriteInt32(mSize); pSerializer->WriteInt32(mSize);
if (mpBuf == NULL) if (mpBuf == NULL)
@ -430,7 +428,7 @@ void cFCOPropVector::Write(iSerializer* pSerializer) const
} }
else else
{ {
for (i=0; i <= mSize / msBitlength; ++i) for (int i=0; i <= mSize / msBitlength; ++i)
pSerializer->WriteInt32((*mpBuf)[i]); pSerializer->WriteInt32((*mpBuf)[i]);
} }

View File

@ -49,7 +49,7 @@
class cFCOPropVector : public iSerializable // note: this is not iTypedSerializable class cFCOPropVector : public iSerializable // note: this is not iTypedSerializable
{ {
public: public:
cFCOPropVector (int size = 32); explicit cFCOPropVector (int size = 32);
cFCOPropVector (const cFCOPropVector& rhs); cFCOPropVector (const cFCOPropVector& rhs);
virtual ~cFCOPropVector (void); virtual ~cFCOPropVector (void);
bool operator== (const cFCOPropVector& rhs) const; bool operator== (const cFCOPropVector& rhs) const;

View File

@ -80,7 +80,7 @@ cFCOSetImpl::cFCOSetImpl(const cFCOSetImpl& rhs) : iFCOSet()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// operator= // operator=
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void cFCOSetImpl::operator=(const cFCOSetImpl& rhs) cFCOSetImpl& cFCOSetImpl::operator=(const cFCOSetImpl& rhs)
{ {
std::set<cFCONode>::const_iterator i; std::set<cFCONode>::const_iterator i;
for(i = rhs.mFCOSet.begin(); i != rhs.mFCOSet.end(); ++i) for(i = rhs.mFCOSet.begin(); i != rhs.mFCOSet.end(); ++i)
@ -88,6 +88,8 @@ void cFCOSetImpl::operator=(const cFCOSetImpl& rhs)
i->mpFCO->AddRef(); i->mpFCO->AddRef();
mFCOSet.insert(cFCONode(i->mpFCO)); mFCOSet.insert(cFCONode(i->mpFCO));
} }
return *this;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -56,7 +56,7 @@ public:
cFCOSetImpl(); cFCOSetImpl();
cFCOSetImpl(const cFCOSetImpl& rhs); cFCOSetImpl(const cFCOSetImpl& rhs);
virtual ~cFCOSetImpl(); virtual ~cFCOSetImpl();
void operator=(const cFCOSetImpl& rhs); cFCOSetImpl& operator=(const cFCOSetImpl& rhs);
virtual const iFCOIter* Lookup(const cFCOName& name) const; virtual const iFCOIter* Lookup(const cFCOName& name) const;
virtual iFCOIter* Lookup(const cFCOName& name); virtual iFCOIter* Lookup(const cFCOName& name);
@ -85,8 +85,9 @@ private:
const cFCOName* mpFCOName; const cFCOName* mpFCOName;
cFCONode() : mpFCO(0), mpFCOName(0) {} cFCONode() : mpFCO(0), mpFCOName(0) {}
//TODO: make the iFCO* constructor explicit
cFCONode(iFCO* pFCO) : mpFCO(pFCO), mpFCOName(&pFCO->GetName()) {} cFCONode(iFCO* pFCO) : mpFCO(pFCO), mpFCOName(&pFCO->GetName()) {}
cFCONode(const cFCOName& name) : mpFCO(0), mpFCOName(&name) {} explicit cFCONode(const cFCOName& name) : mpFCO(0), mpFCOName(&name) {}
cFCONode(const cFCONode& rhs) : mpFCO(rhs.mpFCO), mpFCOName(rhs.mpFCOName) {} cFCONode(const cFCONode& rhs) : mpFCO(rhs.mpFCO), mpFCOName(rhs.mpFCOName) {}
bool operator < (const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName < *rhs.mpFCOName); else return false; } bool operator < (const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName < *rhs.mpFCOName); else return false; }
bool operator ==(const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName == *rhs.mpFCOName); else return false; } bool operator ==(const cFCONode& rhs) const { if(mpFCOName) return (*mpFCOName == *rhs.mpFCOName); else return false; }
@ -101,8 +102,8 @@ class cFCOIterImpl : public iFCOIter
friend class cFCOSetImpl; friend class cFCOSetImpl;
public: public:
cFCOIterImpl(cFCOSetImpl* pSet); explicit cFCOIterImpl(cFCOSetImpl* pSet);
cFCOIterImpl(const cFCOSetImpl* pSet); explicit cFCOIterImpl(const cFCOSetImpl* pSet);
virtual void SeekBegin() const; virtual void SeekBegin() const;
virtual bool Done() const; virtual bool Done() const;

View File

@ -94,7 +94,7 @@ private:
class cFCOSpecAttrEmailIter class cFCOSpecAttrEmailIter
{ {
public: public:
cFCOSpecAttrEmailIter(const cFCOSpecAttr& attr); explicit cFCOSpecAttrEmailIter(const cFCOSpecAttr& attr);
~cFCOSpecAttrEmailIter(); ~cFCOSpecAttrEmailIter();
void SeekBegin() const; void SeekBegin() const;

View File

@ -159,7 +159,7 @@ protected:
class cFCOSpecStopPointIter class cFCOSpecStopPointIter
{ {
public: public:
cFCOSpecStopPointIter(cFCOSpecStopPointSet& set); explicit cFCOSpecStopPointIter(cFCOSpecStopPointSet& set);
void SeekBegin() const; void SeekBegin() const;
// seeks to the beginning of the stop point list // seeks to the beginning of the stop point list

View File

@ -100,11 +100,13 @@ IMPLEMENT_SERREFCOUNT(cFCOSpecImpl, _T("cFCOSpecImpl"), 0, 1);
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// operator= // operator=
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void cFCOSpecImpl::operator=(const cFCOSpecImpl& rhs) cFCOSpecImpl& cFCOSpecImpl::operator=(const cFCOSpecImpl& rhs)
{ {
mName = rhs.mName; mName = rhs.mName;
mPropVector = rhs.mPropVector; mPropVector = rhs.mPropVector;
mpHelper = rhs.mpHelper ? rhs.mpHelper->Clone() : 0; mpHelper = rhs.mpHelper ? rhs.mpHelper->Clone() : 0;
return *this;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Clone -- make a copy of this spec // Clone -- make a copy of this spec

View File

@ -70,7 +70,7 @@ public:
// the spec will delete whatever helper it contains when it is destroyed // the spec will delete whatever helper it contains when it is destroyed
cFCOSpecImpl(const cFCOSpecImpl& rhs); cFCOSpecImpl(const cFCOSpecImpl& rhs);
cFCOSpecImpl(); cFCOSpecImpl();
void operator=(const cFCOSpecImpl& rhs); cFCOSpecImpl& operator=(const cFCOSpecImpl& rhs);
// from iFCOSpec // from iFCOSpec
virtual bool SpecContainsFCO (const cFCOName& name) const; virtual bool SpecContainsFCO (const cFCOName& name) const;

View File

@ -103,7 +103,7 @@ protected:
class cFCOSpecListAddedIter class cFCOSpecListAddedIter
{ {
public: public:
cFCOSpecListAddedIter(const cFCOSpecList& list); explicit cFCOSpecListAddedIter(const cFCOSpecList& list);
~cFCOSpecListAddedIter(); ~cFCOSpecListAddedIter();
void SeekBegin() const; void SeekBegin() const;
@ -129,7 +129,7 @@ protected:
class cFCOSpecListCanonicalIter class cFCOSpecListCanonicalIter
{ {
public: public:
cFCOSpecListCanonicalIter(const cFCOSpecList& list); explicit cFCOSpecListCanonicalIter(const cFCOSpecList& list);
~cFCOSpecListCanonicalIter(); ~cFCOSpecListCanonicalIter();
void SeekBegin() const; void SeekBegin() const;

View File

@ -50,6 +50,7 @@ template<class TYPE>
class cIterProxy class cIterProxy
{ {
public: public:
//TODO: Can these 2 constructors be made explicit?
cIterProxy(TYPE* pIter = NULL) : mpIter(pIter) {}; cIterProxy(TYPE* pIter = NULL) : mpIter(pIter) {};
cIterProxy(const TYPE* pIter) : mpIter((TYPE*)pIter) {}; cIterProxy(const TYPE* pIter) : mpIter((TYPE*)pIter) {};
~cIterProxy() { if (mpIter) mpIter->DestroyIter(); } ~cIterProxy() { if (mpIter) mpIter->DestroyIter(); }

View File

@ -60,7 +60,7 @@ class cFSObject : public iFCO
DECLARE_SERREFCOUNT() DECLARE_SERREFCOUNT()
public: public:
cFSObject(const cFCOName& name); explicit cFSObject(const cFCOName& name);
virtual void SetName(const cFCOName& name) ; virtual void SetName(const cFCOName& name) ;
virtual const cFCOName& GetName() const ; virtual const cFCOName& GetName() const ;

View File

@ -255,7 +255,7 @@ private:
class cPipedMailMessage : public cMailMessage class cPipedMailMessage : public cMailMessage
{ {
public: public:
cPipedMailMessage(TSTRING strSendMailExePath); explicit cPipedMailMessage(const TSTRING& strSendMailExePath);
virtual ~cPipedMailMessage(); virtual ~cPipedMailMessage();
virtual bool Send(); //throw(eMailMessageError) virtual bool Send(); //throw(eMailMessageError)

View File

@ -49,7 +49,7 @@
// //
// Constructor. Not much to do beside initialize the handle to the DLL // Constructor. Not much to do beside initialize the handle to the DLL
// //
cPipedMailMessage::cPipedMailMessage(TSTRING strSendMailExePath) cPipedMailMessage::cPipedMailMessage(const TSTRING& strSendMailExePath)
{ {
mstrSendMailExePath = strSendMailExePath; mstrSendMailExePath = strSendMailExePath;
mpFile = NULL; mpFile = NULL;

View File

@ -140,7 +140,7 @@ private:
class cConfigFileIter class cConfigFileIter
{ {
public: public:
cConfigFileIter( cConfigFile& cf); explicit cConfigFileIter( cConfigFile& cf);
virtual ~cConfigFileIter(); virtual ~cConfigFileIter();
void SeekBegin() const; void SeekBegin() const;

View File

@ -98,7 +98,7 @@ public:
// Ctor, Dtor: // Ctor, Dtor:
~cDebugHierDbIter () {} ~cDebugHierDbIter () {}
cDebugHierDbIter ( cHierDatabase* pDb ) : cHierDatabaseIter( pDb ) {} explicit cDebugHierDbIter ( cHierDatabase* pDb ) : cHierDatabaseIter( pDb ) {}
// //
// Methods for obtaining protected members of cHierDatabaseIter: // Methods for obtaining protected members of cHierDatabaseIter:

View File

@ -112,7 +112,7 @@ public:
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
struct tEntry struct tEntry
{ {
tEntry( cGenre::Genre genre ); explicit tEntry( cGenre::Genre genre );
// the ctor will get the appropriate database construction parameters // the ctor will get the appropriate database construction parameters
// based on the genre number. // based on the genre number.
~tEntry( ) ~tEntry( )
@ -146,7 +146,7 @@ private:
class cFCODatabaseFileIter class cFCODatabaseFileIter
{ {
public: public:
cFCODatabaseFileIter( cFCODatabaseFile& dbFile ); explicit cFCODatabaseFileIter( cFCODatabaseFile& dbFile );
void SeekBegin(); void SeekBegin();
void Next(); void Next();

View File

@ -239,10 +239,12 @@ cFCOReportGenreIter::~cFCOReportGenreIter()
delete mpData; delete mpData;
} }
void cFCOReportGenreIter::operator=(const cFCOReportGenreIter& rhs) cFCOReportGenreIter& cFCOReportGenreIter::operator=(const cFCOReportGenreIter& rhs)
{ {
mpData->mpList = rhs.mpData->mpList; mpData->mpList = rhs.mpData->mpList;
mpData->mIter = rhs.mpData->mIter; mpData->mIter = rhs.mpData->mIter;
return *this;
} }
// iteration methods // iteration methods
@ -380,13 +382,15 @@ cFCOReportSpecIter::cFCOReportSpecIter(const cFCOReportSpecIter& rhs)
*this = rhs; *this = rhs;
} }
void cFCOReportSpecIter::operator=(const cFCOReportSpecIter& rhs) cFCOReportSpecIter& cFCOReportSpecIter::operator=(const cFCOReportSpecIter& rhs)
{ {
if (mpData == 0) if (mpData == 0)
mpData = new cFCOReportSpecIter_i(); mpData = new cFCOReportSpecIter_i();
mpData->mpList = rhs.mpData->mpList; mpData->mpList = rhs.mpData->mpList;
mpData->mIter = rhs.mpData->mIter; mpData->mIter = rhs.mpData->mIter;
return *this;
} }
int cFCOReportSpecIter::GetNumChanged() const int cFCOReportSpecIter::GetNumChanged() const
@ -525,10 +529,12 @@ cFCOReportChangeIter::~cFCOReportChangeIter()
delete mpData; delete mpData;
} }
void cFCOReportChangeIter::operator=(const cFCOReportChangeIter& rhs) cFCOReportChangeIter& cFCOReportChangeIter::operator=(const cFCOReportChangeIter& rhs)
{ {
mpData->mpList = rhs.mpData->mpList; mpData->mpList = rhs.mpData->mpList;
mpData->mIter = rhs.mpData->mIter; mpData->mIter = rhs.mpData->mIter;
return *this;
} }
void cFCOReportChangeIter::SetSpecIter(const cFCOReportSpecIter& specIter) void cFCOReportChangeIter::SetSpecIter(const cFCOReportSpecIter& specIter)

View File

@ -147,7 +147,7 @@ public:
cFCOReportGenreIter(const cFCOReportGenreIter& rhs); cFCOReportGenreIter(const cFCOReportGenreIter& rhs);
~cFCOReportGenreIter(); ~cFCOReportGenreIter();
void operator=(const cFCOReportGenreIter& rhs); cFCOReportGenreIter& operator=(const cFCOReportGenreIter& rhs);
// iteration methods // iteration methods
void SeekBegin() const; void SeekBegin() const;
@ -179,13 +179,13 @@ public:
cFCOReportSpecIter(cFCOReport& report, cGenre::Genre genre); cFCOReportSpecIter(cFCOReport& report, cGenre::Genre genre);
// if genre does not exist in the report, it will be added to the report with // if genre does not exist in the report, it will be added to the report with
// and empty spec list. // and empty spec list.
cFCOReportSpecIter(const cFCOReportGenreIter& genreIter); explicit cFCOReportSpecIter(const cFCOReportGenreIter& genreIter);
// thorws eInternal if genreIter is not at a valid genre or is Done() // thorws eInternal if genreIter is not at a valid genre or is Done()
cFCOReportSpecIter(const cFCOReportSpecIter& rhs); cFCOReportSpecIter(const cFCOReportSpecIter& rhs);
~cFCOReportSpecIter(); ~cFCOReportSpecIter();
void operator=(const cFCOReportSpecIter& rhs); cFCOReportSpecIter& operator=(const cFCOReportSpecIter& rhs);
// iteration methods // iteration methods
void SeekBegin() const; void SeekBegin() const;
@ -226,11 +226,11 @@ private:
class cFCOReportChangeIter class cFCOReportChangeIter
{ {
public: public:
cFCOReportChangeIter(const cFCOReportSpecIter& specIter); explicit cFCOReportChangeIter(const cFCOReportSpecIter& specIter);
cFCOReportChangeIter(const cFCOReportChangeIter& rhs); cFCOReportChangeIter(const cFCOReportChangeIter& rhs);
~cFCOReportChangeIter(); ~cFCOReportChangeIter();
void operator=(const cFCOReportChangeIter& rhs); cFCOReportChangeIter& operator=(const cFCOReportChangeIter& rhs);
void SetSpecIter(const cFCOReportSpecIter& specIter); void SetSpecIter(const cFCOReportSpecIter& specIter);
// assocaite this iterator with a different spec. We will assert // assocaite this iterator with a different spec. We will assert
// that specIter.Done() is not true. // that specIter.Done() is not true.

View File

@ -91,7 +91,7 @@ TSS_FILE_EXCEPTION( eFileManipUnrecognizedFileType, eFileManip )
class cFileManipulator class cFileManipulator
{ {
public: public:
cFileManipulator(const TCHAR* filename); explicit cFileManipulator(const TCHAR* filename);
// throws eArchive if file does not exist // throws eArchive if file does not exist
cFileManipulator(const cFileManipulator& rhs); cFileManipulator(const cFileManipulator& rhs);
~cFileManipulator(); ~cFileManipulator();

View File

@ -155,7 +155,7 @@ protected:
RuleSummaryLine() : mSeverity(0), mAddedObjects(0), mRemovedObjects(0), mChangedObjects(0) {} RuleSummaryLine() : mSeverity(0), mAddedObjects(0), mRemovedObjects(0), mChangedObjects(0) {}
RuleSummaryLine(const RuleSummaryLine& rhs) { *this = rhs; } RuleSummaryLine(const RuleSummaryLine& rhs) { *this = rhs; }
void operator = (const RuleSummaryLine& rhs) RuleSummaryLine& operator = (const RuleSummaryLine& rhs)
{ {
mSpecName = rhs.mSpecName; mSpecName = rhs.mSpecName;
mSeverity = rhs.mSeverity; mSeverity = rhs.mSeverity;
@ -163,6 +163,8 @@ protected:
mRemovedObjects = rhs.mRemovedObjects; mRemovedObjects = rhs.mRemovedObjects;
mChangedObjects = rhs.mChangedObjects; mChangedObjects = rhs.mChangedObjects;
mStartPoint = rhs.mStartPoint; mStartPoint = rhs.mStartPoint;
return *this;
} }
}; };

View File

@ -855,7 +855,7 @@ void cTWUtil::ReadConfigText(cArchive &arch, TSTRING& configText, cArchive* pBag
// of the policy file text to disk. // of the policy file text to disk.
// Will throw eError on failure. // Will throw eError on failure.
void cTWUtil::WritePolicyText(const TCHAR* filename, const std::string polText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey) void cTWUtil::WritePolicyText(const TCHAR* filename, const std::string& polText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey)
{ {
cSerializableNString nstring; cSerializableNString nstring;
@ -874,7 +874,7 @@ void cTWUtil::WritePolicyText(const TCHAR* filename, const std::string polText,
cDisplayEncoder::EncodeInline( filename ).c_str() ); cDisplayEncoder::EncodeInline( filename ).c_str() );
} }
void cTWUtil::WritePolicyText(cArchive &archive, const std::string polText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey) void cTWUtil::WritePolicyText(cArchive &archive, const std::string& polText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey)
{ {
cSerializableNString nstring; cSerializableNString nstring;

View File

@ -122,8 +122,8 @@ public:
// eSerializer is thrown if reading or writing fails // eSerializer is thrown if reading or writing fails
// eConfigFile is thrown if config file does not parse correctly during reading // eConfigFile is thrown if config file does not parse correctly during reading
static void WritePolicyText(const TCHAR* filename, const std::string policyText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); static void WritePolicyText(const TCHAR* filename, const std::string& policyText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey);
static void WritePolicyText(cArchive &archive, const std::string policyText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey); static void WritePolicyText(cArchive &archive, const std::string& policyText, bool bEncrypt, const cElGamalSigPrivateKey* pPrivateKey);
static void ReadPolicyText(const TCHAR* filename, std::string& policyText, const cElGamalSigPublicKey* pPublicKey); static void ReadPolicyText(const TCHAR* filename, std::string& policyText, const cElGamalSigPublicKey* pPublicKey);
static void ReadPolicyText(cArchive &archive, std::string& policyText, const cElGamalSigPublicKey* pPublicKey); static void ReadPolicyText(cArchive &archive, std::string& policyText, const cElGamalSigPublicKey* pPublicKey);
// read and write policy file to and from disk // read and write policy file to and from disk

View File

@ -46,7 +46,7 @@
class cByteQueueNode class cByteQueueNode
{ {
public: public:
cByteQueueNode(unsigned int maxSize); explicit cByteQueueNode(unsigned int maxSize);
unsigned int CurrentSize() const unsigned int CurrentSize() const
{return tail-head;} {return tail-head;}

View File

@ -45,7 +45,7 @@ class cByteQueueNode;
class cByteQueue : public BufferedTransformation class cByteQueue : public BufferedTransformation
{ {
public: public:
cByteQueue(int nodeSize=1024); explicit cByteQueue(int nodeSize=1024);
cByteQueue(const cByteQueue &copy); cByteQueue(const cByteQueue &copy);
~cByteQueue(); ~cByteQueue();

View File

@ -147,9 +147,9 @@ public:
KEY2048 = 2048 KEY2048 = 2048
}; };
cRSA(KeySize keysize); explicit cRSA(KeySize keysize);
cRSA(const cRSAPublicKey& publicKey); // read keysize from key explicit cRSA(const cRSAPublicKey& publicKey); // read keysize from key
cRSA(const cRSAPrivateKey& privateKey); // ditto explicit cRSA(const cRSAPrivateKey& privateKey); // ditto
virtual ~cRSA(); virtual ~cRSA();
void SetEncrypting(const cRSAPublicKey* pKey); void SetEncrypting(const cRSAPublicKey* pKey);
@ -183,7 +183,7 @@ class cRSAPrivateKey
friend class cRSA; friend class cRSA;
friend class cRSAPublicKey; friend class cRSAPublicKey;
public: public:
cRSAPrivateKey(void* pDataStream); explicit cRSAPrivateKey(void* pDataStream);
~cRSAPrivateKey(); ~cRSAPrivateKey();
int GetWriteLen() const; int GetWriteLen() const;
@ -202,8 +202,8 @@ class cRSAPublicKey
{ {
friend class cRSA; friend class cRSA;
public: public:
cRSAPublicKey(void* pDataStream); explicit cRSAPublicKey(void* pDataStream);
cRSAPublicKey(const cRSAPrivateKey& privateKey); explicit cRSAPublicKey(const cRSAPrivateKey& privateKey);
~cRSAPublicKey(); ~cRSAPublicKey();
int GetWriteLen() const; int GetWriteLen() const;
@ -249,9 +249,9 @@ public:
KEY2048 = 2048 KEY2048 = 2048
}; };
cElGamalSig(KeySize keysize); explicit cElGamalSig(KeySize keysize);
cElGamalSig(const cElGamalSigPublicKey& publicKey); // read keysize from key explicit cElGamalSig(const cElGamalSigPublicKey& publicKey); // read keysize from key
cElGamalSig(const cElGamalSigPrivateKey& privateKey); // ditto explicit cElGamalSig(const cElGamalSigPrivateKey& privateKey); // ditto
virtual ~cElGamalSig(); virtual ~cElGamalSig();
void SetSigning(const cElGamalSigPrivateKey* pKey); void SetSigning(const cElGamalSigPrivateKey* pKey);
@ -285,7 +285,7 @@ class cElGamalSigPrivateKey
friend class cElGamalSig; friend class cElGamalSig;
friend class cElGamalSigPublicKey; friend class cElGamalSigPublicKey;
public: public:
cElGamalSigPrivateKey(void* pDataStream); explicit cElGamalSigPrivateKey(void* pDataStream);
~cElGamalSigPrivateKey(); ~cElGamalSigPrivateKey();
int GetWriteLen() const; int GetWriteLen() const;
@ -304,8 +304,8 @@ class cElGamalSigPublicKey
{ {
friend class cElGamalSig; friend class cElGamalSig;
public: public:
cElGamalSigPublicKey(void* pDataStream); explicit cElGamalSigPublicKey(void* pDataStream);
cElGamalSigPublicKey(const cElGamalSigPrivateKey& privateKey); explicit cElGamalSigPublicKey(const cElGamalSigPrivateKey& privateKey);
~cElGamalSigPublicKey(); ~cElGamalSigPublicKey();
int GetWriteLen() const; int GetWriteLen() const;
@ -332,7 +332,7 @@ private:
class cHashedKey128 class cHashedKey128
{ {
public: public:
cHashedKey128(const TSTRING& data); explicit cHashedKey128(const TSTRING& data);
cHashedKey128(void* pData, int dataLen); cHashedKey128(void* pData, int dataLen);
~cHashedKey128(); ~cHashedKey128();
@ -368,7 +368,7 @@ inline void cHashedKey128::Write(void* pDataStream)
class cHashedKey192 class cHashedKey192
{ {
public: public:
cHashedKey192(const TSTRING& data); explicit cHashedKey192(const TSTRING& data);
cHashedKey192(void* pData, int dataLen); cHashedKey192(void* pData, int dataLen);
~cHashedKey192(); ~cHashedKey192();

View File

@ -238,7 +238,7 @@ public:
// //
// ctors and dtor // ctors and dtor
// //
cParseRule( const cParseSpecMask& defSpecMask ) :mDefSpecMask( defSpecMask ), mpAttrList(0), mpSpecMaskList(0), mName(_T("")) {} explicit cParseRule( const cParseSpecMask& defSpecMask ) :mDefSpecMask( defSpecMask ), mpAttrList(0), mpSpecMaskList(0), mName(_T("")) {}
~cParseRule(); ~cParseRule();
// //

View File

@ -76,7 +76,7 @@ class tw_yy_scan : public yy_scan
{ {
enum { MAX_TOKEN_LENGTH = 1024 }; enum { MAX_TOKEN_LENGTH = 1024 };
public: public:
tw_yy_scan( std::istream& i ) : yy_scan( MAX_TOKEN_LENGTH ), mIn(i) {}; // need to increase token length over mks default explicit tw_yy_scan( std::istream& i ) : yy_scan( MAX_TOKEN_LENGTH ), mIn(i) {}; // need to increase token length over mks default
virtual int yygetc() { return mIn.get(); }; virtual int yygetc() { return mIn.get(); };
@ -123,7 +123,7 @@ private:
class cPolicyParser class cPolicyParser
{ {
public: public:
cPolicyParser( std::istream& in ); // input source explicit cPolicyParser( std::istream& in ); // input source
void Execute( cGenreSpecListVector& policy, cErrorBucket* pError ); //throw(eError); void Execute( cGenreSpecListVector& policy, cErrorBucket* pError ); //throw(eError);
void Check( cErrorBucket* pError ); //throw(eError); void Check( cErrorBucket* pError ); //throw(eError);