diff options
author | Lutz Helwing <lutz_helwing@mentor.com> | 2015-10-09 14:58:32 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2015-10-28 11:38:00 +0100 |
commit | 2355ca4927cffd8307fdb78aaadeb584450bef21 (patch) | |
tree | 8b681db88138ab259f3994cbe6943e6030a5eb1f | |
parent | fb99b7875dfe64a4073aa14f33c551098632847c (diff) | |
download | DLT-daemon-2355ca4927cffd8307fdb78aaadeb584450bef21.tar.gz |
Got rid of warnings from some older compilers
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-rw-r--r-- | src/daemon/dlt_daemon_client.c | 2 | ||||
-rw-r--r-- | src/lib/dlt_user.c | 15 | ||||
-rw-r--r-- | tests/dlt_env_ll_unit_test.cpp | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c index e6135e3..e1cf841 100644 --- a/src/daemon/dlt_daemon_client.c +++ b/src/daemon/dlt_daemon_client.c @@ -1183,7 +1183,7 @@ int dlt_daemon_control_message_timezone(int sock, DltDaemon *daemon, DltDaemonLo resp->status = DLT_SERVICE_RESPONSE_OK; time_t t = time(NULL); - struct tm lt = {0}; + struct tm lt; localtime_r(&t, <); #if !defined(__CYGWIN__) resp->timezone = (int32_t) lt.tm_gmtoff; diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c index 2823208..8e5b6a1 100644 --- a/src/lib/dlt_user.c +++ b/src/lib/dlt_user.c @@ -1409,7 +1409,8 @@ DltReturnValue dlt_user_log_write_raw_formatted(DltContextData *log, void *data, if (log == NULL || data == NULL) return DLT_RETURN_WRONG_PARAMETER; - if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) + // Have to cast type to signed type because some compilers assume that DltFormatType is unsigned and issue a warning + if ((int16_t)type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) { dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type); return DLT_RETURN_WRONG_PARAMETER; @@ -1760,7 +1761,8 @@ DltReturnValue dlt_user_log_write_uint8_formatted(DltContextData *log, uint8_t d if (log == NULL) return DLT_RETURN_WRONG_PARAMETER; - if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) + // Have to cast type to signed type because some compilers assume that DltFormatType is unsigned and issue a warning + if ((int16_t)type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) { dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type); return DLT_RETURN_WRONG_PARAMETER; @@ -1815,7 +1817,8 @@ DltReturnValue dlt_user_log_write_uint16_formatted(DltContextData *log, uint16_t if (log == NULL) return DLT_RETURN_WRONG_PARAMETER; - if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) + // Have to cast type to signed type because some compilers assume that DltFormatType is unsigned and issue a warning + if ((int16_t)type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) { dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type); return DLT_RETURN_WRONG_PARAMETER; @@ -1870,7 +1873,8 @@ DltReturnValue dlt_user_log_write_uint32_formatted(DltContextData *log, uint32_t if (log == NULL) return DLT_RETURN_WRONG_PARAMETER; - if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) + // Have to cast type to signed type because some compilers assume that DltFormatType is unsigned and issue a warning + if ((int16_t)type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) { dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type); return DLT_RETURN_WRONG_PARAMETER; @@ -1925,7 +1929,8 @@ DltReturnValue dlt_user_log_write_uint64_formatted(DltContextData *log, uint64_t if (log == NULL) return DLT_RETURN_WRONG_PARAMETER; - if (type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) + // Have to cast type to signed type because some compilers assume that DltFormatType is unsigned and issue a warning + if ((int16_t)type < DLT_FORMAT_DEFAULT || type >= DLT_FORMAT_MAX) { dlt_vlog(LOG_ERR, "Format type %d is outside valid range", type); return DLT_RETURN_WRONG_PARAMETER; diff --git a/tests/dlt_env_ll_unit_test.cpp b/tests/dlt_env_ll_unit_test.cpp index 10c8907..a5387bf 100644 --- a/tests/dlt_env_ll_unit_test.cpp +++ b/tests/dlt_env_ll_unit_test.cpp @@ -530,7 +530,7 @@ TEST(DltExtensionTests, dlt_env_extract_symbolic_ll) result = 18; ASSERT_EQ(-1, dlt_env_extract_symbolic_ll(&tmp1, &result)); - ASSERT_EQ(NULL, *tmp1); + ASSERT_EQ(0, *tmp1); ASSERT_EQ(18, result); /* 'result' is not touched */ // incorrect behavior |