summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLassi Marttala <lassi.lm.marttala@partner.bmw.de>2012-06-04 11:53:10 +0200
committerChristian Muck <christian.muck@bmw.de>2012-06-13 23:53:01 +0200
commit54daad6cc95fb66662c894fabb5fd18308eec6e0 (patch)
tree5c20a58a362133d3bdde143851209f17a458bbbc
parent85f564f2b4c580bc151d05559e6ed0614919da8a (diff)
downloadDLT-daemon-54daad6cc95fb66662c894fabb5fd18308eec6e0.tar.gz
[GDLT-93]: Add -Wextra flags for compilation
Fixed all the warnings that popped up with the new flag. Signed-off-by: Christian Muck <christian.muck@bmw.de>
-rw-r--r--CMakeLists.txt8
-rw-r--r--src/system/dlt-system-filetransfer.c6
-rw-r--r--src/system/dlt-system-logfile.c2
-rw-r--r--src/system/dlt-system-process-handling.c2
-rw-r--r--src/system/dlt-system-processes.c6
-rw-r--r--src/tests/dlt-test-stress-client.c3
6 files changed, 14 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc4de91..524ca4f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,11 +91,11 @@ if(WITH_DLT_SHM_ENABLE)
add_definitions( -DDLT_SHM_ENABLE)
endif(WITH_DLT_SHM_ENABLE)
-if(WITH_GPROF)
- SET(CMAKE_C_FLAGS "-pg")
+if(WITH_GPROF)
+ SET(CMAKE_C_FLAGS "-pg")
endif(WITH_GPROF)
-
-add_definitions( "-Wall" )
+
+add_definitions( "-Wall" )
add_definitions( "-Wextra" )
configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.spec.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.spec)
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index 275818e..7eb6e92 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -102,7 +102,7 @@ char *compress_file(char *src, int level)
FILE *src_file;
dst_file = gzopen(dst, dst_mode);
- if(dst_file < 0)
+ if(dst_file == Z_NULL)
{
free(dst);
return NULL;
@@ -110,7 +110,7 @@ char *compress_file(char *src, int level)
src_file = fopen(src, "r");
- if(src_file < 0)
+ if(src_file == NULL)
{
gzclose(dst_file);
free(dst);
@@ -217,7 +217,7 @@ int flush_dir(FiletransferOptions opts, int which)
DIR *dir;
dir = opendir(sdir);
- if(dir > 0)
+ if(dir != NULL)
{
while((dp = readdir(dir)) != NULL)
{
diff --git a/src/system/dlt-system-logfile.c b/src/system/dlt-system-logfile.c
index 63c81b5..50964f2 100644
--- a/src/system/dlt-system-logfile.c
+++ b/src/system/dlt-system-logfile.c
@@ -68,7 +68,7 @@ void send_file(LogFileOptions fileopt, int n)
pFile = fopen(fileopt.Filename[n],"r");
- if(pFile>0)
+ if(pFile != NULL)
{
while (!feof(pFile)) {
bytes = fread(buffer,1,sizeof(buffer)-1,pFile);
diff --git a/src/system/dlt-system-process-handling.c b/src/system/dlt-system-process-handling.c
index 2fd07fc..3ad7908 100644
--- a/src/system/dlt-system-process-handling.c
+++ b/src/system/dlt-system-process-handling.c
@@ -69,7 +69,7 @@ int daemonize()
exit(0);
// Create a new process group
- if(setsid < 0)
+ if(setsid() < 0)
return -1;
/**
diff --git a/src/system/dlt-system-processes.c b/src/system/dlt-system-processes.c
index fc46c97..ee37bfc 100644
--- a/src/system/dlt-system-processes.c
+++ b/src/system/dlt-system-processes.c
@@ -76,7 +76,7 @@ void send_process(LogProcessOptions popts, int n)
/* go through all process files in directory */
DIR *dir = opendir("/proc");
- if(dir>0)
+ if(dir != NULL)
{
while ((dp=readdir(dir)) != NULL)
{
@@ -85,7 +85,7 @@ void send_process(LogProcessOptions popts, int n)
buffer[0] = 0;
sprintf(filename, "/proc/%s/cmdline",dp->d_name);
pFile = fopen(filename, "r");
- if(pFile>0)
+ if(pFile != NULL)
{
bytes = fread(buffer, 1, sizeof(buffer)-1, pFile);
fclose(pFile);
@@ -96,7 +96,7 @@ void send_process(LogProcessOptions popts, int n)
found = 1;
sprintf(filename, "/proc/%s/%s", dp->d_name,popts.Filename[n]);
pFile = fopen(filename, "r");
- if(pFile>0)
+ if(pFile != NULL)
{
bytes = fread(buffer, 1, sizeof(buffer)-1, pFile);
fclose(pFile);
diff --git a/src/tests/dlt-test-stress-client.c b/src/tests/dlt-test-stress-client.c
index 5c0310d..44fcdb7 100644
--- a/src/tests/dlt-test-stress-client.c
+++ b/src/tests/dlt-test-stress-client.c
@@ -402,7 +402,8 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
int16_t length,length_tmp; /* the macro can set this variable to -1 */
uint8_t *ptr;
int32_t datalength;
- int32_t value,value_tmp=0;
+ int32_t value;
+ uint32_t value_tmp = 0;
struct iovec iov[2];
int bytes_written;