Merge remote-tracking branch 'nickbroon/silence_compiler_warnings'

master
Oliver Gasser 2017-06-15 16:55:47 +02:00
commit b70d4f2e6d
12 changed files with 28 additions and 20 deletions

View File

@ -60,6 +60,8 @@ include(CppcheckTargets)
### basic modules
ENABLE_TESTING()
SUBDIRS(
src
)

View File

@ -82,27 +82,28 @@ void vermont_exception(const int, const char*, const char*, const char*, const c
({ \
if (msg_getlevel() & LOG_MASK(MSG_FATAL)) { \
if (msg_get_syslog()) { \
syslog(MSG_FATAL, ##__VA_ARGS__); \
syslog(MSG_FATAL, __VA_ARGS__); \
} \
if (msg_get_journald()) { \
sd_journal_print(MSG_FATAL, ##__VA_ARGS__); \
sd_journal_print(MSG_FATAL, __VA_ARGS__); \
} \
} \
vermont_exception(__LINE__, __FILE__, __PRETTY_FUNCTION__, __func__, ##__VA_ARGS__); \
vermont_exception(__LINE__, __FILE__, __PRETTY_FUNCTION__, __func__, __VA_ARGS__); \
})
#define msg(lvl, ...) \
#define msg(...) _msg_helper(__VA_ARGS__)
#define _msg_helper(lvl, ...) \
__extension__ \
({ \
if (msg_getlevel() & LOG_MASK(lvl)) { \
if (msg_get_syslog()) { \
syslog(lvl, ##__VA_ARGS__); \
syslog(lvl, __VA_ARGS__); \
} \
if (msg_get_journald()) { \
sd_journal_print(lvl, ##__VA_ARGS__); \
sd_journal_print(lvl, __VA_ARGS__); \
} \
if (!msg_getquiet()) { \
msg2(__LINE__, __FILE__, __PRETTY_FUNCTION__, __func__, lvl, ##__VA_ARGS__); \
msg2(__LINE__, __FILE__, __PRETTY_FUNCTION__, __func__, lvl, __VA_ARGS__); \
} \
} \
})

View File

@ -20,7 +20,7 @@ std::string XMLNode::getName() const
return std::string((const char*)xmlNode->name);
}
std::string XMLNode::getContent() const
const std::string XMLNode::getContent() const
{
return std::string((const char*)xmlNodeGetContent(xmlNode));
}

View File

@ -25,7 +25,7 @@ public:
std::string getName () const;
/** Get the content of this node. */
virtual std::string getContent () const;
virtual const std::string getContent () const;
/** compares the node name with the supplied string */
inline bool matches(const char* str) const
@ -104,7 +104,7 @@ public:
virtual ~XMLTextNode();
/** Get the value of this node. */
const std::string getContent();
virtual const std::string getContent() const;
/** checks if the node consists of only whitespace */
bool isBlank() const;

View File

@ -9,7 +9,7 @@ XMLTextNode::~XMLTextNode()
{
}
const std::string XMLTextNode::getContent()
const std::string XMLTextNode::getContent() const
{
const char* content = (const char*)cobj()->content;
if (!content)

View File

@ -62,8 +62,6 @@
#include <cassert>
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
// we create a static array of all root config entrys so that we don't
// need to hardcode the config entry name in here. Instead, we just ask the
// module instances if they handle the specific entry.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "common/defs.h"
#include "Signature.h"
#include <errno.h>
@ -56,8 +56,9 @@ struct BayesSignature * new_Signature_s(const char * absolute_path, char * filen
int numOfLines = 0;
/** Open file */
char absolute_filename[300] = "";
snprintf(absolute_filename,299, "%s/%s", absolute_path, filename_sig);
char absolute_filename[300] = "";
snprintf(absolute_filename, ARRAY_SIZE(absolute_filename), "%s/%s",
absolute_path, filename_sig);
if( (fp=fopen(absolute_filename, "r")) == NULL) {
printf("\nCannot open file \"%s\"\n", absolute_filename);

View File

@ -56,7 +56,7 @@ using namespace std;
IpfixReceiverDtlsUdpIpV4::IpfixReceiverDtlsUdpIpV4(int port, const std::string ipAddr,
const std::string &certificateChainFile, const std::string &privateKeyFile,
const std::string &caFile, const std::string &caPath,
const std::set<string> &peerFqdnsParam, const uint32_t buffer),
const std::set<string> &peerFqdnsParam, const uint32_t buffer,
unsigned int moduleId)
: IpfixReceiver(port),listen_socket(-1),
ssl_ctx(certificateChainFile,privateKeyFile,caFile,caPath, ! peerFqdnsParam.empty()),

View File

@ -41,7 +41,8 @@
* Does SCTP/IPv4 specific initialization.
* @param port Port to listen on
*/
IpfixReceiverSctpIpV4::IpfixReceiverSctpIpV4(int port, std::string ipAddr, uint32_t buffer)
IpfixReceiverSctpIpV4::IpfixReceiverSctpIpV4(int port, std::string ipAddr, uint32_t buffer,
unsigned int moduleId)
: statReceivedPackets(0), moduleId(moduleId)
{
receiverPort = port;

View File

@ -41,7 +41,8 @@
class IpfixReceiverSctpIpV4 : public IpfixReceiver, Sensor {
#ifdef SUPPORT_SCTP
public:
IpfixReceiverSctpIpV4(int port, std::string ipAddr = "", uint32_t buffer = 0);
IpfixReceiverSctpIpV4(int port, std::string ipAddr = "", uint32_t buffer = 0,
unsigned int moduleId = 0);
virtual ~IpfixReceiverSctpIpV4();
virtual void run();

View File

@ -18,7 +18,7 @@
*
*/
#ifndef _STATE_CONNECITON_FILTER_H_
#ifndef _STATE_CONNECTION_FILTER_H_
#define _STATE_CONNECTION_FILTER_H_
#include <modules/packet/filter//PacketProcessor.h>

View File

@ -60,3 +60,7 @@ IF (JOURNALD_FOUND)
${JOURNALD_LIBRARIES}
)
ENDIF (JOURNALD_FOUND)
ADD_TEST(vermonttest_build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target vermonttest --config $<CONFIG>)
ADD_TEST(vermont vermonttest)
SET_TESTS_PROPERTIES(vermont PROPERTIES DEPENDS vermonttest_build)