diff --git a/configure b/configure index 73eef5b..89b6cec 100755 --- a/configure +++ b/configure @@ -3251,8 +3251,8 @@ ac_config_headers="$ac_config_headers config.h" rm -f src/tripwire/syslog.h 2> /dev/null chmod 755 install-sh 2> /dev/null -CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} -CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} +CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} +CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : diff --git a/configure.in b/configure.in index 4cb8f5f..ebd7a95 100644 --- a/configure.in +++ b/configure.in @@ -17,8 +17,8 @@ chmod 755 install-sh 2> /dev/null dnl ############### dnl Setup defaults dnl ############### -CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} -CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} +CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} +CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wextra -Wno-unused-parameter -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} dnl ##################### dnl Configuration options diff --git a/src/core/archive.cpp b/src/core/archive.cpp index 08c7813..3815c0f 100755 --- a/src/core/archive.cpp +++ b/src/core/archive.cpp @@ -237,7 +237,7 @@ int64 cArchive::Copy(cArchive* pFrom, int64 amt) while(amtLeft > 0) { - int64 amtToRead = amtLeft > BUF_SIZE ? BUF_SIZE : amtLeft; + int64 amtToRead = amtLeft > (int64)BUF_SIZE ? (int64)BUF_SIZE : amtLeft; int64 amtRead = pFrom->ReadBlob(buf, static_cast( amtToRead ) ); amtLeft -= amtRead; WriteBlob(buf, static_cast( amtRead ) ); diff --git a/src/core/debug.h b/src/core/debug.h index b38a8da..4891a32 100644 --- a/src/core/debug.h +++ b/src/core/debug.h @@ -190,33 +190,33 @@ inline int cDebug::GetDebugLevel() #else // DEBUG -inline cDebug::cDebug (const char *pLabel) {} +inline cDebug::cDebug (const char *) {} inline cDebug::~cDebug () {} -inline cDebug::cDebug (const cDebug& rhs) {} -inline void cDebug::TraceAlways (const char *format, ...) {} -inline void cDebug::TraceError (const char *format, ...) {} -inline void cDebug::TraceWarning (const char *format, ...) {} -inline void cDebug::TraceDebug (const char *format, ...) {} -inline void cDebug::TraceDetail (const char *format, ...) {} -inline void cDebug::TraceNever (const char *format, ...) {} -inline void cDebug::TraceAlways (const wchar_t *format, ...) {} -inline void cDebug::TraceError (const wchar_t *format, ...) {} -inline void cDebug::TraceWarning (const wchar_t *format, ...) {} -inline void cDebug::TraceDebug (const wchar_t *format, ...) {} -inline void cDebug::TraceDetail (const wchar_t *format, ...) {} -inline void cDebug::TraceNever (const wchar_t *format, ...) {} -inline void cDebug::TraceVaArgs (int iDebugLevel, const char *format, va_list &args) {} -inline void cDebug::TraceVaArgs (int iDebugLevel, const wchar_t *format, va_list &args) {} -inline void cDebug::Trace (int levelNum, const char* format, ...) {} -inline void cDebug::Trace (int levelNum, const wchar_t* format, ...) {} -inline bool cDebug::AddOutTarget (OutTarget target) { return false; } -inline bool cDebug::RemoveOutTarget (OutTarget target) { return false; } -inline bool cDebug::HasOutTarget (OutTarget target) { return false; } -inline bool cDebug::SetOutputFile (const char* filename) { return false; } -inline void cDebug::SetDebugLevel (int level) {} +inline cDebug::cDebug (const cDebug&) {} +inline void cDebug::TraceAlways (const char *, ...) {} +inline void cDebug::TraceError (const char *, ...) {} +inline void cDebug::TraceWarning (const char *, ...) {} +inline void cDebug::TraceDebug (const char *, ...) {} +inline void cDebug::TraceDetail (const char *, ...) {} +inline void cDebug::TraceNever (const char *, ...) {} +inline void cDebug::TraceAlways (const wchar_t *, ...) {} +inline void cDebug::TraceError (const wchar_t *, ...) {} +inline void cDebug::TraceWarning (const wchar_t *, ...) {} +inline void cDebug::TraceDebug (const wchar_t *, ...) {} +inline void cDebug::TraceDetail (const wchar_t *, ...) {} +inline void cDebug::TraceNever (const wchar_t *, ...) {} +inline void cDebug::TraceVaArgs (int, const char *, va_list &) {} +inline void cDebug::TraceVaArgs (int, const wchar_t *, va_list &) {} +inline void cDebug::Trace (int, const char*, ...) {} +inline void cDebug::Trace (int, const wchar_t*, ...) {} +inline bool cDebug::AddOutTarget (OutTarget) { return false; } +inline bool cDebug::RemoveOutTarget (OutTarget) { return false; } +inline bool cDebug::HasOutTarget (OutTarget) { return false; } +inline bool cDebug::SetOutputFile (const char*) { return false; } +inline void cDebug::SetDebugLevel (int) {} inline int cDebug::GetDebugLevel (void) { return 0; } -inline void cDebug::DebugOut ( const char* lpOutputString, ... ) {} -inline void cDebug::DebugOut ( const wchar_t* lpOutputString, ... ) {} +inline void cDebug::DebugOut ( const char*, ... ) {} +inline void cDebug::DebugOut ( const wchar_t*, ... ) {} #endif // DEBUG diff --git a/src/core/errorbucketimpl.cpp b/src/core/errorbucketimpl.cpp index 132b3f1..8f3aaea 100644 --- a/src/core/errorbucketimpl.cpp +++ b/src/core/errorbucketimpl.cpp @@ -56,7 +56,6 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra) (cDisplayEncoder::Flags) ( cDisplayEncoder::NON_ROUNDTRIP | cDisplayEncoder::ALLOW_WHITESPACE ) ); TSTRING errStr; - int len; // // if the ID is zero, just return. @@ -86,7 +85,7 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra) errStr = strm.str(); } - len = errStr.length(); // save for later + //int len = errStr.length(); // save for later TCERR << errStr; // "First Part" error string diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index df6969d..1fea9a4 100755 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -54,7 +54,7 @@ /////////////////////////////////////////////////////////////////////////////// // util_GetErrnoString -- return the result of strerror(errno) as a tstring /////////////////////////////////////////////////////////////////////////////// -static TSTRING util_GetErrnoString() +/*static TSTRING util_GetErrnoString() { TSTRING ret; char* pErrorStr = strerror(errno); @@ -64,7 +64,7 @@ static TSTRING util_GetErrnoString() ret = pErrorStr; #endif return ret; -} +}*/ /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// diff --git a/src/core/twlocale.cpp b/src/core/twlocale.cpp index 549502f..aacb404 100644 --- a/src/core/twlocale.cpp +++ b/src/core/twlocale.cpp @@ -57,11 +57,13 @@ //========================================================================= // UTIL FUNCTION PROTOTYPES //========================================================================= - static TSTRING& util_FormatTimeC( struct tm* ptm, TSTRING& strBuf ); -static TSTRING& util_FormatTimeCPlusPlus( struct tm* ptm, TSTRING& strBuf ); static TSTRING& util_FormatTime( struct tm* ptm, TSTRING& strBuf ); +#if !USES_CLIB_DATE_FUNCTION +static TSTRING& util_FormatTimeCPlusPlus( struct tm* ptm, TSTRING& strBuf ); +#endif + //========================================================================= // PUBLIC METHOD CODE //========================================================================= @@ -281,6 +283,7 @@ TSTRING& util_FormatTime( struct tm* ptm, TSTRING& strBuf ) } +#if !USES_CLIB_DATE_FUNCTION TSTRING& util_FormatTimeCPlusPlus( struct tm* ptm, TSTRING& strBuf ) { ASSERT( ptm ); @@ -299,6 +302,7 @@ TSTRING& util_FormatTimeCPlusPlus( struct tm* ptm, TSTRING& strBuf ) strBuf = sstr.str(); return strBuf; } +#endif TSTRING& util_FormatTimeC( struct tm* ptm, TSTRING& strBuf ) diff --git a/src/fco/genrespeclist.cpp b/src/fco/genrespeclist.cpp index 82a36ee..17f2b49 100644 --- a/src/fco/genrespeclist.cpp +++ b/src/fco/genrespeclist.cpp @@ -81,10 +81,12 @@ void cGenreSpecListPair::SetSpecList(const cFCOSpecList& speclist) //============================================================================= cGenreSpecListVector::cGenreSpecListVector() + : std::vector() { } -cGenreSpecListVector::cGenreSpecListVector(const cGenreSpecListVector& rhs) +cGenreSpecListVector::cGenreSpecListVector(const cGenreSpecListVector& rhs) + : std::vector() { *this = rhs; } diff --git a/src/fco/signature.cpp b/src/fco/signature.cpp index 9111212..7fc6ee4 100755 --- a/src/fco/signature.cpp +++ b/src/fco/signature.cpp @@ -523,24 +523,22 @@ TSTRING cMD5Signature::AsString() const return AsStringHex(); TSTRING ret; - char buf[24]; - int length; + char buf[24]; ASSERT( sizeof( uint8 ) == sizeof( byte ) ); /* everything breaks otherwise */ - btob64((byte*)md5_digest, buf, SIG_BYTE_SIZE*8); + btob64((byte*)md5_digest, buf, SIG_BYTE_SIZE*8); //converting to base64 representation. - length = strlen(buf); #ifdef _UNICODE //making it TSTRING sensitive - ret.resize(length); - mbstowcs((TCHAR*) ret.data(), buf, length); + int length; + length = strlen(buf); + ret.resize(length); + mbstowcs((TCHAR*) ret.data(), buf, length); #else - ret.append(buf); + ret.append(buf); #endif - return ret; - //return ret; - //ret holds base64 representation of digest. + return ret; } TSTRING cMD5Signature::AsStringHex() const @@ -649,13 +647,13 @@ TSTRING cSHASignature::AsString(void) const TSTRING ret; char* ps_signature; char buf[100]; - int length; ps_signature = btob64((uint8*)sha_digest, buf, SIG_UINT32_SIZE*sizeof(uint32)*8); //converting to base64 representation. - length = strlen(ps_signature); - + #ifdef _UNICODE //making it TSTRING sensitive + int length; + length = strlen(ps_signature); ret.resize(length); mbstowcs((TCHAR*) ret.data(), ps_signature, length); #else @@ -839,23 +837,21 @@ TSTRING cHAVALSignature::AsString() const return AsStringHex(); TSTRING ret; - char buf[24]; - int length; + char buf[24]; - btob64((byte*)mSignature, buf, 128); - //converting to base64 representation. - length = strlen(buf); + btob64((byte*)mSignature, buf, 128); + //converting to base64 representation. #ifdef _UNICODE //making it TSTRING sensitive - ret.resize(length); - mbstowcs((TCHAR*) ret.data(), buf, length); + int length; + length = strlen(buf); + ret.resize(length); + mbstowcs((TCHAR*) ret.data(), buf, length); #else - ret.append(buf); + ret.append(buf); #endif - return ret; - //return ret; - //ret holds base64 representation of digest. + return ret; } TSTRING cHAVALSignature::AsStringHex() const diff --git a/src/fs/fsdatasourceiter.cpp b/src/fs/fsdatasourceiter.cpp index 998299d..9696f9d 100644 --- a/src/fs/fsdatasourceiter.cpp +++ b/src/fs/fsdatasourceiter.cpp @@ -55,11 +55,10 @@ // METHOD CODE //========================================================================= -cFSDataSourceIter::cFSDataSourceIter() +cFSDataSourceIter::cFSDataSourceIter() : cFCODataSourceIterImpl(), mDev(0) { // set the case sensitiveness of the parent... // - mDev = 0; mParentName.SetCaseSensitive( iTWFactory::GetInstance()->GetNameInfo()->IsCaseSensitive() ); } @@ -67,7 +66,7 @@ cFSDataSourceIter::~cFSDataSourceIter() { } -cFSDataSourceIter::cFSDataSourceIter( const cFSDataSourceIter& rhs ) +cFSDataSourceIter::cFSDataSourceIter( const cFSDataSourceIter& rhs ) : cFCODataSourceIterImpl(), mDev(0) { // set the case sensitiveness of the parent... // diff --git a/src/tripwire/pipedmailmessage.cpp b/src/tripwire/pipedmailmessage.cpp index be80c09..bfaeb32 100644 --- a/src/tripwire/pipedmailmessage.cpp +++ b/src/tripwire/pipedmailmessage.cpp @@ -86,8 +86,6 @@ bool cPipedMailMessage::Send() // Get Body and Attachments //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool allOK = true; - // get body std::string sNBody = cStringUtil::TstrToStr( mstrBody ); @@ -96,7 +94,6 @@ bool cPipedMailMessage::Send() if( ! GetAttachmentsAsString( sAttachments ) ) { sAttachments.erase(); - allOK = false; } std::string sSend = sNBody + sAttachments; diff --git a/src/tw/configfile.cpp b/src/tw/configfile.cpp index d9d7670..2b977a6 100644 --- a/src/tw/configfile.cpp +++ b/src/tw/configfile.cpp @@ -75,7 +75,7 @@ static bool PopNextLine( TSTRING& fileIn, TSTRING& sLine, int& nLine ); static bool IsReturnChar( TCHAR tch ); static bool IsComment( const TSTRING& sLine ); -static void GetKeyValuePair( const TSTRING& sLine, TSTRING& sKey, TSTRING& sVal ); // throw( eConfigFile ); +//static void GetKeyValuePair( const TSTRING& sLine, TSTRING& sKey, TSTRING& sVal ); // throw( eConfigFile ); static TSTRING& util_MakeTripwireDateString( TSTRING& strBuf ); //========================================================================= diff --git a/src/tw/dbdebug.cpp b/src/tw/dbdebug.cpp index 869d179..38f1db3 100644 --- a/src/tw/dbdebug.cpp +++ b/src/tw/dbdebug.cpp @@ -67,9 +67,9 @@ // UTILITY METHODS ////////////////////////////////////////////////////////////////////////////////////////////////// // -static void util_PrintFCO(const iFCO* pFCO, iFCOPropDisplayer * pPropDisplayer); +//static void util_PrintFCO(const iFCO* pFCO, iFCOPropDisplayer * pPropDisplayer); static void util_InitBlockArray( cBlockRecordArray& block ); -static void util_MapHierRoot( std::map< std::pair< int, int>, int > dbMap ); +//static void util_MapHierRoot( std::map< std::pair< int, int>, int > dbMap ); ////////////////////////////////////////////////////////////////////////////////////////////////// // Insulated implementation: diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index ce11e15..126123b 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -2688,6 +2688,8 @@ static bool NotifyEncryptionType(cFileHeader::Encoding encoding, iUserNotify::Ve case cFileHeader::ASYM_ENCRYPTION: iUserNotify::GetInstance()->Notify(vl, TSS_GetString(cTWAdmin, twadmin::STR_ENCRYPT_TYPE_ASYM).c_str()); return true; + default: + ASSERT("Unexpeced encryption type"); } iUserNotify::GetInstance()->Notify(vl, TSS_GetString(cTWAdmin, twadmin::STR_ENCRYPT_TYPE_UNK).c_str()); diff --git a/src/twparser/policyparser.cpp b/src/twparser/policyparser.cpp index c1c12e7..bf1b907 100644 --- a/src/twparser/policyparser.cpp +++ b/src/twparser/policyparser.cpp @@ -58,9 +58,9 @@ //========================================================================= static std::string util_ConvertMB( const std::string& sIn ); -static bool util_ReadMBCharAsSBString( std::stringstream& ss, std::string& strCh ); +//static bool util_ReadMBCharAsSBString( std::stringstream& ss, std::string& strCh ); static std::string convert_to_encoded_hex( char ch ); -static std::string util_Output512Chars( const std::string& s ); +//static std::string util_Output512Chars( const std::string& s ); // don't want to pass debug a string over 1024, so play it safe with 512 //=========================================================================