summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Herkenhoff <sherkenhoff@jp.adit-jv.com>2018-10-10 10:43:11 +0900
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2019-05-06 15:55:07 +0900
commit40590be05c5eb99f557dfca6f7f6623dcdbe334a (patch)
tree8542563eacb18119b76f2264cc557ab6739031b8 /tests
parentdf6fc2a1ce9f3a1778e9c8e14c800cd2ad96e96e (diff)
downloadDLT-daemon-40590be05c5eb99f557dfca6f7f6623dcdbe334a.tar.gz
Fix compiler warnings
Fix compiler warnings about socket usage Correct the data types used for the socket declaration. We use AF_UNIX sockets so we use struct sockaddr_un, but we need to cast to struct sockaddr for the socket API. Fix compiler warnings about sign-compare Fix two occurences of signed - unsigned comparison by casting the values accordingly. Note that the cast is legal as the first parts of both conditional statements make sure the value is not negative before casting to unsigned. While at it, add strtol error checking. Fix compiler warnings about string functions Add string.h to src/daemon/dlt_daemon_unix_socket.c, because it was unaware of memcpy and strerror. While at it, change unsafe use of sprintf to proper dlt_vlog and remove the char buffer. Fix compiler warnings about unused-* Fix two unused-variable and one unused-parameter warning. While at it, change the #ifdef to not run into an empty block. Simply reverse the condition and enclose the complete else with the #ifdef. POSIX: Use memset instead of bzero "The bzero() function is deprecated (marked as LEGACY in POSIX.1-2001); use memset(3) in new programs." Use memset instead of bzero and remove any occurrence from DLT. Include of header "strings.h" that has bzero is also removed. Signed-off-by: Simon Herkenhoff <sherkenhoff@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/gtest_dlt_daemon_event_handler.cpp2
-rw-r--r--tests/gtest_dlt_daemon_offline_log.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/gtest_dlt_daemon_event_handler.cpp b/tests/gtest_dlt_daemon_event_handler.cpp
index 82e01bb..e9206e6 100644
--- a/tests/gtest_dlt_daemon_event_handler.cpp
+++ b/tests/gtest_dlt_daemon_event_handler.cpp
@@ -663,7 +663,7 @@ int main(int argc, char **argv)
return -1;
}
- bzero((char *)&serv_addr, sizeof(serv_addr));
+ memset((char *) &serv_addr, 0, sizeof(serv_addr));
portno = 8080;
serv_addr.sin_family = AF_INET;
diff --git a/tests/gtest_dlt_daemon_offline_log.cpp b/tests/gtest_dlt_daemon_offline_log.cpp
index 21156fa..4d086dd 100644
--- a/tests/gtest_dlt_daemon_offline_log.cpp
+++ b/tests/gtest_dlt_daemon_offline_log.cpp
@@ -1690,7 +1690,7 @@ int connectServer(void)
portno = 8080;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
server = gethostbyname("127.0.0.1");
- bzero((char *)&serv_addr, sizeof(serv_addr));
+ memset((char *) &serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
memcpy((char *)&serv_addr.sin_addr.s_addr,
(char *)server->h_addr,
@@ -1732,7 +1732,7 @@ int main(int argc, char **argv)
return -1;
}
- bzero((char *)&serv_addr, sizeof(serv_addr));
+ memset((char *) &serv_addr, 0, sizeof(serv_addr));
portno = 8080;
serv_addr.sin_family = AF_INET;