diff options
author | Lutz Helwing <lutz_helwing@mentor.com> | 2015-10-09 14:34:19 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2015-10-28 11:37:32 +0100 |
commit | fb99b7875dfe64a4073aa14f33c551098632847c (patch) | |
tree | d771a7287e00b9dcedb3f94281cfdcb58d306a0e /src | |
parent | a65dcd34513308b37165f8544ab647016d6e7209 (diff) | |
download | DLT-daemon-fb99b7875dfe64a4073aa14f33c551098632847c.tar.gz |
Purged all warnings for -Wall -Wextra
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/adaptor/dlt-adaptor-stdin.c | 2 | ||||
-rw-r--r-- | src/adaptor/dlt-adaptor-udp.c | 2 | ||||
-rw-r--r-- | src/dbus/dlt-dbus.c | 4 | ||||
-rw-r--r-- | src/examples/dlt-example-filetransfer.c | 2 | ||||
-rw-r--r-- | src/examples/dlt-example-user-common-api.c | 2 | ||||
-rw-r--r-- | src/examples/dlt-example-user.c | 2 | ||||
-rw-r--r-- | src/shared/dlt_common.c | 7 | ||||
-rw-r--r-- | src/system/dlt-system-filetransfer.c | 2 | ||||
-rw-r--r-- | src/system/dlt-system-logfile.c | 2 | ||||
-rw-r--r-- | src/system/dlt-system-process-handling.c | 2 | ||||
-rw-r--r-- | src/tests/dlt-test-filetransfer.c | 4 | ||||
-rw-r--r-- | src/tests/dlt-test-init-free.c | 33 | ||||
-rw-r--r-- | src/tests/dlt-test-stress-user.c | 6 | ||||
-rw-r--r-- | src/tests/dlt-test-user.c | 6 |
14 files changed, 39 insertions, 37 deletions
diff --git a/src/adaptor/dlt-adaptor-stdin.c b/src/adaptor/dlt-adaptor-stdin.c index 33ab8a2..f8e8fc0 100644 --- a/src/adaptor/dlt-adaptor-stdin.c +++ b/src/adaptor/dlt-adaptor-stdin.c @@ -80,7 +80,7 @@ #define PS_DLT_APP "SINA" #define PS_DLT_CONTEXT "SINC" -DLT_DECLARE_CONTEXT(mycontext); +DLT_DECLARE_CONTEXT(mycontext) int main(int argc, char* argv[]) { diff --git a/src/adaptor/dlt-adaptor-udp.c b/src/adaptor/dlt-adaptor-udp.c index dcb5820..9e4ce74 100644 --- a/src/adaptor/dlt-adaptor-udp.c +++ b/src/adaptor/dlt-adaptor-udp.c @@ -89,7 +89,7 @@ #define PU_DLT_APP "UDPA" #define PU_DLT_CONTEXT "UDPC" -DLT_DECLARE_CONTEXT(mycontext); +DLT_DECLARE_CONTEXT(mycontext) int main(int argc, char* argv[]) { diff --git a/src/dbus/dlt-dbus.c b/src/dbus/dlt-dbus.c index f85252f..5013c77 100644 --- a/src/dbus/dlt-dbus.c +++ b/src/dbus/dlt-dbus.c @@ -35,8 +35,8 @@ #include <time.h> -DLT_DECLARE_CONTEXT(dbusLog); -DLT_DECLARE_CONTEXT(dbusContext); +DLT_DECLARE_CONTEXT(dbusLog) +DLT_DECLARE_CONTEXT(dbusContext) static char dbus_message_buffer[DBUS_MAXIMUM_MESSAGE_LENGTH]; diff --git a/src/examples/dlt-example-filetransfer.c b/src/examples/dlt-example-filetransfer.c index 4fc10e2..0f4f038 100644 --- a/src/examples/dlt-example-filetransfer.c +++ b/src/examples/dlt-example-filetransfer.c @@ -73,7 +73,7 @@ #define TIMEOUT 1 //!Declare some context for the file transfer. It's not a must have to do this, but later you can set a filter on this context in the dlt viewer. -DLT_DECLARE_CONTEXT(fileContext); +DLT_DECLARE_CONTEXT(fileContext) /** diff --git a/src/examples/dlt-example-user-common-api.c b/src/examples/dlt-example-user-common-api.c index ee6370c..171ca89 100644 --- a/src/examples/dlt-example-user-common-api.c +++ b/src/examples/dlt-example-user-common-api.c @@ -63,7 +63,7 @@ #include "dlt_common_api.h" -DLT_DECLARE_CONTEXT(mycontext); +DLT_DECLARE_CONTEXT(mycontext) /** * Print usage information of tool. diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c index 3479ee8..532402a 100644 --- a/src/examples/dlt-example-user.c +++ b/src/examples/dlt-example-user.c @@ -79,7 +79,7 @@ int dlt_user_injection_callback(uint32_t service_id, void *data, uint32_t length); void dlt_user_log_level_changed_callback(char context_id[DLT_ID_SIZE],uint8_t log_level,uint8_t trace_status); -DLT_DECLARE_CONTEXT(mycontext); +DLT_DECLARE_CONTEXT(mycontext) /** * Print usage information of tool. diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c index 680e0a4..2448e70 100644 --- a/src/shared/dlt_common.c +++ b/src/shared/dlt_common.c @@ -3346,6 +3346,12 @@ DltReturnValue dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uin int64_t value64f_tmp_int64i=0,value64f_tmp_int64i_swaped=0; uint32_t quantisation_tmp = 0; + + /* apparently this makes no sense but needs to be done to prevent compiler warning. + * This variable is only written by DLT_MSG_READ_VALUE macro in if (type_info & DLT_TYPE_INFO_FIXP) + * case but never read anywhere */ + quantisation_tmp += quantisation_tmp; + if ( (type_info & DLT_TYPE_INFO_STRG) && (((type_info & DLT_TYPE_INFO_SCOD) == DLT_SCOD_ASCII) || ((type_info & DLT_TYPE_INFO_SCOD) == DLT_SCOD_UTF8)) ) { /* string type or utf8-encoded string type */ @@ -3495,7 +3501,6 @@ DltReturnValue dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uin } if (type_info & DLT_TYPE_INFO_FIXP) { - quantisation_tmp=quantisation_tmp; // prevent compiler warning DLT_MSG_READ_VALUE(quantisation_tmp, *ptr, *datalength, uint32_t); if((*datalength)<0) diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c index 56d2f52..7cdcbac 100644 --- a/src/system/dlt-system-filetransfer.c +++ b/src/system/dlt-system-filetransfer.c @@ -82,7 +82,7 @@ extern DltSystemThreads threads; // From dlt_filetransfer extern unsigned long getFileSerialNumber(const char* file, int *ok); -DLT_IMPORT_CONTEXT(dltsystem); +DLT_IMPORT_CONTEXT(dltsystem) DLT_DECLARE_CONTEXT(filetransferContext) #ifdef linux diff --git a/src/system/dlt-system-logfile.c b/src/system/dlt-system-logfile.c index cd1a828..687d739 100644 --- a/src/system/dlt-system-logfile.c +++ b/src/system/dlt-system-logfile.c @@ -55,7 +55,7 @@ #define SEND_MODE_ONCE 1 #define SEND_MODE_ON 2 -DLT_IMPORT_CONTEXT(dltsystem); +DLT_IMPORT_CONTEXT(dltsystem) extern DltSystemThreads threads; DltContext logfileContext[DLT_SYSTEM_LOG_FILE_MAX]; diff --git a/src/system/dlt-system-process-handling.c b/src/system/dlt-system-process-handling.c index 118b868..0b6b77d 100644 --- a/src/system/dlt-system-process-handling.c +++ b/src/system/dlt-system-process-handling.c @@ -57,7 +57,7 @@ volatile DltSystemThreads threads; -DLT_IMPORT_CONTEXT(dltsystem); +DLT_IMPORT_CONTEXT(dltsystem) int daemonize() { diff --git a/src/tests/dlt-test-filetransfer.c b/src/tests/dlt-test-filetransfer.c index 5ec4114..591714a 100644 --- a/src/tests/dlt-test-filetransfer.c +++ b/src/tests/dlt-test-filetransfer.c @@ -59,10 +59,10 @@ #include <dlt.h> /*Needed for dlt logging*/ //!Declare some context for the main program. It's a must have to do this, when you want to log with dlt. -DLT_DECLARE_CONTEXT(mainContext); +DLT_DECLARE_CONTEXT(mainContext) //!Declare some context for the file transfer. It's not a must have to do this, but later you can set a filter on this context in the dlt viewer. -DLT_DECLARE_CONTEXT(fileContext); +DLT_DECLARE_CONTEXT(fileContext) //!Textfile which will be transferred. char *file1; diff --git a/src/tests/dlt-test-init-free.c b/src/tests/dlt-test-init-free.c index d299938..81083e3 100644 --- a/src/tests/dlt-test-init-free.c +++ b/src/tests/dlt-test-init-free.c @@ -27,11 +27,12 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdbool.h> #include "dlt_common.h" #include "dlt_user.h" -char* exec(const char* cmd); +void exec(const char* cmd, char *buffer, size_t length); void printMemoryUsage(); char* occupyMemory(uint size); void do_example_test(); @@ -110,32 +111,28 @@ void do_dlt_test() } } -char* exec(const char* cmd) +void exec(const char* cmd, char *buffer, size_t length) { - FILE* pipe = popen(cmd, "r"); - if (!pipe) - return "ERROR"; + FILE* pipe = NULL; + strncpy(buffer, "ERROR", length); - char* buffer = (char*)malloc(128); - while (!feof(pipe)) - { - fgets(buffer, 128, pipe); - } - pclose(pipe); + if ( (pipe = popen(cmd, "r")) == NULL ) + return; + + while (fgets(buffer, length, pipe) != NULL); - return buffer; + if(pipe != NULL) + pclose(pipe); } void printMemoryUsage() { - char command[128] = "pmap "; + char result[128] = { 0 }; + char command[128] = { 0 }; - char buf[128]; - snprintf(buf, sizeof(command), "%d", getpid()); - strcat(command, buf); - strcat(command, " | grep total"); + snprintf(command, sizeof(command), "pmap %d | grep total", getpid()); - char* result = exec(command); + exec(command, result, sizeof(result)); printf("%s", result); } diff --git a/src/tests/dlt-test-stress-user.c b/src/tests/dlt-test-stress-user.c index dcd7555..6fe73d9 100644 --- a/src/tests/dlt-test-stress-user.c +++ b/src/tests/dlt-test-stress-user.c @@ -83,11 +83,11 @@ int testall(int count,int repeat,int delay,int size); /* Context declaration.. */ -DLT_DECLARE_CONTEXT(context_info); +DLT_DECLARE_CONTEXT(context_info) /* for macro interface */ -DLT_DECLARE_CONTEXT(context_macro_callback); -DLT_DECLARE_CONTEXT(context_macro_test[DLT_TEST_NUM_CONTEXT]); +DLT_DECLARE_CONTEXT(context_macro_callback) +DLT_DECLARE_CONTEXT(context_macro_test[DLT_TEST_NUM_CONTEXT]) /* for function interface */ DltContext context_function_callback; diff --git a/src/tests/dlt-test-user.c b/src/tests/dlt-test-user.c index 3abe9d8..80614e0 100644 --- a/src/tests/dlt-test-user.c +++ b/src/tests/dlt-test-user.c @@ -107,11 +107,11 @@ int test_injection_macro_callback(uint32_t service_id, void *data, uint32_t leng int test_injection_function_callback(uint32_t service_id, void *data, uint32_t length); /* Context declaration.. */ -DLT_DECLARE_CONTEXT(context_info); +DLT_DECLARE_CONTEXT(context_info) /* for macro interface */ -DLT_DECLARE_CONTEXT(context_macro_callback); -DLT_DECLARE_CONTEXT(context_macro_test[DLT_TEST_NUM_CONTEXT]); +DLT_DECLARE_CONTEXT(context_macro_callback) +DLT_DECLARE_CONTEXT(context_macro_test[DLT_TEST_NUM_CONTEXT]) /* for function interface */ DltContext context_function_callback; |