From 2b067176ad9ba0817e4775ef253e2188b9dd78af Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 17 Mar 2017 00:04:21 -0700 Subject: [PATCH] Fix some clang extended warnings: non-virtual-dtor, shadow, unneeded-internal-declaration --- src/core/displayencoder.cpp | 14 ++++++++++++-- src/fco/fcodatasource.h | 2 ++ src/tw/textreportviewer.cpp | 6 +++--- src/twadmin/twadmincl.cpp | 12 ++++++------ src/twcrypto/bytequeue.cpp | 4 ++-- src/twprint/twprintcmdline.cpp | 4 +--- src/twtest/hierdatabase_t.cpp | 4 ++-- 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/core/displayencoder.cpp b/src/core/displayencoder.cpp index e0e1102..3b3536d 100644 --- a/src/core/displayencoder.cpp +++ b/src/core/displayencoder.cpp @@ -81,6 +81,8 @@ inline bool IsSingleTCHAR( TSTRING::const_iterator first, class iCharEncoder { public: + virtual ~iCharEncoder() {}; + virtual bool NeedsEncoding( TSTRING::const_iterator first, TSTRING::const_iterator last ) const = 0; // Determines if character identified by [first,last) needs encoding. @@ -107,7 +109,7 @@ class iCharEncoder static TCHAR EscapeChar() { return char_escape; } - protected: + protected: static TCHAR char_escape; }; @@ -116,6 +118,8 @@ class iCharEncoder class cNonNarrowableCharEncoder : public iCharEncoder { public: + virtual ~cNonNarrowableCharEncoder() {} + virtual bool NeedsEncoding( TSTRING::const_iterator first, TSTRING::const_iterator last ) const; @@ -141,7 +145,9 @@ class cNonPrintableCharEncoder : public iCharEncoder cNonPrintableCharEncoder( bool f_allowWS ) : m_allowWS( f_allowWS ) {}; - virtual bool NeedsEncoding( TSTRING::const_iterator first, + virtual ~cNonPrintableCharEncoder() {} + + virtual bool NeedsEncoding( TSTRING::const_iterator first, TSTRING::const_iterator last ) const; virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first, @@ -164,6 +170,8 @@ class cNonPrintableCharEncoder : public iCharEncoder class cQuoteCharEncoder : public iCharEncoder { public: + virtual ~cQuoteCharEncoder() {} + virtual bool NeedsEncoding( TSTRING::const_iterator first, TSTRING::const_iterator last ) const; @@ -187,6 +195,8 @@ class cQuoteCharEncoder : public iCharEncoder class cBackslashCharEncoder : public iCharEncoder { public: + virtual ~cBackslashCharEncoder() {} + virtual bool NeedsEncoding( TSTRING::const_iterator first, TSTRING::const_iterator last ) const; diff --git a/src/fco/fcodatasource.h b/src/fco/fcodatasource.h index 1cbebb1..f103189 100644 --- a/src/fco/fcodatasource.h +++ b/src/fco/fcodatasource.h @@ -46,6 +46,8 @@ public: enum { CHILDREN_NONE = 0, CHILDREN_ALL = -1 }; + virtual ~iFCODataSource() = 0; + // NOTE -- in the act of creating fcos, there are certain properties that we can obtain "for free" just // by the act of querying the system we are generating fcos for (for example, a stat() call is required // to create file system fcos, which also gives us many of the fsfco's property values). Therefore, diff --git a/src/tw/textreportviewer.cpp b/src/tw/textreportviewer.cpp index 2d6986d..2824536 100644 --- a/src/tw/textreportviewer.cpp +++ b/src/tw/textreportviewer.cpp @@ -436,8 +436,8 @@ void cTextReportViewer::PrintErrors() cFCOReportSpecIter rsi( genreIter ); for( rsi.SeekBegin(); !rsi.Done(); rsi.Next() ) { - cErrorQueueIter eqIter( *( rsi.GetErrorQueue() ) ); - for( eqIter.SeekBegin(); !eqIter.Done(); eqIter.Next() ) + cErrorQueueIter eqIter2( *( rsi.GetErrorQueue() ) ); + for( eqIter2.SeekBegin(); !eqIter2.Done(); eqIter2.Next() ) { if( fFirstErrorInGenre ) { @@ -445,7 +445,7 @@ void cTextReportViewer::PrintErrors() fFirstErrorInGenre = false; } - ReportError( eqIter ); + ReportError( eqIter2 ); } } diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index 17db7e2..b4d1ddb 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -325,18 +325,18 @@ bool cTWAModeCreateCfg::Init(const cConfigFile* cf, const cCmdLineParser& parser } // get full path to files - TSTRING strFullPath; - if( iFSServices::GetInstance()->FullPath( strFullPath, mPlaintextConfig ) ) - mPlaintextConfig = strFullPath; + TSTRING strPlaintextConfigPath; + if( iFSServices::GetInstance()->FullPath( strPlaintextConfigPath, mPlaintextConfig ) ) + mPlaintextConfig = strPlaintextConfigPath; // OK, now we need to figure out where to put the new config file. // If the location was specified on the command line, get the full path to it. // otherwise, the location is the dir that this exe is in. if( fConfigOnCmdLine ) { - TSTRING strFullPath; - if( iFSServices::GetInstance()->FullPath( strFullPath, mEncryptedConfig ) ) - mEncryptedConfig = strFullPath; + TSTRING strEncryptedConfigPath; + if( iFSServices::GetInstance()->FullPath( strEncryptedConfigPath, mEncryptedConfig ) ) + mEncryptedConfig = strEncryptedConfigPath; } else { diff --git a/src/twcrypto/bytequeue.cpp b/src/twcrypto/bytequeue.cpp index 118f464..accc70b 100644 --- a/src/twcrypto/bytequeue.cpp +++ b/src/twcrypto/bytequeue.cpp @@ -133,9 +133,9 @@ unsigned int cByteQueueNode::Peek(byte &outByte) const // cByteQueue //----------------------------------------------------------------------------- -cByteQueue::cByteQueue(int mNodeSize) +cByteQueue::cByteQueue(int nodeSize) : BufferedTransformation(), - mNodeSize(mNodeSize), + mNodeSize(nodeSize), mCurrentSize(0) { head = tail = new cByteQueueNode(mNodeSize); diff --git a/src/twprint/twprintcmdline.cpp b/src/twprint/twprintcmdline.cpp index 7e10372..9e3fe8e 100644 --- a/src/twprint/twprintcmdline.cpp +++ b/src/twprint/twprintcmdline.cpp @@ -498,9 +498,6 @@ bool cTWPrintReportMode::Init(const cConfigFile& cf, const cCmdLineParser& cmdLi /////////////////////////////////////////////////////////////////////////////// int cTWPrintReportMode::Execute(cErrorQueue* pQueue) { - cFCOReport report; - cFCOReportHeader reportHeader; - try { ASSERT( ! mpData->mReportFile.empty() ); @@ -510,6 +507,7 @@ int cTWPrintReportMode::Execute(cErrorQueue* pQueue) cKeyFile localKeyfile; const cElGamalSigPublicKey* pKey; cFCOReport report; + cFCOReportHeader reportHeader; cTWUtil::OpenKeyFile( localKeyfile, mpData->mLocalKeyFile ); pKey = localKeyfile.GetPublicKey(); diff --git a/src/twtest/hierdatabase_t.cpp b/src/twtest/hierdatabase_t.cpp index 62d517c..e3a7545 100644 --- a/src/twtest/hierdatabase_t.cpp +++ b/src/twtest/hierdatabase_t.cpp @@ -35,7 +35,7 @@ #include "test.h" #include "core/error.h" -static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true ) +/*static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true ) { if( ! bFirst ) { @@ -54,7 +54,7 @@ static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true } d.TraceDebug( "-- Done Processing directory %s\n", iter.GetCwd().c_str() ); -} +}*/ static void GetNoun( TSTRING& noun ) {