From 40590be05c5eb99f557dfca6f7f6623dcdbe334a Mon Sep 17 00:00:00 2001 From: Simon Herkenhoff Date: Wed, 10 Oct 2018 10:43:11 +0900 Subject: 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 Signed-off-by: ManikandanC Signed-off-by: Christoph Lipka --- cmake/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) (limited to 'cmake') diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0182d2a..5ba0040 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -36,7 +36,6 @@ CHECK_INCLUDE_FILES( stddef.h HAVE_STDDEF_H) CHECK_INCLUDE_FILES( stdint.h HAVE_STDINT_H) CHECK_INCLUDE_FILES( stdlib.h HAVE_STDLIB_H) CHECK_INCLUDE_FILES( string.h HAVE_STRING_H) -CHECK_INCLUDE_FILES( strings.h HAVE_STRINGS_H) CHECK_INCLUDE_FILES( sys/ioctl.h HAVE_SYSIOCTL_H) CHECK_INCLUDE_FILES( sys/socket.h HAVE_SYSSOCKET_H) CHECK_INCLUDE_FILES( sys/time.h HAVE_SYSTIME_H) @@ -58,7 +57,6 @@ CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H) INCLUDE(CheckFunctionExists) -CHECK_FUNCTION_EXISTS( bzero HAVE_FUNC_BZERO) CHECK_FUNCTION_EXISTS( clock_gettime HAVE_FUNC_CLOCKGETTIME) CHECK_FUNCTION_EXISTS( floor HAVE_FUNC_FLOOR) CHECK_FUNCTION_EXISTS( fork HAVE_FUNC_FORK) -- cgit v1.2.1