utils: fix integer warnings in r files

Ticket: 4516
pull/7112/head
Philippe Antoine 4 years ago committed by Victor Julien
parent dca76a45a8
commit 5790280c95

@ -77,7 +77,7 @@ static void SRepCIDRFreeUserData(void *data)
return;
}
static void SRepCIDRAddNetblock(SRepCIDRTree *cidr_ctx, char *ip, int cat, int value)
static void SRepCIDRAddNetblock(SRepCIDRTree *cidr_ctx, char *ip, int cat, uint8_t value)
{
SReputation *user_data = NULL;
if ((user_data = SCMalloc(sizeof(SReputation))) == NULL) {
@ -309,11 +309,11 @@ static int SRepSplitLine(SRepCIDRTree *cidr_ctx, char *line, Address *ip, uint8_
if (strcmp(ptrs[0], "ip") == 0)
return 1;
int c, v;
if (StringParseI32RangeCheck(&c, 10, 0, (const char *)ptrs[1], 0, SREP_MAX_CATS - 1) < 0)
uint8_t c, v;
if (StringParseU8RangeCheck(&c, 10, 0, (const char *)ptrs[1], 0, SREP_MAX_CATS - 1) < 0)
return -1;
if (StringParseI32RangeCheck(&v, 10, 0, (const char *)ptrs[2], 0, SREP_MAX_VAL) < 0)
if (StringParseU8RangeCheck(&v, 10, 0, (const char *)ptrs[2], 0, SREP_MAX_VAL) < 0)
return -1;
if (strchr(ptrs[0], '/') != NULL) {

@ -80,7 +80,7 @@ typedef struct Libnet11Packet_ {
struct libnet_in6_addr src6, dst6;
uint32_t src4, dst4;
uint16_t sp, dp;
size_t len;
uint16_t len;
uint8_t *smac, *dmac;
} Libnet11Packet;
@ -351,7 +351,7 @@ int RejectSendLibnet11IPv4ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
lpacket.id = 0;
lpacket.flow = 0;
lpacket.class = 0;
const int iplen = IPV4_GET_IPLEN(p);
const uint16_t iplen = IPV4_GET_IPLEN(p);
if (g_reject_dev_mtu >= ETHERNET_HEADER_LEN + LIBNET_IPV4_H + 8) {
lpacket.len = MIN(g_reject_dev_mtu - ETHERNET_HEADER_LEN, (LIBNET_IPV4_H + iplen));
} else {
@ -493,7 +493,7 @@ int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum Rejec
lpacket.id = 0;
lpacket.flow = 0;
lpacket.class = 0;
const int iplen = IPV6_GET_PLEN(p);
const uint16_t iplen = IPV6_GET_PLEN(p);
if (g_reject_dev_mtu >= ETHERNET_HEADER_LEN + IPV6_HEADER_LEN + 8) {
lpacket.len = IPV6_HEADER_LEN + MIN(g_reject_dev_mtu - ETHERNET_HEADER_LEN, iplen);
} else {

@ -210,7 +210,7 @@ int RunModeErfFileAutoFp(void)
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
if (threading_set_cpu_affinity) {
TmThreadSetCPUAffinity(tv_detect_ncpu, (int)cpu);
TmThreadSetCPUAffinity(tv_detect_ncpu, cpu);
/* If we have more than one core/cpu, the first Detect thread
* (at cpu 0) will have less priority (higher 'nice' value)
* In this case we will set the thread priority to +10 (default is 0)

@ -808,7 +808,7 @@ TmEcode UnixSocketRegisterTenantHandler(json_t *cmd, json_t* answer, void *data)
}
SCLogInfo("VLAN handler: id %u maps to tenant %u", (uint32_t)traffic_id, tenant_id);
r = DetectEngineTentantRegisterVlanId(tenant_id, (uint32_t)traffic_id);
r = DetectEngineTentantRegisterVlanId(tenant_id, (uint16_t)traffic_id);
}
if (r != 0) {
json_object_set_new(answer, "message", json_string("handler setup failure"));
@ -889,7 +889,7 @@ TmEcode UnixSocketUnregisterTenantHandler(json_t *cmd, json_t* answer, void *dat
}
SCLogInfo("VLAN handler: removing mapping of %u to tenant %u", (uint32_t)traffic_id, tenant_id);
r = DetectEngineTentantUnregisterVlanId(tenant_id, (uint32_t)traffic_id);
r = DetectEngineTentantUnregisterVlanId(tenant_id, (uint16_t)traffic_id);
}
if (r != 0) {
json_object_set_new(answer, "message", json_string("handler unregister failure"));

@ -903,7 +903,7 @@ void RunModeInitializeOutputs(void)
}
/* register the logger bits to the app-layer */
int a;
AppProto a;
for (a = 0; a < ALPROTO_MAX; a++) {
if (logger_bits[a] == 0)
continue;

Loading…
Cancel
Save