From 60f5ded83a9032bb51f94d02558ee0a09f887c26 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 7 Aug 2012 21:02:12 +0200 Subject: [PATCH] Fixed some compiler warnings. --- base/dictionary.cpp | 8 -------- base/dictionary.h | 2 -- base/dynamicobject.cpp | 3 ++- base/ioqueue.h | 2 +- base/object.h | 2 +- base/process.h | 2 +- base/ringbuffer.cpp | 10 +++++----- base/ringbuffer.h | 12 +++++++----- base/tcpclient.cpp | 5 +++-- base/tlsclient.cpp | 12 +----------- base/utility.cpp | 4 ++-- dyn/config_parser.cc | 2 +- dyn/config_parser.yy | 2 +- 13 files changed, 25 insertions(+), 41 deletions(-) diff --git a/base/dictionary.cpp b/base/dictionary.cpp index 4b3c61678..432609d42 100644 --- a/base/dictionary.cpp +++ b/base/dictionary.cpp @@ -81,8 +81,6 @@ void Dictionary::Set(const String& key, const Value& value) ret = m_Data.insert(make_pair(key, value)); if (!ret.second) ret.first->second = value; - - OnItemModified(key, value); } /** @@ -164,8 +162,6 @@ void Dictionary::Remove(const String& key) return; m_Data.erase(it); - - OnItemModified(key, Empty); } /** @@ -177,8 +173,6 @@ void Dictionary::Remove(Dictionary::Iterator it) { String key = it->first; m_Data.erase(it); - - OnItemModified(key, Empty); } /** @@ -226,5 +220,3 @@ cJSON *Dictionary::ToJson(void) const return json; } -void Dictionary::OnItemModified(const String& key, const Value& value) -{ } diff --git a/base/dictionary.h b/base/dictionary.h index 76ee95d50..63eb166db 100644 --- a/base/dictionary.h +++ b/base/dictionary.h @@ -53,8 +53,6 @@ public: static Dictionary::Ptr FromJson(cJSON *json); cJSON *ToJson(void) const; - virtual void OnItemModified(const String& key, const Value& value); - private: map m_Data; }; diff --git a/base/dynamicobject.cpp b/base/dynamicobject.cpp index fd7c81316..a2d94cfa1 100644 --- a/base/dynamicobject.cpp +++ b/base/dynamicobject.cpp @@ -521,5 +521,6 @@ void DynamicObject::FinishTx(void) m_CurrentTx = 0; } -void DynamicObject::OnAttributeChanged(const String& name, const Value& oldValue) +void DynamicObject::OnAttributeChanged(const String&, const Value&) { } + diff --git a/base/ioqueue.h b/base/ioqueue.h index 8388ccd0a..3ec17185c 100644 --- a/base/ioqueue.h +++ b/base/ioqueue.h @@ -70,4 +70,4 @@ public: } -#endif /* IOQUEUE_H */ \ No newline at end of file +#endif /* IOQUEUE_H */ diff --git a/base/object.h b/base/object.h index 571b7d5d8..59c469161 100644 --- a/base/object.h +++ b/base/object.h @@ -86,7 +86,7 @@ protected: private: Object(const Object& other); - Object operator=(const Object& rhs); + Object& operator=(const Object& rhs); static mutex m_Mutex; static vector m_HeldObjects; diff --git a/base/process.h b/base/process.h index b4bc5cc9b..e9af6c804 100644 --- a/base/process.h +++ b/base/process.h @@ -37,7 +37,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - static const int MaxTasksPerThread = 128; + static const deque::size_type MaxTasksPerThread = 128; Process(const String& command); diff --git a/base/ringbuffer.cpp b/base/ringbuffer.cpp index 03c7a494f..cc8d559bd 100644 --- a/base/ringbuffer.cpp +++ b/base/ringbuffer.cpp @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the Free Software Foundation * + * aRingBuffer::SizeType with this program; if not, write to the Free Software Foundation * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ @@ -21,16 +21,16 @@ using namespace icinga; -RingBuffer::RingBuffer(long slots) +RingBuffer::RingBuffer(RingBuffer::SizeType slots) : m_Slots(slots, 0), m_Offset(0) { } -long RingBuffer::GetLength(void) const +RingBuffer::SizeType RingBuffer::GetLength(void) const { return m_Slots.size(); } -void RingBuffer::InsertValue(long tv, int num) +void RingBuffer::InsertValue(RingBuffer::SizeType tv, int num) { vector::size_type offsetTarget = tv % m_Slots.size(); @@ -47,7 +47,7 @@ void RingBuffer::InsertValue(long tv, int num) m_Slots[m_Offset] += num; } -int RingBuffer::GetValues(long span) const +int RingBuffer::GetValues(RingBuffer::SizeType span) const { if (span > m_Slots.size()) span = m_Slots.size(); diff --git a/base/ringbuffer.h b/base/ringbuffer.h index 5ab581a4e..fc85a8cbe 100644 --- a/base/ringbuffer.h +++ b/base/ringbuffer.h @@ -26,15 +26,17 @@ namespace icinga class I2_BASE_API RingBuffer { public: - RingBuffer(long slots); + typedef vector::size_type SizeType; - long GetLength(void) const; - void InsertValue(long tv, int num); - int GetValues(long span) const; + RingBuffer(SizeType slots); + + SizeType GetLength(void) const; + void InsertValue(SizeType tv, int num); + int GetValues(SizeType span) const; private: vector m_Slots; - vector::size_type m_Offset; + SizeType m_Offset; }; } diff --git a/base/tcpclient.cpp b/base/tcpclient.cpp index 9e980406c..14ac23fa2 100644 --- a/base/tcpclient.cpp +++ b/base/tcpclient.cpp @@ -27,8 +27,9 @@ using namespace icinga; * @param role The role of the TCP client socket. */ TcpClient::TcpClient(TcpClientRole role) - : m_Role(role), m_SendQueue(boost::make_shared()), - m_RecvQueue(boost::make_shared()) + : m_SendQueue(boost::make_shared()), + m_RecvQueue(boost::make_shared()), + m_Role(role) { } /** diff --git a/base/tlsclient.cpp b/base/tlsclient.cpp index 111bc2850..80eb61ca7 100644 --- a/base/tlsclient.cpp +++ b/base/tlsclient.cpp @@ -73,16 +73,6 @@ void TlsClient::Start(void) Socket::Start(); } -/** - * Takes a certificate as an argument. Does nothing. - * - * @param certificate An X509 certificate. - */ -void TlsClient::NullCertificateDeleter(X509 *certificate) -{ - /* Nothing to do here. */ -} - /** * Retrieves the X509 certficate for this client. * @@ -92,7 +82,7 @@ shared_ptr TlsClient::GetClientCertificate(void) const { mutex::scoped_lock lock(m_SocketMutex); - return shared_ptr(SSL_get_certificate(m_SSL.get()), &TlsClient::NullCertificateDeleter); + return shared_ptr(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter); } /** diff --git a/base/utility.cpp b/base/utility.cpp index dc0e7b2e7..79ae91ad8 100644 --- a/base/utility.cpp +++ b/base/utility.cpp @@ -249,9 +249,9 @@ String Utility::BaseName(const String& path) /** * Null deleter. Used as a parameter for the shared_ptr constructor. * - * @param obj The object that should be deleted. + * @param -- The object that should be deleted. */ -void Utility::NullDeleter(void *obj) +void Utility::NullDeleter(void *) { /* Nothing to do here. */ } diff --git a/dyn/config_parser.cc b/dyn/config_parser.cc index 068902ac7..a5550ba89 100644 --- a/dyn/config_parser.cc +++ b/dyn/config_parser.cc @@ -208,7 +208,7 @@ typedef struct YYLTYPE int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner); -void yyerror(YYLTYPE *locp, ConfigCompiler *context, const char *err) +void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err) { stringstream message; message << *locp << ": " << err; diff --git a/dyn/config_parser.yy b/dyn/config_parser.yy index a9a6e716f..fc639bef5 100644 --- a/dyn/config_parser.yy +++ b/dyn/config_parser.yy @@ -66,7 +66,7 @@ using namespace icinga; int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner); -void yyerror(YYLTYPE *locp, ConfigCompiler *context, const char *err) +void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err) { stringstream message; message << *locp << ": " << err; -- 2.40.0