summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-26 14:35:22 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-26 14:35:22 +0000
commit1d02c374c8877d430f4ab35a790fc02f02974704 (patch)
tree8d03d2226cc9322262308eba5eb0754d58a71a98
parentb1522d279d22725a731cb8db93ec2d077028374c (diff)
downloadlibbu++-1d02c374c8877d430f4ab35a790fc02f02974704.tar.gz
libbu++-1d02c374c8877d430f4ab35a790fc02f02974704.tar.bz2
libbu++-1d02c374c8877d430f4ab35a790fc02f02974704.tar.xz
libbu++-1d02c374c8877d430f4ab35a790fc02f02974704.zip
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.
-rw-r--r--src/csvreader.cpp2
-rw-r--r--src/fbasicstring.h2
-rw-r--r--src/filter.cpp2
-rw-r--r--src/myriadstream.cpp2
-rw-r--r--src/newline.cpp3
-rw-r--r--src/process.cpp2
-rw-r--r--src/queuebuf.cpp4
-rw-r--r--src/regex.cpp2
-rw-r--r--src/socket.cpp2
-rw-r--r--src/stdstream.cpp2
-rw-r--r--src/tafreader.cpp30
-rw-r--r--src/tools/mkunit.cpp5
-rw-r--r--src/unit/taf.unit1
-rw-r--r--src/unitsuite.cpp2
14 files changed, 39 insertions, 22 deletions
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 )
120 return sRet; 120 return sRet;
121} 121}
122 122
123Bu::FString Bu::CsvReader::decodeC( Bu::FString::iterator &i ) 123Bu::FString Bu::CsvReader::decodeC( Bu::FString::iterator & )
124{ 124{
125 return ""; 125 return "";
126} 126}
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
1040 nLen = core->nLength-nPos; 1040 nLen = core->nLength-nPos;
1041 flatten(); 1041 flatten();
1042 _hardCopy(); 1042 _hardCopy();
1043 cpy( core->pFirst->pData+nPos, core->pFirst->pData+nPos+nLen, core->nLength-nPos-nLen+1 ); 1043 memmove( core->pFirst->pData+nPos, core->pFirst->pData+nPos+nLen, core->nLength-nPos-nLen+1 );
1044 core->nLength -= nLen; 1044 core->nLength -= nLen;
1045 core->pFirst->nLength -= nLen; 1045 core->pFirst->nLength -= nLen;
1046 } 1046 }
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 )
87 rNext.setBlocking( bBlocking ); 87 rNext.setBlocking( bBlocking );
88} 88}
89 89
90void Bu::Filter::setSize( long iSize ) 90void Bu::Filter::setSize( long )
91{ 91{
92} 92}
93 93
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 )
49 sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b." 49 sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b."
50 << sio.nl; 50 << sio.nl;
51#endif 51#endif
52 if( nBytes > pStream->iSize-iPos ) 52 if( nBytes > (size_t)pStream->iSize-iPos )
53 nBytes = pStream->iSize-iPos; 53 nBytes = pStream->iSize-iPos;
54 if( nBytes <= 0 ) 54 if( nBytes <= 0 )
55 return 0; 55 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 )
61 return iTotal; 61 return iTotal;
62} 62}
63 63
64size_t Bu::NewLine::write( const void *pBuf, size_t iAmnt ) 64size_t Bu::NewLine::write( const void *, size_t )
65{ 65{
66 return 0;
66} 67}
67 68
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 )
278 this->bBlocking = bBlocking; 278 this->bBlocking = bBlocking;
279} 279}
280 280
281void Bu::Process::setSize( long iSize ) 281void Bu::Process::setSize( long )
282{ 282{
283} 283}
284 284
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 )
175 if( iAmnt <= 0 ) 175 if( iAmnt <= 0 )
176 return; 176 return;
177 177
178 if( iAmnt >= iTotalSize ) 178 if( (size_t)iAmnt >= iTotalSize )
179 { 179 {
180// sio << "seek: clear all data (" << iAmnt << ">=" << iTotalSize 180// sio << "seek: clear all data (" << iAmnt << ">=" << iTotalSize
181// << ")." << sio.nl; 181// << ")." << sio.nl;
@@ -249,7 +249,7 @@ void Bu::QueueBuf::setBlocking( bool )
249{ 249{
250} 250}
251 251
252void Bu::QueueBuf::setSize( long iSize ) 252void Bu::QueueBuf::setSize( long )
253{ 253{
254} 254}
255 255
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 )
86 86
87Bu::FString Bu::RegEx::getSubString( int nIndex ) 87Bu::FString Bu::RegEx::getSubString( int nIndex )
88{ 88{
89 regmatch_t *Subs = aSubStr; 89// regmatch_t *Subs = aSubStr;
90 return Bu::FString( 90 return Bu::FString(
91 sTest.getStr()+aSubStr[nIndex].rm_so, 91 sTest.getStr()+aSubStr[nIndex].rm_so,
92 aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so 92 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 )
412#endif 412#endif
413} 413}
414 414
415void Bu::Socket::setSize( long iSize ) 415void Bu::Socket::setSize( long )
416{ 416{
417} 417}
418 418
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 )
96{ 96{
97} 97}
98 98
99void Bu::StdStream::setSize( long iSize ) 99void Bu::StdStream::setSize( long )
100{ 100{
101} 101}
102 102
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()
36 ws(); 36 ws();
37 FString sName = readStr(); 37 FString sName = readStr();
38 TafGroup *pGroup = new TafGroup( sName ); 38 TafGroup *pGroup = new TafGroup( sName );
39 ws(); 39 try
40 if( c != ':' ) 40 {
41 throw TafException("%d:%d: Expected ':' got '%c'.", iLine, iCol, c ); 41 ws();
42 next(); 42 if( c != ':' )
43 //printf("Node[%s]:\n", sName.getStr() ); 43 throw TafException("%d:%d: Expected ':' got '%c'.",
44 iLine, iCol, c );
45 next();
46 //printf("Node[%s]:\n", sName.getStr() );
44 47
45 groupContent( pGroup ); 48 groupContent( pGroup );
46 49
47 if( c != '}' ) 50 if( c != '}' )
48 throw TafException("%d:%d: Expected '}' got '%c'.", iLine, iCol, c ); 51 throw TafException("%d:%d: Expected '}' got '%c'.",
52 iLine, iCol, c );
49 53
50 //next(); 54 //next();
51 55
52 return pGroup; 56 return pGroup;
57 }
58 catch(...)
59 {
60 delete pGroup;
61 throw;
62 }
53} 63}
54 64
55void Bu::TafReader::groupContent( Bu::TafGroup *pGroup ) 65void 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:
540 540
541int main( int argc, char *argv[] ) 541int main( int argc, char *argv[] )
542{ 542{
543 if( argc < 3 )
544 {
545 sio << "Too few parameters." << sio.nl;
546 return 0;
547 }
543 Parser p( argv[1] ); 548 Parser p( argv[1] );
544 549
545 p.firstPass(); 550 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
117 const Bu::TafGroup *g = tr.readGroup(); 117 const Bu::TafGroup *g = tr.readGroup();
118 unitTest( g->getChildByPath("inner/final")->getProperty("test") == "hi" ); 118 unitTest( g->getChildByPath("inner/final")->getProperty("test") == "hi" );
119 unitTest( g->getByPath("inner/final/test") == "hi" ); 119 unitTest( g->getByPath("inner/final/test") == "hi" );
120 delete g;
120 } 121 }
121} 122}
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 )
185 sSuiteName = sName; 185 sSuiteName = sName;
186} 186}
187 187
188int Bu::UnitSuite::onListCases( StrArray aParam ) 188int Bu::UnitSuite::onListCases( StrArray )
189{ 189{
190 sio << "Test cases:" << sio.nl; 190 sio << "Test cases:" << sio.nl;
191 for( TestList::iterator i = lTests.begin(); i; i++ ) 191 for( TestList::iterator i = lTests.begin(); i; i++ )