diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-11-21 20:26:23 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-11-21 20:26:23 +0000 |
commit | 8fbf5fda24392d2a2ee19d6f40699a5de29da662 (patch) | |
tree | ac79c447bc4897d8cc350068504f184fdb8e4cfa | |
parent | 2bb05378f31311c353d43688fa753822ab9a6461 (diff) | |
download | libbu++-8fbf5fda24392d2a2ee19d6f40699a5de29da662.tar.gz libbu++-8fbf5fda24392d2a2ee19d6f40699a5de29da662.tar.bz2 libbu++-8fbf5fda24392d2a2ee19d6f40699a5de29da662.tar.xz libbu++-8fbf5fda24392d2a2ee19d6f40699a5de29da662.zip |
Everything in libbu++ now passes -Wall, this should have been done a long time
ago.
-rw-r--r-- | build.conf | 2 | ||||
-rw-r--r-- | src/configmanagerbase.h | 2 | ||||
-rw-r--r-- | src/connection.cpp | 2 | ||||
-rw-r--r-- | src/exceptionbase.h | 2 | ||||
-rw-r--r-- | src/hashtable.cpp | 8 | ||||
-rw-r--r-- | src/hashtable.h | 2 | ||||
-rw-r--r-- | src/httpget.h | 2 | ||||
-rw-r--r-- | src/paramproc.cpp | 2 | ||||
-rw-r--r-- | src/protocoltelnet.cpp | 1 | ||||
-rw-r--r-- | src/sbuffer.cpp | 6 | ||||
-rw-r--r-- | src/serializer.cpp | 4 | ||||
-rw-r--r-- | src/serializertext.cpp | 12 | ||||
-rw-r--r-- | src/staticstring.cpp | 8 | ||||
-rw-r--r-- | src/staticstring.h | 8 | ||||
-rw-r--r-- | src/xmldocument.cpp | 2 | ||||
-rw-r--r-- | src/xmlnode.cpp | 25 | ||||
-rw-r--r-- | src/xmlnode.h | 10 | ||||
-rw-r--r-- | src/xmlreader.cpp | 1 |
18 files changed, 48 insertions, 51 deletions
@@ -5,7 +5,7 @@ default action: check "libbu++.a" | |||
5 | "tests" action: check targets() filter regexp("^tests/.*$") | 5 | "tests" action: check targets() filter regexp("^tests/.*$") |
6 | "all" action: check targets() | 6 | "all" action: check targets() |
7 | 7 | ||
8 | set "CXXFLAGS" += "-ggdb" | 8 | set "CXXFLAGS" += "-ggdb -Wall" |
9 | 9 | ||
10 | "libbu++.a": | 10 | "libbu++.a": |
11 | rule "lib", | 11 | rule "lib", |
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 | |||
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | ConfigManagerBase(); | 10 | ConfigManagerBase(); |
11 | ~ConfigManagerBase(); | 11 | virtual ~ConfigManagerBase(); |
12 | 12 | ||
13 | public: | 13 | public: |
14 | void addSearchPath( const std::string &sPath ); | 14 | 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 | |||
449 | nDataLen = (nBytesMax<nDataLen)?(nBytesMax):(nDataLen); | 449 | nDataLen = (nBytesMax<nDataLen)?(nBytesMax):(nDataLen); |
450 | } | 450 | } |
451 | 451 | ||
452 | fprintf( fh, "%sDisplaying %d bytes of %s.\n", lpPrefix, nDataLen, lpName ); | 452 | fprintf( fh, "%sDisplaying %ld bytes of %s.\n", lpPrefix, nDataLen, lpName ); |
453 | int j = 0; | 453 | int j = 0; |
454 | fprintf( fh, lpPrefix ); | 454 | fprintf( fh, lpPrefix ); |
455 | for( int l = 0; l < 8*3+2*8+2; l++ ) fprintf( fh, (l!=8*3)?("-"):("+") ); fprintf( fh, "\n"); | 455 | for( int l = 0; l < 8*3+2*8+2; l++ ) fprintf( fh, (l!=8*3)?("-"):("+") ); fprintf( fh, "\n"); |
diff --git a/src/exceptionbase.h b/src/exceptionbase.h index c0ced37..7c3cbd9 100644 --- a/src/exceptionbase.h +++ b/src/exceptionbase.h | |||
@@ -61,8 +61,8 @@ public: | |||
61 | void setWhat( const char *lpFormat, va_list &vargs ); | 61 | void setWhat( const char *lpFormat, va_list &vargs ); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | char *sWhat; /**< The text string telling people what went wrong. */ | ||
65 | int nErrorCode; /**< The code for the error that occured. */ | 64 | int nErrorCode; /**< The code for the error that occured. */ |
65 | char *sWhat; /**< The text string telling people what went wrong. */ | ||
66 | }; | 66 | }; |
67 | 67 | ||
68 | #define subExceptionDecl( name ) \ | 68 | #define subExceptionDecl( name ) \ |
diff --git a/src/hashtable.cpp b/src/hashtable.cpp index 725ebc4..dbcd964 100644 --- a/src/hashtable.cpp +++ b/src/hashtable.cpp | |||
@@ -41,7 +41,7 @@ bool HashTable::isFilled( int j ) | |||
41 | return (aTable[j].id != NULL)||(aTable[j].bDeleted); | 41 | return (aTable[j].id != NULL)||(aTable[j].bDeleted); |
42 | } | 42 | } |
43 | 43 | ||
44 | bool HashTable::reHash( unsigned long int nNewSize ) | 44 | void HashTable::reHash( unsigned long int nNewSize ) |
45 | { | 45 | { |
46 | HashNode *aOldTable = aTable; | 46 | HashNode *aOldTable = aTable; |
47 | unsigned long int oldSize = nTableSize; | 47 | unsigned long int oldSize = nTableSize; |
@@ -90,7 +90,7 @@ unsigned long int HashTable::probe( unsigned long int nStart, const void *id ) | |||
90 | */ | 90 | */ |
91 | if( isFilled( nStart ) ) | 91 | if( isFilled( nStart ) ) |
92 | { | 92 | { |
93 | int nOldStart = nStart; | 93 | unsigned long int nOldStart = nStart; |
94 | for( | 94 | for( |
95 | nStart++; | 95 | nStart++; |
96 | isFilled( nStart ) && nStart != nOldStart; | 96 | isFilled( nStart ) && nStart != nOldStart; |
@@ -221,7 +221,7 @@ const void *HashTable::get( const void *id, unsigned long int nSkip ) | |||
221 | 221 | ||
222 | if( bAllowDupes ) | 222 | if( bAllowDupes ) |
223 | { | 223 | { |
224 | int nOldPos = nPos; | 224 | unsigned long int nOldPos = nPos; |
225 | for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) | 225 | for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) |
226 | { | 226 | { |
227 | if( !isFilled( nPos ) ) return NULL; | 227 | if( !isFilled( nPos ) ) return NULL; |
@@ -270,7 +270,7 @@ const void *HashTable::getKey( const void *id, unsigned long int nSkip ) | |||
270 | 270 | ||
271 | if( bAllowDupes ) | 271 | if( bAllowDupes ) |
272 | { | 272 | { |
273 | int nOldPos = nPos; | 273 | unsigned long int nOldPos = nPos; |
274 | for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) | 274 | for( nPos++; nPos != nOldPos; nPos=(nPos+1)%nTableSize ) |
275 | { | 275 | { |
276 | if( !isFilled( nPos ) ) return NULL; | 276 | if( !isFilled( nPos ) ) return NULL; |
diff --git a/src/hashtable.h b/src/hashtable.h index f319cb0..179b694 100644 --- a/src/hashtable.h +++ b/src/hashtable.h | |||
@@ -246,7 +246,7 @@ private: | |||
246 | *@param nNewSize The new size to set the table to while re-hashing. | 246 | *@param nNewSize The new size to set the table to while re-hashing. |
247 | *@returns True if the operation was successful, false otherwise. | 247 | *@returns True if the operation was successful, false otherwise. |
248 | */ | 248 | */ |
249 | bool reHash( unsigned long int nNewSize ); | 249 | void reHash( unsigned long int nNewSize ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Helper function to allocate a new table. Really just does the memory | 252 | * Helper function to allocate a new table. Really just does the memory |
diff --git a/src/httpget.h b/src/httpget.h index afa1ec5..8272641 100644 --- a/src/httpget.h +++ b/src/httpget.h | |||
@@ -33,10 +33,10 @@ private: | |||
33 | std::string sProto; | 33 | std::string sProto; |
34 | std::string sHost; | 34 | std::string sHost; |
35 | std::string sPath; | 35 | std::string sPath; |
36 | int nPort; | ||
36 | std::string sUserAgent; | 37 | std::string sUserAgent; |
37 | typedef std::pair<std::string,std::string> StringPair; | 38 | typedef std::pair<std::string,std::string> StringPair; |
38 | std::list<StringPair> lParams; | 39 | std::list<StringPair> lParams; |
39 | int nPort; | ||
40 | static char hexcode[]; | 40 | static char hexcode[]; |
41 | 41 | ||
42 | }; | 42 | }; |
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 ) | |||
430 | int ParamProc::cmdParam( int argc, char *argv[] ) | 430 | int ParamProc::cmdParam( int argc, char *argv[] ) |
431 | { | 431 | { |
432 | printf("Unhandled command parameter \"%s\" found!\n", argv[0] ); | 432 | printf("Unhandled command parameter \"%s\" found!\n", argv[0] ); |
433 | return 0; | ||
433 | } | 434 | } |
434 | 435 | ||
435 | int ParamProc::unknownParam( int argc, char *argv[] ) | 436 | int ParamProc::unknownParam( int argc, char *argv[] ) |
436 | { | 437 | { |
437 | printf("Unknown parameter \"%s\" found!\n", argv[0] ); | 438 | printf("Unknown parameter \"%s\" found!\n", argv[0] ); |
439 | return 0; | ||
438 | } | 440 | } |
439 | 441 | ||
440 | int ParamProc::help( int argc, char *argv[] ) | 442 | 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() | |||
43 | pCon->appendOutput( (char)ECHO ); | 43 | pCon->appendOutput( (char)ECHO ); |
44 | 44 | ||
45 | // 255(IAC),251(WILL),3 | 45 | // 255(IAC),251(WILL),3 |
46 | return true; | ||
46 | } | 47 | } |
47 | 48 | ||
48 | bool ProtocolTelnet::onNewData() | 49 | 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 @@ | |||
2 | #include "sbuffer.h" | 2 | #include "sbuffer.h" |
3 | 3 | ||
4 | SBuffer::SBuffer() : | 4 | SBuffer::SBuffer() : |
5 | bOpen( true ), | 5 | nPos( 0 ), |
6 | nPos( 0 ) | 6 | bOpen( true ) |
7 | { | 7 | { |
8 | } | 8 | } |
9 | 9 | ||
@@ -19,7 +19,7 @@ void SBuffer::close() | |||
19 | 19 | ||
20 | size_t SBuffer::read( char *pBuf, size_t nBytes ) | 20 | size_t SBuffer::read( char *pBuf, size_t nBytes ) |
21 | { | 21 | { |
22 | long nLeft = fbData.getLength() - nPos; | 22 | size_t nLeft = fbData.getLength() - nPos; |
23 | if( nBytes > nLeft ) | 23 | if( nBytes > nLeft ) |
24 | nBytes = nLeft; | 24 | nBytes = nLeft; |
25 | 25 | ||
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 ) | |||
188 | { | 188 | { |
189 | ar << (uint32_t)s.length(); | 189 | ar << (uint32_t)s.length(); |
190 | ar.write( s.c_str(), s.length() ); | 190 | ar.write( s.c_str(), s.length() ); |
191 | |||
192 | return ar; | ||
191 | } | 193 | } |
192 | 194 | ||
193 | Serializer &operator>>( Serializer &ar, std::string &s ) | 195 | Serializer &operator>>( Serializer &ar, std::string &s ) |
@@ -199,5 +201,7 @@ Serializer &operator>>( Serializer &ar, std::string &s ) | |||
199 | ar.read( tmp, l ); | 201 | ar.read( tmp, l ); |
200 | s = tmp; | 202 | s = tmp; |
201 | delete tmp; | 203 | delete tmp; |
204 | |||
205 | return ar; | ||
202 | } | 206 | } |
203 | 207 | ||
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) | |||
64 | } | 64 | } |
65 | Serializer &SerializerText::operator<<(int32_t p) | 65 | Serializer &SerializerText::operator<<(int32_t p) |
66 | { | 66 | { |
67 | fprintf(fhFile, "%ld\n", p); | 67 | fprintf(fhFile, "%d\n", p); |
68 | return *this; | 68 | return *this; |
69 | } | 69 | } |
70 | Serializer &SerializerText::operator<<(int64_t p) | 70 | Serializer &SerializerText::operator<<(int64_t p) |
@@ -84,7 +84,7 @@ Serializer &SerializerText::operator<<(uint16_t p) | |||
84 | } | 84 | } |
85 | Serializer &SerializerText::operator<<(uint32_t p) | 85 | Serializer &SerializerText::operator<<(uint32_t p) |
86 | { | 86 | { |
87 | fprintf(fhFile, "%lu\n", p); | 87 | fprintf(fhFile, "%u\n", p); |
88 | return *this; | 88 | return *this; |
89 | } | 89 | } |
90 | Serializer &SerializerText::operator<<(uint64_t p) | 90 | Serializer &SerializerText::operator<<(uint64_t p) |
@@ -110,7 +110,7 @@ Serializer &SerializerText::operator<<(long double p) | |||
110 | 110 | ||
111 | Serializer &SerializerText::operator>>(bool &p) | 111 | Serializer &SerializerText::operator>>(bool &p) |
112 | { | 112 | { |
113 | fscanf(fhFile, "%hhd\n", &p); | 113 | fscanf(fhFile, "%hhd\n", ((signed char *)&p)); |
114 | return *this; | 114 | return *this; |
115 | } | 115 | } |
116 | Serializer &SerializerText::operator>>(int8_t &p) | 116 | Serializer &SerializerText::operator>>(int8_t &p) |
@@ -125,7 +125,7 @@ Serializer &SerializerText::operator>>(int16_t &p) | |||
125 | } | 125 | } |
126 | Serializer &SerializerText::operator>>(int32_t &p) | 126 | Serializer &SerializerText::operator>>(int32_t &p) |
127 | { | 127 | { |
128 | fscanf(fhFile, "%ld\n", &p); | 128 | fscanf(fhFile, "%d\n", &p); |
129 | return *this; | 129 | return *this; |
130 | } | 130 | } |
131 | Serializer &SerializerText::operator>>(int64_t &p) | 131 | Serializer &SerializerText::operator>>(int64_t &p) |
@@ -145,7 +145,7 @@ Serializer &SerializerText::operator>>(uint16_t &p) | |||
145 | } | 145 | } |
146 | Serializer &SerializerText::operator>>(uint32_t &p) | 146 | Serializer &SerializerText::operator>>(uint32_t &p) |
147 | { | 147 | { |
148 | fscanf(fhFile, "%lu\n", &p); | 148 | fscanf(fhFile, "%u\n", &p); |
149 | return *this; | 149 | return *this; |
150 | } | 150 | } |
151 | Serializer &SerializerText::operator>>(uint64_t &p) | 151 | Serializer &SerializerText::operator>>(uint64_t &p) |
@@ -160,7 +160,7 @@ Serializer &SerializerText::operator>>(float &p) | |||
160 | } | 160 | } |
161 | Serializer &SerializerText::operator>>(double &p) | 161 | Serializer &SerializerText::operator>>(double &p) |
162 | { | 162 | { |
163 | fscanf(fhFile, "%f\n", &p); | 163 | fscanf(fhFile, "%lf\n", &p); |
164 | return *this; | 164 | return *this; |
165 | } | 165 | } |
166 | Serializer &SerializerText::operator>>(long double &p) | 166 | 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() | |||
61 | return nLen; | 61 | return nLen; |
62 | } | 62 | } |
63 | 63 | ||
64 | int StaticString::setLength( int nNewLength ) | 64 | void StaticString::setLength( int nNewLength ) |
65 | { | 65 | { |
66 | char *lpNewStr = new char[nNewLength+1]; | 66 | char *lpNewStr = new char[nNewLength+1]; |
67 | if( lpStr != NULL ) | 67 | if( lpStr != NULL ) |
@@ -153,7 +153,7 @@ StaticString::operator const char *() | |||
153 | return lpStr; | 153 | return lpStr; |
154 | } | 154 | } |
155 | 155 | ||
156 | char StaticString::getAt( int nIndex ) | 156 | char StaticString::getAt( unsigned int nIndex ) |
157 | { | 157 | { |
158 | if( nIndex < 0 || nIndex >= nLen ) | 158 | if( nIndex < 0 || nIndex >= nLen ) |
159 | return '\0'; | 159 | return '\0'; |
@@ -161,7 +161,7 @@ char StaticString::getAt( int nIndex ) | |||
161 | return lpStr[nIndex]; | 161 | return lpStr[nIndex]; |
162 | } | 162 | } |
163 | 163 | ||
164 | void StaticString::setAt( int nIndex, char cVal ) | 164 | void StaticString::setAt( unsigned int nIndex, char cVal ) |
165 | { | 165 | { |
166 | if( nIndex < 0 || nIndex >= nLen ) | 166 | if( nIndex < 0 || nIndex >= nLen ) |
167 | return; | 167 | return; |
@@ -169,7 +169,7 @@ void StaticString::setAt( int nIndex, char cVal ) | |||
169 | lpStr[nIndex] = cVal; | 169 | lpStr[nIndex] = cVal; |
170 | } | 170 | } |
171 | 171 | ||
172 | char &StaticString::operator[]( int nIndex ) | 172 | char &StaticString::operator[]( unsigned int nIndex ) |
173 | { | 173 | { |
174 | if( nIndex < 0 || nIndex >= nLen ) | 174 | if( nIndex < 0 || nIndex >= nLen ) |
175 | return lpStr[0]; | 175 | 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: | |||
25 | 25 | ||
26 | char *getString(); | 26 | char *getString(); |
27 | int getLength(); | 27 | int getLength(); |
28 | int setLength( int nNewLength ); | 28 | void setLength( int nNewLength ); |
29 | 29 | ||
30 | void setString( const char *lpNewStr, int nNewLen=-1 ); | 30 | void setString( const char *lpNewStr, int nNewLen=-1 ); |
31 | void setString( StaticString &sNewStr, int nNewLen=-1 ); | 31 | void setString( StaticString &sNewStr, int nNewLen=-1 ); |
32 | 32 | ||
33 | char getAt( int nIndex ); | 33 | char getAt( unsigned int nIndex ); |
34 | void setAt( int nIndex, char cVal ); | 34 | void setAt( unsigned int nIndex, char cVal ); |
35 | 35 | ||
36 | class StaticString &operator=( class StaticString &lpOtherStr ); | 36 | class StaticString &operator=( class StaticString &lpOtherStr ); |
37 | class StaticString &operator=( std::string &lpOtherStr ); | 37 | class StaticString &operator=( std::string &lpOtherStr ); |
38 | class StaticString &operator=( const char *lpNewStr ); | 38 | class StaticString &operator=( const char *lpNewStr ); |
39 | operator const char *(); | 39 | operator const char *(); |
40 | char &operator[]( int nIndex ); | 40 | char &operator[]( unsigned int nIndex ); |
41 | operator int(); | 41 | operator int(); |
42 | char *operator+( int nAmnt ); | 42 | char *operator+( int nAmnt ); |
43 | char *operator-( int nAmnt ); | 43 | 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 ) | |||
114 | void XmlDocument::addProperty( const char *sName, const int nValue ) | 114 | void XmlDocument::addProperty( const char *sName, const int nValue ) |
115 | { | 115 | { |
116 | char buf[12]; | 116 | char buf[12]; |
117 | sprintf( buf, "%li", nValue ); | 117 | sprintf( buf, "%d", nValue ); |
118 | addProperty( sName, buf ); | 118 | addProperty( sName, buf ); |
119 | } | 119 | } |
120 | 120 | ||
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 ) | |||
181 | return tmp; | 181 | return tmp; |
182 | } | 182 | } |
183 | 183 | ||
184 | bool XmlNode::deleteProperty( int nIndex ) | 184 | void XmlNode::deleteProperty( int nIndex ) |
185 | { | 185 | { |
186 | hProperties.del( ((std::string *)lPropNames[nIndex])->c_str() ); | 186 | hProperties.del( ((std::string *)lPropNames[nIndex])->c_str() ); |
187 | 187 | ||
@@ -217,18 +217,13 @@ const char *XmlNode::getName() | |||
217 | return sName.c_str(); | 217 | return sName.c_str(); |
218 | } | 218 | } |
219 | 219 | ||
220 | bool XmlNode::deleteNode( int nIndex, const char *sReplacementText ) | 220 | void XmlNode::deleteNode( int nIndex, const char *sReplacementText ) |
221 | { | 221 | { |
222 | XmlNode *xRet = detatchNode( nIndex, sReplacementText ); | 222 | XmlNode *xRet = detatchNode( nIndex, sReplacementText ); |
223 | 223 | ||
224 | if( xRet == NULL ) | 224 | if( xRet != NULL ) |
225 | { | ||
226 | return false; | ||
227 | } | ||
228 | else | ||
229 | { | 225 | { |
230 | delete xRet; | 226 | delete xRet; |
231 | return true; | ||
232 | } | 227 | } |
233 | } | 228 | } |
234 | 229 | ||
@@ -317,16 +312,14 @@ XmlNode *XmlNode::detatchNode( int nIndex, const char *sReplacementText ) | |||
317 | return xRet; | 312 | return xRet; |
318 | } | 313 | } |
319 | 314 | ||
320 | bool XmlNode::replaceNode( int nIndex, XmlNode *pNewNode ) | 315 | void XmlNode::replaceNode( int nIndex, XmlNode *pNewNode ) |
321 | { | 316 | { |
322 | if( nIndex < 0 || nIndex >= lChildren.getSize() ) | 317 | if( nIndex < 0 || nIndex >= lChildren.getSize() ) |
323 | return false; | 318 | return; //TODO: throw an exception |
324 | 319 | ||
325 | delete (XmlNode *)lChildren[nIndex]; | 320 | delete (XmlNode *)lChildren[nIndex]; |
326 | lChildren.setAt( nIndex, pNewNode ); | 321 | lChildren.setAt( nIndex, pNewNode ); |
327 | pNewNode->pParent = this; | 322 | pNewNode->pParent = this; |
328 | |||
329 | return true; | ||
330 | } | 323 | } |
331 | 324 | ||
332 | XmlNode *XmlNode::getCopy() | 325 | XmlNode *XmlNode::getCopy() |
@@ -388,7 +381,7 @@ XmlNode *XmlNode::getCopy() | |||
388 | return pNew; | 381 | return pNew; |
389 | } | 382 | } |
390 | 383 | ||
391 | bool XmlNode::deleteNodeKeepChildren( int nIndex ) | 384 | void XmlNode::deleteNodeKeepChildren( int nIndex ) |
392 | { | 385 | { |
393 | // This is a tricky one...we need to do some patching to keep things all | 386 | // This is a tricky one...we need to do some patching to keep things all |
394 | // even... | 387 | // even... |
@@ -396,7 +389,7 @@ bool XmlNode::deleteNodeKeepChildren( int nIndex ) | |||
396 | 389 | ||
397 | if( xRet == NULL ) | 390 | if( xRet == NULL ) |
398 | { | 391 | { |
399 | return false; | 392 | return; |
400 | } | 393 | } |
401 | else | 394 | else |
402 | { | 395 | { |
@@ -443,12 +436,10 @@ bool XmlNode::deleteNodeKeepChildren( int nIndex ) | |||
443 | } | 436 | } |
444 | 437 | ||
445 | deleteNode( nIndex+nSize ); | 438 | deleteNode( nIndex+nSize ); |
446 | return true; | ||
447 | } | 439 | } |
448 | |||
449 | } | 440 | } |
450 | 441 | ||
451 | bool XmlNode::replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ) | 442 | void XmlNode::replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ) |
452 | { | 443 | { |
453 | } | 444 | } |
454 | 445 | ||
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: | |||
161 | *@returns True if the property was found and deleted, false if it wasn't | 161 | *@returns True if the property was found and deleted, false if it wasn't |
162 | * found. | 162 | * found. |
163 | */ | 163 | */ |
164 | bool deleteProperty( int nIndex ); | 164 | void deleteProperty( int nIndex ); |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * Delete a child node, possibly replacing it with some text. This actually | 167 | * Delete a child node, possibly replacing it with some text. This actually |
@@ -171,7 +171,7 @@ public: | |||
171 | *@returns True of the node was found, and deleted, false if it wasn't | 171 | *@returns True of the node was found, and deleted, false if it wasn't |
172 | * found. | 172 | * found. |
173 | */ | 173 | */ |
174 | bool deleteNode( int nIndex, const char *sReplacementText = NULL ); | 174 | void deleteNode( int nIndex, const char *sReplacementText = NULL ); |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * Delete a given node, but move all of it's children and content up to | 177 | * Delete a given node, but move all of it's children and content up to |
@@ -180,7 +180,7 @@ public: | |||
180 | *@param nIndex The node to delete. | 180 | *@param nIndex The node to delete. |
181 | *@returns True if the node was found and deleted, false if it wasn't. | 181 | *@returns True if the node was found and deleted, false if it wasn't. |
182 | */ | 182 | */ |
183 | bool deleteNodeKeepChildren( int nIndex ); | 183 | void deleteNodeKeepChildren( int nIndex ); |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Detatch a given child node from this node. This effectively works just | 186 | * Detatch a given child node from this node. This effectively works just |
@@ -201,7 +201,7 @@ public: | |||
201 | *@param pNewNode The new node to replace the old node with. | 201 | *@param pNewNode The new node to replace the old node with. |
202 | *@returns True if the node was found and replaced, false if it wasn't. | 202 | *@returns True if the node was found and replaced, false if it wasn't. |
203 | */ | 203 | */ |
204 | bool replaceNode( int nIndex, XmlNode *pNewNode ); | 204 | void replaceNode( int nIndex, XmlNode *pNewNode ); |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * Replace a given node with the children and content of a given node. | 207 | * Replace a given node with the children and content of a given node. |
@@ -210,7 +210,7 @@ public: | |||
210 | * replace the node specified by nIndex. | 210 | * replace the node specified by nIndex. |
211 | *@returns True if the node was found and replaced, false if it wasn't. | 211 | *@returns True if the node was found and replaced, false if it wasn't. |
212 | */ | 212 | */ |
213 | bool replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ); | 213 | void replaceNodeWithChildren( int nIndex, XmlNode *pNewNode ); |
214 | 214 | ||
215 | /** | 215 | /** |
216 | * Get a copy of this node and all children. getCopy is recursive, so | 216 | * 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() | |||
71 | 71 | ||
72 | void XmlReader::textDecl() | 72 | void XmlReader::textDecl() |
73 | { | 73 | { |
74 | char chr; | ||
75 | if( getChar() == '<' && getChar( 1 ) == '?' ) | 74 | if( getChar() == '<' && getChar( 1 ) == '?' ) |
76 | { | 75 | { |
77 | usedChar( 2 ); | 76 | usedChar( 2 ); |