Fixed some compiler warnings.

This commit is contained in:
Gunnar Beutner 2012-08-07 21:02:12 +02:00
parent 3c2acab7d7
commit 60f5ded83a
13 changed files with 25 additions and 41 deletions

View File

@ -81,8 +81,6 @@ void Dictionary::Set(const String& key, const Value& value)
ret = m_Data.insert(make_pair(key, value)); ret = m_Data.insert(make_pair(key, value));
if (!ret.second) if (!ret.second)
ret.first->second = value; ret.first->second = value;
OnItemModified(key, value);
} }
/** /**
@ -164,8 +162,6 @@ void Dictionary::Remove(const String& key)
return; return;
m_Data.erase(it); m_Data.erase(it);
OnItemModified(key, Empty);
} }
/** /**
@ -177,8 +173,6 @@ void Dictionary::Remove(Dictionary::Iterator it)
{ {
String key = it->first; String key = it->first;
m_Data.erase(it); m_Data.erase(it);
OnItemModified(key, Empty);
} }
/** /**
@ -226,5 +220,3 @@ cJSON *Dictionary::ToJson(void) const
return json; return json;
} }
void Dictionary::OnItemModified(const String& key, const Value& value)
{ }

View File

@ -53,8 +53,6 @@ public:
static Dictionary::Ptr FromJson(cJSON *json); static Dictionary::Ptr FromJson(cJSON *json);
cJSON *ToJson(void) const; cJSON *ToJson(void) const;
virtual void OnItemModified(const String& key, const Value& value);
private: private:
map<String, Value> m_Data; map<String, Value> m_Data;
}; };

View File

@ -521,5 +521,6 @@ void DynamicObject::FinishTx(void)
m_CurrentTx = 0; m_CurrentTx = 0;
} }
void DynamicObject::OnAttributeChanged(const String& name, const Value& oldValue) void DynamicObject::OnAttributeChanged(const String&, const Value&)
{ } { }

View File

@ -70,4 +70,4 @@ public:
} }
#endif /* IOQUEUE_H */ #endif /* IOQUEUE_H */

View File

@ -86,7 +86,7 @@ protected:
private: private:
Object(const Object& other); Object(const Object& other);
Object operator=(const Object& rhs); Object& operator=(const Object& rhs);
static mutex m_Mutex; static mutex m_Mutex;
static vector<Object::Ptr> m_HeldObjects; static vector<Object::Ptr> m_HeldObjects;

View File

@ -37,7 +37,7 @@ public:
typedef shared_ptr<Process> Ptr; typedef shared_ptr<Process> Ptr;
typedef weak_ptr<Process> WeakPtr; typedef weak_ptr<Process> WeakPtr;
static const int MaxTasksPerThread = 128; static const deque<Process::Ptr>::size_type MaxTasksPerThread = 128;
Process(const String& command); Process(const String& command);

View File

@ -13,7 +13,7 @@
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * 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. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
@ -21,16 +21,16 @@
using namespace icinga; using namespace icinga;
RingBuffer::RingBuffer(long slots) RingBuffer::RingBuffer(RingBuffer::SizeType slots)
: m_Slots(slots, 0), m_Offset(0) : m_Slots(slots, 0), m_Offset(0)
{ } { }
long RingBuffer::GetLength(void) const RingBuffer::SizeType RingBuffer::GetLength(void) const
{ {
return m_Slots.size(); return m_Slots.size();
} }
void RingBuffer::InsertValue(long tv, int num) void RingBuffer::InsertValue(RingBuffer::SizeType tv, int num)
{ {
vector<int>::size_type offsetTarget = tv % m_Slots.size(); vector<int>::size_type offsetTarget = tv % m_Slots.size();
@ -47,7 +47,7 @@ void RingBuffer::InsertValue(long tv, int num)
m_Slots[m_Offset] += num; m_Slots[m_Offset] += num;
} }
int RingBuffer::GetValues(long span) const int RingBuffer::GetValues(RingBuffer::SizeType span) const
{ {
if (span > m_Slots.size()) if (span > m_Slots.size())
span = m_Slots.size(); span = m_Slots.size();

View File

@ -26,15 +26,17 @@ namespace icinga
class I2_BASE_API RingBuffer class I2_BASE_API RingBuffer
{ {
public: public:
RingBuffer(long slots); typedef vector<int>::size_type SizeType;
long GetLength(void) const; RingBuffer(SizeType slots);
void InsertValue(long tv, int num);
int GetValues(long span) const; SizeType GetLength(void) const;
void InsertValue(SizeType tv, int num);
int GetValues(SizeType span) const;
private: private:
vector<int> m_Slots; vector<int> m_Slots;
vector<int>::size_type m_Offset; SizeType m_Offset;
}; };
} }

View File

@ -27,8 +27,9 @@ using namespace icinga;
* @param role The role of the TCP client socket. * @param role The role of the TCP client socket.
*/ */
TcpClient::TcpClient(TcpClientRole role) TcpClient::TcpClient(TcpClientRole role)
: m_Role(role), m_SendQueue(boost::make_shared<FIFO>()), : m_SendQueue(boost::make_shared<FIFO>()),
m_RecvQueue(boost::make_shared<FIFO>()) m_RecvQueue(boost::make_shared<FIFO>()),
m_Role(role)
{ } { }
/** /**

View File

@ -73,16 +73,6 @@ void TlsClient::Start(void)
Socket::Start(); 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. * Retrieves the X509 certficate for this client.
* *
@ -92,7 +82,7 @@ shared_ptr<X509> TlsClient::GetClientCertificate(void) const
{ {
mutex::scoped_lock lock(m_SocketMutex); mutex::scoped_lock lock(m_SocketMutex);
return shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &TlsClient::NullCertificateDeleter); return shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter);
} }
/** /**

View File

@ -249,9 +249,9 @@ String Utility::BaseName(const String& path)
/** /**
* Null deleter. Used as a parameter for the shared_ptr constructor. * 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. */ /* Nothing to do here. */
} }

View File

@ -208,7 +208,7 @@ typedef struct YYLTYPE
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner); 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; stringstream message;
message << *locp << ": " << err; message << *locp << ": " << err;

View File

@ -66,7 +66,7 @@ using namespace icinga;
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner); 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; stringstream message;
message << *locp << ": " << err; message << *locp << ": " << err;