fix all sign-compare warnings

This commit is contained in:
Daniel Agar
2018-07-01 09:36:55 +00:00
committed by Lorenz Meier
parent cf74166801
commit 9ce83f2208
54 changed files with 106 additions and 129 deletions
@@ -34,7 +34,6 @@ px4_add_module(
MODULE drivers__mb12xx
MAIN mb12xx
COMPILE_FLAGS
-Wno-sign-compare
SRCS
mb12xx.cpp
DEPENDS
@@ -118,9 +118,9 @@ private:
float _min_distance;
float _max_distance;
work_s _work;
ringbuffer::RingBuffer *_reports;
ringbuffer::RingBuffer *_reports;
bool _sensor_ok;
int _measure_ticks;
int _measure_ticks;
bool _collect_phase;
int _class_instance;
int _orb_class_instance;
@@ -34,7 +34,6 @@ px4_add_module(
MODULE drivers__sf0x
MAIN sf0x
COMPILE_FLAGS
-Wno-sign-compare # TODO: fix all sign-compare
SRCS
sf0x.cpp
sf0x_parser.cpp
+3 -3
View File
@@ -105,7 +105,7 @@ private:
uint8_t _rotation;
float _min_distance;
float _max_distance;
int _conversion_interval;
int _conversion_interval;
work_s _work;
ringbuffer::RingBuffer *_reports;
int _measure_ticks;
@@ -419,7 +419,7 @@ SF0X::ioctl(device::file_t *filp, int cmd, unsigned long arg)
bool want_start = (_measure_ticks == 0);
/* convert hz to tick interval via microseconds */
unsigned ticks = USEC2TICK(1000000 / arg);
int ticks = USEC2TICK(1000000 / arg);
/* check against maximum rate */
if (ticks < USEC2TICK(_conversion_interval)) {
@@ -564,7 +564,7 @@ SF0X::collect()
perf_begin(_sample_perf);
/* clear buffer if last read was too long ago */
uint64_t read_elapsed = hrt_elapsed_time(&_last_read);
int64_t read_elapsed = hrt_elapsed_time(&_last_read);
/* the buffer for read chars is buflen minus null termination */
char readbuf[sizeof(_linebuf)];
@@ -34,7 +34,6 @@ px4_add_module(
MODULE drivers__sf0x__sf0x_tests
MAIN sf0x_tests
COMPILE_FLAGS
-Wno-sign-compare # TODO: fix all sign-compare
SRCS
SF0XTest.cpp
../sf0x_parser.cpp
@@ -58,9 +58,9 @@ bool SF0XTest::sf0xTest()
for (unsigned l = 0; l < sizeof(lines) / sizeof(lines[0]); l++) {
//printf("\n%s", _linebuf);
int parse_ret;
int parse_ret = -1;
for (int i = 0; i < strlen(lines[l]); i++) {
for (int i = 0; i < (ssize_t)strlen(lines[l]); i++) {
parse_ret = sf0x_parser(lines[l][i], _parserbuf, &_parsebuf_index, &state, &dist_m);
if (parse_ret == 0) {
@@ -35,7 +35,6 @@ px4_add_module(
MODULE drivers__sf1xx
MAIN sf1xx
COMPILE_FLAGS
-Wno-sign-compare
SRCS
sf1xx.cpp
DEPENDS
@@ -34,7 +34,6 @@ px4_add_module(
MODULE drivers__srf02
MAIN srf02
COMPILE_FLAGS
-Wno-sign-compare
SRCS
srf02.cpp
DEPENDS
@@ -35,7 +35,6 @@ px4_add_module(
MAIN teraranger
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-sign-compare
SRCS
teraranger.cpp
DEPENDS
@@ -125,7 +125,7 @@ private:
ringbuffer::RingBuffer *_reports;
bool _sensor_ok;
uint8_t _valid;
int _measure_ticks;
int _measure_ticks;
bool _collect_phase;
int _class_instance;
int _orb_class_instance;
@@ -34,7 +34,6 @@ px4_add_module(
MODULE drivers__tfmini
MAIN tfmini
COMPILE_FLAGS
-Wno-sign-compare
SRCS
tfmini.cpp
tfmini_parser.cpp
@@ -411,7 +411,7 @@ TFMINI::ioctl(device::file_t *filp, int cmd, unsigned long arg)
bool want_start = (_measure_ticks == 0);
/* convert hz to tick interval via microseconds */
unsigned ticks = USEC2TICK(1000000 / arg);
int ticks = USEC2TICK(1000000 / arg);
/* check against maximum rate */
if (ticks < USEC2TICK(_conversion_interval)) {
@@ -528,7 +528,7 @@ TFMINI::collect()
perf_begin(_sample_perf);
/* clear buffer if last read was too long ago */
uint64_t read_elapsed = hrt_elapsed_time(&_last_read);
int64_t read_elapsed = hrt_elapsed_time(&_last_read);
/* the buffer for read chars is buflen minus null termination */
char readbuf[sizeof(_linebuf)];
-1
View File
@@ -34,7 +34,6 @@ px4_add_module(
MODULE drivers__vmount
MAIN vmount
COMPILE_FLAGS
-Wno-sign-compare # TODO: fix all sign-compare
STACK_MAIN 1024
SRCS
input.cpp
+2 -2
View File
@@ -72,11 +72,11 @@ using namespace vmount;
static volatile bool thread_should_exit = false;
static volatile bool thread_running = false;
static constexpr unsigned input_objs_len_max = 3;
static constexpr int input_objs_len_max = 3;
struct ThreadData {
InputBase *input_objs[input_objs_len_max] = {nullptr, nullptr, nullptr};
unsigned input_objs_len = 0;
int input_objs_len = 0;
OutputBase *output_obj = nullptr;
};
static volatile ThreadData *g_thread_data = nullptr;