Module: check_mk
Branch: master
Commit: 20130a7c202038a1fc69234036b8bf3cde5775d6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=20130a7c202038…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Nov 10 08:28:49 2015 +0100
cppcheck-induced cleanup: Prefer C++ casts.
---
livestatus/src/ColumnsColumn.cc | 2 +-
livestatus/src/DownCommColumn.cc | 2 +-
livestatus/src/StatsColumn.cc | 12 ++++++------
livestatus/src/TableDownComm.cc | 2 +-
livestatus/src/TableLog.cc | 2 +-
livestatus/src/TableStateHistory.cc | 2 +-
livestatus/src/store_c.cc | 10 +++++-----
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/livestatus/src/ColumnsColumn.cc b/livestatus/src/ColumnsColumn.cc
index 3216579..16c6eac 100644
--- a/livestatus/src/ColumnsColumn.cc
+++ b/livestatus/src/ColumnsColumn.cc
@@ -29,6 +29,6 @@ class Column;
char *ColumnsColumn::getValue(void *data)
{
- Column *column = (Column *)data;
+ Column *column = static_cast<Column *>(data);
return (char *)_table_columns->getValue(column, _colcol);
}
diff --git a/livestatus/src/DownCommColumn.cc b/livestatus/src/DownCommColumn.cc
index 17ade80..7a88e54 100644
--- a/livestatus/src/DownCommColumn.cc
+++ b/livestatus/src/DownCommColumn.cc
@@ -81,7 +81,7 @@ void DownCommColumn::output(void *data, Query *query)
query->outputString(dt->_comment);
if(_with_extra_info && !_is_downtime) {
query->outputSublistSeparator();
- query->outputInteger(((Comment*)dt)->_entry_type);
+
query->outputInteger(static_cast<Comment*>(dt)->_entry_type);
query->outputSublistSeparator();
query->outputTime(dt->_entry_time);
}
diff --git a/livestatus/src/StatsColumn.cc b/livestatus/src/StatsColumn.cc
index 9688813..b3729a5 100644
--- a/livestatus/src/StatsColumn.cc
+++ b/livestatus/src/StatsColumn.cc
@@ -26,13 +26,13 @@
#include "Column.h"
#include "CountAggregator.h"
#include "DoubleAggregator.h"
+#include "DoubleColumn.h"
#include "Filter.h"
#include "IntAggregator.h"
+#include "IntColumn.h"
#include "PerfdataAggregator.h"
+#include "StringColumn.h"
#include "strutil.h"
-class DoubleColumn;
-class IntColumn;
-class StringColumn;
StatsColumn::~StatsColumn()
@@ -47,11 +47,11 @@ Aggregator *StatsColumn::createAggregator()
if (_operation == STATS_OP_COUNT)
return new CountAggregator(_filter);
else if (_column->type() == COLTYPE_INT || _column->type() == COLTYPE_TIME)
- return new IntAggregator((IntColumn *)_column, _operation);
+ return new IntAggregator(static_cast<IntColumn *>(_column), _operation);
else if (_column->type() == COLTYPE_DOUBLE)
- return new DoubleAggregator((DoubleColumn *)_column, _operation);
+ return new DoubleAggregator(static_cast<DoubleColumn *>(_column),
_operation);
else if (_column->type() == COLTYPE_STRING and ends_with(_column->name(),
"perf_data"))
- return new PerfdataAggregator((StringColumn *)_column, _operation);
+ return new PerfdataAggregator(static_cast<StringColumn *>(_column),
_operation);
else // unaggregateble column
return new CountAggregator(_filter);
}
diff --git a/livestatus/src/TableDownComm.cc b/livestatus/src/TableDownComm.cc
index bfcca21..3b192fa 100644
--- a/livestatus/src/TableDownComm.cc
+++ b/livestatus/src/TableDownComm.cc
@@ -165,7 +165,7 @@ void TableDownComm::answerQuery(Query *query)
bool TableDownComm::isAuthorized(contact *ctc, void *data)
{
- DowntimeOrComment *dtc = (DowntimeOrComment *)data;
+ DowntimeOrComment *dtc = static_cast<DowntimeOrComment *>(data);
return is_authorized_for(ctc, dtc->_host, dtc->_service);
}
diff --git a/livestatus/src/TableLog.cc b/livestatus/src/TableLog.cc
index da93b62..6d19b8a 100644
--- a/livestatus/src/TableLog.cc
+++ b/livestatus/src/TableLog.cc
@@ -164,7 +164,7 @@ void TableLog::answerQuery(Query *query)
bool TableLog::isAuthorized(contact *ctc, void *data)
{
- LogEntry *entry = (LogEntry *)data;
+ LogEntry *entry = static_cast<LogEntry *>(data);
service *svc = entry->_service;
host *hst = entry->_host;
diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc
index 21a976e..68d139f 100644
--- a/livestatus/src/TableStateHistory.cc
+++ b/livestatus/src/TableStateHistory.cc
@@ -879,7 +879,7 @@ void TableStateHistory::process(Query *query, HostServiceState
*hs_state)
bool TableStateHistory::isAuthorized(contact *ctc, void *data)
{
- HostServiceState *entry = (HostServiceState *)data;
+ HostServiceState *entry = static_cast<HostServiceState *>(data);
service *svc = entry->_service;
host *hst = entry->_host;
diff --git a/livestatus/src/store_c.cc b/livestatus/src/store_c.cc
index 5f5e61a..c36af2f 100644
--- a/livestatus/src/store_c.cc
+++ b/livestatus/src/store_c.cc
@@ -85,7 +85,7 @@ void store_register_downtime(nebstruct_downtime_data *d)
int store_answer_request(void *ib, void *ob)
{
- return g_store->answerRequest((InputBuffer *)ib, (OutputBuffer *)ob);
+ return g_store->answerRequest(static_cast<InputBuffer *>(ib),
static_cast<OutputBuffer *>(ob));
}
void *create_outputbuffer()
@@ -95,12 +95,12 @@ void *create_outputbuffer()
void flush_output_buffer(void *ob, int fd, int *termination_flag)
{
- ((OutputBuffer *)ob)->flush(fd, termination_flag);
+ static_cast<OutputBuffer *>(ob)->flush(fd, termination_flag);
}
void delete_outputbuffer(void *ob)
{
- delete (OutputBuffer *)ob;
+ delete static_cast<OutputBuffer *>(ob);
}
void *create_inputbuffer(int *termination_flag)
@@ -110,12 +110,12 @@ void *create_inputbuffer(int *termination_flag)
void set_inputbuffer_fd(void *ib, int fd)
{
- ((InputBuffer *)ib)->setFd(fd);
+ static_cast<InputBuffer *>(ib)->setFd(fd);
}
void delete_inputbuffer(void *ib)
{
- delete (InputBuffer *)ib;
+ delete static_cast<InputBuffer *>(ib);
}
void update_timeperiods_cache(time_t now)