Module: check_mk
Branch: master
Commit: a0e521c4757eec84e60de34e59ad2abf2e15f562
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a0e521c4757eec…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Oct 26 11:58:38 2015 +0100
Warning police: Fixed signed/unsigned confusion (in a slightly hacky way).
---
livestatus/src/LogCache.cc | 10 +++++-----
livestatus/src/LogEntry.h | 2 +-
livestatus/src/waittriggers.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/livestatus/src/LogCache.cc b/livestatus/src/LogCache.cc
index 4b90914..f5bb267 100644
--- a/livestatus/src/LogCache.cc
+++ b/livestatus/src/LogCache.cc
@@ -219,7 +219,7 @@ void LogCache::dumpLogfiles()
*/
void LogCache::handleNewMessage(Logfile *logfile, time_t since __attribute__
((__unused__)), time_t until __attribute__ ((__unused__)), unsigned logclasses)
{
- if ( ++num_cached_log_messages <= _max_cached_messages )
+ if ( static_cast<unsigned long>(++num_cached_log_messages) <=
_max_cached_messages )
return; // current message count still allowed, everything ok
/* Memory checking an freeing consumes CPU ressources. We save
@@ -228,7 +228,7 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t since
__attribute__ ((_
memory can be freed. We do this by suppressing the check when
the number of messages loaded into memory has not grown
by at least CHECK_MEM_CYCLE messages */
- if (num_cached_log_messages < _num_at_last_check + CHECK_MEM_CYCLE)
+ if (static_cast<unsigned long>(num_cached_log_messages) < _num_at_last_check
+ CHECK_MEM_CYCLE)
return; // Do not check this time
// [1] Begin by deleting old logfiles
@@ -244,7 +244,7 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t since
__attribute__ ((_
if (log->numEntries() > 0) {
num_cached_log_messages -= log->numEntries();
log->flush(); // drop all messages of that file
- if (num_cached_log_messages <= _max_cached_messages) {
+ if (static_cast<unsigned long>(num_cached_log_messages) <=
_max_cached_messages) {
// remember the number of log messages in cache when
// the last memory-release was done. No further
// release-check shall be done until that number changes.
@@ -269,7 +269,7 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t since
__attribute__ ((_
debug("Freeing classes 0x%02x of file %s", ~logclasses,
log->path());
long freed = log->freeMessages(~logclasses); // flush only messages not
needed for current query
num_cached_log_messages -= freed;
- if (num_cached_log_messages <= _max_cached_messages) {
+ if (static_cast<unsigned long>(num_cached_log_messages) <=
_max_cached_messages) {
_num_at_last_check = num_cached_log_messages;
return;
}
@@ -287,7 +287,7 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t since
__attribute__ ((_
debug("Flush newer log, msgs %d", log->numEntries());
num_cached_log_messages -= log->numEntries();
log->flush();
- if (num_cached_log_messages <= _max_cached_messages) {
+ if (static_cast<unsigned long>(num_cached_log_messages) <=
_max_cached_messages) {
_num_at_last_check = num_cached_log_messages;
return;
}
diff --git a/livestatus/src/LogEntry.h b/livestatus/src/LogEntry.h
index af32237..8f2b72e 100644
--- a/livestatus/src/LogEntry.h
+++ b/livestatus/src/LogEntry.h
@@ -34,7 +34,7 @@
#define LOGCLASS_STATE 6 // initial or current states
#define LOGCLASS_TEXT 7 // specific text passages. e.g "logging initial
states"
// TODO: This LOGCLASS sets different logclasses on
match -> fix this
-#define LOGCLASS_INVALID -1 // never stored
+#define LOGCLASS_INVALID 0x7fffffff // never stored
#define LOGCLASS_ALL 0xffff
#include "nagios.h"
diff --git a/livestatus/src/waittriggers.h b/livestatus/src/waittriggers.h
index 8d3d389..b468a76 100644
--- a/livestatus/src/waittriggers.h
+++ b/livestatus/src/waittriggers.h
@@ -27,7 +27,7 @@
#include "pthread.h"
-#define WT_NONE -1
+#define WT_NONE 0x7fffffff
#define WT_ALL 0
#define WT_CHECK 1
#define WT_STATE 2