Skip to content

Commit

Permalink
fix compiler -Wsign-compare warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Ofer Heifetz <oheifetz@gmail.com>
  • Loading branch information
oheifetz authored and poiana committed Jul 13, 2023
1 parent f1b7e86 commit 7c68b42
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion userspace/libsinsp/cyclewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ cycle_writer::conclusion cycle_writer::consider(sinsp_evt* evt, uint64_t written
}
}

if(m_rollover_mb > 0 && written_bytes > m_rollover_mb)
if(m_rollover_mb > 0 && written_bytes > (uint64_t)m_rollover_mb)
{
m_last_reason = "Maximum File Size Reached";
return next_file();
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ uint32_t binary_buffer_to_hex_string(char *dst, char *src, uint32_t dstlen, uint
{
ret = snprintf(row + k, sizeof(row) - k, " %.4x", chunk);
}
if (ret < 0 || ret >= sizeof(row) - k)
if (ret < 0 || (unsigned int)ret >= sizeof(row) - k)
{
dst[0] = 0;
return 0;
Expand Down
14 changes: 7 additions & 7 deletions userspace/libsinsp/socket_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,13 @@ class socket_data_handler
}
}

int get_all_data_secure(std::vector<char> &buf)
unsigned int get_all_data_secure(std::vector<char> &buf)
{
int processed = 0;
unsigned int processed = 0;
int rec = SSL_read(m_ssl_connection, &buf[0], buf.size());
if (rec > 0)
{
processed += rec;
processed += (unsigned int)rec;
}
int err = SSL_get_error(m_ssl_connection, rec);
switch (err) {
Expand All @@ -381,9 +381,9 @@ class socket_data_handler
return processed;
}

int get_all_data_unsecure(std::vector<char> &buf) {
unsigned int get_all_data_unsecure(std::vector<char> &buf) {
int rec;
int processed = 0;
unsigned int processed = 0;
int count = 0;
int ioret = ioctl(m_socket, FIONREAD, &count);
if(ioret >= 0 && count > 0)
Expand All @@ -399,7 +399,7 @@ class socket_data_handler
break;
default:
process(&buf[0], rec, false);
processed = rec;
processed = (unsigned int)rec;
break;
}
}
Expand All @@ -408,7 +408,7 @@ class socket_data_handler

int get_all_data()
{
int processed = 0;
unsigned int processed = 0;
int counter = 0;
std::vector<char> buf(1024, 0);

Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/tuples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool ipv6net::in_cidr(const ipv6addr &other) const
auto this_bytes = (const uint8_t*)(&m_addr.m_b);
auto other_bytes = (const uint8_t*)(&other.m_b);

int i = 0;
unsigned int i = 0;
for (; i < m_mask_len_bytes; i++)
{
if(this_bytes[i] != other_bytes[i])
Expand Down

0 comments on commit 7c68b42

Please sign in to comment.