From 8fbf5fda24392d2a2ee19d6f40699a5de29da662 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 21 Nov 2006 20:26:23 +0000 Subject: Everything in libbu++ now passes -Wall, this should have been done a long time ago. --- src/configmanagerbase.h | 2 +- src/connection.cpp | 2 +- src/exceptionbase.h | 2 +- src/hashtable.cpp | 8 ++++---- src/hashtable.h | 2 +- src/httpget.h | 2 +- src/paramproc.cpp | 2 ++ src/protocoltelnet.cpp | 1 + src/sbuffer.cpp | 6 +++--- src/serializer.cpp | 4 ++++ src/serializertext.cpp | 12 ++++++------ src/staticstring.cpp | 8 ++++---- src/staticstring.h | 8 ++++---- src/xmldocument.cpp | 2 +- src/xmlnode.cpp | 25 ++++++++----------------- src/xmlnode.h | 10 +++++----- src/xmlreader.cpp | 1 - 17 files changed, 47 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/configmanagerbase.h b/src/configmanagerbase.h index 11a9a8e..381cc1f 100644 --- a/src/configmanagerbase.h +++ b/src/configmanagerbase.h @@ -8,7 +8,7 @@ class ConfigManagerBase { public: ConfigManagerBase(); - ~ConfigManagerBase(); + virtual ~ConfigManagerBase(); public: void addSearchPath( const std::string &sPath ); diff --git a/src/connection.cpp b/src/connection.cpp index bf687ec..aa130db 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -449,7 +449,7 @@ void Connection::printDataDebug( const unsigned char *pData, long nDataLen, cons nDataLen = (nBytesMax StringPair; std::list lParams; - int nPort; static char hexcode[]; }; diff --git a/src/paramproc.cpp b/src/paramproc.cpp index 5cb815c..906ec21 100644 --- a/src/paramproc.cpp +++ b/src/paramproc.cpp @@ -430,11 +430,13 @@ ParamProc::ArgSpec *ParamProc::checkLetr( const char arg ) int ParamProc::cmdParam( int argc, char *argv[] ) { printf("Unhandled command parameter \"%s\" found!\n", argv[0] ); + return 0; } int ParamProc::unknownParam( int argc, char *argv[] ) { printf("Unknown parameter \"%s\" found!\n", argv[0] ); + return 0; } int ParamProc::help( int argc, char *argv[] ) diff --git a/src/protocoltelnet.cpp b/src/protocoltelnet.cpp index 7beea5b..b169a51 100644 --- a/src/protocoltelnet.cpp +++ b/src/protocoltelnet.cpp @@ -43,6 +43,7 @@ bool ProtocolTelnet::onNewConnection() pCon->appendOutput( (char)ECHO ); // 255(IAC),251(WILL),3 + return true; } bool ProtocolTelnet::onNewData() diff --git a/src/sbuffer.cpp b/src/sbuffer.cpp index 00324b5..0ed0f47 100644 --- a/src/sbuffer.cpp +++ b/src/sbuffer.cpp @@ -2,8 +2,8 @@ #include "sbuffer.h" SBuffer::SBuffer() : - bOpen( true ), - nPos( 0 ) + nPos( 0 ), + bOpen( true ) { } @@ -19,7 +19,7 @@ void SBuffer::close() size_t SBuffer::read( char *pBuf, size_t nBytes ) { - long nLeft = fbData.getLength() - nPos; + size_t nLeft = fbData.getLength() - nPos; if( nBytes > nLeft ) nBytes = nLeft; diff --git a/src/serializer.cpp b/src/serializer.cpp index e03a9a4..0afaf4b 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -188,6 +188,8 @@ Serializer &operator<<( Serializer &ar, std::string &s ) { ar << (uint32_t)s.length(); ar.write( s.c_str(), s.length() ); + + return ar; } Serializer &operator>>( Serializer &ar, std::string &s ) @@ -199,5 +201,7 @@ Serializer &operator>>( Serializer &ar, std::string &s ) ar.read( tmp, l ); s = tmp; delete tmp; + + return ar; } diff --git a/src/serializertext.cpp b/src/serializertext.cpp index 2933e86..f758bf8 100644 --- a/src/serializertext.cpp +++ b/src/serializertext.cpp @@ -64,7 +64,7 @@ Serializer &SerializerText::operator<<(int16_t p) } Serializer &SerializerText::operator<<(int32_t p) { - fprintf(fhFile, "%ld\n", p); + fprintf(fhFile, "%d\n", p); return *this; } Serializer &SerializerText::operator<<(int64_t p) @@ -84,7 +84,7 @@ Serializer &SerializerText::operator<<(uint16_t p) } Serializer &SerializerText::operator<<(uint32_t p) { - fprintf(fhFile, "%lu\n", p); + fprintf(fhFile, "%u\n", p); return *this; } Serializer &SerializerText::operator<<(uint64_t p) @@ -110,7 +110,7 @@ Serializer &SerializerText::operator<<(long double p) Serializer &SerializerText::operator>>(bool &p) { - fscanf(fhFile, "%hhd\n", &p); + fscanf(fhFile, "%hhd\n", ((signed char *)&p)); return *this; } Serializer &SerializerText::operator>>(int8_t &p) @@ -125,7 +125,7 @@ Serializer &SerializerText::operator>>(int16_t &p) } Serializer &SerializerText::operator>>(int32_t &p) { - fscanf(fhFile, "%ld\n", &p); + fscanf(fhFile, "%d\n", &p); return *this; } Serializer &SerializerText::operator>>(int64_t &p) @@ -145,7 +145,7 @@ Serializer &SerializerText::operator>>(uint16_t &p) } Serializer &SerializerText::operator>>(uint32_t &p) { - fscanf(fhFile, "%lu\n", &p); + fscanf(fhFile, "%u\n", &p); return *this; } Serializer &SerializerText::operator>>(uint64_t &p) @@ -160,7 +160,7 @@ Serializer &SerializerText::operator>>(float &p) } Serializer &SerializerText::operator>>(double &p) { - fscanf(fhFile, "%f\n", &p); + fscanf(fhFile, "%lf\n", &p); return *this; } Serializer &SerializerText::operator>>(long double &p) diff --git a/src/staticstring.cpp b/src/staticstring.cpp index 0012b0f..179ba6f 100644 --- a/src/staticstring.cpp +++ b/src/staticstring.cpp @@ -61,7 +61,7 @@ int StaticString::getLength() return nLen; } -int StaticString::setLength( int nNewLength ) +void StaticString::setLength( int nNewLength ) { char *lpNewStr = new char[nNewLength+1]; if( lpStr != NULL ) @@ -153,7 +153,7 @@ StaticString::operator const char *() return lpStr; } -char StaticString::getAt( int nIndex ) +char StaticString::getAt( unsigned int nIndex ) { if( nIndex < 0 || nIndex >= nLen ) return '\0'; @@ -161,7 +161,7 @@ char StaticString::getAt( int nIndex ) return lpStr[nIndex]; } -void StaticString::setAt( int nIndex, char cVal ) +void StaticString::setAt( unsigned int nIndex, char cVal ) { if( nIndex < 0 || nIndex >= nLen ) return; @@ -169,7 +169,7 @@ void StaticString::setAt( int nIndex, char cVal ) lpStr[nIndex] = cVal; } -char &StaticString::operator[]( int nIndex ) +char &StaticString::operator[]( unsigned int nIndex ) { if( nIndex < 0 || nIndex >= nLen ) return lpStr[0]; diff --git a/src/staticstring.h b/src/staticstring.h index 1ff3f63..c83f391 100644 --- a/src/staticstring.h +++ b/src/staticstring.h @@ -25,19 +25,19 @@ public: char *getString(); int getLength(); - int setLength( int nNewLength ); + void setLength( int nNewLength ); void setString( const char *lpNewStr, int nNewLen=-1 ); void setString( StaticString &sNewStr, int nNewLen=-1 ); - char getAt( int nIndex ); - void setAt( int nIndex, char cVal ); + char getAt( unsigned int nIndex ); + void setAt( unsigned int nIndex, char cVal ); class StaticString &operator=( class StaticString &lpOtherStr ); class StaticString &operator=( std::string &lpOtherStr ); class StaticString &operator=( const char *lpNewStr ); operator const char *(); - char &operator[]( int nIndex ); + char &operator[]( unsigned int nIndex ); operator int(); char *operator+( int nAmnt ); char *operator-( int nAmnt ); diff --git a/src/xmldocument.cpp b/src/xmldocument.cpp index 32f1409..d7867d5 100644 --- a/src/xmldocument.cpp +++ b/src/xmldocument.cpp @@ -114,7 +114,7 @@ void XmlDocument::addProperty( const char *sName, const short nValue ) void XmlDocument::addProperty( const char *sName, const int nValue ) { char buf[12]; - sprintf( buf, "%li", nValue ); + sprintf( buf, "%d", nValue ); addProperty( sName, buf ); } diff --git a/src/xmlnode.cpp b/src/xmlnode.cpp index 8468047..b1ed9a9 100644 --- a/src/xmlnode.cpp +++ b/src/xmlnode.cpp @@ -181,7 +181,7 @@ const char *XmlNode::getProperty( const char *sName ) return tmp; } -bool XmlNode::deleteProperty( int nIndex ) +void XmlNode::deleteProperty( int nIndex ) { hProperties.del( ((std::string *)lPropNames[nIndex])->c_str() ); @@ -217,18 +217,13 @@ const char *XmlNode::getName() return sName.c_str(); } -bool XmlNode::deleteNode( int nIndex, const char *sReplacementText ) +void XmlNode::deleteNode( int nIndex, const char *sReplacementText ) { XmlNode *xRet = detatchNode( nIndex, sReplacementText ); - if( xRet == NULL ) - { - return false; - } - else + if( xRet != NULL ) { delete xRet; - return true; } } @@ -317,16 +312,14 @@ XmlNode *XmlNode::detatchNode( int nIndex, const char *sReplacementText ) return xRet; } -bool XmlNode::replaceNode( int nIndex, XmlNode *pNewNode ) +void XmlNode::replaceNode( int nIndex, XmlNode *pNewNode ) { if( nIndex < 0 || nIndex >= lChildren.getSize() ) - return false; + return; //TODO: throw an exception delete (XmlNode *)lChildren[nIndex]; lChildren.setAt( nIndex, pNewNode ); pNewNode->pParent = this; - - return true; } XmlNode *XmlNode::getCopy() @@ -388,7 +381,7 @@ XmlNode *XmlNode::getCopy() return pNew; } -bool XmlNode::deleteNodeKeepChildren( int nIndex ) +void XmlNode::deleteNodeKeepChildren( int nIndex ) { // This is a tricky one...we need to do some patching to keep things all // even... @@ -396,7 +389,7 @@ bool XmlNode::deleteNodeKeepChildren( int nIndex ) if( xRet == NULL ) { - return false; + return; } else { @@ -443,12 +436,10 @@ bool XmlNode::deleteNodeKeepChildren( int nIndex ) } deleteNode( nIndex+nSize ); - return true; } - } -bool XmlNode::replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ) +void XmlNode::replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ) { } diff --git a/src/xmlnode.h b/src/xmlnode.h index 02ab41d..7525306 100644 --- a/src/xmlnode.h +++ b/src/xmlnode.h @@ -161,7 +161,7 @@ public: *@returns True if the property was found and deleted, false if it wasn't * found. */ - bool deleteProperty( int nIndex ); + void deleteProperty( int nIndex ); /** * Delete a child node, possibly replacing it with some text. This actually @@ -171,7 +171,7 @@ public: *@returns True of the node was found, and deleted, false if it wasn't * found. */ - bool deleteNode( int nIndex, const char *sReplacementText = NULL ); + void deleteNode( int nIndex, const char *sReplacementText = NULL ); /** * Delete a given node, but move all of it's children and content up to @@ -180,7 +180,7 @@ public: *@param nIndex The node to delete. *@returns True if the node was found and deleted, false if it wasn't. */ - bool deleteNodeKeepChildren( int nIndex ); + void deleteNodeKeepChildren( int nIndex ); /** * Detatch a given child node from this node. This effectively works just @@ -201,7 +201,7 @@ public: *@param pNewNode The new node to replace the old node with. *@returns True if the node was found and replaced, false if it wasn't. */ - bool replaceNode( int nIndex, XmlNode *pNewNode ); + void replaceNode( int nIndex, XmlNode *pNewNode ); /** * Replace a given node with the children and content of a given node. @@ -210,7 +210,7 @@ public: * replace the node specified by nIndex. *@returns True if the node was found and replaced, false if it wasn't. */ - bool replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ); + void replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ); /** * Get a copy of this node and all children. getCopy is recursive, so diff --git a/src/xmlreader.cpp b/src/xmlreader.cpp index d51568c..18df69c 100644 --- a/src/xmlreader.cpp +++ b/src/xmlreader.cpp @@ -71,7 +71,6 @@ bool XmlReader::buildDoc() void XmlReader::textDecl() { - char chr; if( getChar() == '<' && getChar( 1 ) == '?' ) { usedChar( 2 ); -- cgit v1.2.3