From 1d02c374c8877d430f4ab35a790fc02f02974704 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 26 May 2010 14:35:22 +0000 Subject: Fixed most of the compilation warnings, and a valgrind warning in the fstring's remove function. memcpy can't do overlapping memory, changed it to use memmove. --- src/csvreader.cpp | 2 +- src/fbasicstring.h | 2 +- src/filter.cpp | 2 +- src/myriadstream.cpp | 2 +- src/newline.cpp | 3 ++- src/process.cpp | 2 +- src/queuebuf.cpp | 4 ++-- src/regex.cpp | 2 +- src/socket.cpp | 2 +- src/stdstream.cpp | 2 +- src/tafreader.cpp | 30 ++++++++++++++++++++---------- src/tools/mkunit.cpp | 5 +++++ src/unit/taf.unit | 1 + src/unitsuite.cpp | 2 +- 14 files changed, 39 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/csvreader.cpp b/src/csvreader.cpp index ef7a326..edbb7f8 100644 --- a/src/csvreader.cpp +++ b/src/csvreader.cpp @@ -120,7 +120,7 @@ Bu::FString Bu::CsvReader::decodeExcel( Bu::FString::iterator &i ) return sRet; } -Bu::FString Bu::CsvReader::decodeC( Bu::FString::iterator &i ) +Bu::FString Bu::CsvReader::decodeC( Bu::FString::iterator & ) { return ""; } diff --git a/src/fbasicstring.h b/src/fbasicstring.h index 670873e..19853f5 100644 --- a/src/fbasicstring.h +++ b/src/fbasicstring.h @@ -1040,7 +1040,7 @@ namespace Bu nLen = core->nLength-nPos; flatten(); _hardCopy(); - cpy( core->pFirst->pData+nPos, core->pFirst->pData+nPos+nLen, core->nLength-nPos-nLen+1 ); + memmove( core->pFirst->pData+nPos, core->pFirst->pData+nPos+nLen, core->nLength-nPos-nLen+1 ); core->nLength -= nLen; core->pFirst->nLength -= nLen; } diff --git a/src/filter.cpp b/src/filter.cpp index 8dc3694..900baaa 100644 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -87,7 +87,7 @@ void Bu::Filter::setBlocking( bool bBlocking ) rNext.setBlocking( bBlocking ); } -void Bu::Filter::setSize( long iSize ) +void Bu::Filter::setSize( long ) { } diff --git a/src/myriadstream.cpp b/src/myriadstream.cpp index b0b1d05..6623b2b 100644 --- a/src/myriadstream.cpp +++ b/src/myriadstream.cpp @@ -49,7 +49,7 @@ size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b." << sio.nl; #endif - if( nBytes > pStream->iSize-iPos ) + if( nBytes > (size_t)pStream->iSize-iPos ) nBytes = pStream->iSize-iPos; if( nBytes <= 0 ) return 0; diff --git a/src/newline.cpp b/src/newline.cpp index d22ce85..8c5d3d5 100644 --- a/src/newline.cpp +++ b/src/newline.cpp @@ -61,7 +61,8 @@ size_t Bu::NewLine::read( void *pBufV, size_t iAmnt ) return iTotal; } -size_t Bu::NewLine::write( const void *pBuf, size_t iAmnt ) +size_t Bu::NewLine::write( const void *, size_t ) { + return 0; } diff --git a/src/process.cpp b/src/process.cpp index 2d8eda0..0e3e93a 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -278,7 +278,7 @@ void Bu::Process::setBlocking( bool bBlocking ) this->bBlocking = bBlocking; } -void Bu::Process::setSize( long iSize ) +void Bu::Process::setSize( long ) { } diff --git a/src/queuebuf.cpp b/src/queuebuf.cpp index 1a902bc..e8eb2ed 100644 --- a/src/queuebuf.cpp +++ b/src/queuebuf.cpp @@ -175,7 +175,7 @@ void Bu::QueueBuf::seek( long iAmnt ) if( iAmnt <= 0 ) return; - if( iAmnt >= iTotalSize ) + if( (size_t)iAmnt >= iTotalSize ) { // sio << "seek: clear all data (" << iAmnt << ">=" << iTotalSize // << ")." << sio.nl; @@ -249,7 +249,7 @@ void Bu::QueueBuf::setBlocking( bool ) { } -void Bu::QueueBuf::setSize( long iSize ) +void Bu::QueueBuf::setSize( long ) { } diff --git a/src/regex.cpp b/src/regex.cpp index b69f215..e634639 100644 --- a/src/regex.cpp +++ b/src/regex.cpp @@ -86,7 +86,7 @@ void Bu::RegEx::getSubStringRange( int nIndex, int &iStart, int &iEnd ) Bu::FString Bu::RegEx::getSubString( int nIndex ) { - regmatch_t *Subs = aSubStr; +// regmatch_t *Subs = aSubStr; return Bu::FString( sTest.getStr()+aSubStr[nIndex].rm_so, aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so diff --git a/src/socket.cpp b/src/socket.cpp index 696db1e..baf3be3 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -412,7 +412,7 @@ void Bu::Socket::setBlocking( bool bBlocking ) #endif } -void Bu::Socket::setSize( long iSize ) +void Bu::Socket::setSize( long ) { } diff --git a/src/stdstream.cpp b/src/stdstream.cpp index 4c2c828..32ddec4 100644 --- a/src/stdstream.cpp +++ b/src/stdstream.cpp @@ -96,7 +96,7 @@ void Bu::StdStream::setBlocking( bool ) { } -void Bu::StdStream::setSize( long iSize ) +void Bu::StdStream::setSize( long ) { } diff --git a/src/tafreader.cpp b/src/tafreader.cpp index 012bb32..ca06daf 100644 --- a/src/tafreader.cpp +++ b/src/tafreader.cpp @@ -36,20 +36,30 @@ Bu::TafGroup *Bu::TafReader::readGroup() ws(); FString sName = readStr(); TafGroup *pGroup = new TafGroup( sName ); - ws(); - if( c != ':' ) - throw TafException("%d:%d: Expected ':' got '%c'.", iLine, iCol, c ); - next(); - //printf("Node[%s]:\n", sName.getStr() ); + try + { + ws(); + if( c != ':' ) + throw TafException("%d:%d: Expected ':' got '%c'.", + iLine, iCol, c ); + next(); + //printf("Node[%s]:\n", sName.getStr() ); - groupContent( pGroup ); + groupContent( pGroup ); - if( c != '}' ) - throw TafException("%d:%d: Expected '}' got '%c'.", iLine, iCol, c ); + if( c != '}' ) + throw TafException("%d:%d: Expected '}' got '%c'.", + iLine, iCol, c ); - //next(); + //next(); - return pGroup; + return pGroup; + } + catch(...) + { + delete pGroup; + throw; + } } void Bu::TafReader::groupContent( Bu::TafGroup *pGroup ) diff --git a/src/tools/mkunit.cpp b/src/tools/mkunit.cpp index 0454013..12ce65f 100644 --- a/src/tools/mkunit.cpp +++ b/src/tools/mkunit.cpp @@ -540,6 +540,11 @@ private: int main( int argc, char *argv[] ) { + if( argc < 3 ) + { + sio << "Too few parameters." << sio.nl; + return 0; + } Parser p( argv[1] ); p.firstPass(); diff --git a/src/unit/taf.unit b/src/unit/taf.unit index eb9475e..cab04d2 100644 --- a/src/unit/taf.unit +++ b/src/unit/taf.unit @@ -117,5 +117,6 @@ suite Taf const Bu::TafGroup *g = tr.readGroup(); unitTest( g->getChildByPath("inner/final")->getProperty("test") == "hi" ); unitTest( g->getByPath("inner/final/test") == "hi" ); + delete g; } } diff --git a/src/unitsuite.cpp b/src/unitsuite.cpp index 7d8cc2a..0a531c0 100644 --- a/src/unitsuite.cpp +++ b/src/unitsuite.cpp @@ -185,7 +185,7 @@ void Bu::UnitSuite::setName( const FString &sName ) sSuiteName = sName; } -int Bu::UnitSuite::onListCases( StrArray aParam ) +int Bu::UnitSuite::onListCases( StrArray ) { sio << "Test cases:" << sio.nl; for( TestList::iterator i = lTests.begin(); i; i++ ) -- cgit v1.2.3