solved the additional clang warnings

master
Emanuel Vintila 2017-12-10 19:59:02 +01:00
parent 692eec5887
commit 1dd173d670
4 changed files with 48 additions and 22 deletions

View File

@ -695,7 +695,7 @@ int IpfixParser::processNetflowV9Packet(boost::shared_array<uint8_t> message, ui
if(iter != snInfoMap.end()) {
int64_t difference = (int64_t)sequenceNumber - (int64_t)iter->second.expectedSN;
if(difference > 0) {
msg(MSG_INFO, "IpfixParser: Loss of %d NetflowV9 messages from %s detected (SN=%u, expected=%u).",
msg(MSG_INFO, "IpfixParser: Loss of %ld NetflowV9 messages from %s detected (SN=%u, expected=%u).",
difference, (sourceId->toString()).c_str(), sequenceNumber, iter->second.expectedSN);
iter->second.lostMessages += difference;
} else if (difference < 0) {
@ -795,7 +795,7 @@ int IpfixParser::processIpfixPacket(boost::shared_array<uint8_t> message, uint16
if(iter != snInfoMap.end()) {
int64_t difference = (int64_t)sequenceNumber - (int64_t)iter->second.expectedSN;
if(difference > 0) {
msg(MSG_INFO, "IpfixParser: Loss of %d IPFIX Data Records from %s detected (SN=%u, expected=%u).",
msg(MSG_INFO, "IpfixParser: Loss of %ld IPFIX Data Records from %s detected (SN=%u, expected=%u).",
difference, (sourceId->toString()).c_str(), sequenceNumber, iter->second.expectedSN);
iter->second.lostDataRecords += difference;
} else if (difference < 0) {

View File

@ -603,7 +603,7 @@ void IpfixPrinter::printOneLineRecord(IpfixDataRecord* record)
if (fi != NULL && fi->type.length==2) {
srcport = ntohs(*reinterpret_cast<uint16_t*>(record->data+fi->offset));
}
snprintf(buf, ARRAY_SIZE(buf), "%hhu.%hhu.%hhu.%hhu:%hu", (srcip>>0)&0xFF, (srcip>>8)&0xFF, (srcip>>16)&0xFF, (srcip>>24)&0xFF, srcport);
snprintf(buf, ARRAY_SIZE(buf), "%hhu.%hhu.%hhu.%hhu:%hu", (uint8_t)((srcip>>0)&0xFF), (uint8_t)((srcip>>8)&0xFF), (uint8_t)((srcip>>16)&0xFF), (uint8_t)((srcip>>24)&0xFF), srcport);
fprintf(fh, "%21s ", buf);
fi = dataTemplateInfo->getFieldInfo(IPFIX_TYPEID_destinationIPv4Address, 0);
@ -616,7 +616,7 @@ void IpfixPrinter::printOneLineRecord(IpfixDataRecord* record)
if (fi != NULL && fi->type.length==2) {
dstport = ntohs(*reinterpret_cast<uint16_t*>(record->data+fi->offset));
}
snprintf(buf, ARRAY_SIZE(buf), "%hhu.%hhu.%hhu.%hhu:%hu", (dstip>>0)&0xFF, (dstip>>8)&0xFF, (dstip>>16)&0xFF, (dstip>>24)&0xFF, dstport);
snprintf(buf, ARRAY_SIZE(buf), "%hhu.%hhu.%hhu.%hhu:%hu", (uint8_t)((dstip>>0)&0xFF), (uint8_t)((dstip>>8)&0xFF), (uint8_t)((dstip>>16)&0xFF), (uint8_t)((dstip>>24)&0xFF), dstport);
fprintf(fh, "%21s ", buf);
fi = dataTemplateInfo->getFieldInfo(IPFIX_TYPEID_packetDeltaCount, 0);

View File

@ -97,23 +97,49 @@ static void old_Hertz_hack(void){
seconds = (up_1 + up_2) / 2;
h = (unsigned)( (double)jiffies/seconds/smp_num_cpus );
/* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */
switch(h){
case 9 ... 11 : Hertz = 10; break; /* S/390 (sometimes) */
case 18 ... 22 : Hertz = 20; break; /* user-mode Linux */
case 30 ... 34 : Hertz = 32; break; /* ia64 emulator */
case 48 ... 52 : Hertz = 50; break;
case 58 ... 61 : Hertz = 60; break;
case 62 ... 65 : Hertz = 64; break; /* StrongARM /Shark */
case 95 ... 105 : Hertz = 100; break; /* normal Linux */
case 124 ... 132 : Hertz = 128; break; /* MIPS, ARM */
case 195 ... 204 : Hertz = 200; break; /* normal << 1 */
case 253 ... 260 : Hertz = 256; break;
case 393 ... 408 : Hertz = 400; break; /* normal << 2 */
case 790 ... 808 : Hertz = 800; break; /* normal << 3 */
case 990 ... 1010 : Hertz = 1000; break; /* ARM */
case 1015 ... 1035 : Hertz = 1024; break; /* Alpha, ia64 */
case 1180 ... 1220 : Hertz = 1200; break; /* Alpha */
default:
if ( (h >= 9 ) && (h <= 11 ) ){
/* S/390 (sometimes) */
Hertz = 10;
} else if ( (h >= 18 ) && (h <= 22 ) ){
/* user-mode Linux */
Hertz = 20; /* S/390 (sometimes) */
} else if ( (h >= 30 ) && (h <= 34 ) ){
/* ia64 emulator */
Hertz = 32;
} else if ( (h >= 48 ) && (h <= 52 ) ){
Hertz = 50;
} else if ( (h >= 58 ) && (h <= 61 ) ){
Hertz = 60;
} else if ( (h >= 62 ) && (h <= 65 ) ){
/* StrongARM /Shark */
Hertz = 64;
} else if ( (h >= 95 ) && (h <= 105 ) ){
/* normal Linux */
Hertz = 100;
} else if ( (h >= 124 ) && (h <= 132 ) ){
/* MIPS, ARM */
Hertz = 128;
} else if ( (h >= 195 ) && (h <= 204 ) ){
/* normal << 1 */
Hertz = 200;
} else if ( (h >= 253 ) && (h <= 260 ) ){
Hertz = 256;
} else if ( (h >= 393 ) && (h <= 408 ) ){
/* normal << 2 */
Hertz = 400;
} else if ( (h >= 790 ) && (h <= 808 ) ){
/* normal << 3 */
Hertz = 800;
} else if ( (h >= 990 ) && (h <= 1010) ){
/* ARM */
Hertz = 1000;
} else if ( (h >= 1015) && (h <= 1035) ){
/* Alpha, ia64 */
Hertz = 1024;
} else if ( (h >= 1180) && (h <= 1220) ){
/* Alpha */
Hertz = 1200;
} else {
#ifdef HZ
Hertz = (unsigned long long)HZ; /* <asm/param.h> */
#else

View File

@ -6,7 +6,7 @@
#include <vector>
#define ERROR(...) vermont_exception(__LINE__, __FILE__, __PRETTY_FUNCTION__, __func__, ##__VA_ARGS__)
#define ERROR(...) vermont_exception(__LINE__, __FILE__, __PRETTY_FUNCTION__, __func__, __VA_ARGS__)
// redefine assert, so that ASSERT is always properly defined in unit tests
#undef ASSERT