From 7cf2a499483085c685eb1130cc20c1aa5f0f8b70 Mon Sep 17 00:00:00 2001 From: Peter Duerr Date: Mon, 7 Aug 2017 15:36:52 +0200 Subject: [PATCH] Cosmetic fix (silencing cppcheck) * For some reason cppcheck complains with `fp != nullptr` but accepts truthiness of handle by itself. * Note that the expressions are equivalent according to the C++ standard ("A prvalue of arithmetic, unscoped enumeration, pointer, or pointer to member type can be converted to a prvalue of type bool. A zero value, null pointer value, or null member pointer value is converted to false; any other value is converted to true. A prvalue of type std::nullptr_t can be converted to a prvalue of type bool; the resulting value is false.") --- src/lib/rc/rc_tests/RCTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/rc/rc_tests/RCTest.cpp b/src/lib/rc/rc_tests/RCTest.cpp index 1fd20589d0..d0ea23478e 100644 --- a/src/lib/rc/rc_tests/RCTest.cpp +++ b/src/lib/rc/rc_tests/RCTest.cpp @@ -62,7 +62,7 @@ bool RCTest::dsmTest(const char *filepath, unsigned expected_chancount, unsigned FILE *fp; fp = fopen(filepath, "rt"); - ut_test(fp != nullptr); + ut_test(fp); //PX4_INFO("loading data from: %s", filepath); float f; @@ -138,7 +138,7 @@ bool RCTest::sbus2Test() FILE *fp; fp = fopen(filepath, "rt"); - ut_test(fp != nullptr); + ut_test(fp); //warnx("loading data from: %s", filepath); // if (argc < 2) @@ -221,7 +221,7 @@ bool RCTest::st24Test() FILE *fp; fp = fopen(filepath, "rt"); - ut_test(fp != nullptr); + ut_test(fp); float f; unsigned x; @@ -282,7 +282,7 @@ bool RCTest::sumdTest() FILE *fp; fp = fopen(filepath, "rt"); - ut_test(fp != nullptr); + ut_test(fp); float f; unsigned x;