summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/daemon/dlt_daemon_client.c2
-rw-r--r--src/lib/dlt_user.c15
-rw-r--r--tests/dlt_env_ll_unit_test.cpp2
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, &lt);
#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