util: fix -Wshorten-64-to-32 warnings for afpacket

Ticket: #6186
pull/13419/head
Philippe Antoine 6 months ago committed by Victor Julien
parent e0e91c9302
commit 9e64555c5e

@ -597,12 +597,12 @@ static void *ParseAFPConfig(const char *iface)
}
if ((SCConfGetChildValueIntWithDefault(if_root, if_default, "buffer-size", &value)) == 1) {
aconf->buffer_size = value;
aconf->buffer_size = (int)value;
} else {
aconf->buffer_size = 0;
}
if ((SCConfGetChildValueIntWithDefault(if_root, if_default, "ring-size", &value)) == 1) {
aconf->ring_size = value;
aconf->ring_size = (int)value;
}
if ((SCConfGetChildValueIntWithDefault(if_root, if_default, "block-size", &value)) == 1) {
@ -610,12 +610,12 @@ static void *ParseAFPConfig(const char *iface)
SCLogWarning("%s: block-size %" PRIuMAX " must be a multiple of pagesize (%u).", iface,
value, getpagesize());
} else {
aconf->block_size = value;
aconf->block_size = (int)value;
}
}
if ((SCConfGetChildValueIntWithDefault(if_root, if_default, "block-timeout", &value)) == 1) {
aconf->block_timeout = value;
aconf->block_timeout = (int)value;
} else {
aconf->block_timeout = 10;
}
@ -625,7 +625,7 @@ static void *ParseAFPConfig(const char *iface)
SCLogWarning("%s: v2-block-size %" PRIuMAX " must be a multiple of pagesize (%u).",
iface, value, getpagesize());
} else {
aconf->v2_block_size = value;
aconf->v2_block_size = (int)value;
}
}

@ -2744,7 +2744,7 @@ static void UpdateRawDataForVLANHdr(Packet *p)
{
if (p->afp_v.vlan_tci != 0) {
uint8_t *pstart = GET_PKT_DATA(p) - VLAN_HEADER_LEN;
size_t plen = GET_PKT_LEN(p) + VLAN_HEADER_LEN;
uint32_t plen = GET_PKT_LEN(p) + VLAN_HEADER_LEN;
/* move ethernet addresses */
memmove(pstart, GET_PKT_DATA(p), 2 * ETH_ALEN);
/* write vlan info */

@ -252,12 +252,13 @@ enum {
})
#else
#define SCGetThreadIdLong(...) ({ \
pid_t tmpthid; \
tmpthid = syscall(SYS_gettid); \
unsigned long _scgetthread_tid = (unsigned long)tmpthid; \
_scgetthread_tid; \
})
#define SCGetThreadIdLong(...) \
({ \
pid_t tmpthid; \
tmpthid = (pid_t)syscall(SYS_gettid); \
unsigned long _scgetthread_tid = (unsigned long)tmpthid; \
_scgetthread_tid; \
})
#endif /* OS FREEBSD */
extern thread_local char t_thread_name[THREAD_NAME_LEN + 1];

@ -74,7 +74,8 @@ static int Notify(const char *message)
if (fd < 0)
return -errno;
if (connect(fd, &socket_addr.sa, offsetof(struct sockaddr_un, sun_path) + path_length) != 0)
if (connect(fd, &socket_addr.sa,
offsetof(struct sockaddr_un, sun_path) + (uint32_t)path_length) != 0)
return -errno;
ssize_t written = write(fd, message, message_length);

Loading…
Cancel
Save